@progress/kendo-vue-editor 3.5.0 → 3.5.1-dev.202208100944

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (153) hide show
  1. package/README.md +1 -1
  2. package/dist/cdn/js/kendo-vue-editor.js +1 -1
  3. package/dist/es/Editor.d.ts +41 -41
  4. package/dist/es/Editor.js +7 -11
  5. package/dist/es/EditorProps.js +1 -0
  6. package/dist/es/config/pasteSettings.js +1 -0
  7. package/dist/es/config/toolsSettings.js +13 -11
  8. package/dist/es/dialogs/EditorDialogProps.js +1 -0
  9. package/dist/es/dialogs/FindReplace.js +4 -4
  10. package/dist/es/main.d.ts +0 -1
  11. package/dist/es/main.js +115 -28
  12. package/dist/es/messages/index.d.ts +0 -313
  13. package/dist/es/package-metadata.js +1 -1
  14. package/dist/es/tools/ToolProps.d.ts +2 -1
  15. package/dist/es/tools/ToolProps.js +1 -0
  16. package/dist/es/tools/fontStyle.js +7 -11
  17. package/dist/es/tools/formatBlock.js +7 -11
  18. package/dist/es/tools/insertTable/popupGrid.js +1 -1
  19. package/dist/es/tools/main.js +1 -0
  20. package/dist/esm/Editor.d.ts +283 -0
  21. package/dist/esm/Editor.js +813 -0
  22. package/dist/esm/EditorProps.d.ts +182 -0
  23. package/dist/esm/EditorProps.js +1 -0
  24. package/dist/esm/additionalTypes.ts +21 -0
  25. package/dist/esm/config/defaultStyles.d.ts +12 -0
  26. package/dist/esm/config/defaultStyles.js +12 -0
  27. package/dist/esm/config/pasteSettings.d.ts +6 -0
  28. package/dist/esm/config/pasteSettings.js +1 -0
  29. package/dist/esm/config/schema.d.ts +8 -0
  30. package/dist/esm/config/schema.js +51 -0
  31. package/dist/esm/config/shortcuts.d.ts +22 -0
  32. package/dist/esm/config/shortcuts.js +70 -0
  33. package/dist/esm/config/toolsSettings.d.ts +485 -0
  34. package/dist/esm/config/toolsSettings.js +525 -0
  35. package/dist/esm/dialogs/EditorDialogProps.d.ts +23 -0
  36. package/dist/esm/dialogs/EditorDialogProps.js +1 -0
  37. package/dist/esm/dialogs/FindReplace.d.ts +70 -0
  38. package/dist/esm/dialogs/FindReplace.js +880 -0
  39. package/dist/esm/dialogs/insertImage.d.ts +54 -0
  40. package/dist/esm/dialogs/insertImage.js +299 -0
  41. package/dist/esm/dialogs/insertLink.d.ts +52 -0
  42. package/dist/esm/dialogs/insertLink.js +313 -0
  43. package/dist/esm/dialogs/main.d.ts +1 -0
  44. package/dist/esm/dialogs/main.js +42 -0
  45. package/dist/esm/dialogs/viewHtml.d.ts +51 -0
  46. package/dist/esm/dialogs/viewHtml.js +149 -0
  47. package/dist/esm/main.d.ts +184 -0
  48. package/dist/esm/main.js +216 -0
  49. package/dist/esm/messages/index.d.ts +166 -0
  50. package/dist/esm/messages/index.js +485 -0
  51. package/dist/esm/package-metadata.d.ts +5 -0
  52. package/dist/esm/package-metadata.js +11 -0
  53. package/dist/esm/package.json +3 -0
  54. package/dist/esm/tools/ToolProps.d.ts +35 -0
  55. package/dist/esm/tools/ToolProps.js +1 -0
  56. package/dist/esm/tools/align.d.ts +42 -0
  57. package/dist/esm/tools/align.js +124 -0
  58. package/dist/esm/tools/applyColor.d.ts +45 -0
  59. package/dist/esm/tools/applyColor.js +107 -0
  60. package/dist/esm/tools/cleanFormatting.d.ts +49 -0
  61. package/dist/esm/tools/cleanFormatting.js +122 -0
  62. package/dist/esm/tools/findReplace.d.ts +43 -0
  63. package/dist/esm/tools/findReplace.js +127 -0
  64. package/dist/esm/tools/fontStyle.d.ts +55 -0
  65. package/dist/esm/tools/fontStyle.js +166 -0
  66. package/dist/esm/tools/formatBlock.d.ts +45 -0
  67. package/dist/esm/tools/formatBlock.js +161 -0
  68. package/dist/esm/tools/history.d.ts +18 -0
  69. package/dist/esm/tools/history.js +5 -0
  70. package/dist/esm/tools/indent.d.ts +44 -0
  71. package/dist/esm/tools/indent.js +135 -0
  72. package/dist/esm/tools/inlineFormat.d.ts +74 -0
  73. package/dist/esm/tools/inlineFormat.js +133 -0
  74. package/dist/esm/tools/insertImage.d.ts +46 -0
  75. package/dist/esm/tools/insertImage.js +138 -0
  76. package/dist/esm/tools/insertLink.d.ts +46 -0
  77. package/dist/esm/tools/insertLink.js +138 -0
  78. package/dist/esm/tools/insertTable/index.d.ts +1 -0
  79. package/dist/esm/tools/insertTable/index.js +6 -0
  80. package/dist/esm/tools/insertTable/popup.d.ts +80 -0
  81. package/dist/esm/tools/insertTable/popup.js +176 -0
  82. package/dist/esm/tools/insertTable/popupGrid.d.ts +51 -0
  83. package/dist/esm/tools/insertTable/popupGrid.js +139 -0
  84. package/dist/esm/tools/insertTable/tool.d.ts +53 -0
  85. package/dist/esm/tools/insertTable/tool.js +173 -0
  86. package/dist/esm/tools/lists.d.ts +48 -0
  87. package/dist/esm/tools/lists.js +140 -0
  88. package/dist/esm/tools/main.d.ts +95 -0
  89. package/dist/esm/tools/main.js +1 -0
  90. package/dist/esm/tools/outdent.d.ts +44 -0
  91. package/dist/esm/tools/outdent.js +137 -0
  92. package/dist/esm/tools/pdf.d.ts +58 -0
  93. package/dist/esm/tools/pdf.js +113 -0
  94. package/dist/esm/tools/print.d.ts +49 -0
  95. package/dist/esm/tools/print.js +117 -0
  96. package/dist/esm/tools/proseMirrorTool.d.ts +48 -0
  97. package/dist/esm/tools/proseMirrorTool.js +118 -0
  98. package/dist/esm/tools/selectAll.d.ts +49 -0
  99. package/dist/esm/tools/selectAll.js +110 -0
  100. package/dist/esm/tools/tableEdit.d.ts +51 -0
  101. package/dist/esm/tools/tableEdit.js +43 -0
  102. package/dist/esm/tools/unlink.d.ts +47 -0
  103. package/dist/esm/tools/unlink.js +118 -0
  104. package/dist/esm/tools/utils.d.ts +18 -0
  105. package/dist/esm/tools/utils.js +36 -0
  106. package/dist/esm/tools/viewHtml.d.ts +54 -0
  107. package/dist/esm/tools/viewHtml.js +133 -0
  108. package/dist/esm/utils/browser-detection.d.ts +4 -0
  109. package/dist/esm/utils/browser-detection.js +5 -0
  110. package/dist/esm/utils/controlled-value.d.ts +5 -0
  111. package/dist/esm/utils/controlled-value.js +31 -0
  112. package/dist/esm/utils/index.d.ts +358 -0
  113. package/dist/esm/utils/index.js +422 -0
  114. package/dist/esm/utils/props-key.d.ts +5 -0
  115. package/dist/esm/utils/props-key.js +5 -0
  116. package/dist/npm/Editor.d.ts +41 -41
  117. package/dist/npm/Editor.js +18 -22
  118. package/dist/npm/config/schema.js +1 -1
  119. package/dist/npm/config/shortcuts.js +11 -9
  120. package/dist/npm/config/toolsSettings.js +13 -11
  121. package/dist/npm/dialogs/FindReplace.js +11 -11
  122. package/dist/npm/dialogs/insertImage.js +12 -12
  123. package/dist/npm/dialogs/insertLink.js +9 -9
  124. package/dist/npm/dialogs/viewHtml.js +7 -7
  125. package/dist/npm/main.d.ts +0 -1
  126. package/dist/npm/main.js +116 -29
  127. package/dist/npm/messages/index.d.ts +0 -313
  128. package/dist/npm/package-metadata.js +1 -1
  129. package/dist/npm/tools/ToolProps.d.ts +2 -1
  130. package/dist/npm/tools/align.js +4 -4
  131. package/dist/npm/tools/applyColor.js +2 -2
  132. package/dist/npm/tools/cleanFormatting.js +2 -2
  133. package/dist/npm/tools/findReplace.js +1 -1
  134. package/dist/npm/tools/fontStyle.js +10 -14
  135. package/dist/npm/tools/formatBlock.js +10 -14
  136. package/dist/npm/tools/indent.js +11 -11
  137. package/dist/npm/tools/inlineFormat.js +3 -3
  138. package/dist/npm/tools/insertImage.js +2 -2
  139. package/dist/npm/tools/insertLink.js +2 -2
  140. package/dist/npm/tools/insertTable/popupGrid.js +2 -2
  141. package/dist/npm/tools/insertTable/tool.js +5 -5
  142. package/dist/npm/tools/lists.js +4 -4
  143. package/dist/npm/tools/outdent.js +7 -7
  144. package/dist/npm/tools/pdf.js +2 -2
  145. package/dist/npm/tools/print.js +1 -1
  146. package/dist/npm/tools/proseMirrorTool.js +1 -1
  147. package/dist/npm/tools/selectAll.js +2 -2
  148. package/dist/npm/tools/tableEdit.js +4 -4
  149. package/dist/npm/tools/unlink.js +3 -3
  150. package/dist/npm/tools/viewHtml.js +1 -1
  151. package/dist/npm/utils/controlled-value.js +2 -1
  152. package/dist/npm/utils/index.js +35 -35
  153. package/package.json +12 -12
@@ -0,0 +1,813 @@
1
+ var __assign = this && this.__assign || function () {
2
+ __assign = Object.assign || function (t) {
3
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
4
+ s = arguments[i];
5
+
6
+ for (var p in s) {
7
+ if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
8
+ }
9
+ }
10
+
11
+ return t;
12
+ };
13
+
14
+ return __assign.apply(this, arguments);
15
+ };
16
+
17
+ var __spreadArray = this && this.__spreadArray || function (to, from, pack) {
18
+ if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
19
+ if (ar || !(i in from)) {
20
+ if (!ar) ar = Array.prototype.slice.call(from, 0, i);
21
+ ar[i] = from[i];
22
+ }
23
+ }
24
+ return to.concat(ar || Array.prototype.slice.call(from));
25
+ }; // @ts-ignore
26
+
27
+
28
+ import * as Vue from 'vue';
29
+ var allVue = Vue;
30
+ var gh = allVue.h;
31
+ var isV3 = allVue.version && allVue.version[0] === '3';
32
+ var markRaw = allVue.markRaw;
33
+ import { ButtonGroup, Toolbar, ToolbarSeparator } from '@progress/kendo-vue-buttons';
34
+ import { classNames, validatePackage, getTemplate, getListeners, templateRendering, guid, setRef, getRef } from '@progress/kendo-vue-common';
35
+ import { EditorState, Plugin, PluginKey, EditorView, Schema, baseKeymap, keymap, history, dropCursor, gapCursor, getMark, spacesFix, tableEditing } from '@progress/kendo-editor-common';
36
+ import { marks, nodes } from './config/schema.js';
37
+ import { defaultStyle, tablesStyles, rtlStyles } from './config/defaultStyles.js';
38
+ import { EditorToolsSettings } from './config/toolsSettings.js';
39
+ import { InsertLinkDialog } from './dialogs/insertLink.js';
40
+ import { EditorUtils } from './utils.js';
41
+ import { editorPropsKey } from './utils/props-key.js';
42
+ import { updateEditorValue } from './utils/controlled-value.js';
43
+ var link = EditorToolsSettings.link,
44
+ bold = EditorToolsSettings.bold,
45
+ italic = EditorToolsSettings.italic,
46
+ underline = EditorToolsSettings.underline;
47
+ import { firefox } from './utils/browser-detection.js';
48
+ import { packageMetadata } from './package-metadata.js';
49
+ import { Align } from './tools/align.js';
50
+ import { Indent } from './tools/indent.js';
51
+ import { List } from './tools/lists.js';
52
+ import { Outdent } from './tools/outdent.js';
53
+ import { InlineFormat } from './tools/inlineFormat.js';
54
+ import { FontName } from './tools/fontStyle.js';
55
+ import { FormatBlock } from './tools/formatBlock.js';
56
+ import { ProseMirror } from './tools/proseMirrorTool.js';
57
+ import { LinkTool } from './tools/insertLink.js';
58
+ import { Unlink } from './tools/unlink.js';
59
+ import { CleanFormatting } from './tools/cleanFormatting.js';
60
+ import { SelectAll } from './tools/selectAll.js';
61
+ import { InsertImage } from './tools/insertImage.js';
62
+ import { InsertTable } from './tools/insertTable/tool.js';
63
+ import { ViewHtml } from './tools/viewHtml.js';
64
+ import { Pdf } from './tools/pdf.js';
65
+ import { Print } from './tools/print.js';
66
+ import { FindAndReplace } from './tools/findReplace.js';
67
+ import { ApplyColor } from './tools/applyColor.js';
68
+ /** @hidden */
69
+
70
+ export var allTools = {
71
+ 'Bold': {
72
+ comp: InlineFormat,
73
+ props: EditorToolsSettings.bold
74
+ },
75
+ 'Italic': {
76
+ comp: InlineFormat,
77
+ props: EditorToolsSettings.italic
78
+ },
79
+ 'Underline': {
80
+ comp: InlineFormat,
81
+ props: EditorToolsSettings.underline
82
+ },
83
+ 'Strikethrough': {
84
+ comp: InlineFormat,
85
+ props: EditorToolsSettings.strikethrough
86
+ },
87
+ 'Subscript': {
88
+ comp: InlineFormat,
89
+ props: EditorToolsSettings.subscript
90
+ },
91
+ 'Superscript': {
92
+ comp: InlineFormat,
93
+ props: EditorToolsSettings.superscript
94
+ },
95
+ 'AlignLeft': {
96
+ comp: Align,
97
+ props: EditorToolsSettings.alignLeft
98
+ },
99
+ 'AlignCenter': {
100
+ comp: Align,
101
+ props: EditorToolsSettings.alignCenter
102
+ },
103
+ 'AlignRight': {
104
+ comp: Align,
105
+ props: EditorToolsSettings.alignRight
106
+ },
107
+ 'AlignJustify': {
108
+ comp: Align,
109
+ props: EditorToolsSettings.alignJustify
110
+ },
111
+ 'Indent': {
112
+ comp: Indent,
113
+ props: EditorToolsSettings.indent
114
+ },
115
+ 'Outdent': {
116
+ comp: Outdent,
117
+ props: EditorToolsSettings.outdent
118
+ },
119
+ 'OrderedList': {
120
+ comp: List,
121
+ props: EditorToolsSettings.orderedList
122
+ },
123
+ 'UnorderedList': {
124
+ comp: List,
125
+ props: EditorToolsSettings.bulletList
126
+ },
127
+ 'FontSize': {
128
+ comp: FontName,
129
+ props: EditorToolsSettings.fontSize
130
+ },
131
+ 'FontName': {
132
+ comp: FontName,
133
+ props: EditorToolsSettings.fontName
134
+ },
135
+ 'FormatBlock': {
136
+ comp: FormatBlock,
137
+ props: EditorToolsSettings.formatBlock
138
+ },
139
+ 'Undo': {
140
+ comp: ProseMirror,
141
+ props: EditorToolsSettings.undo
142
+ },
143
+ 'Redo': {
144
+ comp: ProseMirror,
145
+ props: EditorToolsSettings.redo
146
+ },
147
+ 'Link': {
148
+ comp: LinkTool,
149
+ props: EditorToolsSettings.link
150
+ },
151
+ 'Unlink': {
152
+ comp: Unlink,
153
+ props: EditorToolsSettings.unlink
154
+ },
155
+ 'InsertImage': {
156
+ comp: InsertImage,
157
+ props: EditorToolsSettings.image
158
+ },
159
+ 'ViewHtml': {
160
+ comp: ViewHtml,
161
+ props: EditorToolsSettings.viewHtml
162
+ },
163
+ 'CleanFormatting': {
164
+ comp: CleanFormatting,
165
+ props: EditorToolsSettings.cleanFormatting
166
+ },
167
+ 'SelectAll': {
168
+ comp: SelectAll,
169
+ props: EditorToolsSettings.selectAll
170
+ },
171
+ 'InsertTable': {
172
+ comp: InsertTable,
173
+ props: EditorToolsSettings.insertTable
174
+ },
175
+ 'MergeCells': {
176
+ comp: ProseMirror,
177
+ props: EditorToolsSettings.mergeCells
178
+ },
179
+ 'SplitCell': {
180
+ comp: ProseMirror,
181
+ props: EditorToolsSettings.splitCell
182
+ },
183
+ 'AddRowBefore': {
184
+ comp: ProseMirror,
185
+ props: EditorToolsSettings.addRowBefore
186
+ },
187
+ 'AddRowAfter': {
188
+ comp: ProseMirror,
189
+ props: EditorToolsSettings.addRowAfter
190
+ },
191
+ 'AddColumnBefore': {
192
+ comp: ProseMirror,
193
+ props: EditorToolsSettings.addColumnBefore
194
+ },
195
+ 'AddColumnAfter': {
196
+ comp: ProseMirror,
197
+ props: EditorToolsSettings.addColumnAfter
198
+ },
199
+ 'DeleteRow': {
200
+ comp: ProseMirror,
201
+ props: EditorToolsSettings.deleteRow
202
+ },
203
+ 'DeleteColumn': {
204
+ comp: ProseMirror,
205
+ props: EditorToolsSettings.deleteColumn
206
+ },
207
+ 'DeleteTable': {
208
+ comp: ProseMirror,
209
+ props: EditorToolsSettings.deleteTable
210
+ },
211
+ 'Print': {
212
+ comp: Print,
213
+ props: EditorToolsSettings.print
214
+ },
215
+ 'Pdf': {
216
+ comp: Pdf,
217
+ props: EditorToolsSettings.pdf
218
+ },
219
+ 'InsertFile': {
220
+ comp: LinkTool,
221
+ props: EditorToolsSettings.insertFile
222
+ },
223
+ 'FindAndReplace': {
224
+ comp: FindAndReplace,
225
+ props: EditorToolsSettings.findAndReplace
226
+ },
227
+ 'ForeColor': {
228
+ comp: ApplyColor,
229
+ props: EditorToolsSettings.foreColor
230
+ },
231
+ 'BackColor': {
232
+ comp: ApplyColor,
233
+ props: EditorToolsSettings.backColor
234
+ }
235
+ };
236
+ /**
237
+ * @hidden
238
+ */
239
+
240
+ var EditorVue2 = {
241
+ name: 'KendoEditor',
242
+ // @ts-ignore
243
+ emits: {
244
+ focus: null,
245
+ blur: null,
246
+ change: null,
247
+ loaded: null,
248
+ execute: null
249
+ },
250
+ props: {
251
+ defaultContent: String,
252
+ value: [Object, String],
253
+ defaultEditMode: {
254
+ type: String,
255
+ default: 'iframe',
256
+ validator: function validator(value) {
257
+ return ['iframe', 'div'].includes(value);
258
+ }
259
+ },
260
+ contentStyle: Object,
261
+ dir: String,
262
+ tools: Array,
263
+ keyboardNavigation: {
264
+ type: Boolean,
265
+ default: true
266
+ },
267
+ resizable: Boolean,
268
+ preserveWhitespace: {
269
+ type: [String, Boolean],
270
+ default: 'full',
271
+ validator: function validator(value) {
272
+ return [true, false, 'full'].includes(value);
273
+ }
274
+ },
275
+ pasteHtml: Function,
276
+ extendView: Function
277
+ },
278
+ data: function data() {
279
+ return {
280
+ updateGuid: guid(),
281
+ view: undefined,
282
+ linkDialog: false
283
+ };
284
+ },
285
+ created: function created() {
286
+ this._view = undefined;
287
+ validatePackage(packageMetadata);
288
+ },
289
+ mounted: function mounted() {
290
+ this.iframe = getRef(this, 'iframe');
291
+ this.contentElement = getRef(this, 'contentElement');
292
+
293
+ if (!this.iframe || !firefox) {
294
+ this.initialize();
295
+ }
296
+ },
297
+ watch: {
298
+ value: function value(_newNextMatch, oldMatch) {
299
+ this._prevValue = oldMatch;
300
+ }
301
+ },
302
+ updated: function updated() {
303
+ var value = this.$props.value;
304
+ var view = this.getView();
305
+
306
+ if (value === undefined || !view) {
307
+ return;
308
+ }
309
+
310
+ updateEditorValue(view, value, this._prevValue, this.trOnChange, this.htmlOnChange);
311
+ this.trOnChange = null;
312
+ this.htmlOnChange = null;
313
+ },
314
+ destroyed: !!isV3 ? undefined : function () {
315
+ if (this.getView()) {
316
+ this.getView().destroy();
317
+ }
318
+
319
+ this.view = undefined;
320
+ this._view = undefined;
321
+ },
322
+ // @ts-ignore
323
+ unmounted: function unmounted() {
324
+ if (this.getView()) {
325
+ this.getView().destroy();
326
+ }
327
+
328
+ this.view = undefined;
329
+ this._view = undefined;
330
+ },
331
+ computed: {
332
+ computedValue: function computedValue() {
333
+ if (this.trOnChange !== null) {
334
+ return this.trOnChange.doc;
335
+ } else if (this.$props.value !== undefined) {
336
+ return this.$props.value;
337
+ } else if (this.getView()) {
338
+ return this.getView().state.doc;
339
+ }
340
+
341
+ return this.$props.defaultContent || '';
342
+ }
343
+ },
344
+ // @ts-ignore
345
+ setup: !isV3 ? undefined : function () {
346
+ var v3 = !!isV3;
347
+ return {
348
+ v3: v3
349
+ };
350
+ },
351
+ // @ts-ignore
352
+ render: function render(createElement) {
353
+ var h = gh || createElement;
354
+ var toolindex = 100;
355
+ var _a = this.$props,
356
+ _b = _a.tools,
357
+ tools = _b === void 0 ? [] : _b,
358
+ _c = _a.defaultEditMode,
359
+ defaultEditMode = _c === void 0 ? 'iframe' : _c,
360
+ _d = _a.preserveWhitespace,
361
+ preserveWhitespace = _d === void 0 ? 'full' : _d,
362
+ style = _a.style;
363
+ var view = this.getView();
364
+
365
+ if (this.view) {
366
+ var editorProps = editorPropsKey.getState(this.view.state);
367
+ editorProps.preserveWhitespace = preserveWhitespace;
368
+ }
369
+
370
+ var contentStyle = this.$props.contentStyle;
371
+
372
+ if (contentStyle === undefined && (style || {}).height === undefined) {
373
+ contentStyle = {
374
+ height: '300px'
375
+ };
376
+ }
377
+
378
+ var renderDialog = function renderDialog() {
379
+ return this.linkDialog && // @ts-ignore function children
380
+ h(InsertLinkDialog, {
381
+ view: view,
382
+ attrs: this.v3 ? undefined : {
383
+ view: view,
384
+ settings: link,
385
+ dir: this.$props.dir
386
+ },
387
+ settings: link,
388
+ dir: this.$props.dir,
389
+ onClose: this.handleClose,
390
+ on: this.v3 ? undefined : {
391
+ "close": this.handleClose
392
+ }
393
+ });
394
+ };
395
+
396
+ var renderTool = function renderTool(currentTool, _index) {
397
+ var ct = allTools[currentTool] || currentTool;
398
+
399
+ if (allTools[currentTool]) {
400
+ toolindex++;
401
+
402
+ var toolProps = __assign({
403
+ view: view,
404
+ dir: this.$props.dir,
405
+ key: toolindex,
406
+ updateGuid: this.updateGuid,
407
+ settings: allTools[currentTool].props
408
+ }, allTools[currentTool].props);
409
+
410
+ return h(this.v3 ? markRaw(allTools[currentTool].comp) : allTools[currentTool].comp, this.v3 ? toolProps : {
411
+ props: toolProps
412
+ });
413
+ } else if (ct === 'Separator') {
414
+ return (// @ts-ignore
415
+ h(ToolbarSeparator, {
416
+ key: toolindex
417
+ })
418
+ );
419
+ } else {
420
+ var tool = templateRendering.call(this, ct.render, getListeners.call(this));
421
+ return getTemplate.call(this, {
422
+ h: h,
423
+ template: tool,
424
+ defaultRendering: null,
425
+ additionalListeners: {},
426
+ additionalProps: {
427
+ view: view,
428
+ dir: this.$props.dir,
429
+ updateGuid: this.updateGuid,
430
+ key: toolindex,
431
+ settings: ct.props
432
+ }
433
+ });
434
+ }
435
+ };
436
+
437
+ var renderTools = function renderTools(item, index) {
438
+ return item.map(function (it) {
439
+ return renderTool.call(this, it, index);
440
+ }, this);
441
+ };
442
+
443
+ var buttons = tools.map(function (item, index) {
444
+ var _this2 = this;
445
+
446
+ return Array.isArray(item) ? // @ts-ignore function children
447
+ h(ButtonGroup, {
448
+ key: index
449
+ }, this.v3 ? function () {
450
+ return [renderTools.call(_this2, item, index)];
451
+ } : [renderTools.call(_this2, item, index)]) : renderTool.call(this, item, index);
452
+ }, this);
453
+ return h("div", {
454
+ "class": classNames('k-widget k-editor', {
455
+ 'k-editor-resizable': this.$props.resizable
456
+ }),
457
+ dir: this.$props.dir,
458
+ attrs: this.v3 ? undefined : {
459
+ dir: this.$props.dir
460
+ }
461
+ }, [buttons.length > 0 && // @ts-ignore function children
462
+ h(Toolbar, {
463
+ keyboardNavigation: this.$props.keyboardNavigation,
464
+ attrs: this.v3 ? undefined : {
465
+ keyboardNavigation: this.$props.keyboardNavigation
466
+ }
467
+ }, this.v3 ? function () {
468
+ return [buttons];
469
+ } : [buttons]), defaultEditMode === 'iframe' ? h("div", {
470
+ "class": "k-editor-content"
471
+ }, [h("iframe", {
472
+ onLoad: this.iframeLoad,
473
+ on: this.v3 ? undefined : {
474
+ "load": this.iframeLoad
475
+ },
476
+ ref: setRef(this, 'iframe'),
477
+ frameborder: "0",
478
+ attrs: this.v3 ? undefined : {
479
+ frameborder: "0"
480
+ },
481
+ style: contentStyle,
482
+ "class": "k-iframe"
483
+ })]) : h("div", {
484
+ style: contentStyle,
485
+ "class": "k-editor-content"
486
+ }, [h("div", {
487
+ ref: setRef(this, 'contentElement')
488
+ })]), renderDialog.call(this)]);
489
+ },
490
+ methods: {
491
+ getView: function getView() {
492
+ return this.v3 ? this.view : this._view;
493
+ },
494
+ getHTML: function getHTML() {
495
+ var view = this.getView();
496
+
497
+ if (view) {
498
+ return EditorUtils.getHtml(view.state);
499
+ }
500
+
501
+ return '';
502
+ },
503
+ setHTML: function setHTML(value) {
504
+ var view = this.getView();
505
+
506
+ if (view) {
507
+ EditorUtils.setHtml(view, value);
508
+ }
509
+ },
510
+ focus: function focus() {
511
+ if (this.getView()) {
512
+ this.getView().focus();
513
+ }
514
+ },
515
+ updateTools: function updateTools(view) {
516
+ if (this.v3) {
517
+ this.view = view;
518
+ } else {
519
+ this._view = view;
520
+ }
521
+
522
+ if (this.v3) {
523
+ this.updateGuid = guid();
524
+ }
525
+ },
526
+ iframeLoad: function iframeLoad() {
527
+ if (firefox) {
528
+ this.initialize();
529
+ }
530
+ },
531
+ initialize: function initialize() {
532
+ var _this = this;
533
+
534
+ var iframeWindow = this.iframe && this.iframe.contentWindow;
535
+
536
+ if (iframeWindow) {
537
+ var iframeDocument_1 = iframeWindow.document;
538
+ [defaultStyle, tablesStyles, this.$props.dir === 'rtl' ? rtlStyles : undefined].forEach(function (styles) {
539
+ if (styles) {
540
+ var style = iframeDocument_1.createElement('style');
541
+ style.appendChild(iframeDocument_1.createTextNode(styles));
542
+ iframeDocument_1.head.appendChild(style);
543
+ }
544
+ });
545
+ var meta = iframeDocument_1.createElement('meta');
546
+ meta.setAttribute('charset', 'utf-8');
547
+ iframeDocument_1.head.appendChild(meta); // The content has to be wrapped because the `dropCursor`
548
+ // plugin raises a `body.offsetParent is null` error.
549
+
550
+ this.contentElement = iframeDocument_1.createElement('div');
551
+ iframeDocument_1.body.appendChild(this.contentElement);
552
+ this.contentElement.classList.add('k-content');
553
+ }
554
+
555
+ var dom = this.contentElement;
556
+
557
+ if (!dom) {
558
+ return;
559
+ }
560
+
561
+ var _a = this.$props.preserveWhitespace,
562
+ preserveWhitespace = _a === void 0 ? 'full' : _a;
563
+ var target = this;
564
+ var plugins = [// https://prosemirror.net/docs/ref/#state.PluginSpec
565
+ new Plugin({
566
+ view: function view() {
567
+ return {
568
+ update: _this.updateTools
569
+ };
570
+ },
571
+ key: new PluginKey('toolbar-tools-update-plugin')
572
+ }), new Plugin({
573
+ filterTransaction: this.filterTransaction,
574
+ key: new PluginKey('onExecute-event-plugin')
575
+ }), new Plugin({
576
+ key: editorPropsKey,
577
+ state: {
578
+ init: function init() {
579
+ return {
580
+ preserveWhitespace: preserveWhitespace
581
+ };
582
+ },
583
+ apply: function apply(_, val) {
584
+ return val;
585
+ }
586
+ }
587
+ }), spacesFix(), history(), dropCursor(), gapCursor(), tableEditing()];
588
+
589
+ var shortcuts = __assign(__assign({}, EditorUtils.getShortcuts({
590
+ types: {
591
+ listItem: 'list_item',
592
+ hardBreak: 'hard_break'
593
+ },
594
+ toolsSettings: {
595
+ bold: bold,
596
+ italic: italic,
597
+ underline: underline
598
+ }
599
+ })), {
600
+ 'Mod-k': function ModK() {
601
+ var linkDialog = _this.$data.linkDialog;
602
+
603
+ var editorView = _this.getView();
604
+
605
+ if (editorView) {
606
+ var editorState = editorView.state;
607
+ var collapsed = editorState.selection.empty;
608
+ var linkMark = getMark(editorState, editorState.schema.marks[link.mark]);
609
+ var disabled = collapsed && !linkMark;
610
+
611
+ if (!linkDialog && !disabled) {
612
+ _this.linkDialog = true;
613
+ }
614
+ }
615
+
616
+ return !linkDialog;
617
+ }
618
+ });
619
+
620
+ var _b = this.$props,
621
+ _c = _b.defaultContent,
622
+ defaultContent = _c === void 0 ? '' : _c,
623
+ value = _b.value;
624
+ var doc = value && typeof value !== 'string' ? value : EditorUtils.createDocument(new Schema({
625
+ nodes: nodes,
626
+ marks: marks
627
+ }), value || defaultContent, {
628
+ preserveWhitespace: preserveWhitespace
629
+ });
630
+ var viewProps = {
631
+ state: EditorState.create({
632
+ plugins: __spreadArray(__spreadArray([], plugins, true), [keymap(shortcuts), keymap(baseKeymap)], false),
633
+ doc: doc
634
+ }),
635
+ transformPastedHTML: this.onPasteHtml,
636
+ dispatchTransaction: this.dispatchTransaction,
637
+ handleDOMEvents: {
638
+ focus: this.onFocus,
639
+ blur: this.onBlur,
640
+ paste: this.onPaste
641
+ }
642
+ };
643
+ var mountEvent = {
644
+ plugins: plugins,
645
+ shortcuts: shortcuts,
646
+ target: target,
647
+ viewProps: viewProps,
648
+ dom: dom
649
+ };
650
+ this.$emit('loaded', mountEvent);
651
+ var view = this.$props.extendView && this.$props.extendView(mountEvent) || new EditorView({
652
+ mount: dom
653
+ }, viewProps);
654
+
655
+ if (this.v3) {
656
+ this.view = markRaw(view);
657
+ } else {
658
+ this._view = view;
659
+ }
660
+ },
661
+ filterTransaction: function filterTransaction(transaction, state) {
662
+ var event = {
663
+ target: this,
664
+ transaction: transaction,
665
+ state: state
666
+ };
667
+ this.$emit('execute', event);
668
+ return true;
669
+ },
670
+ onPasteHtml: function onPasteHtml(html) {
671
+ if (this.$props.pasteHtml && this.pasteEvent) {
672
+ var event_1 = {
673
+ target: this,
674
+ pastedHtml: html,
675
+ event: this.pasteEvent
676
+ };
677
+ var newHtml = this.$props.pasteHtml(event_1);
678
+ this.pasteEvent = undefined;
679
+
680
+ if (typeof newHtml === 'string') {
681
+ return newHtml;
682
+ }
683
+ }
684
+
685
+ return html;
686
+ },
687
+ dispatchTransaction: function dispatchTransaction(transaction) {
688
+ var docChanged = transaction.docChanged;
689
+
690
+ if (docChanged) {
691
+ this.trOnChange = transaction;
692
+ var doc_1 = transaction.doc,
693
+ schema_1 = transaction.doc.type.schema;
694
+ var target_1 = this;
695
+ var event_2 = {
696
+ target: target_1,
697
+ value: doc_1,
698
+
699
+ get html() {
700
+ target_1.htmlOnChange = EditorUtils.getHtml({
701
+ doc: doc_1,
702
+ schema: schema_1
703
+ });
704
+ return target_1.htmlOnChange;
705
+ },
706
+
707
+ transaction: transaction,
708
+ schema: schema_1
709
+ };
710
+ this.$emit('change', event_2);
711
+ }
712
+
713
+ if (this.getView() && (this.$props.value === undefined || !docChanged)) {
714
+ this.getView().updateState(this.getView().state.apply(transaction));
715
+ }
716
+ },
717
+ onFocus: function onFocus(_view, e) {
718
+ var event = {
719
+ target: this,
720
+ event: e
721
+ };
722
+ this.$emit('focus', event);
723
+ return false;
724
+ },
725
+ onBlur: function onBlur(_view, e) {
726
+ var event = {
727
+ target: this,
728
+ event: e
729
+ };
730
+ this.$emit('blur', event);
731
+ return false;
732
+ },
733
+ onPaste: function onPaste(_view, nativeEvent) {
734
+ if (this.$props.pasteHtml) {
735
+ this.pasteEvent = nativeEvent;
736
+ }
737
+
738
+ return false;
739
+ },
740
+ handleClose: function handleClose() {
741
+ this.linkDialog = false;
742
+ }
743
+ }
744
+ };
745
+ /**
746
+ * Represents the [Kendo UI for Vue Editor component]({% slug overview_editor %}).
747
+ *
748
+ * ```jsx
749
+ * <template>
750
+ * <div>
751
+ * <Editor
752
+ * :tools="tools"
753
+ * :content-style="{
754
+ * height: '690px',
755
+ * }"
756
+ * :default-content="content"
757
+ * />
758
+ * </div>
759
+ * </template>
760
+ *
761
+ * <script>
762
+ * import { Editor } from "@progress/kendo-vue-editor";
763
+ * import content from "./content-overview";
764
+ *
765
+ * export default {
766
+ * components: {
767
+ * Editor,
768
+ * },
769
+ * data() {
770
+ * return {
771
+ * tools: [
772
+ * ["Bold", "Italic", "Underline", "Strikethrough"],
773
+ * ["Subscript", "Superscript"],
774
+ * ["AlignLeft", "AlignCenter", "AlignRight", "AlignJustify"],
775
+ * ["Indent", "Outdent"],
776
+ * ["OrderedList", "UnorderedList"],
777
+ * "FontSize",
778
+ * "FontName",
779
+ * "FormatBlock",
780
+ * ["Undo", "Redo"],
781
+ * ["Link", "Unlink", "InsertImage", "ViewHtml"],
782
+ * ["InsertTable"],
783
+ * ["AddRowBefore", "AddRowAfter", "AddColumnBefore", "AddColumnAfter"],
784
+ * ["DeleteRow", "DeleteColumn", "DeleteTable"],
785
+ * ["MergeCells", "SplitCell"],
786
+ * ],
787
+ * content: content,
788
+ * };
789
+ * },
790
+ * };
791
+ * </script>
792
+ * ```
793
+ *
794
+ *
795
+ *
796
+ * ### props <span class='code'>Readonly&lt;[EditorProps]({% slug api_editor_editorprops %})</span>
797
+ * The props of the Editor component.
798
+ *
799
+ * ### contentElement <span class='code'>HTMLDivElement</span>
800
+ * Returns the content-editable DOM element of the Editor.
801
+ *
802
+ * ### element <span class='code'>HTMLElement</span>
803
+ * Returns the DOM element of the Editor.
804
+ *
805
+ * ### value <span class='code'>Node | string</span>
806
+ * The value of the Editor.
807
+ *
808
+ * ### view <span class='code'>EditorView&lt;any&gt;</span>
809
+ * Returns the `view` object of the Editor.
810
+ */
811
+
812
+ var Editor = EditorVue2;
813
+ export { Editor, EditorVue2 };