1
1
<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 =" {
20
20
skin_url: '/build/libs/tinymce/skins/ui/oxide',
21
21
content_css: '/build/libs/tinymce/skins/content/default/content.css',
22
- branding:false,
22
+ branding: false,
23
+ relative_urls: false,
23
24
height: 500,
24
25
toolbar_mode: 'sliding',
25
26
file_picker_callback : browser,
26
27
/*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
+ },*/
47
48
//menubar: true,
48
49
autosave_ask_before_unload: true,
49
50
plugins: [
54
55
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',
55
56
}
56
57
"
57
- />
58
-
59
- <!-- For extra content-->
60
- <slot ></slot >
61
- </q-form >
58
+ />
59
+ <!-- For extra content-->
60
+ <slot ></slot >
61
+ </q-form >
62
62
</template >
63
63
64
64
<script >
@@ -67,6 +67,7 @@ import useVuelidate from '@vuelidate/core';
67
67
import { required } from ' @vuelidate/validators' ;
68
68
// import UploadAdapter from './UploadAdapter';
69
69
import Editor from ' ../Editor'
70
+ import {useRouter } from " vue-router" ;
70
71
71
72
export default {
72
73
name: ' DocumentsForm' ,
@@ -132,8 +133,28 @@ export default {
132
133
},
133
134
methods: {
134
135
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
+
135
156
tinymce .activeEditor .windowManager .openUrl ({
136
- url: ' / ' ,// use an absolute path!
157
+ url: url ,// use an absolute path!
137
158
title: ' file manager' ,
138
159
/* width: 900,
139
160
height: 450,
0 commit comments