@progress/kendo-vue-editor 7.0.1-develop.1 → 7.0.1-develop.3
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.
- package/Editor.js +1 -1
- package/Editor.mjs +293 -269
- package/dist/cdn/js/kendo-vue-editor.js +1 -1
- package/package-metadata.js +1 -1
- package/package-metadata.mjs +2 -2
- package/package.json +12 -12
- package/utils/cleanup.js +8 -0
- package/utils/cleanup.mjs +35 -0
package/Editor.mjs
CHANGED
|
@@ -5,215 +5,216 @@
|
|
|
5
5
|
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
6
|
*-------------------------------------------------------------------------------------------
|
|
7
7
|
*/
|
|
8
|
-
import { defineComponent as j, toRaw as K, markRaw as
|
|
8
|
+
import { defineComponent as j, toRaw as K, markRaw as P, createVNode as h, h as T, isVNode as J } from "vue";
|
|
9
9
|
import { ButtonGroup as q, Toolbar as Q, ToolbarSeparator as X } from "@progress/kendo-vue-buttons";
|
|
10
|
-
import { guid as
|
|
11
|
-
import { Plugin as
|
|
10
|
+
import { guid as V, WatermarkOverlay as Y, classNames as Z, setRef as M, getRef as R, validatePackage as ee, shouldShowValidationUI as te, getLicenseMessage as ie, templateRendering as oe, getListeners as se, getTemplate as re } from "@progress/kendo-vue-common";
|
|
11
|
+
import { Plugin as $, spacesFix as ne, history as ae, dropCursor as le, gapCursor as pe, tableEditing as de, PluginKey as H, Schema as ce, marks as me, EditorState as ue, keymap as _, baseKeymap as he, EditorView as fe, getMark as ge } from "@progress/kendo-editor-common";
|
|
12
12
|
import { nodes as ve } from "./config/schema.mjs";
|
|
13
|
-
import { defaultStyle as we, tablesStyles as
|
|
14
|
-
import { EditorToolsSettings as
|
|
13
|
+
import { defaultStyle as we, tablesStyles as be, rtlStyles as ke } from "./config/defaultStyles.mjs";
|
|
14
|
+
import { EditorToolsSettings as t } from "./config/toolsSettings.mjs";
|
|
15
15
|
import { InsertLinkDialog as ye } from "./dialogs/insertLink.mjs";
|
|
16
16
|
import { EditorUtils as y } from "./utils/main.mjs";
|
|
17
|
-
import { editorPropsKey as
|
|
17
|
+
import { editorPropsKey as x } from "./utils/props-key.mjs";
|
|
18
18
|
import { updateEditorValue as Ce } from "./utils/controlled-value.mjs";
|
|
19
|
-
import {
|
|
19
|
+
import { cleanupAndDestroyProseMirrorView as Se, nullifyObjectProperties as Le, cleanupIframe as Ee } from "./utils/cleanup.mjs";
|
|
20
|
+
import { firefox as D } from "./utils/browser-detection.mjs";
|
|
20
21
|
import { packageMetadata as A } from "./package-metadata.mjs";
|
|
21
|
-
import { Align as
|
|
22
|
-
import { Indent as
|
|
23
|
-
import { List as
|
|
24
|
-
import { Outdent as
|
|
25
|
-
import { InlineFormat as
|
|
26
|
-
import { FontName as
|
|
27
|
-
import { FormatBlock as
|
|
28
|
-
import { ProseMirror as
|
|
22
|
+
import { Align as E } from "./tools/align.mjs";
|
|
23
|
+
import { Indent as Ve } from "./tools/indent.mjs";
|
|
24
|
+
import { List as I } from "./tools/lists.mjs";
|
|
25
|
+
import { Outdent as $e } from "./tools/outdent.mjs";
|
|
26
|
+
import { InlineFormat as b } from "./tools/inlineFormat.mjs";
|
|
27
|
+
import { FontName as U } from "./tools/fontStyle.mjs";
|
|
28
|
+
import { FormatBlock as Ae } from "./tools/formatBlock.mjs";
|
|
29
|
+
import { ProseMirror as c } from "./tools/proseMirrorTool.mjs";
|
|
29
30
|
import { LinkTool as N } from "./tools/insertLink.mjs";
|
|
30
|
-
import { Unlink as
|
|
31
|
-
import { CleanFormatting as
|
|
32
|
-
import { SelectAll as
|
|
33
|
-
import { InsertImage as
|
|
34
|
-
import { InsertTable as
|
|
35
|
-
import { ViewHtml as
|
|
36
|
-
import { Pdf as
|
|
37
|
-
import { Print as
|
|
38
|
-
import { FindAndReplace as
|
|
39
|
-
import { ApplyColor as
|
|
40
|
-
import { keys as
|
|
41
|
-
import { provideLocalizationService as
|
|
31
|
+
import { Unlink as Oe } from "./tools/unlink.mjs";
|
|
32
|
+
import { CleanFormatting as Be } from "./tools/cleanFormatting.mjs";
|
|
33
|
+
import { SelectAll as Fe } from "./tools/selectAll.mjs";
|
|
34
|
+
import { InsertImage as Pe } from "./tools/insertImage.mjs";
|
|
35
|
+
import { InsertTable as Te } from "./tools/insertTable/tool.mjs";
|
|
36
|
+
import { ViewHtml as Me } from "./tools/viewHtml.mjs";
|
|
37
|
+
import { Pdf as Re } from "./tools/pdf.mjs";
|
|
38
|
+
import { Print as He } from "./tools/print.mjs";
|
|
39
|
+
import { FindAndReplace as _e } from "./tools/findReplace.mjs";
|
|
40
|
+
import { ApplyColor as z } from "./tools/applyColor.mjs";
|
|
41
|
+
import { keys as k, messages as O } from "./messages/main.mjs";
|
|
42
|
+
import { provideLocalizationService as xe } from "@progress/kendo-vue-intl";
|
|
42
43
|
const {
|
|
43
|
-
link:
|
|
44
|
-
bold:
|
|
45
|
-
italic:
|
|
46
|
-
underline:
|
|
47
|
-
} =
|
|
48
|
-
function
|
|
49
|
-
return typeof
|
|
44
|
+
link: W,
|
|
45
|
+
bold: De,
|
|
46
|
+
italic: Ie,
|
|
47
|
+
underline: Ue
|
|
48
|
+
} = t;
|
|
49
|
+
function G(e) {
|
|
50
|
+
return typeof e == "function" || Object.prototype.toString.call(e) === "[object Object]" && !J(e);
|
|
50
51
|
}
|
|
51
52
|
const C = {
|
|
52
53
|
Bold: {
|
|
53
|
-
comp:
|
|
54
|
-
props:
|
|
54
|
+
comp: b,
|
|
55
|
+
props: t.bold
|
|
55
56
|
},
|
|
56
57
|
Italic: {
|
|
57
|
-
comp:
|
|
58
|
-
props:
|
|
58
|
+
comp: b,
|
|
59
|
+
props: t.italic
|
|
59
60
|
},
|
|
60
61
|
Underline: {
|
|
61
|
-
comp:
|
|
62
|
-
props:
|
|
62
|
+
comp: b,
|
|
63
|
+
props: t.underline
|
|
63
64
|
},
|
|
64
65
|
Strikethrough: {
|
|
65
|
-
comp:
|
|
66
|
-
props:
|
|
66
|
+
comp: b,
|
|
67
|
+
props: t.strikethrough
|
|
67
68
|
},
|
|
68
69
|
Subscript: {
|
|
69
|
-
comp:
|
|
70
|
-
props:
|
|
70
|
+
comp: b,
|
|
71
|
+
props: t.subscript
|
|
71
72
|
},
|
|
72
73
|
Superscript: {
|
|
73
|
-
comp:
|
|
74
|
-
props:
|
|
74
|
+
comp: b,
|
|
75
|
+
props: t.superscript
|
|
75
76
|
},
|
|
76
77
|
AlignLeft: {
|
|
77
|
-
comp:
|
|
78
|
-
props:
|
|
78
|
+
comp: E,
|
|
79
|
+
props: t.alignLeft
|
|
79
80
|
},
|
|
80
81
|
AlignCenter: {
|
|
81
|
-
comp:
|
|
82
|
-
props:
|
|
82
|
+
comp: E,
|
|
83
|
+
props: t.alignCenter
|
|
83
84
|
},
|
|
84
85
|
AlignRight: {
|
|
85
|
-
comp:
|
|
86
|
-
props:
|
|
86
|
+
comp: E,
|
|
87
|
+
props: t.alignRight
|
|
87
88
|
},
|
|
88
89
|
AlignJustify: {
|
|
89
|
-
comp:
|
|
90
|
-
props:
|
|
90
|
+
comp: E,
|
|
91
|
+
props: t.alignJustify
|
|
91
92
|
},
|
|
92
93
|
Indent: {
|
|
93
|
-
comp:
|
|
94
|
-
props:
|
|
94
|
+
comp: Ve,
|
|
95
|
+
props: t.indent
|
|
95
96
|
},
|
|
96
97
|
Outdent: {
|
|
97
|
-
comp:
|
|
98
|
-
props:
|
|
98
|
+
comp: $e,
|
|
99
|
+
props: t.outdent
|
|
99
100
|
},
|
|
100
101
|
OrderedList: {
|
|
101
|
-
comp:
|
|
102
|
-
props:
|
|
102
|
+
comp: I,
|
|
103
|
+
props: t.orderedList
|
|
103
104
|
},
|
|
104
105
|
UnorderedList: {
|
|
105
|
-
comp:
|
|
106
|
-
props:
|
|
106
|
+
comp: I,
|
|
107
|
+
props: t.bulletList
|
|
107
108
|
},
|
|
108
109
|
FontSize: {
|
|
109
|
-
comp:
|
|
110
|
-
props:
|
|
110
|
+
comp: U,
|
|
111
|
+
props: t.fontSize
|
|
111
112
|
},
|
|
112
113
|
FontName: {
|
|
113
|
-
comp:
|
|
114
|
-
props:
|
|
114
|
+
comp: U,
|
|
115
|
+
props: t.fontName
|
|
115
116
|
},
|
|
116
117
|
FormatBlock: {
|
|
117
|
-
comp:
|
|
118
|
-
props:
|
|
118
|
+
comp: Ae,
|
|
119
|
+
props: t.formatBlock
|
|
119
120
|
},
|
|
120
121
|
Undo: {
|
|
121
|
-
comp:
|
|
122
|
-
props:
|
|
122
|
+
comp: c,
|
|
123
|
+
props: t.undo
|
|
123
124
|
},
|
|
124
125
|
Redo: {
|
|
125
|
-
comp:
|
|
126
|
-
props:
|
|
126
|
+
comp: c,
|
|
127
|
+
props: t.redo
|
|
127
128
|
},
|
|
128
129
|
Link: {
|
|
129
130
|
comp: N,
|
|
130
|
-
props:
|
|
131
|
+
props: t.link
|
|
131
132
|
},
|
|
132
133
|
Unlink: {
|
|
133
|
-
comp:
|
|
134
|
-
props:
|
|
134
|
+
comp: Oe,
|
|
135
|
+
props: t.unlink
|
|
135
136
|
},
|
|
136
137
|
InsertImage: {
|
|
137
|
-
comp:
|
|
138
|
-
props:
|
|
138
|
+
comp: Pe,
|
|
139
|
+
props: t.image
|
|
139
140
|
},
|
|
140
141
|
ViewHtml: {
|
|
141
|
-
comp:
|
|
142
|
-
props:
|
|
142
|
+
comp: Me,
|
|
143
|
+
props: t.viewHtml
|
|
143
144
|
},
|
|
144
145
|
CleanFormatting: {
|
|
145
|
-
comp:
|
|
146
|
-
props:
|
|
146
|
+
comp: Be,
|
|
147
|
+
props: t.cleanFormatting
|
|
147
148
|
},
|
|
148
149
|
SelectAll: {
|
|
149
|
-
comp:
|
|
150
|
-
props:
|
|
150
|
+
comp: Fe,
|
|
151
|
+
props: t.selectAll
|
|
151
152
|
},
|
|
152
153
|
InsertTable: {
|
|
153
|
-
comp:
|
|
154
|
-
props:
|
|
154
|
+
comp: Te,
|
|
155
|
+
props: t.insertTable
|
|
155
156
|
},
|
|
156
157
|
MergeCells: {
|
|
157
|
-
comp:
|
|
158
|
-
props:
|
|
158
|
+
comp: c,
|
|
159
|
+
props: t.mergeCells
|
|
159
160
|
},
|
|
160
161
|
SplitCell: {
|
|
161
|
-
comp:
|
|
162
|
-
props:
|
|
162
|
+
comp: c,
|
|
163
|
+
props: t.splitCell
|
|
163
164
|
},
|
|
164
165
|
AddRowBefore: {
|
|
165
|
-
comp:
|
|
166
|
-
props:
|
|
166
|
+
comp: c,
|
|
167
|
+
props: t.addRowBefore
|
|
167
168
|
},
|
|
168
169
|
AddRowAfter: {
|
|
169
|
-
comp:
|
|
170
|
-
props:
|
|
170
|
+
comp: c,
|
|
171
|
+
props: t.addRowAfter
|
|
171
172
|
},
|
|
172
173
|
AddColumnBefore: {
|
|
173
|
-
comp:
|
|
174
|
-
props:
|
|
174
|
+
comp: c,
|
|
175
|
+
props: t.addColumnBefore
|
|
175
176
|
},
|
|
176
177
|
AddColumnAfter: {
|
|
177
|
-
comp:
|
|
178
|
-
props:
|
|
178
|
+
comp: c,
|
|
179
|
+
props: t.addColumnAfter
|
|
179
180
|
},
|
|
180
181
|
DeleteRow: {
|
|
181
|
-
comp:
|
|
182
|
-
props:
|
|
182
|
+
comp: c,
|
|
183
|
+
props: t.deleteRow
|
|
183
184
|
},
|
|
184
185
|
DeleteColumn: {
|
|
185
|
-
comp:
|
|
186
|
-
props:
|
|
186
|
+
comp: c,
|
|
187
|
+
props: t.deleteColumn
|
|
187
188
|
},
|
|
188
189
|
DeleteTable: {
|
|
189
|
-
comp:
|
|
190
|
-
props:
|
|
190
|
+
comp: c,
|
|
191
|
+
props: t.deleteTable
|
|
191
192
|
},
|
|
192
193
|
Print: {
|
|
193
|
-
comp:
|
|
194
|
-
props:
|
|
194
|
+
comp: He,
|
|
195
|
+
props: t.print
|
|
195
196
|
},
|
|
196
197
|
Pdf: {
|
|
197
|
-
comp:
|
|
198
|
-
props:
|
|
198
|
+
comp: Re,
|
|
199
|
+
props: t.pdf
|
|
199
200
|
},
|
|
200
201
|
InsertFile: {
|
|
201
202
|
comp: N,
|
|
202
|
-
props:
|
|
203
|
+
props: t.insertFile
|
|
203
204
|
},
|
|
204
205
|
FindAndReplace: {
|
|
205
|
-
comp:
|
|
206
|
-
props:
|
|
206
|
+
comp: _e,
|
|
207
|
+
props: t.findAndReplace
|
|
207
208
|
},
|
|
208
209
|
ForeColor: {
|
|
209
|
-
comp:
|
|
210
|
-
props:
|
|
210
|
+
comp: z,
|
|
211
|
+
props: t.foreColor
|
|
211
212
|
},
|
|
212
213
|
BackColor: {
|
|
213
|
-
comp:
|
|
214
|
-
props:
|
|
214
|
+
comp: z,
|
|
215
|
+
props: t.backColor
|
|
215
216
|
}
|
|
216
|
-
},
|
|
217
|
+
}, St = /* @__PURE__ */ j({
|
|
217
218
|
name: "KendoEditor",
|
|
218
219
|
emits: {
|
|
219
220
|
focus: null,
|
|
@@ -233,8 +234,8 @@ const C = {
|
|
|
233
234
|
defaultEditMode: {
|
|
234
235
|
type: String,
|
|
235
236
|
default: "iframe",
|
|
236
|
-
validator: function(
|
|
237
|
-
return ["iframe", "div"].includes(
|
|
237
|
+
validator: function(e) {
|
|
238
|
+
return ["iframe", "div"].includes(e);
|
|
238
239
|
}
|
|
239
240
|
},
|
|
240
241
|
contentStyle: Object,
|
|
@@ -248,8 +249,8 @@ const C = {
|
|
|
248
249
|
preserveWhitespace: {
|
|
249
250
|
type: [String, Boolean],
|
|
250
251
|
default: "full",
|
|
251
|
-
validator: function(
|
|
252
|
-
return [!0, !1, "full"].includes(
|
|
252
|
+
validator: function(e) {
|
|
253
|
+
return [!0, !1, "full"].includes(e);
|
|
253
254
|
}
|
|
254
255
|
},
|
|
255
256
|
pasteHtml: Function,
|
|
@@ -260,7 +261,7 @@ const C = {
|
|
|
260
261
|
},
|
|
261
262
|
data() {
|
|
262
263
|
return {
|
|
263
|
-
updateGuid:
|
|
264
|
+
updateGuid: V(),
|
|
264
265
|
view: void 0,
|
|
265
266
|
linkDialog: !1,
|
|
266
267
|
showLicenseWatermark: !1,
|
|
@@ -268,192 +269,215 @@ const C = {
|
|
|
268
269
|
};
|
|
269
270
|
},
|
|
270
271
|
created() {
|
|
271
|
-
this._view = void 0, this.trOnChange = null, this.valueisUpdated = !1, this._prevValue = this.$props.value, ee(A), this.showLicenseWatermark = te(A), this.licenseMessage = ie(A);
|
|
272
|
+
this._view = void 0, this.trOnChange = null, this.valueisUpdated = !1, this._prevValue = this.$props.value, this.pluginViews = [], ee(A), this.showLicenseWatermark = te(A), this.licenseMessage = ie(A);
|
|
272
273
|
},
|
|
273
274
|
mounted() {
|
|
274
|
-
this.iframe = R(this, "iframe"), this.contentElement = R(this, "contentElement"), (!this.iframe || !
|
|
275
|
+
this.iframe = R(this, "iframe"), this.contentElement = R(this, "contentElement"), (!this.iframe || !D) && this.initialize();
|
|
275
276
|
},
|
|
276
277
|
watch: {
|
|
277
|
-
value: function(
|
|
278
|
+
value: function(e, i) {
|
|
278
279
|
this.valueisUpdated = !0, this._prevValue = i;
|
|
279
280
|
}
|
|
280
281
|
},
|
|
281
282
|
updated() {
|
|
282
283
|
const {
|
|
283
|
-
value:
|
|
284
|
+
value: e
|
|
284
285
|
} = this.$props, i = this.getView();
|
|
285
|
-
|
|
286
|
+
e === void 0 || !this.valueisUpdated || !i || (Ce(i, this.computedValue(), this._prevValue, this.trOnChange, this.htmlOnChange), this.valueisUpdated = !1, this.trOnChange = null, this.htmlOnChange = null);
|
|
287
|
+
},
|
|
288
|
+
beforeUnmount() {
|
|
289
|
+
var a, m;
|
|
290
|
+
this.iframe && (this.iframe.src = "about:blank");
|
|
291
|
+
const e = this.iframe, i = this.contentElement, s = this.getView();
|
|
292
|
+
if (s) {
|
|
293
|
+
(a = this.pluginViews) == null || a.forEach((l) => {
|
|
294
|
+
var f;
|
|
295
|
+
(f = l == null ? void 0 : l.destroy) == null || f.call(l);
|
|
296
|
+
});
|
|
297
|
+
const u = Se(s);
|
|
298
|
+
(m = u == null ? void 0 : u.parentNode) == null || m.removeChild(u);
|
|
299
|
+
}
|
|
300
|
+
this.view && Le(this.view), this.view = void 0, this._view = null, this.trOnChange = null, this.htmlOnChange = null, this.pasteEvent = void 0, this.valueisUpdated = !1, this._prevValue = void 0, this.pluginViews && (this.pluginViews.length = 0, this.pluginViews = null), this.iframe = void 0, this.contentElement = void 0, e && Ee(e, i), this.updateGuid = void 0, this.linkDialog = !1;
|
|
286
301
|
},
|
|
287
302
|
unmounted() {
|
|
288
|
-
this.
|
|
303
|
+
this.view = void 0, this._view = null, this.iframe = void 0, this.contentElement = void 0, this.pluginViews = null;
|
|
289
304
|
},
|
|
290
305
|
render() {
|
|
291
|
-
let
|
|
306
|
+
let e = 100;
|
|
292
307
|
const {
|
|
293
308
|
tools: i = [],
|
|
294
|
-
defaultEditMode:
|
|
295
|
-
preserveWhitespace:
|
|
296
|
-
style:
|
|
297
|
-
value:
|
|
298
|
-
} = this.$props,
|
|
309
|
+
defaultEditMode: s = "iframe",
|
|
310
|
+
preserveWhitespace: a = "full",
|
|
311
|
+
style: m,
|
|
312
|
+
value: u
|
|
313
|
+
} = this.$props, l = this.getView(), f = xe(this), w = this.showLicenseWatermark ? h(Y, {
|
|
299
314
|
message: this.licenseMessage
|
|
300
315
|
}, null) : null;
|
|
301
316
|
if (this.view) {
|
|
302
|
-
const o =
|
|
303
|
-
o.preserveWhitespace =
|
|
317
|
+
const o = x.getState(this.view.state);
|
|
318
|
+
o.preserveWhitespace = a;
|
|
304
319
|
}
|
|
305
|
-
let
|
|
306
|
-
|
|
320
|
+
let g = this.$props.contentStyle;
|
|
321
|
+
g === void 0 && (m || {}).height === void 0 && (g = {
|
|
307
322
|
height: "300px"
|
|
308
323
|
});
|
|
309
|
-
const
|
|
310
|
-
return this.linkDialog &&
|
|
311
|
-
view:
|
|
312
|
-
settings:
|
|
324
|
+
const S = function() {
|
|
325
|
+
return this.linkDialog && h(ye, {
|
|
326
|
+
view: l,
|
|
327
|
+
settings: W,
|
|
313
328
|
dir: this.$props.dir,
|
|
314
329
|
onClose: this.handleClose
|
|
315
330
|
}, null);
|
|
316
|
-
},
|
|
317
|
-
const
|
|
318
|
-
let
|
|
319
|
-
return o === "ForeColor" ?
|
|
331
|
+
}, L = function(o, p) {
|
|
332
|
+
const d = C[o] || o, F = function() {
|
|
333
|
+
let v;
|
|
334
|
+
return o === "ForeColor" ? v = f.toLanguageString(k.foregroundColorAriaLabel, O[k.foregroundColorAriaLabel]) : o === "BackColor" && (v = f.toLanguageString(k.backgroundColor, O[k.backgroundColor])), v;
|
|
320
335
|
};
|
|
321
336
|
if (C[o]) {
|
|
322
|
-
|
|
323
|
-
const
|
|
324
|
-
view:
|
|
337
|
+
e++;
|
|
338
|
+
const v = {
|
|
339
|
+
view: l,
|
|
325
340
|
dir: this.$props.dir,
|
|
326
|
-
key:
|
|
341
|
+
key: e,
|
|
327
342
|
updateGuid: this.updateGuid,
|
|
328
343
|
settings: C[o].props,
|
|
329
344
|
...C[o].props,
|
|
330
|
-
ariaLabel:
|
|
345
|
+
ariaLabel: F()
|
|
331
346
|
};
|
|
332
|
-
return T(
|
|
347
|
+
return T(P(C[o].comp), v);
|
|
333
348
|
} else {
|
|
334
|
-
if (
|
|
335
|
-
return
|
|
336
|
-
key:
|
|
349
|
+
if (d === "Separator")
|
|
350
|
+
return h(X, {
|
|
351
|
+
key: e
|
|
337
352
|
}, null);
|
|
338
353
|
{
|
|
339
|
-
const
|
|
340
|
-
return
|
|
354
|
+
const v = oe.call(this, d.render, se.call(this));
|
|
355
|
+
return re.call(this, {
|
|
341
356
|
h: T,
|
|
342
|
-
template:
|
|
357
|
+
template: v,
|
|
343
358
|
defaultRendering: null,
|
|
344
359
|
additionalListeners: {},
|
|
345
360
|
additionalProps: {
|
|
346
|
-
view:
|
|
361
|
+
view: l,
|
|
347
362
|
dir: this.$props.dir,
|
|
348
363
|
updateGuid: this.updateGuid,
|
|
349
|
-
key:
|
|
350
|
-
settings:
|
|
364
|
+
key: e,
|
|
365
|
+
settings: d.props
|
|
351
366
|
}
|
|
352
367
|
});
|
|
353
368
|
}
|
|
354
369
|
}
|
|
355
|
-
},
|
|
356
|
-
return o.map(function(
|
|
357
|
-
return
|
|
370
|
+
}, r = function(o, p) {
|
|
371
|
+
return o.map(function(d) {
|
|
372
|
+
return L.call(this, d, p);
|
|
358
373
|
}, this);
|
|
359
|
-
}, n = i.map(function(o,
|
|
360
|
-
let
|
|
361
|
-
return Array.isArray(o) ?
|
|
362
|
-
key:
|
|
363
|
-
},
|
|
364
|
-
default: () => [
|
|
365
|
-
}) :
|
|
374
|
+
}, n = i.map(function(o, p) {
|
|
375
|
+
let d;
|
|
376
|
+
return Array.isArray(o) ? h(q, {
|
|
377
|
+
key: p
|
|
378
|
+
}, G(d = r.call(this, o, p)) ? d : {
|
|
379
|
+
default: () => [d]
|
|
380
|
+
}) : L.call(this, o, p);
|
|
366
381
|
}, this);
|
|
367
|
-
return
|
|
382
|
+
return h("div", {
|
|
368
383
|
class: Z("k-editor", {
|
|
369
384
|
"k-editor-resizable": this.$props.resizable
|
|
370
385
|
}),
|
|
371
386
|
dir: this.$props.dir
|
|
372
|
-
}, [n.length > 0 &&
|
|
387
|
+
}, [n.length > 0 && h(Q, {
|
|
373
388
|
overflow: "none",
|
|
374
389
|
class: "k-editor-toolbar",
|
|
375
390
|
keyboardNavigation: this.$props.keyboardNavigation
|
|
376
|
-
},
|
|
391
|
+
}, G(n) ? n : {
|
|
377
392
|
default: () => [n]
|
|
378
|
-
}),
|
|
393
|
+
}), s === "iframe" ? h("div", {
|
|
379
394
|
class: "k-editor-content"
|
|
380
|
-
}, [
|
|
395
|
+
}, [h("iframe", {
|
|
381
396
|
onLoad: this.iframeLoad,
|
|
382
|
-
ref:
|
|
397
|
+
ref: M(this, "iframe"),
|
|
383
398
|
frameborder: "0",
|
|
384
|
-
title:
|
|
385
|
-
style:
|
|
399
|
+
title: f.toLanguageString(k.iframeTitle, O[k.iframeTitle]),
|
|
400
|
+
style: g,
|
|
386
401
|
class: "k-iframe"
|
|
387
|
-
}, null)]) :
|
|
388
|
-
style:
|
|
402
|
+
}, null)]) : h("div", {
|
|
403
|
+
style: g,
|
|
389
404
|
class: "k-editor-content"
|
|
390
|
-
}, [
|
|
391
|
-
ref:
|
|
405
|
+
}, [h("div", {
|
|
406
|
+
ref: M(this, "contentElement"),
|
|
392
407
|
role: "textbox",
|
|
393
408
|
"aria-labelledby": this.$props.ariaLabelledBy,
|
|
394
409
|
"aria-describedby": this.$props.ariaDescribedBy,
|
|
395
410
|
"aria-label": this.$props.ariaLabel
|
|
396
|
-
}, null)]),
|
|
411
|
+
}, null)]), S.call(this), w]);
|
|
397
412
|
},
|
|
398
413
|
methods: {
|
|
399
414
|
getView() {
|
|
400
415
|
return this.view;
|
|
401
416
|
},
|
|
402
417
|
getHTML() {
|
|
403
|
-
const
|
|
404
|
-
return
|
|
418
|
+
const e = this.getView();
|
|
419
|
+
return e ? y.getHtml(e.state) : "";
|
|
405
420
|
},
|
|
406
|
-
setHTML(
|
|
421
|
+
setHTML(e) {
|
|
407
422
|
const i = this.getView();
|
|
408
|
-
i && y.setHtml(i,
|
|
423
|
+
i && y.setHtml(i, e);
|
|
409
424
|
},
|
|
410
425
|
focus() {
|
|
411
426
|
this.getView() && this.getView().focus();
|
|
412
427
|
},
|
|
413
|
-
updateTools(
|
|
414
|
-
this.view =
|
|
428
|
+
updateTools(e) {
|
|
429
|
+
this.view = e, this.updateGuid = V();
|
|
415
430
|
},
|
|
416
431
|
iframeLoad() {
|
|
417
|
-
|
|
432
|
+
D && this.initialize();
|
|
418
433
|
},
|
|
419
434
|
initialize() {
|
|
420
|
-
const
|
|
421
|
-
if (
|
|
422
|
-
const
|
|
423
|
-
[we,
|
|
424
|
-
if (
|
|
425
|
-
const
|
|
426
|
-
|
|
435
|
+
const e = this.iframe && this.iframe.contentWindow;
|
|
436
|
+
if (e) {
|
|
437
|
+
const r = e.document;
|
|
438
|
+
[we, be, this.$props.dir === "rtl" ? ke : void 0].forEach((o) => {
|
|
439
|
+
if (o) {
|
|
440
|
+
const p = r.createElement("style");
|
|
441
|
+
p.appendChild(r.createTextNode(o)), r.head.appendChild(p);
|
|
427
442
|
}
|
|
428
443
|
});
|
|
429
|
-
const
|
|
430
|
-
|
|
444
|
+
const n = r.createElement("meta");
|
|
445
|
+
n.setAttribute("charset", "utf-8"), r.head.appendChild(n), this.contentElement = r.createElement("div"), r.body.appendChild(this.contentElement), this.contentElement.classList.add("k-content"), this.contentElement.setAttribute("role", "main");
|
|
431
446
|
}
|
|
432
447
|
const i = this.contentElement;
|
|
433
448
|
if (!i)
|
|
434
449
|
return;
|
|
435
450
|
const {
|
|
436
|
-
preserveWhitespace:
|
|
437
|
-
} = this.$props,
|
|
438
|
-
|
|
451
|
+
preserveWhitespace: s = "full"
|
|
452
|
+
} = this.$props, a = this, m = function(r) {
|
|
453
|
+
a.view = r, a.updateGuid = V();
|
|
454
|
+
};
|
|
455
|
+
let u = [
|
|
439
456
|
// https://prosemirror.net/docs/ref/#state.PluginSpec
|
|
440
|
-
new
|
|
441
|
-
view: () =>
|
|
442
|
-
|
|
443
|
-
|
|
457
|
+
new $({
|
|
458
|
+
view: (r) => {
|
|
459
|
+
const n = {
|
|
460
|
+
update: m,
|
|
461
|
+
destroy: () => {
|
|
462
|
+
const o = a.pluginViews.indexOf(n);
|
|
463
|
+
o > -1 && a.pluginViews.splice(o, 1);
|
|
464
|
+
}
|
|
465
|
+
};
|
|
466
|
+
return a.pluginViews.push(n), n;
|
|
467
|
+
},
|
|
444
468
|
key: new H("toolbar-tools-update-plugin")
|
|
445
469
|
}),
|
|
446
|
-
new
|
|
470
|
+
new $({
|
|
447
471
|
filterTransaction: this.filterTransaction,
|
|
448
472
|
key: new H("onExecute-event-plugin")
|
|
449
473
|
}),
|
|
450
|
-
new
|
|
451
|
-
key:
|
|
474
|
+
new $({
|
|
475
|
+
key: x,
|
|
452
476
|
state: {
|
|
453
477
|
init: () => ({
|
|
454
|
-
preserveWhitespace:
|
|
478
|
+
preserveWhitespace: s
|
|
455
479
|
}),
|
|
456
|
-
apply: (
|
|
480
|
+
apply: (r, n) => n
|
|
457
481
|
}
|
|
458
482
|
}),
|
|
459
483
|
ne(),
|
|
@@ -461,41 +485,41 @@ const C = {
|
|
|
461
485
|
le(),
|
|
462
486
|
pe(),
|
|
463
487
|
de()
|
|
464
|
-
],
|
|
488
|
+
], l = {
|
|
465
489
|
...y.getShortcuts({
|
|
466
490
|
types: {
|
|
467
491
|
listItem: "list_item",
|
|
468
492
|
hardBreak: "hard_break"
|
|
469
493
|
},
|
|
470
494
|
toolsSettings: {
|
|
471
|
-
bold:
|
|
472
|
-
italic:
|
|
473
|
-
underline:
|
|
495
|
+
bold: De,
|
|
496
|
+
italic: Ie,
|
|
497
|
+
underline: Ue
|
|
474
498
|
}
|
|
475
499
|
}),
|
|
476
500
|
"Mod-k": () => {
|
|
477
501
|
const {
|
|
478
|
-
linkDialog:
|
|
479
|
-
} = this.$data,
|
|
480
|
-
if (
|
|
481
|
-
const
|
|
482
|
-
!
|
|
502
|
+
linkDialog: r
|
|
503
|
+
} = this.$data, n = this.getView();
|
|
504
|
+
if (n) {
|
|
505
|
+
const o = n.state, p = o.selection.empty, d = ge(o, o.schema.marks[W.mark]);
|
|
506
|
+
!r && !(p && !d) && (this.linkDialog = !0);
|
|
483
507
|
}
|
|
484
|
-
return !
|
|
508
|
+
return !r;
|
|
485
509
|
}
|
|
486
510
|
};
|
|
487
511
|
const {
|
|
488
|
-
defaultContent:
|
|
489
|
-
value:
|
|
490
|
-
} = this.$props,
|
|
512
|
+
defaultContent: f = "",
|
|
513
|
+
value: w
|
|
514
|
+
} = this.$props, B = w && typeof w != "string" ? K(w) : y.createDocument(new ce({
|
|
491
515
|
nodes: ve,
|
|
492
516
|
marks: me
|
|
493
|
-
}),
|
|
494
|
-
preserveWhitespace:
|
|
495
|
-
}),
|
|
517
|
+
}), w || f, {
|
|
518
|
+
preserveWhitespace: s
|
|
519
|
+
}), g = {
|
|
496
520
|
state: ue.create({
|
|
497
|
-
plugins: [...
|
|
498
|
-
doc:
|
|
521
|
+
plugins: [...u, _(l), _(he)],
|
|
522
|
+
doc: B
|
|
499
523
|
}),
|
|
500
524
|
transformPastedHTML: this.onPasteHtml,
|
|
501
525
|
dispatchTransaction: this.dispatchTransaction,
|
|
@@ -504,74 +528,74 @@ const C = {
|
|
|
504
528
|
blur: this.onBlur,
|
|
505
529
|
paste: this.onPaste
|
|
506
530
|
}
|
|
507
|
-
},
|
|
508
|
-
plugins:
|
|
509
|
-
shortcuts:
|
|
510
|
-
target:
|
|
511
|
-
viewProps:
|
|
531
|
+
}, S = {
|
|
532
|
+
plugins: u,
|
|
533
|
+
shortcuts: l,
|
|
534
|
+
target: a,
|
|
535
|
+
viewProps: g,
|
|
512
536
|
dom: i
|
|
513
537
|
};
|
|
514
|
-
this.$emit("loaded",
|
|
515
|
-
const
|
|
538
|
+
this.$emit("loaded", S);
|
|
539
|
+
const L = this.$props.extendView && this.$props.extendView(S) || new fe({
|
|
516
540
|
mount: i
|
|
517
|
-
},
|
|
518
|
-
this.view =
|
|
541
|
+
}, g);
|
|
542
|
+
this.view = P(L);
|
|
519
543
|
},
|
|
520
|
-
filterTransaction(
|
|
521
|
-
const
|
|
544
|
+
filterTransaction(e, i) {
|
|
545
|
+
const s = {
|
|
522
546
|
target: this,
|
|
523
|
-
transaction:
|
|
547
|
+
transaction: e,
|
|
524
548
|
state: i
|
|
525
549
|
};
|
|
526
|
-
return this.$emit("execute",
|
|
550
|
+
return this.$emit("execute", s), !0;
|
|
527
551
|
},
|
|
528
|
-
onPasteHtml(
|
|
552
|
+
onPasteHtml(e) {
|
|
529
553
|
if (this.$props.pasteHtml && this.pasteEvent) {
|
|
530
554
|
const i = {
|
|
531
555
|
target: this,
|
|
532
|
-
pastedHtml:
|
|
556
|
+
pastedHtml: e,
|
|
533
557
|
event: this.pasteEvent
|
|
534
|
-
},
|
|
535
|
-
if (this.pasteEvent = void 0, typeof
|
|
536
|
-
return
|
|
558
|
+
}, s = this.$props.pasteHtml(i);
|
|
559
|
+
if (this.pasteEvent = void 0, typeof s == "string")
|
|
560
|
+
return s;
|
|
537
561
|
}
|
|
538
|
-
return
|
|
562
|
+
return e;
|
|
539
563
|
},
|
|
540
|
-
dispatchTransaction(
|
|
541
|
-
const i =
|
|
564
|
+
dispatchTransaction(e) {
|
|
565
|
+
const i = e.docChanged;
|
|
542
566
|
if (i) {
|
|
543
|
-
this.trOnChange =
|
|
544
|
-
const
|
|
545
|
-
target:
|
|
546
|
-
value:
|
|
567
|
+
this.trOnChange = e;
|
|
568
|
+
const s = e.doc, a = e.doc.type.schema, m = this, u = {
|
|
569
|
+
target: m,
|
|
570
|
+
value: s,
|
|
547
571
|
get html() {
|
|
548
|
-
return
|
|
549
|
-
doc:
|
|
550
|
-
schema:
|
|
551
|
-
}),
|
|
572
|
+
return m.htmlOnChange = y.getHtml({
|
|
573
|
+
doc: s,
|
|
574
|
+
schema: a
|
|
575
|
+
}), m.htmlOnChange;
|
|
552
576
|
},
|
|
553
|
-
transaction:
|
|
554
|
-
schema:
|
|
577
|
+
transaction: e,
|
|
578
|
+
schema: a
|
|
555
579
|
};
|
|
556
|
-
this.$emit("change",
|
|
580
|
+
this.$emit("change", u);
|
|
557
581
|
}
|
|
558
|
-
this.getView() && (this.$props.value === void 0 || !i) && this.getView().updateState(this.getView().state.apply(
|
|
582
|
+
this.getView() && (this.$props.value === void 0 || !i) && this.getView().updateState(this.getView().state.apply(e));
|
|
559
583
|
},
|
|
560
|
-
onFocus(
|
|
561
|
-
const
|
|
584
|
+
onFocus(e, i) {
|
|
585
|
+
const s = {
|
|
562
586
|
target: this,
|
|
563
587
|
event: i
|
|
564
588
|
};
|
|
565
|
-
return this.$emit("focus",
|
|
589
|
+
return this.$emit("focus", s), !1;
|
|
566
590
|
},
|
|
567
|
-
onBlur(
|
|
568
|
-
const
|
|
591
|
+
onBlur(e, i) {
|
|
592
|
+
const s = {
|
|
569
593
|
target: this,
|
|
570
594
|
event: i
|
|
571
595
|
};
|
|
572
|
-
return this.$emit("blur",
|
|
596
|
+
return this.$emit("blur", s), !1;
|
|
573
597
|
},
|
|
574
|
-
onPaste(
|
|
598
|
+
onPaste(e, i) {
|
|
575
599
|
return this.$props.pasteHtml && (this.pasteEvent = i), !1;
|
|
576
600
|
},
|
|
577
601
|
handleClose() {
|
|
@@ -583,6 +607,6 @@ const C = {
|
|
|
583
607
|
}
|
|
584
608
|
});
|
|
585
609
|
export {
|
|
586
|
-
|
|
610
|
+
St as Editor,
|
|
587
611
|
C as allTools
|
|
588
612
|
};
|