@editora/core 1.0.8 → 1.0.9
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/README.md +5 -0
- package/dist/{A11yCheckerPlugin.native-BRdGYMju.mjs → A11yCheckerPlugin.native-58d12bed.mjs} +23 -12
- package/dist/{AnchorPlugin.native-BcYGEtd9.mjs → AnchorPlugin.native-289a112a.mjs} +112 -102
- package/dist/{ApprovalWorkflowPlugin.native-C3jtAYjG.mjs → ApprovalWorkflowPlugin.native-449ce66c.mjs} +79 -40
- package/dist/{BackgroundColorPlugin.native-50iAT9xU.mjs → BackgroundColorPlugin.native-8aceb5cc.mjs} +16 -9
- package/dist/{BlockquotePlugin.native-JFmOLsxN.mjs → BlockquotePlugin.native-3541c714.mjs} +3 -2
- package/dist/{BlocksLibraryPlugin.native-HMWKxWNs.mjs → BlocksLibraryPlugin.native-1cc51e63.mjs} +119 -60
- package/dist/{BoldPlugin.native-BAzzoqU5.mjs → BoldPlugin.native-f9d7f8e4.mjs} +1 -1
- package/dist/{CapitalizationPlugin.native-DOMsh5R7.mjs → CapitalizationPlugin.native-42c135dc.mjs} +3 -2
- package/dist/{ChecklistPlugin.native-nuSSEFNI.mjs → ChecklistPlugin.native-3b397ee9.mjs} +43 -22
- package/dist/{CitationsPlugin.native-BnU0qCwR.mjs → CitationsPlugin.native-169fb1e8.mjs} +137 -69
- package/dist/{ClearFormattingPlugin.native-Bq_XcTh2.mjs → ClearFormattingPlugin.native-77baa514.mjs} +11 -6
- package/dist/{CodePlugin.native-DlpTPdkd.mjs → CodePlugin.native-989cf0aa.mjs} +629 -580
- package/dist/{CodeSamplePlugin.native-CgGoH-X4.mjs → CodeSamplePlugin.native-6cc0148e.mjs} +19 -10
- package/dist/{CommentsPlugin.native-DPSqTkiv.mjs → CommentsPlugin.native-03659874.mjs} +55 -28
- package/dist/{ConditionalContentPlugin.native-CfhY46rU.mjs → ConditionalContentPlugin.native-4983143a.mjs} +108 -51
- package/dist/{ContentRulesPlugin.native-nBLQ8QFZ.mjs → ContentRulesPlugin.native-63ed405b.mjs} +100 -50
- package/dist/{DataBindingPlugin.native-jQ1JPRTp.mjs → DataBindingPlugin.native-427e9d75.mjs} +79 -40
- package/dist/{DirectionPlugin.native-CDnbdNyl.mjs → DirectionPlugin.native-4e742f42.mjs} +19 -10
- package/dist/{DocSchemaPlugin.native-CHOge18O.mjs → DocSchemaPlugin.native-8e41eda0.mjs} +115 -58
- package/dist/{DocumentManagerPlugin.native-C2cs_1w4.mjs → DocumentManagerPlugin.native-e69895ad.mjs} +4 -4
- package/dist/{EmbedIframePlugin.native-DKJx2OS7.mjs → EmbedIframePlugin.native-55209c87.mjs} +70 -70
- package/dist/{EmojisPlugin.native-CitxxlWX.mjs → EmojisPlugin.native-65c5ac47.mjs} +11 -6
- package/dist/{FontFamilyPlugin.native-j8hMTbg4.mjs → FontFamilyPlugin.native-f9bc255a.mjs} +7 -4
- package/dist/{FontSizePlugin.native-B_jCh7dY.mjs → FontSizePlugin.native-f5647872.mjs} +19 -10
- package/dist/{FootnotePlugin.native-D730OGRm.mjs → FootnotePlugin.native-494657b3.mjs} +77 -39
- package/dist/{FullscreenPlugin.native-ChXyxeNw.mjs → FullscreenPlugin.native-87ce92e9.mjs} +1 -1
- package/dist/{HeadingPlugin.native-DrLYwQnQ.mjs → HeadingPlugin.native-e38c4a16.mjs} +1 -1
- package/dist/{HistoryPlugin.native-TDnVMsEO.mjs → HistoryPlugin.native-92ed4be4.mjs} +43 -22
- package/dist/{IndentPlugin.native-BHixp8sP.mjs → IndentPlugin.native-e4ee902b.mjs} +23 -12
- package/dist/{ItalicPlugin.native-CQjjDyUL.mjs → ItalicPlugin.native-7c95cfbc.mjs} +1 -1
- package/dist/{LineHeightPlugin.native-CM7iXdQj.mjs → LineHeightPlugin.native-5668f78c.mjs} +19 -10
- package/dist/{LinkPlugin.native-DYCIcdTm.mjs → LinkPlugin.native-6df29111.mjs} +9 -5
- package/dist/{ListPlugin.native-V7EZC1lM.mjs → ListPlugin.native-fe2e115a.mjs} +9 -5
- package/dist/{MathPlugin.native-f_mDp8VL.mjs → MathPlugin.native-735bbac2.mjs} +9 -5
- package/dist/{MediaManagerPlugin.native-BiXiK8FC.mjs → MediaManagerPlugin.native-3cf48a00.mjs} +219 -207
- package/dist/{MentionPlugin.native-BMDlOqur.mjs → MentionPlugin.native-3b1e8c05.mjs} +89 -45
- package/dist/{MergeTagPlugin.native-C3eOfEgw.mjs → MergeTagPlugin.native-31cf7d48.mjs} +51 -26
- package/dist/{PIIRedactionPlugin.native-DcsjmtV1.mjs → PIIRedactionPlugin.native-7ab10b9f.mjs} +107 -54
- package/dist/{PageBreakPlugin.native-DijGuHJZ.mjs → PageBreakPlugin.native-1794c5fb.mjs} +31 -16
- package/dist/{PreviewPlugin.native-WuIwOAOR.mjs → PreviewPlugin.native-f7b67cc0.mjs} +11 -6
- package/dist/{PrintPlugin.native-7qt5v7L5.mjs → PrintPlugin.native-f6a168c2.mjs} +5 -3
- package/dist/{SlashCommandsPlugin.native-CmxvMEaE.mjs → SlashCommandsPlugin.native-8d45e511.mjs} +72 -37
- package/dist/{SmartPastePlugin.native-BOKKtF07.mjs → SmartPastePlugin.native-a6c5efec.mjs} +99 -50
- package/dist/{SpecialCharactersPlugin.native-CZDato89.mjs → SpecialCharactersPlugin.native-7f06d4ba.mjs} +17 -9
- package/dist/{SpellCheckPlugin.native-BZB9AewP.mjs → SpellCheckPlugin.native-04e20834.mjs} +41 -21
- package/dist/{StrikethroughPlugin.native-0Be7j49s.mjs → StrikethroughPlugin.native-905e9501.mjs} +9 -5
- package/dist/{TablePlugin.native-DrHX-efe.mjs → TablePlugin.native-7d5458c1.mjs} +58 -30
- package/dist/{TemplatePlugin.native-CrpfKRJ8.mjs → TemplatePlugin.native-580f0f63.mjs} +32 -17
- package/dist/{TextAlignmentPlugin.native-sM_1s00t.mjs → TextAlignmentPlugin.native-9357b3ed.mjs} +11 -6
- package/dist/{TextColorPlugin.native-Bwl_bSmc.mjs → TextColorPlugin.native-d53ed459.mjs} +26 -14
- package/dist/{TrackChangesPlugin.native-Bghu2q4a.mjs → TrackChangesPlugin.native-e96da509.mjs} +115 -58
- package/dist/{TranslationWorkflowPlugin.native-Bz6jDGvj.mjs → TranslationWorkflowPlugin.native-4e711b1e.mjs} +160 -91
- package/dist/{UnderlinePlugin.native-QpIcK4L2.mjs → UnderlinePlugin.native-8080c998.mjs} +1 -1
- package/dist/{VersionDiffPlugin.native-Bvxgy--t.mjs → VersionDiffPlugin.native-5bbeff85.mjs} +51 -26
- package/dist/_commonjsHelpers-69d58be2.mjs +31 -0
- package/dist/{anchoredPopover-Bxds0VoB.mjs → anchoredPopover-5cca53ba.mjs} +1 -1
- package/dist/documentManager-8327fb6e.mjs +9166 -0
- package/dist/{editorContainerHelpers-C7kdWnS0.mjs → editorContainerHelpers-69585c07.mjs} +3 -2
- package/dist/editora.min.js +14 -13
- package/dist/editora.umd.js +14 -13
- package/dist/{html2canvas.esm-AYkPY5LS.mjs → html2canvas.esm-c51cb3b9.mjs} +978 -894
- package/dist/index-072ef022.js +11 -0
- package/dist/index-49d31221.mjs +16860 -0
- package/dist/{index-DqC57IEH.mjs → index-7da30697.mjs} +163 -124
- package/dist/index.cjs.js +1 -1
- package/dist/index.es-b47a189f.mjs +5782 -0
- package/dist/index.esm.js +12 -7
- package/dist/{jspdf.es.min-BJGtOnRT.mjs → jspdf.es.min-780c82db.mjs} +4808 -3784
- package/dist/plugin-loader.js +67 -67
- package/dist/{purify.es-CKpwg8Tk.mjs → purify.es-3bdbcfc5.mjs} +20 -10
- package/dist/style.css +1 -0
- package/dist/webcomponent-core.js +164 -125
- package/dist/webcomponent-core.min.css +1 -1
- package/dist/webcomponent-core.min.js +18 -17
- package/dist/webcomponent.cjs.js +1 -1
- package/dist/webcomponent.esm.js +1 -1
- package/dist/webcomponent.js +226 -187
- package/dist/webcomponent.min.css +1 -1
- package/dist/webcomponent.min.js +1324 -1117
- package/package.json +11 -5
- package/LICENSE +0 -21
- package/dist/_commonjsHelpers-DOllISpa.mjs +0 -32
- package/dist/core.css +0 -1
- package/dist/documentManager-vQ1VkbUY.mjs +0 -8418
- package/dist/index-BslAFzmv.mjs +0 -16544
- package/dist/index-D1LOqg5C.js +0 -10
- package/dist/index.es-BYD2KEo6.mjs +0 -6666
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
const p = ".rte-content, .editora-content", ie = "[data-editora-editor], .rte-editor, .editora-editor, editora-editor", w = '.rte-mention[data-mention="true"]', b = ':is([data-theme="dark"], .dark, .editora-theme-dark, .rte-theme-dark)', R = /* @__PURE__ */ new WeakMap(), N = /* @__PURE__ */ new WeakMap();
|
|
2
2
|
let F = !1, S = !1, T = null, k = 0;
|
|
3
3
|
function X(e, n) {
|
|
4
|
-
if (n === e.innerHTML)
|
|
4
|
+
if (n === e.innerHTML)
|
|
5
|
+
return;
|
|
5
6
|
const o = window.execEditorCommand || window.executeEditorCommand;
|
|
6
7
|
if (typeof o == "function")
|
|
7
8
|
try {
|
|
@@ -21,7 +22,8 @@ function A(e, n) {
|
|
|
21
22
|
}
|
|
22
23
|
function E(e) {
|
|
23
24
|
const n = window.getSelection();
|
|
24
|
-
if (!n || n.rangeCount === 0)
|
|
25
|
+
if (!n || n.rangeCount === 0)
|
|
26
|
+
return null;
|
|
25
27
|
const o = n.getRangeAt(0);
|
|
26
28
|
return e.contains(o.commonAncestorContainer) ? o.cloneRange() : null;
|
|
27
29
|
}
|
|
@@ -41,7 +43,8 @@ function L(e) {
|
|
|
41
43
|
}
|
|
42
44
|
function le(e) {
|
|
43
45
|
const n = ae(e);
|
|
44
|
-
if (L(n))
|
|
46
|
+
if (L(n))
|
|
47
|
+
return !0;
|
|
45
48
|
const o = n.closest("[data-theme], [theme], .dark, .editora-theme-dark, .rte-theme-dark");
|
|
46
49
|
return L(o) ? !0 : L(document.documentElement) || L(document.body);
|
|
47
50
|
}
|
|
@@ -49,23 +52,29 @@ function Z(e, n) {
|
|
|
49
52
|
e.classList.remove("rte-mention-theme-dark"), le(n) && e.classList.add("rte-mention-theme-dark");
|
|
50
53
|
}
|
|
51
54
|
function se(e) {
|
|
52
|
-
if ((e == null ? void 0 : e.contentElement) instanceof HTMLElement)
|
|
55
|
+
if ((e == null ? void 0 : e.contentElement) instanceof HTMLElement)
|
|
56
|
+
return e.contentElement;
|
|
53
57
|
if ((e == null ? void 0 : e.editorElement) instanceof HTMLElement) {
|
|
54
58
|
const t = e.editorElement;
|
|
55
|
-
if (t.matches(p))
|
|
59
|
+
if (t.matches(p))
|
|
60
|
+
return t;
|
|
56
61
|
const r = t.querySelector(p);
|
|
57
|
-
if (r instanceof HTMLElement)
|
|
62
|
+
if (r instanceof HTMLElement)
|
|
63
|
+
return r;
|
|
58
64
|
}
|
|
59
65
|
const n = window.getSelection();
|
|
60
66
|
if (n && n.rangeCount > 0) {
|
|
61
67
|
const t = n.getRangeAt(0).startContainer, r = t.nodeType === Node.ELEMENT_NODE ? t : t.parentElement, i = r == null ? void 0 : r.closest(p);
|
|
62
|
-
if (i)
|
|
68
|
+
if (i)
|
|
69
|
+
return i;
|
|
63
70
|
}
|
|
64
71
|
const o = document.activeElement;
|
|
65
72
|
if (o) {
|
|
66
|
-
if (o.matches(p))
|
|
73
|
+
if (o.matches(p))
|
|
74
|
+
return o;
|
|
67
75
|
const t = o.closest(p);
|
|
68
|
-
if (t)
|
|
76
|
+
if (t)
|
|
77
|
+
return t;
|
|
69
78
|
}
|
|
70
79
|
return document.querySelector(p);
|
|
71
80
|
}
|
|
@@ -85,7 +94,8 @@ function ue(e) {
|
|
|
85
94
|
return e ? /\s|[([{"'`]/.test(e) : !0;
|
|
86
95
|
}
|
|
87
96
|
function de(e) {
|
|
88
|
-
if (!e.collapsed)
|
|
97
|
+
if (!e.collapsed)
|
|
98
|
+
return null;
|
|
89
99
|
const n = e.startContainer, o = e.startOffset;
|
|
90
100
|
if (n.nodeType === Node.TEXT_NODE) {
|
|
91
101
|
const t = n;
|
|
@@ -116,7 +126,8 @@ function fe(e, n, o) {
|
|
|
116
126
|
if (n.forEach((a) => {
|
|
117
127
|
const l = e.lastIndexOf(a);
|
|
118
128
|
l > t && (t = l, r = a);
|
|
119
|
-
}), t < 0 || !ue(e[t - 1]))
|
|
129
|
+
}), t < 0 || !ue(e[t - 1]))
|
|
130
|
+
return null;
|
|
120
131
|
const i = e.slice(t + 1);
|
|
121
132
|
return /\s/.test(i) || i.length > o ? null : {
|
|
122
133
|
trigger: r,
|
|
@@ -136,7 +147,8 @@ function me(e, n) {
|
|
|
136
147
|
return r.remove(), e.normalize(), i;
|
|
137
148
|
}
|
|
138
149
|
function ge(e, n) {
|
|
139
|
-
if (e.panel && e.list)
|
|
150
|
+
if (e.panel && e.list)
|
|
151
|
+
return;
|
|
140
152
|
const o = document.createElement("div");
|
|
141
153
|
o.className = "rte-mention-panel", o.style.display = "none";
|
|
142
154
|
const t = document.createElement("div");
|
|
@@ -144,9 +156,11 @@ function ge(e, n) {
|
|
|
144
156
|
r.preventDefault();
|
|
145
157
|
}), o.addEventListener("click", (r) => {
|
|
146
158
|
const i = r.target;
|
|
147
|
-
if (!i)
|
|
159
|
+
if (!i)
|
|
160
|
+
return;
|
|
148
161
|
const a = i.closest(".rte-mention-item");
|
|
149
|
-
if (!a)
|
|
162
|
+
if (!a)
|
|
163
|
+
return;
|
|
150
164
|
const l = Number(a.getAttribute("data-index"));
|
|
151
165
|
Number.isFinite(l) && ee(e, n, l);
|
|
152
166
|
});
|
|
@@ -155,7 +169,8 @@ function m(e) {
|
|
|
155
169
|
e.panel && (e.debounceHandle !== null && (window.clearTimeout(e.debounceHandle), e.debounceHandle = null), e.abortController && (e.abortController.abort(), e.abortController = null), e.panel.style.display = "none", e.panel.classList.remove("show"), e.isOpen = !1, e.loading = !1, e.items = [], e.activeIndex = 0, e.query = "", e.replaceRange = null);
|
|
156
170
|
}
|
|
157
171
|
function U(e, n) {
|
|
158
|
-
if (!e.panel)
|
|
172
|
+
if (!e.panel)
|
|
173
|
+
return;
|
|
159
174
|
Z(e.panel, e.editor);
|
|
160
175
|
const o = me(e.editor, n), t = e.panel;
|
|
161
176
|
t.style.display = "block", t.classList.add("show"), t.style.left = "0px", t.style.top = "0px";
|
|
@@ -164,14 +179,17 @@ function U(e, n) {
|
|
|
164
179
|
s + r.height > a - 8 && (s = Math.max(8, o.top - r.height - 8)), t.style.position = "fixed", t.style.left = `${l}px`, t.style.top = `${s}px`;
|
|
165
180
|
}
|
|
166
181
|
function pe(e, n) {
|
|
167
|
-
if (!n)
|
|
182
|
+
if (!n)
|
|
183
|
+
return x(e);
|
|
168
184
|
const o = e.toLowerCase(), t = n.toLowerCase(), r = o.indexOf(t);
|
|
169
|
-
if (r < 0)
|
|
185
|
+
if (r < 0)
|
|
186
|
+
return x(e);
|
|
170
187
|
const i = x(e.slice(0, r)), a = x(e.slice(r, r + n.length)), l = x(e.slice(r + n.length));
|
|
171
188
|
return `${i}<mark>${a}</mark>${l}`;
|
|
172
189
|
}
|
|
173
190
|
function W(e, n) {
|
|
174
|
-
if (!e.list)
|
|
191
|
+
if (!e.list)
|
|
192
|
+
return;
|
|
175
193
|
const o = e.list;
|
|
176
194
|
if (o.innerHTML = "", e.loading) {
|
|
177
195
|
const t = document.createElement("div");
|
|
@@ -240,7 +258,8 @@ function he(e, n) {
|
|
|
240
258
|
async function ye(e, n, o, t) {
|
|
241
259
|
var f, c;
|
|
242
260
|
const r = n.api;
|
|
243
|
-
if (!r)
|
|
261
|
+
if (!r)
|
|
262
|
+
return [];
|
|
244
263
|
e.abortController && e.abortController.abort();
|
|
245
264
|
const i = new AbortController();
|
|
246
265
|
e.abortController = i;
|
|
@@ -269,9 +288,11 @@ async function ye(e, n, o, t) {
|
|
|
269
288
|
var _, $, B, j, z;
|
|
270
289
|
if (r.mapItem)
|
|
271
290
|
return r.mapItem(d, re);
|
|
272
|
-
if (!q(d))
|
|
291
|
+
if (!q(d))
|
|
292
|
+
return null;
|
|
273
293
|
const H = String((B = ($ = (_ = d.id) != null ? _ : d.value) != null ? $ : d.key) != null ? B : "").trim();
|
|
274
|
-
if (!H)
|
|
294
|
+
if (!H)
|
|
295
|
+
return null;
|
|
275
296
|
const oe = String((z = (j = d.label) != null ? j : d.name) != null ? z : H).trim();
|
|
276
297
|
return {
|
|
277
298
|
id: H,
|
|
@@ -304,7 +325,8 @@ async function be(e, n, o, t) {
|
|
|
304
325
|
}
|
|
305
326
|
function Ee(e, n, o) {
|
|
306
327
|
const t = e.editor;
|
|
307
|
-
if (C(t), !window.getSelection())
|
|
328
|
+
if (C(t), !window.getSelection())
|
|
329
|
+
return !1;
|
|
308
330
|
const i = t.innerHTML;
|
|
309
331
|
let a = e.replaceRange ? e.replaceRange.cloneRange() : E(t);
|
|
310
332
|
if (!a || !t.contains(a.commonAncestorContainer) && (a = E(t), !a))
|
|
@@ -322,7 +344,8 @@ function Ee(e, n, o) {
|
|
|
322
344
|
return u.setStart(f, c), u.collapse(!0), h(t, u), m(e), C(t), J(t), X(t, i), !0;
|
|
323
345
|
}
|
|
324
346
|
function ee(e, n, o) {
|
|
325
|
-
if (o < 0 || o >= e.items.length)
|
|
347
|
+
if (o < 0 || o >= e.items.length)
|
|
348
|
+
return;
|
|
326
349
|
const t = e.items[o];
|
|
327
350
|
Ee(e, n, t);
|
|
328
351
|
}
|
|
@@ -335,15 +358,18 @@ function we(e, n) {
|
|
|
335
358
|
}
|
|
336
359
|
function ne(e, n) {
|
|
337
360
|
const o = we(e, n);
|
|
338
|
-
if (o)
|
|
361
|
+
if (o)
|
|
362
|
+
return o;
|
|
339
363
|
const t = Q(e.startContainer), r = t == null ? void 0 : t.closest(w);
|
|
340
|
-
if (r && n.contains(r))
|
|
364
|
+
if (r && n.contains(r))
|
|
365
|
+
return r;
|
|
341
366
|
const i = Q(e.endContainer), a = i == null ? void 0 : i.closest(w);
|
|
342
367
|
return a && n.contains(a) ? a : null;
|
|
343
368
|
}
|
|
344
369
|
function O(e, n, o = "after") {
|
|
345
370
|
const t = ne(n, e);
|
|
346
|
-
if (!t)
|
|
371
|
+
if (!t)
|
|
372
|
+
return n;
|
|
347
373
|
const r = document.createRange();
|
|
348
374
|
return o === "before" ? r.setStartBefore(t) : r.setStartAfter(t), r.collapse(!0), r;
|
|
349
375
|
}
|
|
@@ -352,7 +378,8 @@ function G(e, n, o = "after") {
|
|
|
352
378
|
o === "before" ? t.setStartBefore(n) : t.setStartAfter(n), t.collapse(!0), h(e, t);
|
|
353
379
|
}
|
|
354
380
|
function Te(e, n, o) {
|
|
355
|
-
if (!e.collapsed)
|
|
381
|
+
if (!e.collapsed)
|
|
382
|
+
return null;
|
|
356
383
|
const t = e.startContainer, r = e.startOffset;
|
|
357
384
|
let i = null;
|
|
358
385
|
if (t.nodeType === Node.TEXT_NODE) {
|
|
@@ -366,11 +393,14 @@ function Te(e, n, o) {
|
|
|
366
393
|
}
|
|
367
394
|
function K(e, n) {
|
|
368
395
|
const o = E(e);
|
|
369
|
-
if (!o)
|
|
396
|
+
if (!o)
|
|
397
|
+
return !1;
|
|
370
398
|
const t = Te(o, n, e);
|
|
371
|
-
if (!t)
|
|
399
|
+
if (!t)
|
|
400
|
+
return !1;
|
|
372
401
|
const r = t.parentNode;
|
|
373
|
-
if (!r)
|
|
402
|
+
if (!r)
|
|
403
|
+
return !1;
|
|
374
404
|
const i = e.innerHTML, a = Array.prototype.indexOf.call(r.childNodes, t);
|
|
375
405
|
t.remove();
|
|
376
406
|
const l = document.createRange();
|
|
@@ -378,7 +408,8 @@ function K(e, n) {
|
|
|
378
408
|
}
|
|
379
409
|
function te(e, n, o, t, r, i) {
|
|
380
410
|
var s;
|
|
381
|
-
if (ge(e, n), e.query = t, e.trigger = r, e.replaceRange = i.cloneRange(), e.loading = !!(n.api && !n.search), e.debounceHandle !== null && (window.clearTimeout(e.debounceHandle), e.debounceHandle = null), !e.panel)
|
|
411
|
+
if (ge(e, n), e.query = t, e.trigger = r, e.replaceRange = i.cloneRange(), e.loading = !!(n.api && !n.search), e.debounceHandle !== null && (window.clearTimeout(e.debounceHandle), e.debounceHandle = null), !e.panel)
|
|
412
|
+
return;
|
|
382
413
|
e.isOpen || (e.panel.style.display = "block", e.panel.classList.add("show"), e.isOpen = !0), W(e, n), U(e, o);
|
|
383
414
|
const a = () => {
|
|
384
415
|
e.debounceHandle = null, be(e, n, t, r).then((f) => {
|
|
@@ -418,9 +449,11 @@ function Ce(e, n) {
|
|
|
418
449
|
l.setStart(i.node, a.startOffset), l.setEnd(i.node, i.caretOffset), te(e, n, t, a.query, a.trigger, l);
|
|
419
450
|
}
|
|
420
451
|
function V(e, n) {
|
|
421
|
-
if (e.items.length === 0)
|
|
452
|
+
if (e.items.length === 0)
|
|
453
|
+
return;
|
|
422
454
|
const o = e.items.length;
|
|
423
|
-
if (e.activeIndex = ((e.activeIndex + n) % o + o) % o, !e.list)
|
|
455
|
+
if (e.activeIndex = ((e.activeIndex + n) % o + o) % o, !e.list)
|
|
456
|
+
return;
|
|
424
457
|
const t = Array.from(e.list.querySelectorAll(".rte-mention-item"));
|
|
425
458
|
t.forEach((i, a) => i.classList.toggle("active", a === e.activeIndex));
|
|
426
459
|
const r = t[e.activeIndex];
|
|
@@ -449,15 +482,18 @@ function ke(e) {
|
|
|
449
482
|
n && ((o = n.panel) != null && o.parentNode && n.panel.parentNode.removeChild(n.panel), R.delete(e));
|
|
450
483
|
}
|
|
451
484
|
function D(e, n, o) {
|
|
452
|
-
if (N.has(e))
|
|
485
|
+
if (N.has(e))
|
|
486
|
+
return;
|
|
453
487
|
C(e);
|
|
454
488
|
const t = {
|
|
455
489
|
beforeInput: (r) => {
|
|
456
490
|
C(e);
|
|
457
491
|
const i = E(e);
|
|
458
|
-
if (!i)
|
|
492
|
+
if (!i)
|
|
493
|
+
return;
|
|
459
494
|
const a = ne(i, e);
|
|
460
|
-
if (!a)
|
|
495
|
+
if (!a)
|
|
496
|
+
return;
|
|
461
497
|
const l = r.inputType || "";
|
|
462
498
|
if (l.startsWith("insert")) {
|
|
463
499
|
if (r.preventDefault(), G(e, a, "after"), l === "insertParagraph" || l === "insertLineBreak") {
|
|
@@ -467,7 +503,8 @@ function D(e, n, o) {
|
|
|
467
503
|
}
|
|
468
504
|
if (l === "insertText" || l === "insertCompositionText") {
|
|
469
505
|
const s = r.data || "";
|
|
470
|
-
if (!s)
|
|
506
|
+
if (!s)
|
|
507
|
+
return;
|
|
471
508
|
document.execCommand("insertText", !1, s);
|
|
472
509
|
}
|
|
473
510
|
}
|
|
@@ -516,7 +553,8 @@ function D(e, n, o) {
|
|
|
516
553
|
},
|
|
517
554
|
click: (r) => {
|
|
518
555
|
const i = r.target;
|
|
519
|
-
if (!i)
|
|
556
|
+
if (!i)
|
|
557
|
+
return;
|
|
520
558
|
const a = i.nodeType === Node.ELEMENT_NODE ? i : i.parentElement, l = a == null ? void 0 : a.closest(w);
|
|
521
559
|
!l || !e.contains(l) || (r.preventDefault(), r.stopPropagation(), G(e, l, "after"), m(n));
|
|
522
560
|
},
|
|
@@ -527,7 +565,8 @@ function D(e, n, o) {
|
|
|
527
565
|
}, 0);
|
|
528
566
|
},
|
|
529
567
|
mousedown: (r) => {
|
|
530
|
-
if (!n.isOpen || !n.panel)
|
|
568
|
+
if (!n.isOpen || !n.panel)
|
|
569
|
+
return;
|
|
531
570
|
const i = r.target;
|
|
532
571
|
i && !n.panel.contains(i) && !e.contains(i) && m(n);
|
|
533
572
|
}
|
|
@@ -539,7 +578,8 @@ function Le(e) {
|
|
|
539
578
|
n && (e.removeEventListener("beforeinput", n.beforeInput), e.removeEventListener("input", n.input), e.removeEventListener("keydown", n.keydown), e.removeEventListener("click", n.click), e.removeEventListener("blur", n.blur), document.removeEventListener("mousedown", n.mousedown, !0), N.delete(e));
|
|
540
579
|
}
|
|
541
580
|
function Me() {
|
|
542
|
-
if (F || typeof document == "undefined")
|
|
581
|
+
if (F || typeof document == "undefined")
|
|
582
|
+
return;
|
|
543
583
|
F = !0;
|
|
544
584
|
const e = document.createElement("style");
|
|
545
585
|
e.id = "rte-mention-plugin-styles", e.textContent = `
|
|
@@ -672,16 +712,19 @@ function Re(e) {
|
|
|
672
712
|
}
|
|
673
713
|
function M(e) {
|
|
674
714
|
const n = R.get(e);
|
|
675
|
-
if (n)
|
|
715
|
+
if (n)
|
|
716
|
+
return n;
|
|
676
717
|
const o = ve(e);
|
|
677
718
|
return R.set(e, o), o;
|
|
678
719
|
}
|
|
679
720
|
function Ne(e) {
|
|
680
721
|
S || (S = !0, T = (n) => {
|
|
681
722
|
const o = n.target;
|
|
682
|
-
if (!(o instanceof Node))
|
|
723
|
+
if (!(o instanceof Node))
|
|
724
|
+
return;
|
|
683
725
|
const t = o.nodeType === Node.ELEMENT_NODE ? o : o.parentElement, r = (t == null ? void 0 : t.closest(p)) || null;
|
|
684
|
-
if (!r)
|
|
726
|
+
if (!r)
|
|
727
|
+
return;
|
|
685
728
|
const i = M(r);
|
|
686
729
|
D(r, i, e);
|
|
687
730
|
}, document.addEventListener("focusin", T, !0));
|
|
@@ -704,7 +747,8 @@ const Ie = (e = {}) => {
|
|
|
704
747
|
commands: {
|
|
705
748
|
insertMention: (o, t) => {
|
|
706
749
|
const r = se(t);
|
|
707
|
-
if (!r)
|
|
750
|
+
if (!r)
|
|
751
|
+
return !1;
|
|
708
752
|
const i = M(r);
|
|
709
753
|
D(r, i, n);
|
|
710
754
|
let a = E(r);
|
|
@@ -731,4 +775,4 @@ const Ie = (e = {}) => {
|
|
|
731
775
|
export {
|
|
732
776
|
Ie as MentionPlugin
|
|
733
777
|
};
|
|
734
|
-
//# sourceMappingURL=MentionPlugin.native-
|
|
778
|
+
//# sourceMappingURL=MentionPlugin.native-3b1e8c05.mjs.map
|
|
@@ -122,7 +122,8 @@ function le(t) {
|
|
|
122
122
|
}
|
|
123
123
|
let K = !1, B = !1, k = null, L = null, T = null, j = !1;
|
|
124
124
|
function Y(t, r) {
|
|
125
|
-
if (r === t.innerHTML)
|
|
125
|
+
if (r === t.innerHTML)
|
|
126
|
+
return;
|
|
126
127
|
const e = window.execEditorCommand || window.executeEditorCommand;
|
|
127
128
|
if (typeof e == "function")
|
|
128
129
|
try {
|
|
@@ -131,7 +132,8 @@ function Y(t, r) {
|
|
|
131
132
|
}
|
|
132
133
|
}
|
|
133
134
|
function I() {
|
|
134
|
-
if (K || typeof document == "undefined")
|
|
135
|
+
if (K || typeof document == "undefined")
|
|
136
|
+
return;
|
|
135
137
|
K = !0;
|
|
136
138
|
const t = document.createElement("style");
|
|
137
139
|
t.id = "merge-tag-plugin-styles", t.textContent = `
|
|
@@ -271,21 +273,25 @@ function q() {
|
|
|
271
273
|
}
|
|
272
274
|
function X() {
|
|
273
275
|
const t = window.getSelection();
|
|
274
|
-
if (!t || t.rangeCount === 0)
|
|
276
|
+
if (!t || t.rangeCount === 0)
|
|
277
|
+
return null;
|
|
275
278
|
const e = t.getRangeAt(0).startContainer, n = e.nodeType === Node.ELEMENT_NODE ? e : e.parentElement;
|
|
276
279
|
return (n == null ? void 0 : n.closest(w)) || null;
|
|
277
280
|
}
|
|
278
281
|
function Z() {
|
|
279
282
|
const t = X();
|
|
280
|
-
if (t)
|
|
283
|
+
if (t)
|
|
284
|
+
return t;
|
|
281
285
|
const r = document.activeElement, e = r == null ? void 0 : r.closest(w);
|
|
282
286
|
return e || (k != null && k.isConnected ? k : document.querySelector(w));
|
|
283
287
|
}
|
|
284
288
|
function ce(t) {
|
|
285
289
|
const r = t.parentNode;
|
|
286
|
-
if (!r)
|
|
290
|
+
if (!r)
|
|
291
|
+
return;
|
|
287
292
|
const e = window.getSelection();
|
|
288
|
-
if (!e)
|
|
293
|
+
if (!e)
|
|
294
|
+
return;
|
|
289
295
|
const n = document.createRange(), l = Array.from(r.childNodes).indexOf(t);
|
|
290
296
|
l < 0 || (n.setStart(r, l), n.setEnd(r, l + 1), e.removeAllRanges(), e.addRange(n));
|
|
291
297
|
}
|
|
@@ -295,28 +301,34 @@ function W(t, r) {
|
|
|
295
301
|
}
|
|
296
302
|
function V(t, r) {
|
|
297
303
|
const e = window.getSelection();
|
|
298
|
-
if (!e)
|
|
304
|
+
if (!e)
|
|
305
|
+
return;
|
|
299
306
|
const n = document.createRange(), a = Math.max(0, Math.min(r, t.childNodes.length));
|
|
300
307
|
n.setStart(t, a), n.collapse(!0), e.removeAllRanges(), e.addRange(n);
|
|
301
308
|
}
|
|
302
309
|
function ie(t, r) {
|
|
303
310
|
var i;
|
|
304
311
|
const e = t.closest(w), n = (i = e == null ? void 0 : e.innerHTML) != null ? i : "", a = t.parentNode;
|
|
305
|
-
if (!a)
|
|
312
|
+
if (!a)
|
|
313
|
+
return !1;
|
|
306
314
|
const c = Array.from(a.childNodes).indexOf(t);
|
|
307
|
-
if (c < 0)
|
|
315
|
+
if (c < 0)
|
|
316
|
+
return !1;
|
|
308
317
|
const s = t.previousSibling, g = t.nextSibling;
|
|
309
318
|
return a.removeChild(t), r === "Backspace" ? (W(g, !0), V(a, c)) : (W(s, !1), V(a, c)), e && (Y(e, n), e.dispatchEvent(new Event("input", { bubbles: !0 }))), !0;
|
|
310
319
|
}
|
|
311
320
|
function se(t) {
|
|
312
|
-
if (t.collapsed || !(t.startContainer instanceof HTMLElement || t.startContainer instanceof Text) || t.startContainer !== t.endContainer || t.endOffset !== t.startOffset + 1)
|
|
321
|
+
if (t.collapsed || !(t.startContainer instanceof HTMLElement || t.startContainer instanceof Text) || t.startContainer !== t.endContainer || t.endOffset !== t.startOffset + 1)
|
|
322
|
+
return null;
|
|
313
323
|
const r = t.startContainer;
|
|
314
|
-
if (!(r instanceof Element || r instanceof DocumentFragment))
|
|
324
|
+
if (!(r instanceof Element || r instanceof DocumentFragment))
|
|
325
|
+
return null;
|
|
315
326
|
const e = r.childNodes[t.startOffset];
|
|
316
327
|
return e instanceof HTMLElement && e.classList.contains("rte-merge-tag") ? e : null;
|
|
317
328
|
}
|
|
318
329
|
function de(t, r) {
|
|
319
|
-
if (!t.collapsed)
|
|
330
|
+
if (!t.collapsed)
|
|
331
|
+
return null;
|
|
320
332
|
const { startContainer: e, startOffset: n } = t, a = (l) => l instanceof HTMLElement && l.classList.contains("rte-merge-tag") ? l : null;
|
|
321
333
|
if (e.nodeType === Node.ELEMENT_NODE) {
|
|
322
334
|
const l = e;
|
|
@@ -331,15 +343,19 @@ function de(t, r) {
|
|
|
331
343
|
function G() {
|
|
332
344
|
j || typeof document == "undefined" || (j = !0, document.addEventListener("click", (t) => {
|
|
333
345
|
const r = t.target, e = r == null ? void 0 : r.closest(".rte-merge-tag");
|
|
334
|
-
if (!e)
|
|
346
|
+
if (!e)
|
|
347
|
+
return;
|
|
335
348
|
const n = e.closest(w);
|
|
336
349
|
n && (t.preventDefault(), t.stopPropagation(), n.focus({ preventScroll: !0 }), ce(e));
|
|
337
350
|
}), document.addEventListener("keydown", (t) => {
|
|
338
|
-
if (t.key !== "Backspace" && t.key !== "Delete")
|
|
351
|
+
if (t.key !== "Backspace" && t.key !== "Delete")
|
|
352
|
+
return;
|
|
339
353
|
const r = window.getSelection();
|
|
340
|
-
if (!r || r.rangeCount === 0)
|
|
354
|
+
if (!r || r.rangeCount === 0)
|
|
355
|
+
return;
|
|
341
356
|
const e = r.getRangeAt(0), n = Z();
|
|
342
|
-
if (!n || !n.contains(e.commonAncestorContainer))
|
|
357
|
+
if (!n || !n.contains(e.commonAncestorContainer))
|
|
358
|
+
return;
|
|
343
359
|
let a = se(e);
|
|
344
360
|
a || (a = de(e, t.key)), a && (t.preventDefault(), t.stopPropagation(), ie(a, t.key));
|
|
345
361
|
}));
|
|
@@ -366,7 +382,8 @@ function fe(t, r) {
|
|
|
366
382
|
}
|
|
367
383
|
function pe(t, r, e, n) {
|
|
368
384
|
const a = window.getSelection();
|
|
369
|
-
if (!a)
|
|
385
|
+
if (!a)
|
|
386
|
+
return !1;
|
|
370
387
|
const l = t.innerHTML;
|
|
371
388
|
t.focus({ preventScroll: !0 });
|
|
372
389
|
const c = ue(t, r), s = c.startContainer.nodeType === Node.ELEMENT_NODE ? c.startContainer : c.startContainer.parentElement, g = s == null ? void 0 : s.closest(".rte-merge-tag");
|
|
@@ -396,7 +413,8 @@ function ye(t, r) {
|
|
|
396
413
|
selectedIndex: 0,
|
|
397
414
|
savedRange: (() => {
|
|
398
415
|
const o = window.getSelection();
|
|
399
|
-
if (!o || o.rangeCount === 0)
|
|
416
|
+
if (!o || o.rangeCount === 0)
|
|
417
|
+
return null;
|
|
400
418
|
const d = o.getRangeAt(0);
|
|
401
419
|
return t.contains(d.commonAncestorContainer) ? d.cloneRange() : null;
|
|
402
420
|
})(),
|
|
@@ -455,7 +473,8 @@ function ye(t, r) {
|
|
|
455
473
|
}
|
|
456
474
|
p.style.display = "block", p.textContent = `Preview: ${r.formatToken(o)}`, x.disabled = !1;
|
|
457
475
|
}, Q = () => {
|
|
458
|
-
if (e.selectedIndex < 0)
|
|
476
|
+
if (e.selectedIndex < 0)
|
|
477
|
+
return;
|
|
459
478
|
const o = u.querySelector(`.rte-merge-tag-item[data-index="${e.selectedIndex}"]`);
|
|
460
479
|
o == null || o.scrollIntoView({ block: "nearest" });
|
|
461
480
|
}, E = () => {
|
|
@@ -489,22 +508,26 @@ function ye(t, r) {
|
|
|
489
508
|
}, h = () => {
|
|
490
509
|
e.searchRaf !== null && (cancelAnimationFrame(e.searchRaf), e.searchRaf = null), n.remove(), L === n && (L = null, T = null);
|
|
491
510
|
}, C = () => {
|
|
492
|
-
if (A(), e.selectedIndex < 0)
|
|
511
|
+
if (A(), e.selectedIndex < 0)
|
|
512
|
+
return;
|
|
493
513
|
const o = e.filteredTags[e.selectedIndex];
|
|
494
514
|
pe(t, e.savedRange, o, r.formatToken) && h();
|
|
495
515
|
}, F = (o) => {
|
|
496
516
|
const f = o.target.closest(".rte-merge-tag-tab");
|
|
497
|
-
if (!f)
|
|
517
|
+
if (!f)
|
|
518
|
+
return;
|
|
498
519
|
const m = f.dataset.category;
|
|
499
520
|
!m || !r.catalog.categoriesByKey[m] || (e.category = m, e.searchTerm = "", i.value = "", e.selectedIndex = 0, _(), S());
|
|
500
521
|
}, U = (o) => {
|
|
501
522
|
const f = o.target.closest(".rte-merge-tag-item");
|
|
502
|
-
if (!f)
|
|
523
|
+
if (!f)
|
|
524
|
+
return;
|
|
503
525
|
const m = Number(f.dataset.index || "-1");
|
|
504
526
|
Number.isNaN(m) || m < 0 || m >= e.filteredTags.length || (e.selectedIndex = m, E());
|
|
505
527
|
}, $ = (o) => {
|
|
506
528
|
const f = o.target.closest(".rte-merge-tag-item");
|
|
507
|
-
if (!f)
|
|
529
|
+
if (!f)
|
|
530
|
+
return;
|
|
508
531
|
const m = Number(f.dataset.index || "-1");
|
|
509
532
|
Number.isNaN(m) || m < 0 || m >= e.filteredTags.length || (e.selectedIndex = m, C());
|
|
510
533
|
}, N = (o) => {
|
|
@@ -513,12 +536,14 @@ function ye(t, r) {
|
|
|
513
536
|
return;
|
|
514
537
|
}
|
|
515
538
|
if (o.key === "ArrowDown") {
|
|
516
|
-
if (o.preventDefault(), e.filteredTags.length === 0)
|
|
539
|
+
if (o.preventDefault(), e.filteredTags.length === 0)
|
|
540
|
+
return;
|
|
517
541
|
e.selectedIndex = Math.min(e.filteredTags.length - 1, e.selectedIndex + 1), E();
|
|
518
542
|
return;
|
|
519
543
|
}
|
|
520
544
|
if (o.key === "ArrowUp") {
|
|
521
|
-
if (o.preventDefault(), e.filteredTags.length === 0)
|
|
545
|
+
if (o.preventDefault(), e.filteredTags.length === 0)
|
|
546
|
+
return;
|
|
522
547
|
e.selectedIndex = Math.max(0, e.selectedIndex - 1), E();
|
|
523
548
|
return;
|
|
524
549
|
}
|
|
@@ -556,4 +581,4 @@ const xe = (t) => ({
|
|
|
556
581
|
export {
|
|
557
582
|
xe as MergeTagPlugin
|
|
558
583
|
};
|
|
559
|
-
//# sourceMappingURL=MergeTagPlugin.native-
|
|
584
|
+
//# sourceMappingURL=MergeTagPlugin.native-31cf7d48.mjs.map
|