@editora/core 1.0.9 → 1.0.11
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 +1 -1
- package/dist/{A11yCheckerPlugin.native-58d12bed.mjs → A11yCheckerPlugin.native-BRdGYMju.mjs} +12 -23
- package/dist/{AnchorPlugin.native-289a112a.mjs → AnchorPlugin.native-BcYGEtd9.mjs} +102 -112
- package/dist/{ApprovalWorkflowPlugin.native-449ce66c.mjs → ApprovalWorkflowPlugin.native-BZ6jO-Wj.mjs} +173 -209
- package/dist/{BackgroundColorPlugin.native-8aceb5cc.mjs → BackgroundColorPlugin.native-50iAT9xU.mjs} +9 -16
- package/dist/BlockquotePlugin.native-57_Xcjl1.mjs +212 -0
- package/dist/{BlocksLibraryPlugin.native-1cc51e63.mjs → BlocksLibraryPlugin.native-5sdsXsiE.mjs} +149 -205
- package/dist/{BoldPlugin.native-f9d7f8e4.mjs → BoldPlugin.native-CSh_LiIJ.mjs} +11 -7
- package/dist/CapitalizationPlugin.native-DLV4oPmB.mjs +159 -0
- package/dist/ChecklistPlugin.native-BS-kMz9O.mjs +371 -0
- package/dist/{CitationsPlugin.native-169fb1e8.mjs → CitationsPlugin.native-DQgoCd1B.mjs} +196 -261
- package/dist/ClearFormattingPlugin.native-DIS6AN2t.mjs +172 -0
- package/dist/CodePlugin.native-veDC_kx5.mjs +4600 -0
- package/dist/{CodeSamplePlugin.native-6cc0148e.mjs → CodeSamplePlugin.native-CgGoH-X4.mjs} +10 -19
- package/dist/{CommentsPlugin.native-03659874.mjs → CommentsPlugin.native-DPSqTkiv.mjs} +28 -55
- package/dist/{ConditionalContentPlugin.native-4983143a.mjs → ConditionalContentPlugin.native-CfhY46rU.mjs} +51 -108
- package/dist/{ContentRulesPlugin.native-63ed405b.mjs → ContentRulesPlugin.native-vPx5nC73.mjs} +153 -200
- package/dist/{DataBindingPlugin.native-427e9d75.mjs → DataBindingPlugin.native-BoXwghTz.mjs} +88 -124
- package/dist/DirectionPlugin.native-Bl-QLFzO.mjs +153 -0
- package/dist/{DocSchemaPlugin.native-8e41eda0.mjs → DocSchemaPlugin.native-DUSVRHqT.mjs} +112 -166
- package/dist/{DocumentManagerPlugin.native-e69895ad.mjs → DocumentManagerPlugin.native-C2cs_1w4.mjs} +4 -4
- package/dist/EmbedIframePlugin.native-BF_-LjTq.mjs +740 -0
- package/dist/{EmojisPlugin.native-65c5ac47.mjs → EmojisPlugin.native-CitxxlWX.mjs} +6 -11
- package/dist/{FontFamilyPlugin.native-f9bc255a.mjs → FontFamilyPlugin.native-j8hMTbg4.mjs} +4 -7
- package/dist/{FontSizePlugin.native-f5647872.mjs → FontSizePlugin.native-B_jCh7dY.mjs} +10 -19
- package/dist/{FootnotePlugin.native-494657b3.mjs → FootnotePlugin.native-D730OGRm.mjs} +39 -77
- package/dist/{FullscreenPlugin.native-87ce92e9.mjs → FullscreenPlugin.native-ChXyxeNw.mjs} +1 -1
- package/dist/HeadingPlugin.native-DZdvubrQ.mjs +249 -0
- package/dist/{HistoryPlugin.native-92ed4be4.mjs → HistoryPlugin.native-D2wl32jV.mjs} +107 -143
- package/dist/{IndentPlugin.native-e4ee902b.mjs → IndentPlugin.native-BHixp8sP.mjs} +12 -23
- package/dist/{ItalicPlugin.native-7c95cfbc.mjs → ItalicPlugin.native-CmnlwFHB.mjs} +15 -11
- package/dist/{LineHeightPlugin.native-5668f78c.mjs → LineHeightPlugin.native-CM7iXdQj.mjs} +10 -19
- package/dist/{LinkPlugin.native-6df29111.mjs → LinkPlugin.native-DYCIcdTm.mjs} +5 -9
- package/dist/{ListPlugin.native-fe2e115a.mjs → ListPlugin.native-V7EZC1lM.mjs} +5 -9
- package/dist/MathPlugin.native-NwWPHVmj.mjs +369 -0
- package/dist/{MediaManagerPlugin.native-3cf48a00.mjs → MediaManagerPlugin.native-eOsTJFpw.mjs} +11 -21
- package/dist/{MentionPlugin.native-3b1e8c05.mjs → MentionPlugin.native-BMDlOqur.mjs} +45 -89
- package/dist/MergeTagPlugin.native-BzRVoD9-.mjs +580 -0
- package/dist/{PIIRedactionPlugin.native-7ab10b9f.mjs → PIIRedactionPlugin.native-g7j4jOmm.mjs} +210 -260
- package/dist/{PageBreakPlugin.native-1794c5fb.mjs → PageBreakPlugin.native-DijGuHJZ.mjs} +16 -31
- package/dist/{PreviewPlugin.native-f7b67cc0.mjs → PreviewPlugin.native-WuIwOAOR.mjs} +6 -11
- package/dist/{PrintPlugin.native-f6a168c2.mjs → PrintPlugin.native-7qt5v7L5.mjs} +3 -5
- package/dist/{SlashCommandsPlugin.native-8d45e511.mjs → SlashCommandsPlugin.native-BiN6ODw5.mjs} +36 -71
- package/dist/{SmartPastePlugin.native-a6c5efec.mjs → SmartPastePlugin.native-CZAEHkyt.mjs} +173 -219
- package/dist/{SpecialCharactersPlugin.native-7f06d4ba.mjs → SpecialCharactersPlugin.native-DaG4b19I.mjs} +101 -85
- package/dist/{SpellCheckPlugin.native-04e20834.mjs → SpellCheckPlugin.native-BZB9AewP.mjs} +21 -41
- package/dist/{StrikethroughPlugin.native-905e9501.mjs → StrikethroughPlugin.native-V0TL4F48.mjs} +12 -30
- package/dist/{TablePlugin.native-7d5458c1.mjs → TablePlugin.native-DrHX-efe.mjs} +30 -58
- package/dist/TemplatePlugin.native-DLjFUaPW.mjs +1150 -0
- package/dist/{TextAlignmentPlugin.native-9357b3ed.mjs → TextAlignmentPlugin.native-sM_1s00t.mjs} +6 -11
- package/dist/{TextColorPlugin.native-d53ed459.mjs → TextColorPlugin.native-Bwl_bSmc.mjs} +14 -26
- package/dist/{TrackChangesPlugin.native-e96da509.mjs → TrackChangesPlugin.native-Bghu2q4a.mjs} +58 -115
- package/dist/{TranslationWorkflowPlugin.native-4e711b1e.mjs → TranslationWorkflowPlugin.native-DdF16tgT.mjs} +191 -257
- package/dist/{UnderlinePlugin.native-8080c998.mjs → UnderlinePlugin.native-DZzg23rv.mjs} +8 -4
- package/dist/{VersionDiffPlugin.native-5bbeff85.mjs → VersionDiffPlugin.native-Bvxgy--t.mjs} +26 -51
- package/dist/_commonjsHelpers-DOllISpa.mjs +32 -0
- package/dist/{anchoredPopover-5cca53ba.mjs → anchoredPopover-Bxds0VoB.mjs} +1 -1
- package/dist/core.css +1 -0
- package/dist/documentManager-vQ1VkbUY.mjs +8418 -0
- package/dist/{editorContainerHelpers-69585c07.mjs → editorContainerHelpers-C7kdWnS0.mjs} +2 -3
- package/dist/editora.min.js +13 -14
- package/dist/editora.umd.js +13 -14
- package/dist/{html2canvas.esm-c51cb3b9.mjs → html2canvas.esm-AYkPY5LS.mjs} +894 -978
- package/dist/index-BslAFzmv.mjs +16544 -0
- package/dist/index-CPMGUZfB.js +10 -0
- package/dist/{index-7da30697.mjs → index-DBoj6QfW.mjs} +127 -164
- package/dist/index.cjs.js +1 -1
- package/dist/index.es-BYD2KEo6.mjs +6666 -0
- package/dist/index.esm.js +7 -12
- package/dist/inlineFormatting-DJ0-NZtx.mjs +97 -0
- package/dist/{jspdf.es.min-780c82db.mjs → jspdf.es.min-BJGtOnRT.mjs} +3784 -4808
- package/dist/plugin-loader.js +67 -67
- package/dist/{purify.es-3bdbcfc5.mjs → purify.es-CKpwg8Tk.mjs} +10 -20
- package/dist/webcomponent-core.js +131 -168
- package/dist/webcomponent-core.min.css +1 -1
- package/dist/webcomponent-core.min.js +147 -65
- package/dist/webcomponent.cjs.js +1 -1
- package/dist/webcomponent.esm.js +1 -1
- package/dist/webcomponent.js +191 -228
- package/dist/webcomponent.min.css +1 -1
- package/dist/webcomponent.min.js +1248 -1346
- package/package.json +1 -1
- package/dist/BlockquotePlugin.native-3541c714.mjs +0 -49
- package/dist/CapitalizationPlugin.native-42c135dc.mjs +0 -80
- package/dist/ChecklistPlugin.native-3b397ee9.mjs +0 -330
- package/dist/ClearFormattingPlugin.native-77baa514.mjs +0 -145
- package/dist/CodePlugin.native-989cf0aa.mjs +0 -2740
- package/dist/DirectionPlugin.native-4e742f42.mjs +0 -139
- package/dist/EmbedIframePlugin.native-55209c87.mjs +0 -568
- package/dist/HeadingPlugin.native-e38c4a16.mjs +0 -64
- package/dist/MathPlugin.native-735bbac2.mjs +0 -296
- package/dist/MergeTagPlugin.native-31cf7d48.mjs +0 -584
- package/dist/TemplatePlugin.native-580f0f63.mjs +0 -617
- package/dist/_commonjsHelpers-69d58be2.mjs +0 -31
- package/dist/documentManager-8327fb6e.mjs +0 -9166
- package/dist/index-072ef022.js +0 -11
- package/dist/index-49d31221.mjs +0 -16860
- package/dist/index.es-b47a189f.mjs +0 -5782
- package/dist/style.css +0 -1
package/README.md
CHANGED
|
@@ -276,7 +276,7 @@ MIT © [Ajay Kumar](https://github.com/ajaykr089)
|
|
|
276
276
|
|
|
277
277
|
## 🔗 Links
|
|
278
278
|
|
|
279
|
-
- [Documentation](https://
|
|
279
|
+
- [Documentation](https://editora-ecosystem.netlify.app/)
|
|
280
280
|
- [GitHub Repository](https://github.com/ajaykr089/Editora)
|
|
281
281
|
- [Issue Tracker](https://github.com/ajaykr089/Editora/issues)
|
|
282
282
|
- [npm Package](https://www.npmjs.com/package/@editora/core)
|
package/dist/{A11yCheckerPlugin.native-58d12bed.mjs → A11yCheckerPlugin.native-BRdGYMju.mjs}
RENAMED
|
@@ -36,8 +36,7 @@ b({
|
|
|
36
36
|
evaluate(t, n) {
|
|
37
37
|
var c;
|
|
38
38
|
const e = t;
|
|
39
|
-
if (e.hasAttribute("data-a11y-ignore") && e.getAttribute("data-a11y-ignore") === "empty-interactive")
|
|
40
|
-
return null;
|
|
39
|
+
if (e.hasAttribute("data-a11y-ignore") && e.getAttribute("data-a11y-ignore") === "empty-interactive") return null;
|
|
41
40
|
const r = (c = e.textContent) == null ? void 0 : c.trim(), a = e.hasAttribute("aria-label"), i = e.hasAttribute("aria-labelledby"), s = e.hasAttribute("title");
|
|
42
41
|
return !r && !a && !i && !s ? {
|
|
43
42
|
id: `interactive-empty-${n.cache.get("buttonIdx")}`,
|
|
@@ -64,8 +63,7 @@ b({
|
|
|
64
63
|
selector: "input, textarea, select",
|
|
65
64
|
evaluate(t, n) {
|
|
66
65
|
const e = t;
|
|
67
|
-
if (e.hasAttribute("type") && e.getAttribute("type") === "hidden" || e.hasAttribute("data-a11y-ignore") && e.getAttribute("data-a11y-ignore") === "form-label")
|
|
68
|
-
return null;
|
|
66
|
+
if (e.hasAttribute("type") && e.getAttribute("type") === "hidden" || e.hasAttribute("data-a11y-ignore") && e.getAttribute("data-a11y-ignore") === "form-label") return null;
|
|
69
67
|
const r = n.doc.querySelector(`label[for="${e.getAttribute("id")}"]`), a = e.hasAttribute("aria-label"), i = e.hasAttribute("aria-labelledby");
|
|
70
68
|
return !r && !a && !i ? {
|
|
71
69
|
id: `form-label-${n.cache.get("inputIdx")}`,
|
|
@@ -92,8 +90,7 @@ b({
|
|
|
92
90
|
selector: "table",
|
|
93
91
|
evaluate(t, n) {
|
|
94
92
|
const e = t;
|
|
95
|
-
if (e.hasAttribute("data-a11y-ignore") && e.getAttribute("data-a11y-ignore") === "table-headers")
|
|
96
|
-
return null;
|
|
93
|
+
if (e.hasAttribute("data-a11y-ignore") && e.getAttribute("data-a11y-ignore") === "table-headers") return null;
|
|
97
94
|
const r = e.querySelectorAll("th"), a = e.querySelectorAll("tr");
|
|
98
95
|
return r.length === 0 && a.length > 0 ? {
|
|
99
96
|
id: `table-no-headers-${n.cache.get("tableIdx")}`,
|
|
@@ -129,8 +126,7 @@ b({
|
|
|
129
126
|
evaluate(t, n) {
|
|
130
127
|
var i;
|
|
131
128
|
const e = t;
|
|
132
|
-
if (e.hasAttribute("data-a11y-ignore") && e.getAttribute("data-a11y-ignore") === "heading-empty")
|
|
133
|
-
return null;
|
|
129
|
+
if (e.hasAttribute("data-a11y-ignore") && e.getAttribute("data-a11y-ignore") === "heading-empty") return null;
|
|
134
130
|
const r = ((i = e.textContent) == null ? void 0 : i.replace(/\s+/g, "")) || "", a = e.childNodes.length === 1 && e.childNodes[0].nodeName === "BR";
|
|
135
131
|
return !r && !a ? {
|
|
136
132
|
id: `heading-empty-${n.cache.get("headingIdx")}`,
|
|
@@ -175,8 +171,7 @@ b({
|
|
|
175
171
|
evaluate(t, n) {
|
|
176
172
|
var s, c;
|
|
177
173
|
const e = t;
|
|
178
|
-
if (e.hasAttribute("data-a11y-ignore") && e.getAttribute("data-a11y-ignore") === "link-text")
|
|
179
|
-
return null;
|
|
174
|
+
if (e.hasAttribute("data-a11y-ignore") && e.getAttribute("data-a11y-ignore") === "link-text") return null;
|
|
180
175
|
const r = ((s = e.textContent) == null ? void 0 : s.replace(/\s+/g, "").toLowerCase()) || "", a = e.childNodes.length === 1 && e.childNodes[0].nodeName === "BR", i = ["clickhere", "readmore", "link", "here", "this", "page"];
|
|
181
176
|
return !r && !a ? {
|
|
182
177
|
id: `link-empty-${n.cache.get("aIdx")}`,
|
|
@@ -213,8 +208,7 @@ b({
|
|
|
213
208
|
selector: "ul, ol",
|
|
214
209
|
evaluate(t, n) {
|
|
215
210
|
const e = t;
|
|
216
|
-
if (e.hasAttribute("data-a11y-ignore") && e.getAttribute("data-a11y-ignore") === "list-structure")
|
|
217
|
-
return null;
|
|
211
|
+
if (e.hasAttribute("data-a11y-ignore") && e.getAttribute("data-a11y-ignore") === "list-structure") return null;
|
|
218
212
|
const r = e.querySelectorAll(":scope > li");
|
|
219
213
|
return Array.from(e.children).filter((i) => i.tagName !== "LI").length > 0 ? {
|
|
220
214
|
id: `list-structure-${n.cache.get("ulIdx")}`,
|
|
@@ -257,27 +251,23 @@ const w = () => {
|
|
|
257
251
|
if (n.getAttribute("contenteditable") === "true")
|
|
258
252
|
return n;
|
|
259
253
|
const e = n.closest('[contenteditable="true"]');
|
|
260
|
-
if (e)
|
|
261
|
-
return e;
|
|
254
|
+
if (e) return e;
|
|
262
255
|
}
|
|
263
256
|
return document.querySelector('[contenteditable="true"]');
|
|
264
257
|
}, T = () => {
|
|
265
258
|
const t = w();
|
|
266
|
-
if (t != null && t.closest(v))
|
|
267
|
-
return !0;
|
|
259
|
+
if (t != null && t.closest(v)) return !0;
|
|
268
260
|
const n = window.getSelection();
|
|
269
261
|
if (n && n.rangeCount > 0) {
|
|
270
262
|
const r = n.getRangeAt(0).startContainer, a = r.nodeType === Node.ELEMENT_NODE ? r : r.parentElement;
|
|
271
|
-
if (a != null && a.closest(v))
|
|
272
|
-
return !0;
|
|
263
|
+
if (a != null && a.closest(v)) return !0;
|
|
273
264
|
}
|
|
274
265
|
const e = document.activeElement;
|
|
275
266
|
return e != null && e.closest(v) ? !0 : document.body.matches(v) || document.documentElement.matches(v);
|
|
276
267
|
}, k = () => {
|
|
277
268
|
var h, u, y;
|
|
278
269
|
const t = w();
|
|
279
|
-
if (!t)
|
|
280
|
-
return [];
|
|
270
|
+
if (!t) return [];
|
|
281
271
|
const n = [], e = { doc: t.ownerDocument || document, cache: /* @__PURE__ */ new Map() }, r = e.doc.createTreeWalker(t, NodeFilter.SHOW_ELEMENT, null);
|
|
282
272
|
let a = r.currentNode, i = {}, s = {}, c = 0;
|
|
283
273
|
for (; a && c < 5e3; ) {
|
|
@@ -288,8 +278,7 @@ const w = () => {
|
|
|
288
278
|
}
|
|
289
279
|
i[o] = (i[o] || 0) + 1, s[o] = `${o}[${i[o] - 1}]`;
|
|
290
280
|
for (const d of A) {
|
|
291
|
-
if (C.has(d.id) || d.selector && !((y = a.matches) != null && y.call(a, d.selector)))
|
|
292
|
-
continue;
|
|
281
|
+
if (C.has(d.id) || d.selector && !((y = a.matches) != null && y.call(a, d.selector))) continue;
|
|
293
282
|
e.cache.set(`${o}Idx`, i[o] - 1), e.cache.set(`${o}Path`, s[o]), /^h[1-6]$/.test(o) && (e.cache.set("headingIdx", i[o] - 1), e.cache.set("headingPath", s[o])), o === "a" && (e.cache.set("aIdx", i[o] - 1), e.cache.set("aPath", s[o])), o === "table" && (e.cache.set("tableIdx", i[o] - 1), e.cache.set("tablePath", s[o])), o === "button" && (e.cache.set("buttonIdx", i[o] - 1), e.cache.set("buttonPath", s[o])), o === "input" && (e.cache.set("inputIdx", i[o] - 1), e.cache.set("inputPath", s[o])), (o === "ul" || o === "ol") && (e.cache.set("ulIdx", i[o] - 1), e.cache.set("ulPath", s[o]));
|
|
294
283
|
const p = d.evaluate(a, e);
|
|
295
284
|
p && n.push(p);
|
|
@@ -535,4 +524,4 @@ export {
|
|
|
535
524
|
P as suppressRule,
|
|
536
525
|
N as unsuppressRule
|
|
537
526
|
};
|
|
538
|
-
//# sourceMappingURL=A11yCheckerPlugin.native-
|
|
527
|
+
//# sourceMappingURL=A11yCheckerPlugin.native-BRdGYMju.mjs.map
|
|
@@ -1,32 +1,30 @@
|
|
|
1
|
-
import { f as D, g as S } from "./editorContainerHelpers-
|
|
2
|
-
const
|
|
3
|
-
function z(t,
|
|
4
|
-
if (
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
if (typeof s == "function")
|
|
1
|
+
import { f as D, g as S } from "./editorContainerHelpers-C7kdWnS0.mjs";
|
|
2
|
+
const b = /* @__PURE__ */ new Set(), y = '[data-theme="dark"], .dark, .editora-theme-dark';
|
|
3
|
+
function z(t, l) {
|
|
4
|
+
if (l === t.innerHTML) return;
|
|
5
|
+
const i = window.execEditorCommand || window.executeEditorCommand;
|
|
6
|
+
if (typeof i == "function")
|
|
8
7
|
try {
|
|
9
|
-
|
|
10
|
-
} catch (
|
|
8
|
+
i("recordDomTransaction", t, l, t.innerHTML);
|
|
9
|
+
} catch (r) {
|
|
11
10
|
}
|
|
12
11
|
}
|
|
13
12
|
function R() {
|
|
14
|
-
if (typeof window == "undefined" || window.__anchorObserverInitialized)
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
c && h.delete(c);
|
|
13
|
+
if (typeof window == "undefined" || window.__anchorObserverInitialized) return;
|
|
14
|
+
window.__anchorObserverInitialized = !0, new MutationObserver((l) => {
|
|
15
|
+
l.forEach((i) => {
|
|
16
|
+
i.removedNodes.forEach((r) => {
|
|
17
|
+
var n, e;
|
|
18
|
+
if (r.nodeType === Node.ELEMENT_NODE) {
|
|
19
|
+
const a = r;
|
|
20
|
+
if ((n = a.classList) != null && n.contains("rte-anchor")) {
|
|
21
|
+
const c = a.id;
|
|
22
|
+
c && b.delete(c);
|
|
25
23
|
}
|
|
26
|
-
const f = (e =
|
|
24
|
+
const f = (e = a.querySelectorAll) == null ? void 0 : e.call(a, ".rte-anchor");
|
|
27
25
|
f == null || f.forEach((c) => {
|
|
28
26
|
const u = c.id;
|
|
29
|
-
u &&
|
|
27
|
+
u && b.delete(u);
|
|
30
28
|
});
|
|
31
29
|
}
|
|
32
30
|
});
|
|
@@ -41,35 +39,31 @@ function A(t) {
|
|
|
41
39
|
}
|
|
42
40
|
function M() {
|
|
43
41
|
const t = D();
|
|
44
|
-
if (!t)
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
e && n.add(e);
|
|
53
|
-
}), h.clear(), n.forEach((a) => h.add(a));
|
|
42
|
+
if (!t) return;
|
|
43
|
+
const l = S(t);
|
|
44
|
+
if (!l) return;
|
|
45
|
+
const i = l.querySelectorAll(".rte-anchor"), r = /* @__PURE__ */ new Set();
|
|
46
|
+
i.forEach((n) => {
|
|
47
|
+
const e = n.id;
|
|
48
|
+
e && r.add(e);
|
|
49
|
+
}), b.clear(), r.forEach((n) => b.add(n));
|
|
54
50
|
}
|
|
55
51
|
function H(t) {
|
|
56
52
|
if (t) {
|
|
57
|
-
const
|
|
58
|
-
if (
|
|
59
|
-
return !0;
|
|
53
|
+
const r = t.startContainer, n = r.nodeType === Node.ELEMENT_NODE ? r : r.parentElement;
|
|
54
|
+
if (n != null && n.closest(y)) return !0;
|
|
60
55
|
}
|
|
61
|
-
const
|
|
62
|
-
if (
|
|
63
|
-
const
|
|
64
|
-
if (
|
|
65
|
-
return !0;
|
|
56
|
+
const l = window.getSelection();
|
|
57
|
+
if (l && l.rangeCount > 0) {
|
|
58
|
+
const r = l.getRangeAt(0).startContainer, n = r.nodeType === Node.ELEMENT_NODE ? r : r.parentElement;
|
|
59
|
+
if (n != null && n.closest(y)) return !0;
|
|
66
60
|
}
|
|
67
|
-
const
|
|
68
|
-
return
|
|
61
|
+
const i = document.activeElement;
|
|
62
|
+
return i != null && i.closest(y) ? !0 : document.body.matches(y) || document.documentElement.matches(y);
|
|
69
63
|
}
|
|
70
|
-
function _(t,
|
|
64
|
+
function _(t, l, i, r) {
|
|
71
65
|
M();
|
|
72
|
-
const
|
|
66
|
+
const n = H(r), e = n ? {
|
|
73
67
|
overlay: "rgba(0, 0, 0, 0.62)",
|
|
74
68
|
dialogBg: "#1f2937",
|
|
75
69
|
panelBg: "#222d3a",
|
|
@@ -81,7 +75,6 @@ function _(t, d, s, n) {
|
|
|
81
75
|
fieldFocusBg: "#111827",
|
|
82
76
|
fieldBorder: "#4b5563",
|
|
83
77
|
fieldText: "#e2e8f0",
|
|
84
|
-
fieldPlaceholder: "#94a3b8",
|
|
85
78
|
fieldErrorBg: "#3f2124",
|
|
86
79
|
fieldErrorBorder: "#ef4444",
|
|
87
80
|
cancelBg: "#334155",
|
|
@@ -106,7 +99,6 @@ function _(t, d, s, n) {
|
|
|
106
99
|
fieldFocusBg: "#f9f9ff",
|
|
107
100
|
fieldBorder: "#d0d0d0",
|
|
108
101
|
fieldText: "#333333",
|
|
109
|
-
fieldPlaceholder: "#9ca3af",
|
|
110
102
|
fieldErrorBg: "#ffebee",
|
|
111
103
|
fieldErrorBorder: "#d32f2f",
|
|
112
104
|
cancelBg: "#f0f0f0",
|
|
@@ -119,8 +111,8 @@ function _(t, d, s, n) {
|
|
|
119
111
|
help: "#999999",
|
|
120
112
|
focusRing: "rgba(0, 102, 204, 0.1)",
|
|
121
113
|
errorRing: "rgba(211, 47, 47, 0.1)"
|
|
122
|
-
},
|
|
123
|
-
|
|
114
|
+
}, a = document.createElement("div");
|
|
115
|
+
a.className = "rte-anchor-dialog-overlay", a.style.cssText = `
|
|
124
116
|
position: fixed;
|
|
125
117
|
top: 0;
|
|
126
118
|
left: 0;
|
|
@@ -144,8 +136,8 @@ function _(t, d, s, n) {
|
|
|
144
136
|
overflow: hidden;
|
|
145
137
|
animation: rte-anchor-dialog-appear 0.2s ease;
|
|
146
138
|
`, !document.getElementById("rte-anchor-dialog-styles")) {
|
|
147
|
-
const
|
|
148
|
-
|
|
139
|
+
const d = document.createElement("style");
|
|
140
|
+
d.id = "rte-anchor-dialog-styles", d.textContent = `
|
|
149
141
|
@keyframes rte-anchor-dialog-appear {
|
|
150
142
|
from { opacity: 0; transform: scale(0.95); }
|
|
151
143
|
to { opacity: 1; transform: scale(1); }
|
|
@@ -153,7 +145,7 @@ function _(t, d, s, n) {
|
|
|
153
145
|
.rte-anchor-dialog input:focus {
|
|
154
146
|
outline: none !important;
|
|
155
147
|
}
|
|
156
|
-
`, document.head.appendChild(
|
|
148
|
+
`, document.head.appendChild(d);
|
|
157
149
|
}
|
|
158
150
|
let c = "";
|
|
159
151
|
const u = document.createElement("div");
|
|
@@ -165,8 +157,8 @@ function _(t, d, s, n) {
|
|
|
165
157
|
border-bottom: 1px solid ${e.border};
|
|
166
158
|
background: ${e.panelBg};
|
|
167
159
|
`;
|
|
168
|
-
const
|
|
169
|
-
|
|
160
|
+
const m = document.createElement("h3");
|
|
161
|
+
m.style.cssText = `margin: 0; font-size: 18px; font-weight: 600; color: ${e.text};`, m.textContent = "Add Anchor";
|
|
170
162
|
const p = document.createElement("button");
|
|
171
163
|
p.textContent = "✕", p.style.cssText = `
|
|
172
164
|
background: none;
|
|
@@ -186,15 +178,15 @@ function _(t, d, s, n) {
|
|
|
186
178
|
p.style.background = e.closeHoverBg, p.style.color = "#f8fafc";
|
|
187
179
|
}, p.onmouseout = () => {
|
|
188
180
|
p.style.background = "none", p.style.color = e.muted;
|
|
189
|
-
}, u.appendChild(
|
|
181
|
+
}, u.appendChild(m), u.appendChild(p);
|
|
190
182
|
const C = document.createElement("div");
|
|
191
183
|
C.style.cssText = "padding: 20px;";
|
|
192
|
-
const
|
|
193
|
-
|
|
184
|
+
const x = document.createElement("div");
|
|
185
|
+
x.style.cssText = "margin-bottom: 0;";
|
|
194
186
|
const v = document.createElement("label");
|
|
195
187
|
v.textContent = "Anchor ID", v.style.cssText = `display: block; font-size: 14px; font-weight: 500; color: ${e.text}; margin-bottom: 8px;`, v.setAttribute("for", "anchor-id-input");
|
|
196
188
|
const o = document.createElement("input");
|
|
197
|
-
o.id = "anchor-id-input", o.type = "text", o.placeholder = "e.g., section-introduction", o.value =
|
|
189
|
+
o.id = "anchor-id-input", o.type = "text", o.placeholder = "e.g., section-introduction", o.value = "", o.style.cssText = `
|
|
198
190
|
width: 100%;
|
|
199
191
|
padding: 10px 12px;
|
|
200
192
|
font-size: 14px;
|
|
@@ -214,9 +206,9 @@ function _(t, d, s, n) {
|
|
|
214
206
|
display: none;
|
|
215
207
|
`;
|
|
216
208
|
const B = document.createElement("div");
|
|
217
|
-
B.textContent = "URL-safe ID (letters, numbers, hyphens, underscores). Must start with letter or underscore.", B.style.cssText = `color: ${e.help}; font-size: 12px; margin-top: 8px; line-height: 1.4;`,
|
|
218
|
-
const
|
|
219
|
-
|
|
209
|
+
B.textContent = "URL-safe ID (letters, numbers, hyphens, underscores). Must start with letter or underscore.", B.style.cssText = `color: ${e.help}; font-size: 12px; margin-top: 8px; line-height: 1.4;`, x.appendChild(v), x.appendChild(o), x.appendChild(g), x.appendChild(B), C.appendChild(x);
|
|
210
|
+
const w = document.createElement("div");
|
|
211
|
+
w.style.cssText = `
|
|
220
212
|
display: flex;
|
|
221
213
|
gap: 12px;
|
|
222
214
|
padding: 16px 20px;
|
|
@@ -224,8 +216,8 @@ function _(t, d, s, n) {
|
|
|
224
216
|
background: ${e.panelBg};
|
|
225
217
|
justify-content: flex-end;
|
|
226
218
|
`;
|
|
227
|
-
const
|
|
228
|
-
|
|
219
|
+
const h = document.createElement("button");
|
|
220
|
+
h.textContent = "Cancel", h.style.cssText = `
|
|
229
221
|
padding: 8px 16px;
|
|
230
222
|
font-size: 14px;
|
|
231
223
|
font-weight: 500;
|
|
@@ -235,9 +227,9 @@ function _(t, d, s, n) {
|
|
|
235
227
|
transition: all 0.2s ease;
|
|
236
228
|
background: ${e.cancelBg};
|
|
237
229
|
color: ${e.cancelText};
|
|
238
|
-
`,
|
|
239
|
-
const
|
|
240
|
-
|
|
230
|
+
`, h.onmouseover = () => h.style.background = e.cancelHover, h.onmouseout = () => h.style.background = e.cancelBg;
|
|
231
|
+
const s = document.createElement("button");
|
|
232
|
+
s.textContent = "Add Anchor", s.style.cssText = `
|
|
241
233
|
padding: 8px 16px;
|
|
242
234
|
font-size: 14px;
|
|
243
235
|
font-weight: 500;
|
|
@@ -247,19 +239,19 @@ function _(t, d, s, n) {
|
|
|
247
239
|
transition: all 0.2s ease;
|
|
248
240
|
background: ${e.saveBg};
|
|
249
241
|
color: white;
|
|
250
|
-
`,
|
|
242
|
+
`, s.disabled = !o.value.trim();
|
|
251
243
|
const $ = () => {
|
|
252
|
-
o.value.trim() ? (
|
|
244
|
+
o.value.trim() ? (s.disabled = !1, s.style.background = e.saveBg, s.style.color = "white", s.style.cursor = "pointer") : (s.disabled = !0, s.style.background = e.saveDisabledBg, s.style.color = e.saveDisabledText, s.style.cursor = "not-allowed");
|
|
253
245
|
};
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
},
|
|
257
|
-
|
|
258
|
-
},
|
|
259
|
-
const
|
|
260
|
-
if ($(),
|
|
261
|
-
const k = A(
|
|
262
|
-
k.valid ?
|
|
246
|
+
s.onmouseover = () => {
|
|
247
|
+
s.disabled || (s.style.background = e.saveHover, s.style.boxShadow = n ? "0 2px 8px rgba(59, 130, 246, 0.35)" : "0 2px 8px rgba(0, 102, 204, 0.3)");
|
|
248
|
+
}, s.onmouseout = () => {
|
|
249
|
+
s.disabled || (s.style.background = e.saveBg, s.style.boxShadow = "none");
|
|
250
|
+
}, w.appendChild(h), w.appendChild(s), o.oninput = () => {
|
|
251
|
+
const d = o.value;
|
|
252
|
+
if ($(), d.trim()) {
|
|
253
|
+
const k = A(d);
|
|
254
|
+
k.valid ? b.has(d) ? (c = `Anchor ID already exists: ${d}`, g.textContent = "⚠ " + c, g.style.display = "block", o.style.borderColor = e.fieldErrorBorder, o.style.background = e.fieldErrorBg) : (c = "", g.style.display = "none", o.style.borderColor = e.fieldBorder, o.style.background = e.fieldBg) : (c = k.error, g.textContent = "⚠ " + c, g.style.display = "block", o.style.borderColor = e.fieldErrorBorder, o.style.background = e.fieldErrorBg);
|
|
263
255
|
} else
|
|
264
256
|
g.style.display = "none", o.style.borderColor = e.fieldBorder, o.style.background = e.fieldBg;
|
|
265
257
|
}, o.onfocus = () => {
|
|
@@ -268,60 +260,58 @@ function _(t, d, s, n) {
|
|
|
268
260
|
o.style.boxShadow = "none", c || (o.style.background = e.fieldBg);
|
|
269
261
|
};
|
|
270
262
|
const T = () => {
|
|
271
|
-
const
|
|
272
|
-
!
|
|
273
|
-
},
|
|
274
|
-
|
|
263
|
+
const d = o.value.trim();
|
|
264
|
+
!d || !A(d).valid || b.has(d) || (i && i(d), a.remove());
|
|
265
|
+
}, E = () => {
|
|
266
|
+
a.remove();
|
|
275
267
|
};
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
},
|
|
279
|
-
|
|
280
|
-
}, f.appendChild(u), f.appendChild(C), f.appendChild(
|
|
268
|
+
s.onclick = T, h.onclick = E, p.onclick = E, o.onkeydown = (d) => {
|
|
269
|
+
d.key === "Enter" ? (d.preventDefault(), T()) : d.key === "Escape" && (d.preventDefault(), E());
|
|
270
|
+
}, a.onclick = (d) => {
|
|
271
|
+
d.target === a && E();
|
|
272
|
+
}, f.appendChild(u), f.appendChild(C), f.appendChild(w), a.appendChild(f), document.body.appendChild(a), setTimeout(() => o.focus(), 100);
|
|
281
273
|
}
|
|
282
|
-
function I(t,
|
|
274
|
+
function I(t, l) {
|
|
283
275
|
var c;
|
|
284
|
-
let
|
|
285
|
-
if (
|
|
286
|
-
|
|
276
|
+
let i;
|
|
277
|
+
if (l)
|
|
278
|
+
i = l;
|
|
287
279
|
else {
|
|
288
280
|
const u = window.getSelection();
|
|
289
|
-
if (!u || u.rangeCount === 0)
|
|
290
|
-
|
|
291
|
-
s = u.getRangeAt(0);
|
|
281
|
+
if (!u || u.rangeCount === 0) return;
|
|
282
|
+
i = u.getRangeAt(0);
|
|
292
283
|
}
|
|
293
|
-
let
|
|
294
|
-
for (;
|
|
295
|
-
if (
|
|
296
|
-
const u =
|
|
284
|
+
let r = null, n = i.startContainer;
|
|
285
|
+
for (; n && n !== document.body; ) {
|
|
286
|
+
if (n.nodeType === Node.ELEMENT_NODE) {
|
|
287
|
+
const u = n;
|
|
297
288
|
if (u.getAttribute("contenteditable") === "true") {
|
|
298
|
-
|
|
289
|
+
r = u;
|
|
299
290
|
break;
|
|
300
291
|
}
|
|
301
292
|
}
|
|
302
|
-
|
|
293
|
+
n = n.parentNode;
|
|
303
294
|
}
|
|
304
|
-
const e = (c =
|
|
305
|
-
|
|
295
|
+
const e = (c = r == null ? void 0 : r.innerHTML) != null ? c : "", a = document.createElement("span");
|
|
296
|
+
a.id = t, a.className = "rte-anchor", a.setAttribute("data-type", "anchor"), a.setAttribute("data-anchor-id", t), a.setAttribute("title", `Anchor: ${t}`), a.style.cssText = `
|
|
306
297
|
display: inline;
|
|
307
298
|
position: relative;
|
|
308
299
|
cursor: pointer;
|
|
309
|
-
`,
|
|
300
|
+
`, i.insertNode(a), b.add(t), i.setStart(a.nextSibling || a.parentNode, 0), i.collapse(!0);
|
|
310
301
|
const f = window.getSelection();
|
|
311
|
-
if (f && (f.removeAllRanges(), f.addRange(
|
|
312
|
-
z(
|
|
302
|
+
if (f && (f.removeAllRanges(), f.addRange(i)), r)
|
|
303
|
+
z(r, e), r.dispatchEvent(new Event("input", { bubbles: !0 }));
|
|
313
304
|
else {
|
|
314
305
|
const u = D();
|
|
315
306
|
if (u) {
|
|
316
|
-
const
|
|
317
|
-
|
|
307
|
+
const m = S(u);
|
|
308
|
+
m && m.dispatchEvent(new Event("input", { bubbles: !0 }));
|
|
318
309
|
}
|
|
319
310
|
}
|
|
320
311
|
N();
|
|
321
312
|
}
|
|
322
313
|
function N() {
|
|
323
|
-
if (document.getElementById("rte-anchor-styles"))
|
|
324
|
-
return;
|
|
314
|
+
if (document.getElementById("rte-anchor-styles")) return;
|
|
325
315
|
const t = document.createElement("style");
|
|
326
316
|
t.id = "rte-anchor-styles", t.textContent = `
|
|
327
317
|
.rte-anchor {
|
|
@@ -419,10 +409,10 @@ const O = () => (typeof window != "undefined" && (R(), N()), {
|
|
|
419
409
|
const t = window.getSelection();
|
|
420
410
|
if (!t || t.rangeCount === 0)
|
|
421
411
|
return alert("Please place your cursor where you want to insert the anchor."), !1;
|
|
422
|
-
const
|
|
423
|
-
return _("add", "", (
|
|
424
|
-
I(
|
|
425
|
-
},
|
|
412
|
+
const l = t.getRangeAt(0).cloneRange();
|
|
413
|
+
return _("add", "", (i) => {
|
|
414
|
+
I(i, l);
|
|
415
|
+
}, l), !0;
|
|
426
416
|
} catch (t) {
|
|
427
417
|
return console.error("Failed to insert anchor:", t), !1;
|
|
428
418
|
}
|
|
@@ -435,4 +425,4 @@ const O = () => (typeof window != "undefined" && (R(), N()), {
|
|
|
435
425
|
export {
|
|
436
426
|
O as AnchorPlugin
|
|
437
427
|
};
|
|
438
|
-
//# sourceMappingURL=AnchorPlugin.native-
|
|
428
|
+
//# sourceMappingURL=AnchorPlugin.native-BcYGEtd9.mjs.map
|