@progress/kendo-vue-editor 2.7.1 → 2.7.2-dev.202201020746

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