1
1
<template >
2
- <textarea :id =" tinymceId" class = " textarea " />
2
+ <textarea :id =" tinymceId" style = " visibility : hidden " />
3
3
</template >
4
4
5
5
<script >
6
6
import loadTinymce from ' @/utils/loadTinymce'
7
7
import { plugins , toolbar } from ' ./config'
8
+ // eslint-disable-next-line import/no-extraneous-dependencies
8
9
import { debounce } from ' throttle-debounce'
9
10
10
11
let num = 1
@@ -19,7 +20,6 @@ export default {
19
20
}
20
21
},
21
22
value: {
22
- type: [String , Number , Boolean ],
23
23
default: ' '
24
24
}
25
25
},
@@ -30,31 +30,33 @@ export default {
30
30
},
31
31
mounted () {
32
32
loadTinymce (tinymce => {
33
- import (' ./zh_CN' ).then (() => {
34
- tinymce .init ({
35
- selector: ` #${ this .tinymceId } ` ,
36
- language: ' zh_CN' ,
37
- menubar: ' file edit insert view format table' ,
38
- plugins,
39
- toolbar,
40
- height: this .$attrs .height || 300 ,
41
- branding: this .$attrs .branding || false ,
42
- object_resizing: false ,
43
- end_container_on_empty_block: true ,
44
- powerpaste_word_import: ' clean' ,
45
- code_dialog_height: 450 ,
46
- code_dialog_width: 1000 ,
47
- advlist_bullet_styles: ' square' ,
48
- advlist_number_styles: ' default' ,
49
- default_link_target: ' _blank' ,
50
- link_title: false ,
51
- nonbreaking_force_tab: true ,
52
- init_instance_callback : editor => {
53
- if (this .value ) editor .setContent (this .value )
54
- this .vModel (editor)
55
- }
56
- })
57
- })
33
+ // eslint-disable-next-line global-require
34
+ require (' ./zh_CN' )
35
+ let conf = {
36
+ selector: ` #${ this .tinymceId } ` ,
37
+ language: ' zh_CN' ,
38
+ menubar: ' file edit insert view format table' ,
39
+ plugins,
40
+ toolbar,
41
+ height: 300 ,
42
+ branding: false ,
43
+ object_resizing: false ,
44
+ end_container_on_empty_block: true ,
45
+ powerpaste_word_import: ' clean' ,
46
+ code_dialog_height: 450 ,
47
+ code_dialog_width: 1000 ,
48
+ advlist_bullet_styles: ' square' ,
49
+ advlist_number_styles: ' default' ,
50
+ default_link_target: ' _blank' ,
51
+ link_title: false ,
52
+ nonbreaking_force_tab: true
53
+ }
54
+ conf = Object .assign (conf, this .$attrs )
55
+ conf .init_instance_callback = editor => {
56
+ if (this .value ) editor .setContent (this .value )
57
+ this .vModel (editor)
58
+ }
59
+ tinymce .init (conf)
58
60
})
59
61
},
60
62
destroyed () {
@@ -85,9 +87,3 @@ export default {
85
87
}
86
88
}
87
89
</script >
88
-
89
- <style lang="scss" scoped>
90
- .textarea {
91
- visibility : hidden ;
92
- }
93
- </style >
0 commit comments