@editora/core 1.0.15 → 1.0.16
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/dist/{A11yCheckerPlugin.native-BRdGYMju.mjs → A11yCheckerPlugin.native-DIKuCeFw.mjs} +82 -79
- package/dist/{AnchorPlugin.native-BcYGEtd9.mjs → AnchorPlugin.native-DXZdK3zr.mjs} +72 -71
- package/dist/{ApprovalWorkflowPlugin.native-BZ6jO-Wj.mjs → ApprovalWorkflowPlugin.native-ZsS_2xmn.mjs} +239 -238
- package/dist/{BackgroundColorPlugin.native-50iAT9xU.mjs → BackgroundColorPlugin.native-H3XyYD7_.mjs} +2 -2
- package/dist/{BlocksLibraryPlugin.native-5sdsXsiE.mjs → BlocksLibraryPlugin.native-CownM6Rk.mjs} +140 -116
- package/dist/{CapitalizationPlugin.native-DLV4oPmB.mjs → CapitalizationPlugin.native-C-HRbXGh.mjs} +10 -5
- package/dist/{ChecklistPlugin.native-BS-kMz9O.mjs → ChecklistPlugin.native-NVrBUkaL.mjs} +141 -103
- package/dist/{CitationsPlugin.native-DQgoCd1B.mjs → CitationsPlugin.native-C_7wWQ-k.mjs} +441 -422
- package/dist/{ClearFormattingPlugin.native-B6ro3a1h.mjs → ClearFormattingPlugin.native-Pp0O-SBf.mjs} +24 -23
- package/dist/{CodePlugin.native-knhM8NNo.mjs → CodePlugin.native-BH-K4xmW.mjs} +474 -342
- package/dist/CodePlugin.native-hNgfXlfS.mjs +4767 -0
- package/dist/CodeSamplePlugin.native-svbAFWh_.mjs +501 -0
- package/dist/CollaborationPlugin.native-oSybCGPW.mjs +7468 -0
- package/dist/{CommentsPlugin.native-DPSqTkiv.mjs → CommentsPlugin.native-CLip9wAO.mjs} +233 -185
- package/dist/{ConditionalContentPlugin.native-CfhY46rU.mjs → ConditionalContentPlugin.native-Bf7XgRSW.mjs} +401 -351
- package/dist/{DataBindingPlugin.native-BoXwghTz.mjs → DataBindingPlugin.native-B7lpI_0c.mjs} +29 -28
- package/dist/{DocumentManagerPlugin.native-D1YHQ2NN.mjs → DocumentManagerPlugin.native-iFip6s4Q.mjs} +94 -45
- package/dist/{EmbedIframePlugin.native-BF_-LjTq.mjs → EmbedIframePlugin.native-BfZ_HGlV.mjs} +231 -186
- package/dist/{EmojisPlugin.native-CitxxlWX.mjs → EmojisPlugin.native-D92aaOKi.mjs} +288 -76
- package/dist/{FontFamilyPlugin.native-j8hMTbg4.mjs → FontFamilyPlugin.native-M3cNQ0KA.mjs} +57 -50
- package/dist/{FontSizePlugin.native-B_jCh7dY.mjs → FontSizePlugin.native-DsLrH8eq.mjs} +41 -34
- package/dist/{FormatPainterPlugin.native-CsMrKfFU.mjs → FormatPainterPlugin.native-BhjzsiVq.mjs} +3 -2
- package/dist/{HistoryPlugin.native-D2wl32jV.mjs → HistoryPlugin.native-DPvhks6h.mjs} +36 -32
- package/dist/LinkPlugin.native-BsQXYsK6.mjs +352 -0
- package/dist/{ListPlugin.native-V7EZC1lM.mjs → ListPlugin.native-Bt0LANbO.mjs} +68 -35
- package/dist/{MathPlugin.native-NwWPHVmj.mjs → MathPlugin.native-Byo3WL0f.mjs} +211 -115
- package/dist/{MediaManagerPlugin.native-eOsTJFpw.mjs → MediaManagerPlugin.native-BT1NZIJS.mjs} +139 -134
- package/dist/{MentionPlugin.native-BMDlOqur.mjs → MentionPlugin.native-S_lwGZQO.mjs} +23 -18
- package/dist/{MergeTagPlugin.native-BzRVoD9-.mjs → MergeTagPlugin.native-7-6F3S1Y.mjs} +44 -43
- package/dist/{PreviewPlugin.native-WuIwOAOR.mjs → PreviewPlugin.native-CiR51jql.mjs} +31 -28
- package/dist/{SlashCommandsPlugin.native-BiN6ODw5.mjs → SlashCommandsPlugin.native-BDIIwGNs.mjs} +90 -79
- package/dist/{SmartPastePlugin.native-CZAEHkyt.mjs → SmartPastePlugin.native-BATLCds5.mjs} +89 -85
- package/dist/{SpecialCharactersPlugin.native-DaG4b19I.mjs → SpecialCharactersPlugin.native-CdZoc1GB.mjs} +73 -26
- package/dist/SpellCheckPlugin.native-Bef2oTLB.mjs +10935 -0
- package/dist/TablePlugin.native-BjIxYZ2X.mjs +772 -0
- package/dist/{TemplatePlugin.native-DLjFUaPW.mjs → TemplatePlugin.native-D6n5RUnC.mjs} +288 -262
- package/dist/{TextColorPlugin.native-Bwl_bSmc.mjs → TextColorPlugin.native-KMZ2uzlq.mjs} +2 -2
- package/dist/{TranslationWorkflowPlugin.native-DdF16tgT.mjs → TranslationWorkflowPlugin.native-CZtG--06.mjs} +67 -65
- package/dist/{VersionDiffPlugin.native-Bvxgy--t.mjs → VersionDiffPlugin.native-Ca1fMWUJ.mjs} +42 -42
- package/dist/anchoredPopover-DJFD2oAP.mjs +116 -0
- package/dist/core.css +1 -1
- package/dist/dialogHelpers-DBf7WqYH.mjs +40 -0
- package/dist/editora.min.js +26 -24
- package/dist/editora.umd.js +26 -24
- package/dist/escapeHtml-CX8RelZ1.mjs +7 -0
- package/dist/historyHelpers-B0-4mq1E.mjs +15 -0
- package/dist/index-B1_vtXRz.mjs +3910 -0
- package/dist/index-C6BoNR2t.js +12 -0
- package/dist/index.cjs.js +3 -3
- package/dist/index.esm.js +17 -14
- package/dist/plugin-loader.js +53 -52
- package/dist/webcomponent-core.js +2039 -473
- package/dist/webcomponent-core.min.css +1 -1
- package/dist/webcomponent-core.min.js +96 -66
- package/dist/webcomponent.cjs.js +1 -1
- package/dist/webcomponent.esm.js +1 -1
- package/dist/webcomponent.js +2208 -641
- package/dist/webcomponent.min.css +1 -1
- package/dist/webcomponent.min.js +1564 -1198
- package/index.d.ts +32 -0
- package/package.json +10 -3
- package/dist/CodeSamplePlugin.native-CgGoH-X4.mjs +0 -384
- package/dist/LinkPlugin.native-DYCIcdTm.mjs +0 -283
- package/dist/SpellCheckPlugin.native-BZB9AewP.mjs +0 -1039
- package/dist/TablePlugin.native-DrHX-efe.mjs +0 -495
- package/dist/anchoredPopover-Bxds0VoB.mjs +0 -110
- package/dist/index-BLm1MtzH.js +0 -10
- package/dist/index-Cd9jEuZP.mjs +0 -2341
|
@@ -1,4 +1,4 @@
|
|
|
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)',
|
|
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)', N = /* @__PURE__ */ new WeakMap(), R = /* @__PURE__ */ new WeakMap();
|
|
2
2
|
let F = !1, S = !1, T = null, k = 0;
|
|
3
3
|
function X(e, n) {
|
|
4
4
|
if (n === e.innerHTML) return;
|
|
@@ -159,8 +159,8 @@ function U(e, n) {
|
|
|
159
159
|
Z(e.panel, e.editor);
|
|
160
160
|
const o = me(e.editor, n), t = e.panel;
|
|
161
161
|
t.style.display = "block", t.classList.add("show"), t.style.left = "0px", t.style.top = "0px";
|
|
162
|
-
const r = t.getBoundingClientRect(), i = window.innerWidth, a = window.innerHeight;
|
|
163
|
-
let
|
|
162
|
+
const r = t.getBoundingClientRect(), i = window.innerWidth, a = window.innerHeight, l = Math.max(8, Math.min(o.left, i - r.width - 8));
|
|
163
|
+
let s = o.bottom + 8;
|
|
164
164
|
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
165
|
}
|
|
166
166
|
function pe(e, n) {
|
|
@@ -414,6 +414,9 @@ function Ce(e, n) {
|
|
|
414
414
|
m(e);
|
|
415
415
|
return;
|
|
416
416
|
}
|
|
417
|
+
if (e.dismissedNode === i.node && e.dismissedOffset === a.startOffset)
|
|
418
|
+
return;
|
|
419
|
+
e.dismissedNode = null, e.dismissedOffset = -1;
|
|
417
420
|
const l = t.cloneRange();
|
|
418
421
|
l.setStart(i.node, a.startOffset), l.setEnd(i.node, i.caretOffset), te(e, n, t, a.query, a.trigger, l);
|
|
419
422
|
}
|
|
@@ -440,16 +443,18 @@ function ve(e) {
|
|
|
440
443
|
isOpen: !1,
|
|
441
444
|
requestId: 0,
|
|
442
445
|
debounceHandle: null,
|
|
443
|
-
abortController: null
|
|
446
|
+
abortController: null,
|
|
447
|
+
dismissedNode: null,
|
|
448
|
+
dismissedOffset: -1
|
|
444
449
|
};
|
|
445
450
|
}
|
|
446
451
|
function ke(e) {
|
|
447
452
|
var o;
|
|
448
|
-
const n =
|
|
449
|
-
n && ((o = n.panel) != null && o.parentNode && n.panel.parentNode.removeChild(n.panel),
|
|
453
|
+
const n = N.get(e);
|
|
454
|
+
n && ((o = n.panel) != null && o.parentNode && n.panel.parentNode.removeChild(n.panel), N.delete(e));
|
|
450
455
|
}
|
|
451
456
|
function D(e, n, o) {
|
|
452
|
-
if (
|
|
457
|
+
if (R.has(e)) return;
|
|
453
458
|
C(e);
|
|
454
459
|
const t = {
|
|
455
460
|
beforeInput: (r) => {
|
|
@@ -490,7 +495,7 @@ function D(e, n, o) {
|
|
|
490
495
|
return;
|
|
491
496
|
}
|
|
492
497
|
if (r.key === "Escape") {
|
|
493
|
-
r.preventDefault(), m(n);
|
|
498
|
+
r.preventDefault(), n.replaceRange && (n.dismissedNode = n.replaceRange.startContainer, n.dismissedOffset = n.replaceRange.startOffset), m(n);
|
|
494
499
|
return;
|
|
495
500
|
}
|
|
496
501
|
}
|
|
@@ -532,11 +537,11 @@ function D(e, n, o) {
|
|
|
532
537
|
i && !n.panel.contains(i) && !e.contains(i) && m(n);
|
|
533
538
|
}
|
|
534
539
|
};
|
|
535
|
-
e.addEventListener("beforeinput", t.beforeInput), e.addEventListener("input", t.input), e.addEventListener("keydown", t.keydown), e.addEventListener("click", t.click), e.addEventListener("blur", t.blur), document.addEventListener("mousedown", t.mousedown, !0),
|
|
540
|
+
e.addEventListener("beforeinput", t.beforeInput), e.addEventListener("input", t.input), e.addEventListener("keydown", t.keydown), e.addEventListener("click", t.click), e.addEventListener("blur", t.blur), document.addEventListener("mousedown", t.mousedown, !0), R.set(e, t);
|
|
536
541
|
}
|
|
537
542
|
function Le(e) {
|
|
538
|
-
const n =
|
|
539
|
-
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),
|
|
543
|
+
const n = R.get(e);
|
|
544
|
+
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), R.delete(e));
|
|
540
545
|
}
|
|
541
546
|
function Me() {
|
|
542
547
|
if (F || typeof document == "undefined") return;
|
|
@@ -648,7 +653,7 @@ function Me() {
|
|
|
648
653
|
}
|
|
649
654
|
`, document.head.appendChild(e);
|
|
650
655
|
}
|
|
651
|
-
function
|
|
656
|
+
function Ne(e) {
|
|
652
657
|
var o, t, r;
|
|
653
658
|
const n = (e.triggerChars || ["@"]).filter((i) => typeof i == "string" && i.length > 0).map((i) => i[0]);
|
|
654
659
|
return {
|
|
@@ -671,12 +676,12 @@ function Re(e) {
|
|
|
671
676
|
};
|
|
672
677
|
}
|
|
673
678
|
function M(e) {
|
|
674
|
-
const n =
|
|
679
|
+
const n = N.get(e);
|
|
675
680
|
if (n) return n;
|
|
676
681
|
const o = ve(e);
|
|
677
|
-
return
|
|
682
|
+
return N.set(e, o), o;
|
|
678
683
|
}
|
|
679
|
-
function
|
|
684
|
+
function Re(e) {
|
|
680
685
|
S || (S = !0, T = (n) => {
|
|
681
686
|
const o = n.target;
|
|
682
687
|
if (!(o instanceof Node)) return;
|
|
@@ -691,7 +696,7 @@ function Se() {
|
|
|
691
696
|
}
|
|
692
697
|
const Ie = (e = {}) => {
|
|
693
698
|
Me();
|
|
694
|
-
const n =
|
|
699
|
+
const n = Ne(e);
|
|
695
700
|
return {
|
|
696
701
|
name: "mentions",
|
|
697
702
|
toolbar: [
|
|
@@ -716,7 +721,7 @@ const Ie = (e = {}) => {
|
|
|
716
721
|
}
|
|
717
722
|
},
|
|
718
723
|
init: () => {
|
|
719
|
-
k += 1,
|
|
724
|
+
k += 1, Re(n), Array.from(document.querySelectorAll(p)).forEach((t) => {
|
|
720
725
|
const r = M(t);
|
|
721
726
|
D(t, r, n);
|
|
722
727
|
});
|
|
@@ -731,4 +736,4 @@ const Ie = (e = {}) => {
|
|
|
731
736
|
export {
|
|
732
737
|
Ie as MentionPlugin
|
|
733
738
|
};
|
|
734
|
-
//# sourceMappingURL=MentionPlugin.native-
|
|
739
|
+
//# sourceMappingURL=MentionPlugin.native-S_lwGZQO.mjs.map
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
|
|
1
|
+
import { i as re } from "./dialogHelpers-DBf7WqYH.mjs";
|
|
2
|
+
const T = ".rte-content, .editora-content", ne = '[data-theme="dark"], .dark, .editora-theme-dark', ae = {
|
|
2
3
|
title: "Insert Merge Tag",
|
|
3
4
|
searchPlaceholder: "Search merge tags...",
|
|
4
5
|
emptyStateText: "No merge tags found",
|
|
@@ -6,7 +7,7 @@ const T = ".rte-content, .editora-content", re = '[data-theme="dark"], .dark, .e
|
|
|
6
7
|
insertText: "Insert",
|
|
7
8
|
showPreview: !0
|
|
8
9
|
};
|
|
9
|
-
function
|
|
10
|
+
function oe() {
|
|
10
11
|
return [
|
|
11
12
|
{
|
|
12
13
|
id: "USER",
|
|
@@ -49,10 +50,10 @@ function ae() {
|
|
|
49
50
|
function I(e, r) {
|
|
50
51
|
return e.trim().toUpperCase().replace(/[^A-Z0-9]+/g, "_").replace(/^_+|_+$/g, "") || `CATEGORY_${r + 1}`;
|
|
51
52
|
}
|
|
52
|
-
function
|
|
53
|
+
function le(e, r) {
|
|
53
54
|
return (e.key || e.value || e.label).trim().toLowerCase().replace(/[^a-z0-9]+/g, "_").replace(/^_+|_+$/g, "") || `tag_${r + 1}`;
|
|
54
55
|
}
|
|
55
|
-
function
|
|
56
|
+
function ce(e) {
|
|
56
57
|
const r = (() => {
|
|
57
58
|
if (Array.isArray(e == null ? void 0 : e.categories) && e.categories.length > 0)
|
|
58
59
|
return e.categories;
|
|
@@ -67,7 +68,7 @@ function le(e) {
|
|
|
67
68
|
tags: g
|
|
68
69
|
}));
|
|
69
70
|
}
|
|
70
|
-
return
|
|
71
|
+
return oe();
|
|
71
72
|
})(), t = {}, n = [];
|
|
72
73
|
if (r.forEach((c, s) => {
|
|
73
74
|
const g = I(c.id || c.name, s);
|
|
@@ -75,7 +76,7 @@ function le(e) {
|
|
|
75
76
|
name: c.name,
|
|
76
77
|
tags: (Array.isArray(c.tags) ? c.tags : []).map((i, y) => {
|
|
77
78
|
var h, x;
|
|
78
|
-
const u =
|
|
79
|
+
const u = le(i, y), p = (i.category || c.name).trim() || c.name;
|
|
79
80
|
return {
|
|
80
81
|
...i,
|
|
81
82
|
key: u,
|
|
@@ -96,7 +97,7 @@ function le(e) {
|
|
|
96
97
|
defaultCategory: o
|
|
97
98
|
};
|
|
98
99
|
}
|
|
99
|
-
function
|
|
100
|
+
function ie(e) {
|
|
100
101
|
const r = e == null ? void 0 : e.tokenTemplate;
|
|
101
102
|
return typeof r == "function" ? (t) => {
|
|
102
103
|
var a;
|
|
@@ -110,14 +111,14 @@ function ce(e) {
|
|
|
110
111
|
return ((n = t.value) == null ? void 0 : n.trim()) || `{{ ${t.label} }}`;
|
|
111
112
|
};
|
|
112
113
|
}
|
|
113
|
-
function
|
|
114
|
+
function se(e) {
|
|
114
115
|
return {
|
|
115
|
-
catalog:
|
|
116
|
+
catalog: ce(e),
|
|
116
117
|
dialog: {
|
|
117
|
-
...
|
|
118
|
+
...ae,
|
|
118
119
|
...(e == null ? void 0 : e.dialog) || {}
|
|
119
120
|
},
|
|
120
|
-
formatToken:
|
|
121
|
+
formatToken: ie(e)
|
|
121
122
|
};
|
|
122
123
|
}
|
|
123
124
|
let B = !1, q = !1, k = null, A = null, E = null, W = !1, b = null;
|
|
@@ -130,7 +131,7 @@ function Z(e, r) {
|
|
|
130
131
|
} catch (n) {
|
|
131
132
|
}
|
|
132
133
|
}
|
|
133
|
-
function
|
|
134
|
+
function O() {
|
|
134
135
|
if (B || typeof document == "undefined") return;
|
|
135
136
|
B = !0;
|
|
136
137
|
const e = document.createElement("style");
|
|
@@ -287,13 +288,13 @@ function ee() {
|
|
|
287
288
|
const r = document.activeElement, t = r == null ? void 0 : r.closest(T);
|
|
288
289
|
return t || (k != null && k.isConnected ? k : document.querySelector(T));
|
|
289
290
|
}
|
|
290
|
-
function
|
|
291
|
+
function _() {
|
|
291
292
|
b && (b.classList.remove("rte-merge-tag-selected"), b.removeAttribute("data-rte-selected-object"), b = null);
|
|
292
293
|
}
|
|
293
|
-
function se(e) {
|
|
294
|
-
b !== e && (O(), b = e, e.classList.add("rte-merge-tag-selected"), e.setAttribute("data-rte-selected-object", "true")), de(e);
|
|
295
|
-
}
|
|
296
294
|
function de(e) {
|
|
295
|
+
b !== e && (_(), b = e, e.classList.add("rte-merge-tag-selected"), e.setAttribute("data-rte-selected-object", "true")), ge(e);
|
|
296
|
+
}
|
|
297
|
+
function ge(e) {
|
|
297
298
|
const r = e.parentNode;
|
|
298
299
|
if (!r) return;
|
|
299
300
|
const t = window.getSelection();
|
|
@@ -311,7 +312,7 @@ function J(e, r) {
|
|
|
311
312
|
const n = document.createRange(), a = Math.max(0, Math.min(r, e.childNodes.length));
|
|
312
313
|
n.setStart(e, a), n.collapse(!0), t.removeAllRanges(), t.addRange(n);
|
|
313
314
|
}
|
|
314
|
-
function
|
|
315
|
+
function me(e, r) {
|
|
315
316
|
var i;
|
|
316
317
|
const t = e.closest(T), n = (i = t == null ? void 0 : t.innerHTML) != null ? i : "", a = e.parentNode;
|
|
317
318
|
if (!a) return !1;
|
|
@@ -320,14 +321,14 @@ function ge(e, r) {
|
|
|
320
321
|
const s = e.previousSibling, g = e.nextSibling;
|
|
321
322
|
return a.removeChild(e), b === e && (b = null), r === "Backspace" ? (G(g, !0), J(a, c)) : (G(s, !1), J(a, c)), t && (Z(t, n), t.dispatchEvent(new Event("input", { bubbles: !0 }))), !0;
|
|
322
323
|
}
|
|
323
|
-
function
|
|
324
|
+
function ue(e) {
|
|
324
325
|
if (e.collapsed || !(e.startContainer instanceof HTMLElement || e.startContainer instanceof Text) || e.startContainer !== e.endContainer || e.endOffset !== e.startOffset + 1) return null;
|
|
325
326
|
const r = e.startContainer;
|
|
326
327
|
if (!(r instanceof Element || r instanceof DocumentFragment)) return null;
|
|
327
328
|
const t = r.childNodes[e.startOffset];
|
|
328
329
|
return t instanceof HTMLElement && t.classList.contains("rte-merge-tag") ? t : null;
|
|
329
330
|
}
|
|
330
|
-
function
|
|
331
|
+
function fe(e, r) {
|
|
331
332
|
if (!e.collapsed) return null;
|
|
332
333
|
const { startContainer: t, startOffset: n } = e, a = (o) => o instanceof HTMLElement && o.classList.contains("rte-merge-tag") ? o : null;
|
|
333
334
|
if (t.nodeType === Node.ELEMENT_NODE) {
|
|
@@ -346,14 +347,14 @@ function Y() {
|
|
|
346
347
|
const r = e.target, t = r == null ? void 0 : r.closest(".rte-merge-tag");
|
|
347
348
|
if (!t) {
|
|
348
349
|
const o = e.target;
|
|
349
|
-
(a = o == null ? void 0 : o.closest) != null && a.call(o, ".rte-merge-tag-overlay") ||
|
|
350
|
+
(a = o == null ? void 0 : o.closest) != null && a.call(o, ".rte-merge-tag-overlay") || _();
|
|
350
351
|
return;
|
|
351
352
|
}
|
|
352
353
|
const n = t.closest(T);
|
|
353
|
-
n && (e.preventDefault(), e.stopPropagation(), n.focus({ preventScroll: !0 }),
|
|
354
|
+
n && (e.preventDefault(), e.stopPropagation(), n.focus({ preventScroll: !0 }), de(t));
|
|
354
355
|
}, !0), document.addEventListener("keydown", (e) => {
|
|
355
356
|
if (e.key === "Escape" && b) {
|
|
356
|
-
|
|
357
|
+
_();
|
|
357
358
|
return;
|
|
358
359
|
}
|
|
359
360
|
if (e.key !== "Backspace" && e.key !== "Delete") return;
|
|
@@ -362,39 +363,39 @@ function Y() {
|
|
|
362
363
|
const t = r.getRangeAt(0), n = ee();
|
|
363
364
|
if (!n || !n.contains(t.commonAncestorContainer)) return;
|
|
364
365
|
let a = b != null && b.isConnected ? b : null;
|
|
365
|
-
a && !n.contains(a) && (a = null), a || (a =
|
|
366
|
+
a && !n.contains(a) && (a = null), a || (a = ue(t)), a || (a = fe(t, e.key)), a && (e.preventDefault(), e.stopPropagation(), me(a, e.key));
|
|
366
367
|
}));
|
|
367
368
|
}
|
|
368
|
-
function
|
|
369
|
-
return e ? !!e.closest(
|
|
369
|
+
function pe(e) {
|
|
370
|
+
return e ? !!e.closest(ne) : !1;
|
|
370
371
|
}
|
|
371
|
-
function
|
|
372
|
+
function be() {
|
|
372
373
|
E && (E(), E = null), A = null;
|
|
373
374
|
}
|
|
374
375
|
function X(e) {
|
|
375
376
|
const r = document.createRange();
|
|
376
377
|
return r.selectNodeContents(e), r.collapse(!1), r;
|
|
377
378
|
}
|
|
378
|
-
function
|
|
379
|
+
function ye(e, r) {
|
|
379
380
|
const t = window.getSelection(), n = r ? r.cloneRange() : X(e), o = n.startContainer.isConnected && n.endContainer.isConnected && e.contains(n.commonAncestorContainer) ? n : X(e);
|
|
380
381
|
return t && (t.removeAllRanges(), t.addRange(o)), o;
|
|
381
382
|
}
|
|
382
|
-
function
|
|
383
|
+
function xe(e, r) {
|
|
383
384
|
const t = document.createElement("span");
|
|
384
385
|
t.className = "rte-merge-tag", t.setAttribute("contenteditable", "false"), t.setAttribute("data-key", e.key), t.setAttribute("data-category", e.category), t.setAttribute("data-label", e.label), e.value && t.setAttribute("data-value", e.value);
|
|
385
386
|
const n = r(e);
|
|
386
387
|
return t.setAttribute("data-token", n), t.setAttribute("aria-label", `Merge tag: ${e.label}`), t.textContent = n, t;
|
|
387
388
|
}
|
|
388
|
-
function
|
|
389
|
+
function ve(e, r, t, n) {
|
|
389
390
|
const a = window.getSelection();
|
|
390
391
|
if (!a) return !1;
|
|
391
392
|
const o = e.innerHTML;
|
|
392
393
|
e.focus({ preventScroll: !0 });
|
|
393
|
-
const c =
|
|
394
|
+
const c = ye(e, r), s = c.startContainer.nodeType === Node.ELEMENT_NODE ? c.startContainer : c.startContainer.parentElement, g = s == null ? void 0 : s.closest(".rte-merge-tag");
|
|
394
395
|
g && e.contains(g) && (c.setStartAfter(g), c.setEndAfter(g));
|
|
395
396
|
try {
|
|
396
397
|
c.deleteContents();
|
|
397
|
-
const i =
|
|
398
|
+
const i = xe(t, n), y = document.createTextNode(" "), u = document.createDocumentFragment();
|
|
398
399
|
u.appendChild(i), u.appendChild(y), c.insertNode(u);
|
|
399
400
|
const p = document.createRange();
|
|
400
401
|
return p.setStartAfter(y), p.collapse(!0), a.removeAllRanges(), a.addRange(p), Z(e, o), e.dispatchEvent(new Event("input", { bubbles: !0 })), !0;
|
|
@@ -402,14 +403,14 @@ function xe(e, r, t, n) {
|
|
|
402
403
|
return console.error("Failed to insert merge tag:", i), !1;
|
|
403
404
|
}
|
|
404
405
|
}
|
|
405
|
-
function
|
|
406
|
+
function he(e, r, t) {
|
|
406
407
|
var o;
|
|
407
408
|
const n = ((o = e.catalog.categoriesByKey[r]) == null ? void 0 : o.tags) || [], a = t.trim().toLowerCase();
|
|
408
409
|
return a ? n.filter((c) => c.searchIndex.includes(a)) : n;
|
|
409
410
|
}
|
|
410
|
-
function
|
|
411
|
+
function we(e, r) {
|
|
411
412
|
var j;
|
|
412
|
-
|
|
413
|
+
be(), O();
|
|
413
414
|
const t = {
|
|
414
415
|
category: r.catalog.defaultCategory,
|
|
415
416
|
searchTerm: "",
|
|
@@ -423,7 +424,7 @@ function he(e, r) {
|
|
|
423
424
|
})(),
|
|
424
425
|
searchRaf: null
|
|
425
426
|
}, n = document.createElement("div");
|
|
426
|
-
n.className = "rte-merge-tag-overlay", n.setAttribute("role", "dialog"), n.setAttribute("aria-modal", "true"),
|
|
427
|
+
re(n), n.className = "rte-merge-tag-overlay", n.setAttribute("role", "dialog"), n.setAttribute("aria-modal", "true"), pe(e) && n.classList.add("rte-ui-theme-dark");
|
|
427
428
|
const a = document.createElement("div");
|
|
428
429
|
a.className = "rte-merge-tag-dialog";
|
|
429
430
|
const o = document.createElement("div");
|
|
@@ -487,7 +488,7 @@ function he(e, r) {
|
|
|
487
488
|
}
|
|
488
489
|
F(), te();
|
|
489
490
|
}, D = () => {
|
|
490
|
-
if (t.filteredTags =
|
|
491
|
+
if (t.filteredTags = he(r, t.category, t.searchTerm), t.filteredTags.length > 0 && t.selectedIndex < 0 && (t.selectedIndex = 0), S(), u.innerHTML = "", t.filteredTags.length === 0) {
|
|
491
492
|
const d = document.createElement("div");
|
|
492
493
|
d.className = "rte-merge-tag-empty", d.textContent = r.dialog.emptyStateText, u.appendChild(d), F();
|
|
493
494
|
return;
|
|
@@ -512,7 +513,7 @@ function he(e, r) {
|
|
|
512
513
|
}, N = () => {
|
|
513
514
|
if (S(), t.selectedIndex < 0) return;
|
|
514
515
|
const l = t.filteredTags[t.selectedIndex];
|
|
515
|
-
|
|
516
|
+
ve(e, t.savedRange, l, r.formatToken) && w();
|
|
516
517
|
}, $ = (l) => {
|
|
517
518
|
const f = l.target.closest(".rte-merge-tag-tab");
|
|
518
519
|
if (!f) return;
|
|
@@ -553,11 +554,11 @@ function he(e, r) {
|
|
|
553
554
|
i.focus();
|
|
554
555
|
}, 0);
|
|
555
556
|
}
|
|
556
|
-
const
|
|
557
|
+
const Te = (e) => ({
|
|
557
558
|
name: "mergeTag",
|
|
558
559
|
config: e,
|
|
559
560
|
init: () => {
|
|
560
|
-
|
|
561
|
+
O(), V(), Y();
|
|
561
562
|
},
|
|
562
563
|
toolbar: [
|
|
563
564
|
{
|
|
@@ -568,13 +569,13 @@ const we = (e) => ({
|
|
|
568
569
|
],
|
|
569
570
|
commands: {
|
|
570
571
|
insertMergeTag: () => {
|
|
571
|
-
|
|
572
|
+
O(), V(), Y();
|
|
572
573
|
const r = ee();
|
|
573
|
-
return r ? (
|
|
574
|
+
return r ? (we(r, se(e)), !0) : !1;
|
|
574
575
|
}
|
|
575
576
|
}
|
|
576
577
|
});
|
|
577
578
|
export {
|
|
578
|
-
|
|
579
|
+
Te as MergeTagPlugin
|
|
579
580
|
};
|
|
580
|
-
//# sourceMappingURL=MergeTagPlugin.native-
|
|
581
|
+
//# sourceMappingURL=MergeTagPlugin.native-7-6F3S1Y.mjs.map
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import { i as v } from "./dialogHelpers-DBf7WqYH.mjs";
|
|
2
|
+
let p = !1, a = null;
|
|
3
|
+
const h = () => {
|
|
3
4
|
if (typeof document == "undefined") return;
|
|
4
5
|
const i = "rte-preview-plugin-styles";
|
|
5
6
|
if (document.getElementById(i)) return;
|
|
@@ -224,7 +225,7 @@ const g = () => {
|
|
|
224
225
|
}
|
|
225
226
|
}
|
|
226
227
|
`, document.head.appendChild(t);
|
|
227
|
-
},
|
|
228
|
+
}, w = () => {
|
|
228
229
|
const i = window.getSelection();
|
|
229
230
|
if (i && i.rangeCount > 0) {
|
|
230
231
|
let e = i.getRangeAt(0).startContainer;
|
|
@@ -245,8 +246,8 @@ const g = () => {
|
|
|
245
246
|
if (e) return e;
|
|
246
247
|
}
|
|
247
248
|
return document.querySelector('[contenteditable="true"]');
|
|
248
|
-
},
|
|
249
|
-
const i =
|
|
249
|
+
}, u = () => {
|
|
250
|
+
const i = w();
|
|
250
251
|
if (!i) return "";
|
|
251
252
|
const t = i.cloneNode(!0);
|
|
252
253
|
return [
|
|
@@ -258,7 +259,7 @@ const g = () => {
|
|
|
258
259
|
].forEach((n) => {
|
|
259
260
|
t.querySelectorAll(n).forEach((r) => r.remove());
|
|
260
261
|
}), t.innerHTML;
|
|
261
|
-
},
|
|
262
|
+
}, f = (i) => {
|
|
262
263
|
const t = document.createElement("div");
|
|
263
264
|
return t.innerHTML = i, t.querySelectorAll(
|
|
264
265
|
'script, iframe[src^="javascript:"], object, embed, form[action^="javascript:"]'
|
|
@@ -267,11 +268,11 @@ const g = () => {
|
|
|
267
268
|
o.name.startsWith("on") && r.removeAttribute(o.name), (o.name === "href" || o.name === "src") && o.value.startsWith("javascript:") && r.removeAttribute(o.name), o.name.toLowerCase() === "contenteditable" && r.removeAttribute(o.name);
|
|
268
269
|
}), r.setAttribute("contenteditable", "false");
|
|
269
270
|
}), t.innerHTML;
|
|
270
|
-
},
|
|
271
|
-
if (typeof window == "undefined" ||
|
|
272
|
-
|
|
273
|
-
const i =
|
|
274
|
-
e.className = "rte-preview-editor-overlay", e.setAttribute("role", "dialog"), e.setAttribute("aria-modal", "true"), e.setAttribute("aria-labelledby", "preview-editor-title");
|
|
271
|
+
}, b = () => {
|
|
272
|
+
if (typeof window == "undefined" || p) return;
|
|
273
|
+
p = !0, h();
|
|
274
|
+
const i = u(), t = f(i), e = document.createElement("div");
|
|
275
|
+
v(e), e.className = "rte-preview-editor-overlay", e.setAttribute("role", "dialog"), e.setAttribute("aria-modal", "true"), e.setAttribute("aria-labelledby", "preview-editor-title");
|
|
275
276
|
const n = document.createElement("div");
|
|
276
277
|
n.className = "rte-preview-editor-modal";
|
|
277
278
|
const r = document.createElement("div");
|
|
@@ -288,21 +289,23 @@ const g = () => {
|
|
|
288
289
|
`;
|
|
289
290
|
const o = document.createElement("div");
|
|
290
291
|
o.className = "rte-preview-editor-body";
|
|
291
|
-
const
|
|
292
|
-
|
|
293
|
-
const
|
|
294
|
-
|
|
295
|
-
const
|
|
296
|
-
e.parentNode && e.parentNode.removeChild(e),
|
|
297
|
-
}
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
292
|
+
const c = document.createElement("div");
|
|
293
|
+
c.className = "rte-preview-editor-content";
|
|
294
|
+
const s = document.createElement("div");
|
|
295
|
+
s.className = "rte-preview-editor-light-editor", s.innerHTML = t, c.appendChild(s), o.appendChild(c), n.appendChild(r), n.appendChild(o), e.appendChild(n);
|
|
296
|
+
const l = () => {
|
|
297
|
+
e.parentNode && e.parentNode.removeChild(e), p = !1, a = null, document.removeEventListener("keydown", m);
|
|
298
|
+
};
|
|
299
|
+
a = l;
|
|
300
|
+
const m = (d) => {
|
|
301
|
+
d.key === "Escape" && (d.preventDefault(), d.stopPropagation(), l());
|
|
302
|
+
}, g = r.querySelector(".rte-preview-editor-close-btn");
|
|
303
|
+
g && g.addEventListener("click", (d) => {
|
|
304
|
+
d.preventDefault(), d.stopPropagation(), l();
|
|
302
305
|
}), e.addEventListener("click", (d) => {
|
|
303
|
-
d.target === e &&
|
|
304
|
-
}), document.addEventListener("keydown",
|
|
305
|
-
},
|
|
306
|
+
d.target === e && l();
|
|
307
|
+
}), document.addEventListener("keydown", m), document.body.appendChild(e);
|
|
308
|
+
}, y = () => ({
|
|
306
309
|
name: "preview",
|
|
307
310
|
toolbar: [
|
|
308
311
|
{
|
|
@@ -312,11 +315,11 @@ const g = () => {
|
|
|
312
315
|
}
|
|
313
316
|
],
|
|
314
317
|
commands: {
|
|
315
|
-
togglePreview: () => (
|
|
318
|
+
togglePreview: () => (p ? a == null || a() : b(), !0)
|
|
316
319
|
},
|
|
317
320
|
keymap: {}
|
|
318
321
|
});
|
|
319
322
|
export {
|
|
320
|
-
|
|
323
|
+
y as PreviewPlugin
|
|
321
324
|
};
|
|
322
|
-
//# sourceMappingURL=PreviewPlugin.native-
|
|
325
|
+
//# sourceMappingURL=PreviewPlugin.native-CiR51jql.mjs.map
|