11<template >
2- <q-form >
3- <q-input
4- id =" item_title"
5- v-model =" item.title"
6- :error =" v$.item.title.$error"
7- :error-message =" titleErrors"
8- :placeholder =" $t('Title')"
9- @input =" v$.item.title.$touch()"
10- @blur =" v$.item.title.$touch()"
11- />
12-
13- <editor
14- id =" item_content"
15- v-if =" (item.resourceNode && item.resourceNode.resourceFile && item.resourceNode.resourceFile.text) || item.newDocument"
16- v-model =" item.contentFile"
17- :error-message =" contentFileErrors"
18- required
19- :init =" {
2+ <q-form >
3+ <q-input
4+ id =" item_title"
5+ v-model =" item.title"
6+ :error =" v$.item.title.$error"
7+ :error-message =" titleErrors"
8+ :placeholder =" $t('Title')"
9+ @input =" v$.item.title.$touch()"
10+ @blur =" v$.item.title.$touch()"
11+ />
12+
13+ <editor
14+ id =" item_content"
15+ v-if =" (item.resourceNode && item.resourceNode.resourceFile && item.resourceNode.resourceFile.text) || item.newDocument"
16+ v-model =" item.contentFile"
17+ :error-message =" contentFileErrors"
18+ required
19+ :init =" {
2020 skin_url: '/build/libs/tinymce/skins/ui/oxide',
2121 content_css: '/build/libs/tinymce/skins/content/default/content.css',
22- branding:false,
22+ branding: false,
23+ relative_urls: false,
2324 height: 500,
2425 toolbar_mode: 'sliding',
2526 file_picker_callback : browser,
2627 /*file_picker_callback: function(callback, value, meta) {
27- // Provide file and text for the link dialog
28- if (meta.filetype == 'file') {
29- callback('mypage.html', {text: 'My text'});
30- }
31-
32- // Provide image and alt text for the image dialog
33- if (meta.filetype == 'image') {
34- callback('myimage.jpg', {alt: 'My alt text'});
35- }
36-
37- // Provide alternative source and posted for the media dialog
38- if (meta.filetype == 'media') {
39- callback('movie.mp4', {source2: 'alt.ogg', poster: 'image.jpg'});
40- }
41- },*/
42- /*images_upload_handler: (blobInfo, success, failure) => {
43- const img = 'data:image/jpeg;base64,' + blobInfo.base64();
44- //console.log(img);
45- success(img);
46- },*/
28+ // Provide file and text for the link dialog
29+ if (meta.filetype == 'file') {
30+ callback('mypage.html', {text: 'My text'});
31+ }
32+
33+ // Provide image and alt text for the image dialog
34+ if (meta.filetype == 'image') {
35+ callback('myimage.jpg', {alt: 'My alt text'});
36+ }
37+
38+ // Provide alternative source and posted for the media dialog
39+ if (meta.filetype == 'media') {
40+ callback('movie.mp4', {source2: 'alt.ogg', poster: 'image.jpg'});
41+ }
42+ },*/
43+ /*images_upload_handler: (blobInfo, success, failure) => {
44+ const img = 'data:image/jpeg;base64,' + blobInfo.base64();
45+ //console.log(img);
46+ success(img);
47+ },*/
4748 //menubar: true,
4849 autosave_ask_before_unload: true,
4950 plugins: [
5455 toolbar: 'undo redo | bold italic underline strikethrough | fontselect fontsizeselect formatselect | alignleft aligncenter alignright alignjustify | outdent indent | numlist bullist | forecolor backcolor removeformat | pagebreak | charmap emoticons | fullscreen preview save print | insertfile image media template link anchor code codesample | ltr rtl',
5556 }
5657 "
57- />
58-
59- <!-- For extra content-->
60- <slot ></slot >
61- </q-form >
58+ />
59+ <!-- For extra content-->
60+ <slot ></slot >
61+ </q-form >
6262</template >
6363
6464<script >
@@ -67,6 +67,7 @@ import useVuelidate from '@vuelidate/core';
6767import { required } from ' @vuelidate/validators' ;
6868// import UploadAdapter from './UploadAdapter';
6969import Editor from ' ../Editor'
70+ import {useRouter } from " vue-router" ;
7071
7172export default {
7273 name: ' DocumentsForm' ,
@@ -132,8 +133,28 @@ export default {
132133 },
133134 methods: {
134135 browser (callback , value , meta ) {
136+ let url = ' /resources/document/4/manager?cid=1&sid=0&gid=0' ;
137+ if (meta .filetype === ' image' ) {
138+ url = url + " &type=images" ;
139+ } else {
140+ url = url + " &type=files" ;
141+ }
142+
143+ console .log (url);
144+
145+ window .addEventListener (' message' , function (event ) {
146+ var data = event .data ;
147+ if (data .url ) {
148+ url = data .url ;
149+ console .log (meta); // {filetype: "image", fieldname: "src"}
150+ callback (url);
151+
152+ }
153+ });
154+
155+
135156 tinymce .activeEditor .windowManager .openUrl ({
136- url: ' / ' ,// use an absolute path!
157+ url: url ,// use an absolute path!
137158 title: ' file manager' ,
138159 /* width: 900,
139160 height: 450,
0 commit comments