@progress/kendo-vue-editor 2.7.1 → 2.7.3-dev.202201070829

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