|
@@ -0,0 +1,366 @@
|
|
1
|
+<template>
|
|
2
|
+ <div class="kindeditor">
|
|
3
|
+ <textarea :id="id" name="content" v-model="outContent"></textarea>
|
|
4
|
+ </div>
|
|
5
|
+</template>
|
|
6
|
+
|
|
7
|
+<script>
|
|
8
|
+
|
|
9
|
+import '../../../node_modules/kindeditor/kindeditor-all.js'
|
|
10
|
+import '../../../node_modules/kindeditor/lang/zh-CN.js'
|
|
11
|
+import '../../../node_modules/kindeditor/themes/default/default.css'
|
|
12
|
+
|
|
13
|
+export default {
|
|
14
|
+ name: 'kindeditor',
|
|
15
|
+ data () {
|
|
16
|
+ return {
|
|
17
|
+ editor: null,
|
|
18
|
+ outContent: this.content
|
|
19
|
+ }
|
|
20
|
+ },
|
|
21
|
+ props: {
|
|
22
|
+ content: {
|
|
23
|
+ type: String,
|
|
24
|
+ default: ''
|
|
25
|
+ },
|
|
26
|
+ id: {
|
|
27
|
+ type: String,
|
|
28
|
+ required: true
|
|
29
|
+ },
|
|
30
|
+ width: {
|
|
31
|
+ type: String
|
|
32
|
+ },
|
|
33
|
+ height: {
|
|
34
|
+ type: String
|
|
35
|
+ },
|
|
36
|
+ minWidth: {
|
|
37
|
+ type: Number,
|
|
38
|
+ default: 650
|
|
39
|
+ },
|
|
40
|
+ minHeight: {
|
|
41
|
+ type: Number,
|
|
42
|
+ default: 100
|
|
43
|
+ },
|
|
44
|
+ items: {
|
|
45
|
+ type: Array,
|
|
46
|
+ default: function () {
|
|
47
|
+ return [
|
|
48
|
+ 'undo', 'redo', '|', 'preview', 'print', 'cut', 'copy', 'paste',
|
|
49
|
+ 'plainpaste', 'wordpaste', '|', 'justifyleft', 'justifycenter', 'justifyright',
|
|
50
|
+ 'justifyfull', 'insertorderedlist', 'insertunorderedlist', 'indent', 'outdent', 'subscript',
|
|
51
|
+ 'superscript', 'clearhtml', 'quickformat', 'selectall', '|', 'fullscreen', '/',
|
|
52
|
+ 'formatblock', 'fontname', 'fontsize', '|', 'forecolor', 'hilitecolor', 'bold',
|
|
53
|
+ 'italic', 'underline', 'strikethrough', 'lineheight', 'removeformat'
|
|
54
|
+ ]
|
|
55
|
+ }
|
|
56
|
+ },
|
|
57
|
+ noDisableItems: {
|
|
58
|
+ type: Array,
|
|
59
|
+ default: function () {
|
|
60
|
+ return ['source', 'fullscreen']
|
|
61
|
+ }
|
|
62
|
+ },
|
|
63
|
+ filterMode: {
|
|
64
|
+ type: Boolean,
|
|
65
|
+ default: true
|
|
66
|
+ },
|
|
67
|
+ htmlTags: {
|
|
68
|
+ type: Object,
|
|
69
|
+ default: function () {
|
|
70
|
+ return {
|
|
71
|
+ font: ['color', 'size', 'face', '.background-color'],
|
|
72
|
+ span: ['style'],
|
|
73
|
+ div: ['class', 'align', 'style'],
|
|
74
|
+ table: ['class', 'border', 'cellspacing', 'cellpadding', 'width', 'height', 'align', 'style'],
|
|
75
|
+ 'td,th': ['class', 'align', 'valign', 'width', 'height', 'colspan', 'rowspan', 'bgcolor', 'style'],
|
|
76
|
+ a: ['class', 'href', 'target', 'name', 'style'],
|
|
77
|
+ embed: ['src', 'width', 'height', 'type', 'loop', 'autostart', 'quality',
|
|
78
|
+ 'style', 'align', 'allowscriptaccess', '/'],
|
|
79
|
+ img: ['src', 'width', 'height', 'border', 'alt', 'title', 'align', 'style', '/'],
|
|
80
|
+ hr: ['class', '/'],
|
|
81
|
+ br: ['/'],
|
|
82
|
+ 'p,ol,ul,li,blockquote,h1,h2,h3,h4,h5,h6': ['align', 'style'],
|
|
83
|
+ 'tbody,tr,strong,b,sub,sup,em,i,u,strike': []
|
|
84
|
+ }
|
|
85
|
+ }
|
|
86
|
+ },
|
|
87
|
+ wellFormatMode: {
|
|
88
|
+ type: Boolean,
|
|
89
|
+ default: true
|
|
90
|
+ },
|
|
91
|
+ resizeType: {
|
|
92
|
+ type: Number,
|
|
93
|
+ default: 2
|
|
94
|
+ },
|
|
95
|
+ themeType: {
|
|
96
|
+ type: String,
|
|
97
|
+ default: 'default'
|
|
98
|
+ },
|
|
99
|
+ langType: {
|
|
100
|
+ type: String,
|
|
101
|
+ default: 'zh-CN'
|
|
102
|
+ },
|
|
103
|
+ designMode: {
|
|
104
|
+ type: Boolean,
|
|
105
|
+ default: true
|
|
106
|
+ },
|
|
107
|
+ fullscreenMode: {
|
|
108
|
+ type: Boolean,
|
|
109
|
+ default: false
|
|
110
|
+ },
|
|
111
|
+ basePath: {
|
|
112
|
+ type: String
|
|
113
|
+ },
|
|
114
|
+ themesPath: {
|
|
115
|
+ type: String
|
|
116
|
+ },
|
|
117
|
+ pluginsPath: {
|
|
118
|
+ type: String,
|
|
119
|
+ default: ''
|
|
120
|
+ },
|
|
121
|
+ langPath: {
|
|
122
|
+ type: String
|
|
123
|
+ },
|
|
124
|
+ minChangeSize: {
|
|
125
|
+ type: Number,
|
|
126
|
+ default: 5
|
|
127
|
+ },
|
|
128
|
+ loadStyleMode: {
|
|
129
|
+ type: Boolean,
|
|
130
|
+ default: true
|
|
131
|
+ },
|
|
132
|
+ urlType: {
|
|
133
|
+ type: String,
|
|
134
|
+ default: ''
|
|
135
|
+ },
|
|
136
|
+ newlineTag: {
|
|
137
|
+ type: String,
|
|
138
|
+ default: 'p'
|
|
139
|
+ },
|
|
140
|
+ pasteType: {
|
|
141
|
+ type: Number,
|
|
142
|
+ default: 2
|
|
143
|
+ },
|
|
144
|
+ dialogAlignType: {
|
|
145
|
+ type: String,
|
|
146
|
+ default: 'page'
|
|
147
|
+ },
|
|
148
|
+ shadowMode: {
|
|
149
|
+ type: Boolean,
|
|
150
|
+ default: true
|
|
151
|
+ },
|
|
152
|
+ zIndex: {
|
|
153
|
+ type: Number,
|
|
154
|
+ default: 811213
|
|
155
|
+ },
|
|
156
|
+ useContextmenu: {
|
|
157
|
+ type: Boolean,
|
|
158
|
+ default: true
|
|
159
|
+ },
|
|
160
|
+ syncType: {
|
|
161
|
+ type: String,
|
|
162
|
+ default: 'form'
|
|
163
|
+ },
|
|
164
|
+ indentChar: {
|
|
165
|
+ type: String,
|
|
166
|
+ default: '\t'
|
|
167
|
+ },
|
|
168
|
+ cssPath: {
|
|
169
|
+ type: [ String, Array ]
|
|
170
|
+ },
|
|
171
|
+ cssData: {
|
|
172
|
+ type: String
|
|
173
|
+ },
|
|
174
|
+ bodyClass: {
|
|
175
|
+ type: String,
|
|
176
|
+ default: 'ke-content'
|
|
177
|
+ },
|
|
178
|
+ colorTable: {
|
|
179
|
+ type: Array
|
|
180
|
+ },
|
|
181
|
+ afterCreate: {
|
|
182
|
+ type: Function
|
|
183
|
+ },
|
|
184
|
+ afterChange: {
|
|
185
|
+ type: Function
|
|
186
|
+ },
|
|
187
|
+ afterTab: {
|
|
188
|
+ type: Function
|
|
189
|
+ },
|
|
190
|
+ afterFocus: {
|
|
191
|
+ type: Function
|
|
192
|
+ },
|
|
193
|
+ afterBlur: {
|
|
194
|
+ type: Function
|
|
195
|
+ },
|
|
196
|
+ afterUpload: {
|
|
197
|
+ type: Function
|
|
198
|
+ },
|
|
199
|
+ uploadJson: {
|
|
200
|
+ type: String
|
|
201
|
+ },
|
|
202
|
+ fileManagerJson: {
|
|
203
|
+ type: Function
|
|
204
|
+ },
|
|
205
|
+ allowPreviewEmoticons: {
|
|
206
|
+ type: Boolean,
|
|
207
|
+ default: true
|
|
208
|
+ },
|
|
209
|
+ allowImageUpload: {
|
|
210
|
+ type: Boolean,
|
|
211
|
+ default: true
|
|
212
|
+ },
|
|
213
|
+ allowFlashUpload: {
|
|
214
|
+ type: Boolean,
|
|
215
|
+ default: true
|
|
216
|
+ },
|
|
217
|
+ allowMediaUpload: {
|
|
218
|
+ type: Boolean,
|
|
219
|
+ default: true
|
|
220
|
+ },
|
|
221
|
+ allowFileUpload: {
|
|
222
|
+ type: Boolean,
|
|
223
|
+ default: true
|
|
224
|
+ },
|
|
225
|
+ allowFileManager: {
|
|
226
|
+ type: Boolean,
|
|
227
|
+ default: false
|
|
228
|
+ },
|
|
229
|
+ fontSizeTable: {
|
|
230
|
+ type: Array,
|
|
231
|
+ default: function () {
|
|
232
|
+ return ['9px', '10px', '12px', '14px', '16px', '18px', '24px', '32px']
|
|
233
|
+ }
|
|
234
|
+ },
|
|
235
|
+ imageTabIndex: {
|
|
236
|
+ type: Number,
|
|
237
|
+ default: 0
|
|
238
|
+ },
|
|
239
|
+ formatUploadUrl: {
|
|
240
|
+ type: Boolean,
|
|
241
|
+ default: true
|
|
242
|
+ },
|
|
243
|
+ fullscreenShortcut: {
|
|
244
|
+ type: Boolean,
|
|
245
|
+ default: false
|
|
246
|
+ },
|
|
247
|
+ extraFileUploadParams: {
|
|
248
|
+ type: Array,
|
|
249
|
+ default: function () {
|
|
250
|
+ return []
|
|
251
|
+ }
|
|
252
|
+ },
|
|
253
|
+ filePostName: {
|
|
254
|
+ type: String,
|
|
255
|
+ default: 'imgFile'
|
|
256
|
+ },
|
|
257
|
+ fillDescAfterUploadImage: {
|
|
258
|
+ type: Boolean,
|
|
259
|
+ default: false
|
|
260
|
+ },
|
|
261
|
+ afterSelectFile: {
|
|
262
|
+ type: Function
|
|
263
|
+ },
|
|
264
|
+ pagebreakHtml: {
|
|
265
|
+ type: String,
|
|
266
|
+ default: '<hr style=”page-break-after: always;” class=”ke-pagebreak” />'
|
|
267
|
+ },
|
|
268
|
+ allowImageRemote: {
|
|
269
|
+ type: Boolean,
|
|
270
|
+ default: true
|
|
271
|
+ },
|
|
272
|
+ autoHeightMode: {
|
|
273
|
+ type: Boolean,
|
|
274
|
+ default: false
|
|
275
|
+ },
|
|
276
|
+ fixToolBar: {
|
|
277
|
+ type: Boolean,
|
|
278
|
+ default: false
|
|
279
|
+ },
|
|
280
|
+ tabIndex: {
|
|
281
|
+ type: Number
|
|
282
|
+ }
|
|
283
|
+ },
|
|
284
|
+ watch: {
|
|
285
|
+ content (val) {
|
|
286
|
+ this.editor && val !== this.outContent && this.editor.html(val)
|
|
287
|
+ },
|
|
288
|
+ outContent (val) {
|
|
289
|
+ this.$emit('update:content', val)
|
|
290
|
+ this.$emit('on-content-change', val)
|
|
291
|
+ }
|
|
292
|
+ },
|
|
293
|
+ mounted () {
|
|
294
|
+ var _this = this
|
|
295
|
+ _this.editor = window.KindEditor.create('#' + this.id, {
|
|
296
|
+ width: _this.width,
|
|
297
|
+ height: _this.height,
|
|
298
|
+ minWidth: _this.minWidth,
|
|
299
|
+ minHeight: _this.minHeight,
|
|
300
|
+ items: _this.items,
|
|
301
|
+ noDisableItems: _this.noDisableItems,
|
|
302
|
+ filterMode: _this.filterMode,
|
|
303
|
+ htmlTags: _this.htmlTags,
|
|
304
|
+ wellFormatMode: _this.wellFormatMode,
|
|
305
|
+ resizeType: _this.resizeType,
|
|
306
|
+ themeType: _this.themeType,
|
|
307
|
+ langType: _this.langType,
|
|
308
|
+ designMode: _this.designMode,
|
|
309
|
+ fullscreenMode: _this.fullscreenMode,
|
|
310
|
+ basePath: _this.basePath,
|
|
311
|
+ themesPath: _this.cssPath,
|
|
312
|
+ pluginsPath: _this.pluginsPath,
|
|
313
|
+ langPath: _this.langPath,
|
|
314
|
+ minChangeSize: _this.minChangeSize,
|
|
315
|
+ loadStyleMode: _this.loadStyleMode,
|
|
316
|
+ urlType: _this.urlType,
|
|
317
|
+ newlineTag: _this.newlineTag,
|
|
318
|
+ pasteType: _this.pasteType,
|
|
319
|
+ dialogAlignType: _this.dialogAlignType,
|
|
320
|
+ shadowMode: _this.shadowMode,
|
|
321
|
+ zIndex: _this.zIndex,
|
|
322
|
+ useContextmenu: _this.useContextmenu,
|
|
323
|
+ syncType: _this.syncType,
|
|
324
|
+ indentChar: _this.indentChar,
|
|
325
|
+ cssPath: _this.cssPath,
|
|
326
|
+ cssData: _this.cssData,
|
|
327
|
+ bodyClass: _this.bodyClass,
|
|
328
|
+ colorTable: _this.colorTable,
|
|
329
|
+ afterCreate: _this.afterCreate,
|
|
330
|
+ afterChange: function () {
|
|
331
|
+ _this.afterChange
|
|
332
|
+ _this.outContent = this.html()
|
|
333
|
+ },
|
|
334
|
+ afterTab: _this.afterTab,
|
|
335
|
+ afterFocus: _this.afterFocus,
|
|
336
|
+ afterBlur: _this.afterBlur,
|
|
337
|
+ afterUpload: _this.afterUpload,
|
|
338
|
+ uploadJson: _this.uploadJson,
|
|
339
|
+ fileManagerJson: _this.fileManagerJson,
|
|
340
|
+ allowPreviewEmoticons: _this.allowPreviewEmoticons,
|
|
341
|
+ allowImageUpload: _this.allowImageUpload,
|
|
342
|
+ allowFlashUpload: _this.allowFlashUpload,
|
|
343
|
+ allowMediaUpload: _this.allowMediaUpload,
|
|
344
|
+ allowFileUpload: _this.allowFileUpload,
|
|
345
|
+ allowFileManager: _this.allowFileManager,
|
|
346
|
+ fontSizeTable: _this.fontSizeTable,
|
|
347
|
+ imageTabIndex: _this.imageTabIndex,
|
|
348
|
+ formatUploadUrl: _this.formatUploadUrl,
|
|
349
|
+ fullscreenShortcut: _this.fullscreenShortcut,
|
|
350
|
+ extraFileUploadParams: _this.extraFileUploadParams,
|
|
351
|
+ filePostName: _this.filePostName,
|
|
352
|
+ fillDescAfterUploadImage: _this.fillDescAfterUploadImage,
|
|
353
|
+ afterSelectFile: _this.afterSelectFile,
|
|
354
|
+ pagebreakHtml: _this.pagebreakHtml,
|
|
355
|
+ allowImageRemote: _this.allowImageRemote,
|
|
356
|
+ autoHeightMode: _this.autoHeightMode,
|
|
357
|
+ fixToolBar: _this.fixToolBar,
|
|
358
|
+ tabIndex: _this.tabIndex
|
|
359
|
+ })
|
|
360
|
+ }
|
|
361
|
+}
|
|
362
|
+</script>
|
|
363
|
+
|
|
364
|
+<style>
|
|
365
|
+
|
|
366
|
+</style>
|