@editora/core 1.0.22 → 1.0.24
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 +247 -243
- package/dist/{A11yCheckerPlugin.native-qW_njhLY.mjs → A11yCheckerPlugin.native-BBCsR5Ur.mjs} +7 -5
- package/dist/{AnchorPlugin.native-Drmxhy98.mjs → AnchorPlugin.native-Dk9R26cF.mjs} +20 -19
- package/dist/{ApprovalWorkflowPlugin.native-ZsS_2xmn.mjs → ApprovalWorkflowPlugin.native-AeJsehXM.mjs} +56 -55
- package/dist/{BackgroundColorPlugin.native-H3XyYD7_.mjs → BackgroundColorPlugin.native-DCAd94kp.mjs} +103 -98
- package/dist/{BlocksLibraryPlugin.native-CownM6Rk.mjs → BlocksLibraryPlugin.native-D9OPcnQV.mjs} +42 -43
- package/dist/{CitationsPlugin.native-C_7wWQ-k.mjs → CitationsPlugin.native-BFChgCSV.mjs} +51 -51
- package/dist/{CodePlugin.native-CAHk9ecG.mjs → CodePlugin.native-BRBEIqY7.mjs} +167 -113
- package/dist/{CodePlugin.native-DZgIez08.mjs → CodePlugin.native-CPfKDrkr.mjs} +1383 -1094
- package/dist/{CodeSamplePlugin.native-svbAFWh_.mjs → CodeSamplePlugin.native-Bai8bgl3.mjs} +5 -5
- package/dist/{CommentsPlugin.native-DncTHiEe.mjs → CommentsPlugin.native-DHCDUm9f.mjs} +161 -141
- package/dist/{ConditionalContentPlugin.native-Bf7XgRSW.mjs → ConditionalContentPlugin.native-B3R6xcqn.mjs} +3 -3
- package/dist/{ContentRulesPlugin.native-vPx5nC73.mjs → ContentRulesPlugin.native-BISqhQKJ.mjs} +52 -52
- package/dist/{DataBindingPlugin.native-B7lpI_0c.mjs → DataBindingPlugin.native-DbaDeXNp.mjs} +37 -37
- package/dist/{DocumentManagerPlugin.native-B8K-Oqom.mjs → DocumentManagerPlugin.native-tZqIa9o5.mjs} +21 -20
- package/dist/{EmbedIframePlugin.native-BfZ_HGlV.mjs → EmbedIframePlugin.native-qHMf1Jtg.mjs} +7 -7
- package/dist/{EmojisPlugin.native-D92aaOKi.mjs → EmojisPlugin.native-B64efKg5.mjs} +4 -4
- package/dist/{FormatPainterPlugin.native-BhjzsiVq.mjs → FormatPainterPlugin.native-CAc1N6xU.mjs} +183 -161
- package/dist/{HeadingPlugin.native-DZdvubrQ.mjs → HeadingPlugin.native-C3YiGERx.mjs} +85 -72
- package/dist/HistoryPlugin.native-C8GyxsgC.mjs +330 -0
- package/dist/{LinkPlugin.native-BsQXYsK6.mjs → LinkPlugin.native-Dt_p6Ukb.mjs} +4 -4
- package/dist/ListPlugin.native-UYaoRiub.mjs +239 -0
- package/dist/{MathPlugin.native-Byo3WL0f.mjs → MathPlugin.native-Cq9WQ7cq.mjs} +148 -130
- package/dist/MediaManagerPlugin.native-BjrEarV6.mjs +1161 -0
- package/dist/{MediaManagerPlugin.native-BT1NZIJS.mjs → MediaManagerPlugin.native-CRi24Mrb.mjs} +340 -281
- package/dist/{MentionPlugin.native-S_lwGZQO.mjs → MentionPlugin.native-Zb1dwdxU.mjs} +304 -300
- package/dist/{MergeTagPlugin.native-7-6F3S1Y.mjs → MergeTagPlugin.native-BXkVPvCo.mjs} +6 -4
- package/dist/{PIIRedactionPlugin.native-g7j4jOmm.mjs → PIIRedactionPlugin.native-Cm0bpzQb.mjs} +2 -2
- package/dist/{PreviewPlugin.native-Dv5OsffK.mjs → PreviewPlugin.native-CrfiwP2J.mjs} +2 -2
- package/dist/{SlashCommandsPlugin.native-BDIIwGNs.mjs → SlashCommandsPlugin.native-BzGTRmMB.mjs} +264 -240
- package/dist/{SmartPastePlugin.native-BATLCds5.mjs → SmartPastePlugin.native-DnOJhDsf.mjs} +2 -2
- package/dist/{SpecialCharactersPlugin.native-CdZoc1GB.mjs → SpecialCharactersPlugin.native-B0XaCfjZ.mjs} +4 -4
- package/dist/{SpellCheckPlugin.native-BGm2qPfn.mjs → SpellCheckPlugin.native-BE7os1Xj.mjs} +302 -265
- package/dist/{TablePlugin.native-C1YZ372P.mjs → TablePlugin.native-CWxEFpV8.mjs} +159 -136
- package/dist/{TemplatePlugin.native-Dwk8TgxI.mjs → TemplatePlugin.native-OD8Wc1R7.mjs} +6 -4
- package/dist/{TextColorPlugin.native-KMZ2uzlq.mjs → TextColorPlugin.native-C2IjioNM.mjs} +75 -71
- package/dist/{TranslationWorkflowPlugin.native-CZtG--06.mjs → TranslationWorkflowPlugin.native-BGXVJD9f.mjs} +101 -98
- package/dist/{VersionDiffPlugin.native-Ca1fMWUJ.mjs → VersionDiffPlugin.native-DJZIzFSK.mjs} +11 -11
- package/dist/anchoredPopover-QN4jNbW1.mjs +134 -0
- package/dist/confirmDialog-BP8hZPpX.mjs +112 -0
- package/dist/dialogHelpers-Dzn8DHoF.mjs +194 -0
- package/dist/{documentManager-BWK_-KJp.mjs → documentManager-8gnG-uG_.mjs} +1728 -1715
- package/dist/editora.min.js +21 -21
- package/dist/editora.umd.js +10 -10
- package/dist/{index-C1sO7DAC.js → index--wO0CZVN.js} +6 -6
- package/dist/{index-DGMYWPLx.mjs → index-BICrB5kg.mjs} +397 -326
- package/dist/index.cjs.js +1 -1
- package/dist/index.esm.js +2 -2
- package/dist/katex-DLIObQUm.mjs +11683 -0
- package/dist/katex.min--Ws3c9be.mjs +6 -0
- package/dist/notify-DCQGpmq-.mjs +60 -0
- package/dist/plugin-loader.js +54 -54
- package/dist/webcomponent-core.js +305 -234
- package/dist/webcomponent-core.min.css +1 -1
- package/dist/webcomponent-core.min.js +153 -80
- package/dist/webcomponent.cjs.js +1 -1
- package/dist/webcomponent.esm.js +1 -1
- package/dist/webcomponent.js +631 -560
- package/dist/webcomponent.min.css +1 -1
- package/dist/webcomponent.min.js +1677 -1328
- package/package.json +1 -1
- package/dist/HistoryPlugin.native-DPvhks6h.mjs +0 -246
- package/dist/ListPlugin.native-Bt0LANbO.mjs +0 -139
- package/dist/anchoredPopover-DJFD2oAP.mjs +0 -116
- package/dist/dialogHelpers-DBf7WqYH.mjs +0 -40
|
@@ -1,43 +1,43 @@
|
|
|
1
|
-
const
|
|
1
|
+
const d = '.rte-content, .editora-content, [contenteditable="true"]', B = "[data-editora-editor], .rte-editor, .editora-editor, editora-editor", C = /* @__PURE__ */ new Set(["P", "DIV", "H1", "H2", "H3", "H4", "H5", "H6", "PRE"]), T = "p,div,h1,h2,h3,h4,h5,h6,ul,ol,blockquote,pre,table", S = /* @__PURE__ */ new Set(["p", "h1", "h2", "h3", "h4", "h5", "h6"]);
|
|
2
2
|
function H(e) {
|
|
3
3
|
return e ? e.nodeType === Node.ELEMENT_NODE ? e : e.parentElement : null;
|
|
4
4
|
}
|
|
5
|
-
function
|
|
5
|
+
function w(e) {
|
|
6
6
|
const n = e == null ? void 0 : e.contentElement;
|
|
7
7
|
if (n instanceof HTMLElement) return n;
|
|
8
8
|
const t = e == null ? void 0 : e.editorElement;
|
|
9
9
|
if (t instanceof HTMLElement) {
|
|
10
|
-
const a = t.querySelector(
|
|
10
|
+
const a = t.querySelector(d);
|
|
11
11
|
if (a instanceof HTMLElement) return a;
|
|
12
12
|
if (t.getAttribute("contenteditable") === "true") return t;
|
|
13
13
|
}
|
|
14
14
|
const r = window.getSelection();
|
|
15
15
|
if (r && r.rangeCount > 0) {
|
|
16
|
-
const a = H(r.getRangeAt(0).startContainer),
|
|
17
|
-
if (
|
|
18
|
-
const
|
|
19
|
-
if (
|
|
16
|
+
const a = H(r.getRangeAt(0).startContainer), l = a == null ? void 0 : a.closest(d);
|
|
17
|
+
if (l instanceof HTMLElement) return l;
|
|
18
|
+
const i = a == null ? void 0 : a.closest(B), f = i == null ? void 0 : i.querySelector(d);
|
|
19
|
+
if (f instanceof HTMLElement) return f;
|
|
20
20
|
}
|
|
21
|
-
const s = document.activeElement, o = s == null ? void 0 : s.closest(
|
|
22
|
-
return o instanceof HTMLElement ? o : document.querySelector(
|
|
21
|
+
const s = document.activeElement, o = s == null ? void 0 : s.closest(d);
|
|
22
|
+
return o instanceof HTMLElement ? o : document.querySelector(d);
|
|
23
23
|
}
|
|
24
|
-
function
|
|
24
|
+
function A(e) {
|
|
25
25
|
const n = window.getSelection();
|
|
26
26
|
if (!n || n.rangeCount === 0) return null;
|
|
27
27
|
const t = n.getRangeAt(0);
|
|
28
28
|
return !e.contains(t.startContainer) || !e.contains(t.endContainer) ? null : t;
|
|
29
29
|
}
|
|
30
|
-
function
|
|
30
|
+
function L(e, n) {
|
|
31
31
|
let t = H(n);
|
|
32
32
|
if (!t || t === e || !e.contains(t)) return null;
|
|
33
33
|
for (; t.parentElement && t.parentElement !== e; )
|
|
34
34
|
t = t.parentElement;
|
|
35
35
|
if (t.parentElement !== e) return null;
|
|
36
|
-
if (t.matches(
|
|
37
|
-
const r = t.closest(
|
|
36
|
+
if (t.matches(T)) return t;
|
|
37
|
+
const r = t.closest(T);
|
|
38
38
|
return r instanceof HTMLElement && r.parentElement === e ? r : t;
|
|
39
39
|
}
|
|
40
|
-
function
|
|
40
|
+
function v(e, n) {
|
|
41
41
|
if (typeof e.intersectsNode == "function")
|
|
42
42
|
try {
|
|
43
43
|
return e.intersectsNode(n);
|
|
@@ -47,105 +47,105 @@ function C(e, n) {
|
|
|
47
47
|
const t = document.createRange();
|
|
48
48
|
return t.selectNode(n), e.compareBoundaryPoints(Range.END_TO_START, t) < 0 && e.compareBoundaryPoints(Range.START_TO_END, t) > 0;
|
|
49
49
|
}
|
|
50
|
-
function
|
|
51
|
-
const t =
|
|
50
|
+
function N(e, n) {
|
|
51
|
+
const t = L(e, n.startContainer), r = L(e, n.endContainer);
|
|
52
52
|
if (!t) return [];
|
|
53
53
|
if (!r || t === r) return [t];
|
|
54
54
|
const o = Array.from(e.children).filter(
|
|
55
55
|
(a) => a instanceof HTMLElement
|
|
56
|
-
).filter((a) =>
|
|
56
|
+
).filter((a) => v(n, a));
|
|
57
57
|
return o.length > 0 ? o : [t];
|
|
58
58
|
}
|
|
59
|
-
function
|
|
59
|
+
function O(e, n) {
|
|
60
60
|
Array.from(e.attributes).forEach((t) => {
|
|
61
61
|
n.setAttribute(t.name, t.value);
|
|
62
62
|
});
|
|
63
63
|
}
|
|
64
|
-
function
|
|
64
|
+
function E(e, n) {
|
|
65
65
|
for (; e.firstChild; )
|
|
66
66
|
n.appendChild(e.firstChild);
|
|
67
67
|
}
|
|
68
|
-
function
|
|
68
|
+
function R(e) {
|
|
69
69
|
return e.tagName !== "P" || e.attributes.length > 0 || (e.textContent || "").trim() !== "" ? !1 : !e.querySelector("img, video, table, iframe, hr, pre, ul, ol");
|
|
70
70
|
}
|
|
71
|
-
function
|
|
71
|
+
function h(e, n) {
|
|
72
72
|
const t = document.createElement(e);
|
|
73
|
-
return n &&
|
|
73
|
+
return n && O(n, t), t;
|
|
74
74
|
}
|
|
75
|
-
function
|
|
76
|
-
const t =
|
|
77
|
-
return
|
|
75
|
+
function M(e, n) {
|
|
76
|
+
const t = h(n, e);
|
|
77
|
+
return E(e, t), t.innerHTML.trim() || (t.innerHTML = "<br>"), t;
|
|
78
78
|
}
|
|
79
|
-
function
|
|
79
|
+
function I(e) {
|
|
80
80
|
const n = e.cloneNode(!1);
|
|
81
81
|
return n instanceof HTMLElement ? n : document.createElement(e.tagName.toLowerCase());
|
|
82
82
|
}
|
|
83
|
-
function
|
|
83
|
+
function g(e, n, t) {
|
|
84
84
|
const r = e.parentNode;
|
|
85
85
|
if (!r) return [];
|
|
86
86
|
const s = document.createDocumentFragment(), o = [];
|
|
87
87
|
let a = null;
|
|
88
|
-
const
|
|
88
|
+
const l = () => {
|
|
89
89
|
a && a.children.length > 0 && s.appendChild(a), a = null;
|
|
90
90
|
};
|
|
91
|
-
return Array.from(e.children).forEach((
|
|
92
|
-
if (
|
|
93
|
-
if (n.has(
|
|
94
|
-
|
|
95
|
-
const
|
|
96
|
-
s.appendChild(
|
|
91
|
+
return Array.from(e.children).forEach((i) => {
|
|
92
|
+
if (i instanceof HTMLLIElement) {
|
|
93
|
+
if (n.has(i)) {
|
|
94
|
+
l();
|
|
95
|
+
const f = M(i, t);
|
|
96
|
+
s.appendChild(f), o.push(f);
|
|
97
97
|
return;
|
|
98
98
|
}
|
|
99
|
-
a || (a =
|
|
99
|
+
a || (a = I(e)), a.appendChild(i);
|
|
100
100
|
}
|
|
101
|
-
}),
|
|
101
|
+
}), l(), r.insertBefore(s, e), r.removeChild(e), o;
|
|
102
102
|
}
|
|
103
103
|
function _(e, n) {
|
|
104
104
|
var r;
|
|
105
105
|
if (e.tagName.toLowerCase() === n) return [e];
|
|
106
|
-
const t =
|
|
107
|
-
return
|
|
106
|
+
const t = h(n, e);
|
|
107
|
+
return E(e, t), t.innerHTML.trim() || (t.innerHTML = "<br>"), (r = e.parentNode) == null || r.replaceChild(t, e), [t];
|
|
108
108
|
}
|
|
109
|
-
function
|
|
109
|
+
function b(e, n) {
|
|
110
110
|
const t = e.parentNode;
|
|
111
111
|
if (!t) return [];
|
|
112
112
|
const r = document.createDocumentFragment(), s = [];
|
|
113
113
|
return Array.from(e.childNodes).forEach((o) => {
|
|
114
|
-
if (o instanceof HTMLElement &&
|
|
114
|
+
if (o instanceof HTMLElement && R(o)) {
|
|
115
115
|
o.remove();
|
|
116
116
|
return;
|
|
117
117
|
}
|
|
118
118
|
if (o instanceof HTMLUListElement || o instanceof HTMLOListElement) {
|
|
119
|
-
Array.from(o.children).forEach((
|
|
120
|
-
if (!(
|
|
121
|
-
const
|
|
122
|
-
r.appendChild(
|
|
119
|
+
Array.from(o.children).forEach((l) => {
|
|
120
|
+
if (!(l instanceof HTMLLIElement)) return;
|
|
121
|
+
const i = M(l, n);
|
|
122
|
+
r.appendChild(i), s.push(i);
|
|
123
123
|
}), o.remove();
|
|
124
124
|
return;
|
|
125
125
|
}
|
|
126
|
-
if (o instanceof HTMLElement &&
|
|
127
|
-
const
|
|
128
|
-
|
|
126
|
+
if (o instanceof HTMLElement && C.has(o.tagName)) {
|
|
127
|
+
const l = h(n, o);
|
|
128
|
+
E(o, l), r.appendChild(l), s.push(l);
|
|
129
129
|
return;
|
|
130
130
|
}
|
|
131
131
|
if (o.nodeType === Node.TEXT_NODE && (o.textContent || "").trim() === "") {
|
|
132
132
|
o.remove();
|
|
133
133
|
return;
|
|
134
134
|
}
|
|
135
|
-
const a =
|
|
135
|
+
const a = h(n, e);
|
|
136
136
|
a.appendChild(o), r.appendChild(a), s.push(a);
|
|
137
137
|
}), t.insertBefore(r, e), t.removeChild(e), s;
|
|
138
138
|
}
|
|
139
|
-
function
|
|
139
|
+
function k(e) {
|
|
140
140
|
const n = window.getSelection();
|
|
141
141
|
if (!n) return;
|
|
142
142
|
const t = document.createRange(), r = e instanceof HTMLElement && e.querySelector("p,li,h1,h2,h3,h4,h5,h6") || e;
|
|
143
143
|
t.selectNodeContents(r), t.collapse(!0), n.removeAllRanges(), n.addRange(t);
|
|
144
144
|
}
|
|
145
|
-
function
|
|
145
|
+
function D(e) {
|
|
146
146
|
e.dispatchEvent(new Event("input", { bubbles: !0 }));
|
|
147
147
|
}
|
|
148
|
-
function
|
|
148
|
+
function P(e, n, t) {
|
|
149
149
|
const r = window.execEditorCommand;
|
|
150
150
|
if (typeof r == "function") {
|
|
151
151
|
r("recordDomTransaction", e, n, t);
|
|
@@ -154,10 +154,10 @@ function D(e, n, t) {
|
|
|
154
154
|
const s = window.executeEditorCommand;
|
|
155
155
|
typeof s == "function" && s("recordDomTransaction", { editor: e, beforeHTML: n, afterHTML: t });
|
|
156
156
|
}
|
|
157
|
-
function
|
|
157
|
+
function q(e, n) {
|
|
158
158
|
const t = /* @__PURE__ */ new Map();
|
|
159
159
|
return Array.from(e.querySelectorAll("li")).filter(
|
|
160
|
-
(s) => s instanceof HTMLLIElement &&
|
|
160
|
+
(s) => s instanceof HTMLLIElement && v(n, s)
|
|
161
161
|
).forEach((s) => {
|
|
162
162
|
var a;
|
|
163
163
|
const o = s.parentElement;
|
|
@@ -166,33 +166,46 @@ function P(e, n) {
|
|
|
166
166
|
}
|
|
167
167
|
function m(e, n) {
|
|
168
168
|
const t = e.toLowerCase();
|
|
169
|
-
if (!
|
|
170
|
-
const r =
|
|
169
|
+
if (!S.has(t)) return !1;
|
|
170
|
+
const r = w(n);
|
|
171
171
|
if (!r) return !1;
|
|
172
|
-
const s =
|
|
172
|
+
const s = A(r);
|
|
173
173
|
if (!s) return !1;
|
|
174
|
-
const o = r.innerHTML, a = [],
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
174
|
+
const o = r.innerHTML, a = [], l = q(r, s), i = {
|
|
175
|
+
startContainer: s.startContainer,
|
|
176
|
+
startOffset: s.startOffset,
|
|
177
|
+
endContainer: s.endContainer,
|
|
178
|
+
endOffset: s.endOffset
|
|
179
|
+
};
|
|
180
|
+
l.size > 0 ? l.forEach((u, c) => {
|
|
181
|
+
a.push(...g(c, u, t));
|
|
182
|
+
}) : N(r, s).forEach((c) => {
|
|
183
|
+
if (c instanceof HTMLUListElement || c instanceof HTMLOListElement) {
|
|
184
|
+
const p = new Set(Array.from(c.children).filter(
|
|
185
|
+
(y) => y instanceof HTMLLIElement
|
|
181
186
|
));
|
|
182
|
-
a.push(...
|
|
187
|
+
a.push(...g(c, p, t));
|
|
183
188
|
return;
|
|
184
189
|
}
|
|
185
|
-
if (
|
|
186
|
-
const
|
|
190
|
+
if (C.has(c.tagName)) {
|
|
191
|
+
const p = c.querySelector(":scope > ul, :scope > ol, :scope > blockquote, :scope > table");
|
|
187
192
|
a.push(
|
|
188
|
-
...
|
|
193
|
+
...p ? b(c, t) : _(c, t)
|
|
189
194
|
);
|
|
190
195
|
}
|
|
191
196
|
});
|
|
192
|
-
const
|
|
193
|
-
|
|
197
|
+
const f = r.innerHTML;
|
|
198
|
+
if (o === f || a.length === 0) return !1;
|
|
199
|
+
if (P(r, o, f), D(r), r.contains(i.startContainer) && r.contains(i.endContainer)) {
|
|
200
|
+
const u = document.createRange();
|
|
201
|
+
u.setStart(i.startContainer, i.startOffset), u.setEnd(i.endContainer, i.endOffset);
|
|
202
|
+
const c = window.getSelection();
|
|
203
|
+
c == null || c.removeAllRanges(), c == null || c.addRange(u);
|
|
204
|
+
} else
|
|
205
|
+
k(a[0]);
|
|
206
|
+
return !0;
|
|
194
207
|
}
|
|
195
|
-
const
|
|
208
|
+
const Z = () => ({
|
|
196
209
|
name: "heading",
|
|
197
210
|
// Toolbar button configuration with dropdown
|
|
198
211
|
toolbar: [
|
|
@@ -244,6 +257,6 @@ const q = () => ({
|
|
|
244
257
|
}
|
|
245
258
|
});
|
|
246
259
|
export {
|
|
247
|
-
|
|
260
|
+
Z as HeadingPlugin
|
|
248
261
|
};
|
|
249
|
-
//# sourceMappingURL=HeadingPlugin.native-
|
|
262
|
+
//# sourceMappingURL=HeadingPlugin.native-C3YiGERx.mjs.map
|
|
@@ -0,0 +1,330 @@
|
|
|
1
|
+
const I = ".rte-content, .editora-content";
|
|
2
|
+
const p = "__editoraCommandEditorRoot", m = /* @__PURE__ */ new Map(), A = {};
|
|
3
|
+
let k = !1, a = null;
|
|
4
|
+
function B(t) {
|
|
5
|
+
if (!t) return null;
|
|
6
|
+
const e = t.querySelector('[contenteditable="true"]');
|
|
7
|
+
return e instanceof HTMLElement ? e : null;
|
|
8
|
+
}
|
|
9
|
+
function Z() {
|
|
10
|
+
if (typeof window == "undefined") return null;
|
|
11
|
+
const t = window[p];
|
|
12
|
+
if (!(t instanceof HTMLElement)) return null;
|
|
13
|
+
window[p] = null;
|
|
14
|
+
const e = t.closest("[data-editora-editor], .rte-editor, .editora-editor, editora-editor") || (t.matches("[data-editora-editor], .rte-editor, .editora-editor, editora-editor") ? t : null);
|
|
15
|
+
if (e) {
|
|
16
|
+
const o = B(e);
|
|
17
|
+
if (o) return o;
|
|
18
|
+
if (e.getAttribute("contenteditable") === "true") return e;
|
|
19
|
+
}
|
|
20
|
+
if (t.getAttribute("contenteditable") === "true")
|
|
21
|
+
return t;
|
|
22
|
+
const n = t.closest('[contenteditable="true"]');
|
|
23
|
+
return n instanceof HTMLElement ? n : null;
|
|
24
|
+
}
|
|
25
|
+
function q(t) {
|
|
26
|
+
return t ? t.nodeType === Node.ELEMENT_NODE ? t : t.parentElement : null;
|
|
27
|
+
}
|
|
28
|
+
function g(t) {
|
|
29
|
+
const e = q(t);
|
|
30
|
+
if (!e) return null;
|
|
31
|
+
const n = e.closest(I);
|
|
32
|
+
if (n) return n;
|
|
33
|
+
const o = e.closest('[contenteditable="true"]');
|
|
34
|
+
if (!o) return null;
|
|
35
|
+
let r = o, i = r.parentElement;
|
|
36
|
+
for (; i; )
|
|
37
|
+
i.getAttribute("contenteditable") === "true" && (r = i), i = i.parentElement;
|
|
38
|
+
return r;
|
|
39
|
+
}
|
|
40
|
+
function w() {
|
|
41
|
+
const t = Z();
|
|
42
|
+
if (t && document.contains(t))
|
|
43
|
+
return t;
|
|
44
|
+
const e = window.getSelection();
|
|
45
|
+
if (e && e.rangeCount > 0) {
|
|
46
|
+
const i = g(e.getRangeAt(0).startContainer);
|
|
47
|
+
if (i) return i;
|
|
48
|
+
}
|
|
49
|
+
const n = document.activeElement;
|
|
50
|
+
if (n) {
|
|
51
|
+
const i = g(n);
|
|
52
|
+
if (i) return i;
|
|
53
|
+
}
|
|
54
|
+
if (a != null && a.isConnected) return a;
|
|
55
|
+
const o = Array.from(m.keys()).find((i) => i.isConnected);
|
|
56
|
+
if (o) return o;
|
|
57
|
+
const r = document.querySelector(I);
|
|
58
|
+
return r || document.querySelector('[contenteditable="true"]');
|
|
59
|
+
}
|
|
60
|
+
function N() {
|
|
61
|
+
for (const t of m.keys())
|
|
62
|
+
t.isConnected || (m.delete(t), a === t && (a = null));
|
|
63
|
+
}
|
|
64
|
+
function C(t) {
|
|
65
|
+
N();
|
|
66
|
+
let e = m.get(t);
|
|
67
|
+
return e || (e = { undoStack: [], redoStack: [] }, m.set(t, e)), e;
|
|
68
|
+
}
|
|
69
|
+
function T(t) {
|
|
70
|
+
t && t.dispatchEvent(new Event("input", { bubbles: !0 }));
|
|
71
|
+
}
|
|
72
|
+
function W(t) {
|
|
73
|
+
return t === "insertText" || t === "insertCompositionText" ? "insert" : t === "deleteContentBackward" || t === "deleteContentForward" ? "delete" : null;
|
|
74
|
+
}
|
|
75
|
+
function h(t) {
|
|
76
|
+
var o;
|
|
77
|
+
if (!t) return;
|
|
78
|
+
const e = (o = m.get(t)) == null ? void 0 : o.undoStack, n = e && e[e.length - 1];
|
|
79
|
+
n && (n.closed = !0);
|
|
80
|
+
}
|
|
81
|
+
function x(t) {
|
|
82
|
+
var n;
|
|
83
|
+
const e = document.createElement("div");
|
|
84
|
+
return e.innerHTML = t, ((n = e.textContent) != null ? n : "").replace(/\u00a0/g, " ");
|
|
85
|
+
}
|
|
86
|
+
function j(t, e) {
|
|
87
|
+
const n = x(t), o = x(e), r = Math.min(n.length, o.length);
|
|
88
|
+
let i = 0;
|
|
89
|
+
for (; i < r && n.charCodeAt(i) === o.charCodeAt(i); ) i++;
|
|
90
|
+
let c = 0;
|
|
91
|
+
for (; c < r - i && n.charCodeAt(n.length - 1 - c) === o.charCodeAt(o.length - 1 - c); )
|
|
92
|
+
c++;
|
|
93
|
+
return { start: i, beforeEnd: n.length - c, afterEnd: o.length - c };
|
|
94
|
+
}
|
|
95
|
+
function V(t, e) {
|
|
96
|
+
const n = window.getSelection();
|
|
97
|
+
if (!n) return;
|
|
98
|
+
const o = document.createTreeWalker(t, NodeFilter.SHOW_TEXT);
|
|
99
|
+
let r = Math.max(0, e), i = null, c = null;
|
|
100
|
+
for (; i = o.nextNode(); ) {
|
|
101
|
+
const d = i;
|
|
102
|
+
if (c = d, r <= d.data.length) {
|
|
103
|
+
const s = document.createRange();
|
|
104
|
+
s.setStart(d, r), s.collapse(!0), n.removeAllRanges(), n.addRange(s);
|
|
105
|
+
return;
|
|
106
|
+
}
|
|
107
|
+
r -= d.data.length;
|
|
108
|
+
}
|
|
109
|
+
const u = document.createRange();
|
|
110
|
+
c ? u.setStart(c, c.data.length) : u.selectNodeContents(t), u.collapse(!0), n.removeAllRanges(), n.addRange(u);
|
|
111
|
+
}
|
|
112
|
+
function _(t, e, n, o) {
|
|
113
|
+
const r = document.activeElement, i = t.closest("[data-editora-editor], .rte-editor, .editora-editor, editora-editor");
|
|
114
|
+
if (!(!r || r === document.body || t.contains(r) || !!(i != null && i.contains(r)))) return;
|
|
115
|
+
const u = j(e, n);
|
|
116
|
+
V(t, o === "undo" ? u.beforeEnd : u.afterEnd), t.contains(document.activeElement) || t.focus({ preventScroll: !0 });
|
|
117
|
+
}
|
|
118
|
+
let v = !1;
|
|
119
|
+
function K() {
|
|
120
|
+
v || typeof document == "undefined" || (v = !0, document.addEventListener(
|
|
121
|
+
"pointerdown",
|
|
122
|
+
(t) => h(g(t.target)),
|
|
123
|
+
!0
|
|
124
|
+
), document.addEventListener(
|
|
125
|
+
"keydown",
|
|
126
|
+
(t) => {
|
|
127
|
+
/^(Arrow(Left|Right|Up|Down)|Home|End|Page(Up|Down)|Tab)$/.test(t.key) && h(g(t.target));
|
|
128
|
+
},
|
|
129
|
+
!0
|
|
130
|
+
));
|
|
131
|
+
}
|
|
132
|
+
function H(t, e) {
|
|
133
|
+
var i, c, u, d;
|
|
134
|
+
if (!t) return;
|
|
135
|
+
const n = C(t);
|
|
136
|
+
n.undoStack.push(e), n.redoStack.length = 0, n.undoStack.length > 200 && n.undoStack.splice(0, n.undoStack.length - 200);
|
|
137
|
+
let o = 0;
|
|
138
|
+
n.undoStack.forEach((s) => {
|
|
139
|
+
var l, E, M, L;
|
|
140
|
+
o += ((E = (l = s.beforeHTML) == null ? void 0 : l.length) != null ? E : 0) + ((L = (M = s.afterHTML) == null ? void 0 : M.length) != null ? L : 0);
|
|
141
|
+
});
|
|
142
|
+
let r = 0;
|
|
143
|
+
for (; o > 4e7 && n.undoStack.length - r > 1; ) {
|
|
144
|
+
const s = n.undoStack[r];
|
|
145
|
+
o -= ((c = (i = s.beforeHTML) == null ? void 0 : i.length) != null ? c : 0) + ((d = (u = s.afterHTML) == null ? void 0 : u.length) != null ? d : 0), r += 1;
|
|
146
|
+
}
|
|
147
|
+
r > 0 && n.undoStack.splice(0, r), a = t;
|
|
148
|
+
}
|
|
149
|
+
function P(t, e = "undo") {
|
|
150
|
+
if (N(), t != null && t.isConnected)
|
|
151
|
+
return t;
|
|
152
|
+
const n = w();
|
|
153
|
+
if (n != null && n.isConnected)
|
|
154
|
+
return n;
|
|
155
|
+
if (a != null && a.isConnected)
|
|
156
|
+
return a;
|
|
157
|
+
const o = (r) => e === "undo" ? r.undoStack.length > 0 : r.redoStack.length > 0;
|
|
158
|
+
for (const [r, i] of m.entries())
|
|
159
|
+
if (r.isConnected && o(i))
|
|
160
|
+
return r;
|
|
161
|
+
return null;
|
|
162
|
+
}
|
|
163
|
+
function O(t) {
|
|
164
|
+
const e = {};
|
|
165
|
+
for (const r of t.getAttributeNames()) {
|
|
166
|
+
const i = t.getAttribute(r);
|
|
167
|
+
i !== null && (e[r] = i);
|
|
168
|
+
}
|
|
169
|
+
const n = t instanceof HTMLInputElement || t instanceof HTMLTextAreaElement || t instanceof HTMLSelectElement, o = t instanceof HTMLInputElement;
|
|
170
|
+
return {
|
|
171
|
+
attributes: e,
|
|
172
|
+
innerHTML: t.innerHTML,
|
|
173
|
+
value: n ? t.value : null,
|
|
174
|
+
checked: o ? t.checked : null
|
|
175
|
+
};
|
|
176
|
+
}
|
|
177
|
+
function R(t, e) {
|
|
178
|
+
const n = new Set(t.getAttributeNames());
|
|
179
|
+
Object.keys(e.attributes).forEach((o) => n.delete(o)), n.forEach((o) => t.removeAttribute(o)), Object.entries(e.attributes).forEach(([o, r]) => {
|
|
180
|
+
t.setAttribute(o, r);
|
|
181
|
+
}), t.innerHTML !== e.innerHTML && (t.innerHTML = e.innerHTML), e.value !== null && (t instanceof HTMLInputElement || t instanceof HTMLTextAreaElement || t instanceof HTMLSelectElement) && (t.value = e.value), e.checked !== null && t instanceof HTMLInputElement && (t.checked = e.checked);
|
|
182
|
+
}
|
|
183
|
+
function f(t, e) {
|
|
184
|
+
if (A[t] = e, typeof window == "undefined") return;
|
|
185
|
+
const n = window.registerEditorCommand;
|
|
186
|
+
typeof n == "function" ? n(t, e) : (window.registerEditorCommand = (o, r) => {
|
|
187
|
+
A[o] = r;
|
|
188
|
+
}, window.registerEditorCommand(t, e));
|
|
189
|
+
}
|
|
190
|
+
const D = (t, ...e) => {
|
|
191
|
+
const n = A[t];
|
|
192
|
+
return n ? n(...e) : !1;
|
|
193
|
+
};
|
|
194
|
+
function S() {
|
|
195
|
+
k || typeof window == "undefined" || (k = !0, K(), window.execEditorCommand || (window.execEditorCommand = D), window.executeEditorCommand || (window.executeEditorCommand = D), f("undo", G), f("redo", Y), f("setAttribute", F), f("setText", U), f("autoFixA11y", X), f("recordDomTransaction", z), f("undoDom", b), f("redoDom", y));
|
|
196
|
+
}
|
|
197
|
+
const G = () => {
|
|
198
|
+
const t = w();
|
|
199
|
+
return b(t != null ? t : void 0);
|
|
200
|
+
}, Y = () => {
|
|
201
|
+
const t = w();
|
|
202
|
+
return y(t != null ? t : void 0);
|
|
203
|
+
}, F = (t, e, n) => {
|
|
204
|
+
if (!(t instanceof HTMLElement)) return;
|
|
205
|
+
const o = g(t), r = t.hasAttribute(e), i = t.getAttribute(e);
|
|
206
|
+
t.setAttribute(e, n), H(o, {
|
|
207
|
+
undo: () => {
|
|
208
|
+
t.isConnected && (r && i !== null ? t.setAttribute(e, i) : t.removeAttribute(e));
|
|
209
|
+
},
|
|
210
|
+
redo: () => {
|
|
211
|
+
t.isConnected && t.setAttribute(e, n);
|
|
212
|
+
}
|
|
213
|
+
}), T(o);
|
|
214
|
+
}, U = (t, e) => {
|
|
215
|
+
var r;
|
|
216
|
+
if (!(t instanceof HTMLElement)) return;
|
|
217
|
+
const n = g(t), o = (r = t.textContent) != null ? r : "";
|
|
218
|
+
t.textContent = e, H(n, {
|
|
219
|
+
undo: () => {
|
|
220
|
+
t.isConnected && (t.textContent = o);
|
|
221
|
+
},
|
|
222
|
+
redo: () => {
|
|
223
|
+
t.isConnected && (t.textContent = e);
|
|
224
|
+
}
|
|
225
|
+
}), T(n);
|
|
226
|
+
}, X = (t) => {
|
|
227
|
+
var c;
|
|
228
|
+
const e = t == null ? void 0 : t.element;
|
|
229
|
+
if (!(e instanceof HTMLElement)) return;
|
|
230
|
+
const n = g(e), o = (c = window.a11yRuleRegistry) == null ? void 0 : c.find((u) => u.id === t.rule);
|
|
231
|
+
if (!o || typeof o.fix != "function") return;
|
|
232
|
+
const r = O(e);
|
|
233
|
+
o.fix(t);
|
|
234
|
+
const i = O(e);
|
|
235
|
+
H(n, {
|
|
236
|
+
undo: () => {
|
|
237
|
+
e.isConnected && R(e, r);
|
|
238
|
+
},
|
|
239
|
+
redo: () => {
|
|
240
|
+
e.isConnected && R(e, i);
|
|
241
|
+
}
|
|
242
|
+
}), T(n);
|
|
243
|
+
}, z = (t, e, n, o) => {
|
|
244
|
+
var E, M;
|
|
245
|
+
if (!(t instanceof HTMLElement)) return !1;
|
|
246
|
+
const r = typeof n == "string" ? n : t.innerHTML;
|
|
247
|
+
if (e === r) return !1;
|
|
248
|
+
const i = C(t), c = i.undoStack[i.undoStack.length - 1];
|
|
249
|
+
if (c && c.beforeHTML === e && c.afterHTML === r)
|
|
250
|
+
return !1;
|
|
251
|
+
const u = Date.now(), d = (o == null ? void 0 : o.selectionCollapsed) === !1 ? null : W(o == null ? void 0 : o.inputType), s = d === "insert" && typeof (o == null ? void 0 : o.data) == "string" && /\s/.test(o.data);
|
|
252
|
+
if (d && c && c.group === d && !c.closed && c.afterHTML === e && u - ((E = c.updatedAt) != null ? E : 0) <= 1e3 && u - ((M = c.startedAt) != null ? M : 0) <= 8e3)
|
|
253
|
+
return c.afterHTML = r, c.updatedAt = u, s && (c.closed = !0), i.redoStack.length = 0, a = t, !0;
|
|
254
|
+
const l = {
|
|
255
|
+
// A step that starts where the one before it ended shares its string, instead of holding a second copy of the document.
|
|
256
|
+
beforeHTML: c && c.afterHTML === e ? c.afterHTML : e,
|
|
257
|
+
afterHTML: r,
|
|
258
|
+
group: d != null ? d : void 0,
|
|
259
|
+
startedAt: u,
|
|
260
|
+
updatedAt: u,
|
|
261
|
+
closed: s,
|
|
262
|
+
undo: () => {
|
|
263
|
+
t.isConnected && (t.innerHTML = l.beforeHTML, _(t, l.beforeHTML, l.afterHTML, "undo"));
|
|
264
|
+
},
|
|
265
|
+
redo: () => {
|
|
266
|
+
t.isConnected && (t.innerHTML = l.afterHTML, _(t, l.beforeHTML, l.afterHTML, "redo"));
|
|
267
|
+
}
|
|
268
|
+
};
|
|
269
|
+
return H(t, l), !0;
|
|
270
|
+
}, b = (t) => {
|
|
271
|
+
const e = P(t, "undo");
|
|
272
|
+
if (!e) return !1;
|
|
273
|
+
const n = C(e), o = n.undoStack.pop();
|
|
274
|
+
return o ? (o.undo(), n.redoStack.push(o), h(e), a = e, T(e), !0) : !1;
|
|
275
|
+
}, y = (t) => {
|
|
276
|
+
const e = P(t, "redo");
|
|
277
|
+
if (!e) return !1;
|
|
278
|
+
const n = C(e), o = n.redoStack.pop();
|
|
279
|
+
return o ? (o.redo(), n.undoStack.push(o), h(e), a = e, T(e), !0) : !1;
|
|
280
|
+
};
|
|
281
|
+
typeof window != "undefined" && (document.readyState === "loading" ? document.addEventListener("DOMContentLoaded", S, { once: !0 }) : S());
|
|
282
|
+
const $ = () => (S(), {
|
|
283
|
+
name: "history",
|
|
284
|
+
toolbar: [
|
|
285
|
+
{
|
|
286
|
+
label: "Undo",
|
|
287
|
+
command: "undo",
|
|
288
|
+
type: "button",
|
|
289
|
+
icon: '<svg width="24" height="24" focusable="false"><path d="M6.4 8H12c3.7 0 6.2 2 6.8 5.1.6 2.7-.4 5.6-2.3 6.8a1 1 0 0 1-1-1.8c1.1-.6 1.8-2.7 1.4-4.6-.5-2.1-2.1-3.5-4.9-3.5H6.4l3.3 3.3a1 1 0 1 1-1.4 1.4l-5-5a1 1 0 0 1 0-1.4l5-5a1 1 0 0 1 1.4 1.4L6.4 8Z" fill-rule="nonzero"></path></svg>',
|
|
290
|
+
shortcut: "Mod-z"
|
|
291
|
+
},
|
|
292
|
+
{
|
|
293
|
+
label: "Redo",
|
|
294
|
+
command: "redo",
|
|
295
|
+
type: "button",
|
|
296
|
+
icon: '<svg width="24" height="24" focusable="false"><path d="M17.6 10H12c-2.8 0-4.4 1.4-4.9 3.5-.4 2 .3 4 1.4 4.6a1 1 0 1 1-1 1.8c-2-1.2-2.9-4.1-2.3-6.8.6-3 3-5.1 6.8-5.1h5.6l-3.3-3.3a1 1 0 1 1 1.4-1.4l5 5a1 1 0 0 1 0 1.4l-5 5a1 1 0 0 1-1.4-1.4l3.3-3.3Z" fill-rule="nonzero"></path></svg>',
|
|
297
|
+
shortcut: "Mod-y"
|
|
298
|
+
}
|
|
299
|
+
],
|
|
300
|
+
commands: {
|
|
301
|
+
undo: G,
|
|
302
|
+
redo: Y,
|
|
303
|
+
setAttribute: F,
|
|
304
|
+
setText: U,
|
|
305
|
+
autoFixA11y: X,
|
|
306
|
+
recordDomTransaction: z,
|
|
307
|
+
undoDom: b,
|
|
308
|
+
redoDom: y
|
|
309
|
+
},
|
|
310
|
+
keymap: {
|
|
311
|
+
"Mod-z": "undo",
|
|
312
|
+
"Mod-Z": "undo",
|
|
313
|
+
"Mod-y": "redo",
|
|
314
|
+
"Mod-Y": "redo",
|
|
315
|
+
"Mod-Shift-z": "redo",
|
|
316
|
+
"Mod-Shift-Z": "redo"
|
|
317
|
+
}
|
|
318
|
+
});
|
|
319
|
+
export {
|
|
320
|
+
$ as HistoryPlugin,
|
|
321
|
+
X as autoFixA11y,
|
|
322
|
+
z as recordDomTransaction,
|
|
323
|
+
Y as redo,
|
|
324
|
+
y as redoDom,
|
|
325
|
+
F as setAttribute,
|
|
326
|
+
U as setText,
|
|
327
|
+
G as undo,
|
|
328
|
+
b as undoDom
|
|
329
|
+
};
|
|
330
|
+
//# sourceMappingURL=HistoryPlugin.native-C8GyxsgC.mjs.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { i as M } from "./dialogHelpers-
|
|
1
|
+
import { i as M } from "./dialogHelpers-Dzn8DHoF.mjs";
|
|
2
2
|
import { r as k } from "./historyHelpers-B0-4mq1E.mjs";
|
|
3
3
|
let a = null, m = "", g = !1, l = null;
|
|
4
4
|
const y = '[data-theme="dark"], .dark, .editora-theme-dark', O = /* @__PURE__ */ new Set(["http:", "https:", "mailto:", "tel:", "sms:", "ftp:"]), C = "Enter a valid URL, e.g. https://example.com, /page, #section or mailto:name@example.com", R = (e) => {
|
|
@@ -100,7 +100,7 @@ const y = '[data-theme="dark"], .dark, .editora-theme-dark', O = /* @__PURE__ */
|
|
|
100
100
|
}
|
|
101
101
|
|
|
102
102
|
.link-dialog-overlay.rte-theme-dark .btn-submit {
|
|
103
|
-
background: #
|
|
103
|
+
background: #2563eb !important;
|
|
104
104
|
}
|
|
105
105
|
|
|
106
106
|
.link-dialog-overlay.rte-theme-dark .btn-submit:hover {
|
|
@@ -215,7 +215,7 @@ const y = '[data-theme="dark"], .dark, .editora-theme-dark', O = /* @__PURE__ */
|
|
|
215
215
|
<div class="link-dialog-footer" style="padding: 12px 20px; border-top: 1px solid #ddd; display: flex; justify-content: flex-end; gap: 10px;">
|
|
216
216
|
${e.isEditing ? '<button type="button" class="btn-remove" style="padding: 8px 16px; border: 1px solid #dc3545; background: white; color: #dc3545; border-radius: 4px; cursor: pointer; margin-right: auto;">Remove Link</button>' : ""}
|
|
217
217
|
<button type="button" class="btn-cancel" style="padding: 8px 16px; border: 1px solid #ccc; background: white; border-radius: 4px; cursor: pointer;">Cancel</button>
|
|
218
|
-
<button type="submit" class="btn-submit" style="padding: 8px 16px; border: none; background: #
|
|
218
|
+
<button type="submit" class="btn-submit" style="padding: 8px 16px; border: none; background: #0069d9; color: white; border-radius: 4px; cursor: pointer;">
|
|
219
219
|
${e.isEditing ? "Update Link" : "Insert Link"}
|
|
220
220
|
</button>
|
|
221
221
|
</div>
|
|
@@ -349,4 +349,4 @@ export {
|
|
|
349
349
|
_ as openLinkDialog,
|
|
350
350
|
z as removeLink
|
|
351
351
|
};
|
|
352
|
-
//# sourceMappingURL=LinkPlugin.native-
|
|
352
|
+
//# sourceMappingURL=LinkPlugin.native-Dt_p6Ukb.mjs.map
|