@editora/core 1.0.7 → 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-449ce66c.mjs +1115 -0
- 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-1cc51e63.mjs +1386 -0
- 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-169fb1e8.mjs +1532 -0
- 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-4983143a.mjs +1424 -0
- package/dist/ContentRulesPlugin.native-63ed405b.mjs +1149 -0
- package/dist/DataBindingPlugin.native-427e9d75.mjs +956 -0
- package/dist/{DirectionPlugin.native-CDnbdNyl.mjs → DirectionPlugin.native-4e742f42.mjs} +19 -10
- package/dist/DocSchemaPlugin.native-8e41eda0.mjs +1382 -0
- 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-3b1e8c05.mjs +778 -0
- package/dist/{MergeTagPlugin.native-C3eOfEgw.mjs → MergeTagPlugin.native-31cf7d48.mjs} +51 -26
- package/dist/PIIRedactionPlugin.native-7ab10b9f.mjs +1449 -0
- package/dist/{PageBreakPlugin.native-CXdX5fAv.mjs → PageBreakPlugin.native-1794c5fb.mjs} +67 -52
- package/dist/{PreviewPlugin.native-DBvfpmIv.mjs → PreviewPlugin.native-f7b67cc0.mjs} +38 -33
- package/dist/{PrintPlugin.native-7qt5v7L5.mjs → PrintPlugin.native-f6a168c2.mjs} +5 -3
- package/dist/SlashCommandsPlugin.native-8d45e511.mjs +790 -0
- package/dist/SmartPastePlugin.native-a6c5efec.mjs +1447 -0
- 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-e96da509.mjs +818 -0
- package/dist/TranslationWorkflowPlugin.native-4e711b1e.mjs +1797 -0
- package/dist/{UnderlinePlugin.native-QpIcK4L2.mjs → UnderlinePlugin.native-8080c998.mjs} +1 -1
- package/dist/VersionDiffPlugin.native-5bbeff85.mjs +801 -0
- 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-yzU4NdPT.mjs → index-7da30697.mjs} +490 -358
- 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 +77 -40
- package/dist/{purify.es-CKpwg8Tk.mjs → purify.es-3bdbcfc5.mjs} +20 -10
- package/dist/style.css +1 -0
- package/dist/webcomponent-core.js +546 -414
- package/dist/webcomponent-core.min.css +1 -1
- package/dist/webcomponent-core.min.js +40 -39
- package/dist/webcomponent.cjs.js +1 -1
- package/dist/webcomponent.esm.js +1 -1
- package/dist/webcomponent.js +484 -315
- package/dist/webcomponent.min.css +1 -1
- package/dist/webcomponent.min.js +6035 -558
- package/package.json +11 -5
- package/dist/_commonjsHelpers-DOllISpa.mjs +0 -32
- package/dist/core.css +0 -1
- package/dist/documentManager-vQ1VkbUY.mjs +0 -8418
- package/dist/index-BpE6GFbz.js +0 -10
- package/dist/index-BslAFzmv.mjs +0 -16544
- package/dist/index.es-BYD2KEo6.mjs +0 -6666
package/README.md
CHANGED
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
# @editora/core
|
|
2
2
|
|
|
3
|
+
> [!IMPORTANT]
|
|
4
|
+
> **Live Website:** https://editora-ecosystem.netlify.app/
|
|
5
|
+
> **Storybook:** https://editora-ecosystem-storybook.netlify.app/
|
|
6
|
+
|
|
7
|
+
|
|
3
8
|
<div align="center">
|
|
4
9
|
<img src="../../images/editora_logo_blocks.svg" alt="Editora Logo" width="200" height="auto">
|
|
5
10
|
</div>
|
package/dist/{A11yCheckerPlugin.native-BRdGYMju.mjs → A11yCheckerPlugin.native-58d12bed.mjs}
RENAMED
|
@@ -36,7 +36,8 @@ 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")
|
|
39
|
+
if (e.hasAttribute("data-a11y-ignore") && e.getAttribute("data-a11y-ignore") === "empty-interactive")
|
|
40
|
+
return null;
|
|
40
41
|
const r = (c = e.textContent) == null ? void 0 : c.trim(), a = e.hasAttribute("aria-label"), i = e.hasAttribute("aria-labelledby"), s = e.hasAttribute("title");
|
|
41
42
|
return !r && !a && !i && !s ? {
|
|
42
43
|
id: `interactive-empty-${n.cache.get("buttonIdx")}`,
|
|
@@ -63,7 +64,8 @@ b({
|
|
|
63
64
|
selector: "input, textarea, select",
|
|
64
65
|
evaluate(t, n) {
|
|
65
66
|
const e = t;
|
|
66
|
-
if (e.hasAttribute("type") && e.getAttribute("type") === "hidden" || e.hasAttribute("data-a11y-ignore") && e.getAttribute("data-a11y-ignore") === "form-label")
|
|
67
|
+
if (e.hasAttribute("type") && e.getAttribute("type") === "hidden" || e.hasAttribute("data-a11y-ignore") && e.getAttribute("data-a11y-ignore") === "form-label")
|
|
68
|
+
return null;
|
|
67
69
|
const r = n.doc.querySelector(`label[for="${e.getAttribute("id")}"]`), a = e.hasAttribute("aria-label"), i = e.hasAttribute("aria-labelledby");
|
|
68
70
|
return !r && !a && !i ? {
|
|
69
71
|
id: `form-label-${n.cache.get("inputIdx")}`,
|
|
@@ -90,7 +92,8 @@ b({
|
|
|
90
92
|
selector: "table",
|
|
91
93
|
evaluate(t, n) {
|
|
92
94
|
const e = t;
|
|
93
|
-
if (e.hasAttribute("data-a11y-ignore") && e.getAttribute("data-a11y-ignore") === "table-headers")
|
|
95
|
+
if (e.hasAttribute("data-a11y-ignore") && e.getAttribute("data-a11y-ignore") === "table-headers")
|
|
96
|
+
return null;
|
|
94
97
|
const r = e.querySelectorAll("th"), a = e.querySelectorAll("tr");
|
|
95
98
|
return r.length === 0 && a.length > 0 ? {
|
|
96
99
|
id: `table-no-headers-${n.cache.get("tableIdx")}`,
|
|
@@ -126,7 +129,8 @@ b({
|
|
|
126
129
|
evaluate(t, n) {
|
|
127
130
|
var i;
|
|
128
131
|
const e = t;
|
|
129
|
-
if (e.hasAttribute("data-a11y-ignore") && e.getAttribute("data-a11y-ignore") === "heading-empty")
|
|
132
|
+
if (e.hasAttribute("data-a11y-ignore") && e.getAttribute("data-a11y-ignore") === "heading-empty")
|
|
133
|
+
return null;
|
|
130
134
|
const r = ((i = e.textContent) == null ? void 0 : i.replace(/\s+/g, "")) || "", a = e.childNodes.length === 1 && e.childNodes[0].nodeName === "BR";
|
|
131
135
|
return !r && !a ? {
|
|
132
136
|
id: `heading-empty-${n.cache.get("headingIdx")}`,
|
|
@@ -171,7 +175,8 @@ b({
|
|
|
171
175
|
evaluate(t, n) {
|
|
172
176
|
var s, c;
|
|
173
177
|
const e = t;
|
|
174
|
-
if (e.hasAttribute("data-a11y-ignore") && e.getAttribute("data-a11y-ignore") === "link-text")
|
|
178
|
+
if (e.hasAttribute("data-a11y-ignore") && e.getAttribute("data-a11y-ignore") === "link-text")
|
|
179
|
+
return null;
|
|
175
180
|
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"];
|
|
176
181
|
return !r && !a ? {
|
|
177
182
|
id: `link-empty-${n.cache.get("aIdx")}`,
|
|
@@ -208,7 +213,8 @@ b({
|
|
|
208
213
|
selector: "ul, ol",
|
|
209
214
|
evaluate(t, n) {
|
|
210
215
|
const e = t;
|
|
211
|
-
if (e.hasAttribute("data-a11y-ignore") && e.getAttribute("data-a11y-ignore") === "list-structure")
|
|
216
|
+
if (e.hasAttribute("data-a11y-ignore") && e.getAttribute("data-a11y-ignore") === "list-structure")
|
|
217
|
+
return null;
|
|
212
218
|
const r = e.querySelectorAll(":scope > li");
|
|
213
219
|
return Array.from(e.children).filter((i) => i.tagName !== "LI").length > 0 ? {
|
|
214
220
|
id: `list-structure-${n.cache.get("ulIdx")}`,
|
|
@@ -251,23 +257,27 @@ const w = () => {
|
|
|
251
257
|
if (n.getAttribute("contenteditable") === "true")
|
|
252
258
|
return n;
|
|
253
259
|
const e = n.closest('[contenteditable="true"]');
|
|
254
|
-
if (e)
|
|
260
|
+
if (e)
|
|
261
|
+
return e;
|
|
255
262
|
}
|
|
256
263
|
return document.querySelector('[contenteditable="true"]');
|
|
257
264
|
}, T = () => {
|
|
258
265
|
const t = w();
|
|
259
|
-
if (t != null && t.closest(v))
|
|
266
|
+
if (t != null && t.closest(v))
|
|
267
|
+
return !0;
|
|
260
268
|
const n = window.getSelection();
|
|
261
269
|
if (n && n.rangeCount > 0) {
|
|
262
270
|
const r = n.getRangeAt(0).startContainer, a = r.nodeType === Node.ELEMENT_NODE ? r : r.parentElement;
|
|
263
|
-
if (a != null && a.closest(v))
|
|
271
|
+
if (a != null && a.closest(v))
|
|
272
|
+
return !0;
|
|
264
273
|
}
|
|
265
274
|
const e = document.activeElement;
|
|
266
275
|
return e != null && e.closest(v) ? !0 : document.body.matches(v) || document.documentElement.matches(v);
|
|
267
276
|
}, k = () => {
|
|
268
277
|
var h, u, y;
|
|
269
278
|
const t = w();
|
|
270
|
-
if (!t)
|
|
279
|
+
if (!t)
|
|
280
|
+
return [];
|
|
271
281
|
const n = [], e = { doc: t.ownerDocument || document, cache: /* @__PURE__ */ new Map() }, r = e.doc.createTreeWalker(t, NodeFilter.SHOW_ELEMENT, null);
|
|
272
282
|
let a = r.currentNode, i = {}, s = {}, c = 0;
|
|
273
283
|
for (; a && c < 5e3; ) {
|
|
@@ -278,7 +288,8 @@ const w = () => {
|
|
|
278
288
|
}
|
|
279
289
|
i[o] = (i[o] || 0) + 1, s[o] = `${o}[${i[o] - 1}]`;
|
|
280
290
|
for (const d of A) {
|
|
281
|
-
if (C.has(d.id) || d.selector && !((y = a.matches) != null && y.call(a, d.selector)))
|
|
291
|
+
if (C.has(d.id) || d.selector && !((y = a.matches) != null && y.call(a, d.selector)))
|
|
292
|
+
continue;
|
|
282
293
|
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]));
|
|
283
294
|
const p = d.evaluate(a, e);
|
|
284
295
|
p && n.push(p);
|
|
@@ -524,4 +535,4 @@ export {
|
|
|
524
535
|
P as suppressRule,
|
|
525
536
|
N as unsuppressRule
|
|
526
537
|
};
|
|
527
|
-
//# sourceMappingURL=A11yCheckerPlugin.native-
|
|
538
|
+
//# sourceMappingURL=A11yCheckerPlugin.native-58d12bed.mjs.map
|
|
@@ -1,30 +1,32 @@
|
|
|
1
|
-
import { f as D, g as S } from "./editorContainerHelpers-
|
|
2
|
-
const
|
|
3
|
-
function z(t,
|
|
4
|
-
if (
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
import { f as D, g as S } from "./editorContainerHelpers-69585c07.mjs";
|
|
2
|
+
const h = /* @__PURE__ */ new Set(), m = '[data-theme="dark"], .dark, .editora-theme-dark';
|
|
3
|
+
function z(t, d) {
|
|
4
|
+
if (d === t.innerHTML)
|
|
5
|
+
return;
|
|
6
|
+
const s = window.execEditorCommand || window.executeEditorCommand;
|
|
7
|
+
if (typeof s == "function")
|
|
7
8
|
try {
|
|
8
|
-
|
|
9
|
-
} catch (
|
|
9
|
+
s("recordDomTransaction", t, d, t.innerHTML);
|
|
10
|
+
} catch (n) {
|
|
10
11
|
}
|
|
11
12
|
}
|
|
12
13
|
function R() {
|
|
13
|
-
if (typeof window == "undefined" || window.__anchorObserverInitialized)
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
c
|
|
14
|
+
if (typeof window == "undefined" || window.__anchorObserverInitialized)
|
|
15
|
+
return;
|
|
16
|
+
window.__anchorObserverInitialized = !0, new MutationObserver((d) => {
|
|
17
|
+
d.forEach((s) => {
|
|
18
|
+
s.removedNodes.forEach((n) => {
|
|
19
|
+
var a, e;
|
|
20
|
+
if (n.nodeType === Node.ELEMENT_NODE) {
|
|
21
|
+
const i = n;
|
|
22
|
+
if ((a = i.classList) != null && a.contains("rte-anchor")) {
|
|
23
|
+
const c = i.id;
|
|
24
|
+
c && h.delete(c);
|
|
23
25
|
}
|
|
24
|
-
const f = (e =
|
|
26
|
+
const f = (e = i.querySelectorAll) == null ? void 0 : e.call(i, ".rte-anchor");
|
|
25
27
|
f == null || f.forEach((c) => {
|
|
26
28
|
const u = c.id;
|
|
27
|
-
u &&
|
|
29
|
+
u && h.delete(u);
|
|
28
30
|
});
|
|
29
31
|
}
|
|
30
32
|
});
|
|
@@ -39,31 +41,35 @@ function A(t) {
|
|
|
39
41
|
}
|
|
40
42
|
function M() {
|
|
41
43
|
const t = D();
|
|
42
|
-
if (!t)
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
44
|
+
if (!t)
|
|
45
|
+
return;
|
|
46
|
+
const d = S(t);
|
|
47
|
+
if (!d)
|
|
48
|
+
return;
|
|
49
|
+
const s = d.querySelectorAll(".rte-anchor"), n = /* @__PURE__ */ new Set();
|
|
50
|
+
s.forEach((a) => {
|
|
51
|
+
const e = a.id;
|
|
52
|
+
e && n.add(e);
|
|
53
|
+
}), h.clear(), n.forEach((a) => h.add(a));
|
|
50
54
|
}
|
|
51
55
|
function H(t) {
|
|
52
56
|
if (t) {
|
|
53
|
-
const
|
|
54
|
-
if (
|
|
57
|
+
const n = t.startContainer, a = n.nodeType === Node.ELEMENT_NODE ? n : n.parentElement;
|
|
58
|
+
if (a != null && a.closest(m))
|
|
59
|
+
return !0;
|
|
55
60
|
}
|
|
56
|
-
const
|
|
57
|
-
if (
|
|
58
|
-
const
|
|
59
|
-
if (
|
|
61
|
+
const d = window.getSelection();
|
|
62
|
+
if (d && d.rangeCount > 0) {
|
|
63
|
+
const n = d.getRangeAt(0).startContainer, a = n.nodeType === Node.ELEMENT_NODE ? n : n.parentElement;
|
|
64
|
+
if (a != null && a.closest(m))
|
|
65
|
+
return !0;
|
|
60
66
|
}
|
|
61
|
-
const
|
|
62
|
-
return
|
|
67
|
+
const s = document.activeElement;
|
|
68
|
+
return s != null && s.closest(m) ? !0 : document.body.matches(m) || document.documentElement.matches(m);
|
|
63
69
|
}
|
|
64
|
-
function _(t,
|
|
70
|
+
function _(t, d, s, n) {
|
|
65
71
|
M();
|
|
66
|
-
const
|
|
72
|
+
const a = H(n), e = a ? {
|
|
67
73
|
overlay: "rgba(0, 0, 0, 0.62)",
|
|
68
74
|
dialogBg: "#1f2937",
|
|
69
75
|
panelBg: "#222d3a",
|
|
@@ -75,6 +81,7 @@ function _(t, l, i, r) {
|
|
|
75
81
|
fieldFocusBg: "#111827",
|
|
76
82
|
fieldBorder: "#4b5563",
|
|
77
83
|
fieldText: "#e2e8f0",
|
|
84
|
+
fieldPlaceholder: "#94a3b8",
|
|
78
85
|
fieldErrorBg: "#3f2124",
|
|
79
86
|
fieldErrorBorder: "#ef4444",
|
|
80
87
|
cancelBg: "#334155",
|
|
@@ -99,6 +106,7 @@ function _(t, l, i, r) {
|
|
|
99
106
|
fieldFocusBg: "#f9f9ff",
|
|
100
107
|
fieldBorder: "#d0d0d0",
|
|
101
108
|
fieldText: "#333333",
|
|
109
|
+
fieldPlaceholder: "#9ca3af",
|
|
102
110
|
fieldErrorBg: "#ffebee",
|
|
103
111
|
fieldErrorBorder: "#d32f2f",
|
|
104
112
|
cancelBg: "#f0f0f0",
|
|
@@ -111,8 +119,8 @@ function _(t, l, i, r) {
|
|
|
111
119
|
help: "#999999",
|
|
112
120
|
focusRing: "rgba(0, 102, 204, 0.1)",
|
|
113
121
|
errorRing: "rgba(211, 47, 47, 0.1)"
|
|
114
|
-
},
|
|
115
|
-
|
|
122
|
+
}, i = document.createElement("div");
|
|
123
|
+
i.className = "rte-anchor-dialog-overlay", i.style.cssText = `
|
|
116
124
|
position: fixed;
|
|
117
125
|
top: 0;
|
|
118
126
|
left: 0;
|
|
@@ -136,8 +144,8 @@ function _(t, l, i, r) {
|
|
|
136
144
|
overflow: hidden;
|
|
137
145
|
animation: rte-anchor-dialog-appear 0.2s ease;
|
|
138
146
|
`, !document.getElementById("rte-anchor-dialog-styles")) {
|
|
139
|
-
const
|
|
140
|
-
|
|
147
|
+
const r = document.createElement("style");
|
|
148
|
+
r.id = "rte-anchor-dialog-styles", r.textContent = `
|
|
141
149
|
@keyframes rte-anchor-dialog-appear {
|
|
142
150
|
from { opacity: 0; transform: scale(0.95); }
|
|
143
151
|
to { opacity: 1; transform: scale(1); }
|
|
@@ -145,7 +153,7 @@ function _(t, l, i, r) {
|
|
|
145
153
|
.rte-anchor-dialog input:focus {
|
|
146
154
|
outline: none !important;
|
|
147
155
|
}
|
|
148
|
-
`, document.head.appendChild(
|
|
156
|
+
`, document.head.appendChild(r);
|
|
149
157
|
}
|
|
150
158
|
let c = "";
|
|
151
159
|
const u = document.createElement("div");
|
|
@@ -157,8 +165,8 @@ function _(t, l, i, r) {
|
|
|
157
165
|
border-bottom: 1px solid ${e.border};
|
|
158
166
|
background: ${e.panelBg};
|
|
159
167
|
`;
|
|
160
|
-
const
|
|
161
|
-
|
|
168
|
+
const x = document.createElement("h3");
|
|
169
|
+
x.style.cssText = `margin: 0; font-size: 18px; font-weight: 600; color: ${e.text};`, x.textContent = t === "add" ? "Add Anchor" : "Edit Anchor";
|
|
162
170
|
const p = document.createElement("button");
|
|
163
171
|
p.textContent = "✕", p.style.cssText = `
|
|
164
172
|
background: none;
|
|
@@ -178,15 +186,15 @@ function _(t, l, i, r) {
|
|
|
178
186
|
p.style.background = e.closeHoverBg, p.style.color = "#f8fafc";
|
|
179
187
|
}, p.onmouseout = () => {
|
|
180
188
|
p.style.background = "none", p.style.color = e.muted;
|
|
181
|
-
}, u.appendChild(
|
|
189
|
+
}, u.appendChild(x), u.appendChild(p);
|
|
182
190
|
const C = document.createElement("div");
|
|
183
191
|
C.style.cssText = "padding: 20px;";
|
|
184
|
-
const
|
|
185
|
-
|
|
192
|
+
const y = document.createElement("div");
|
|
193
|
+
y.style.cssText = "margin-bottom: 0;";
|
|
186
194
|
const v = document.createElement("label");
|
|
187
195
|
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");
|
|
188
196
|
const o = document.createElement("input");
|
|
189
|
-
o.id = "anchor-id-input", o.type = "text", o.placeholder = "e.g., section-introduction", o.value = "", o.style.cssText = `
|
|
197
|
+
o.id = "anchor-id-input", o.type = "text", o.placeholder = "e.g., section-introduction", o.value = d || "", o.style.cssText = `
|
|
190
198
|
width: 100%;
|
|
191
199
|
padding: 10px 12px;
|
|
192
200
|
font-size: 14px;
|
|
@@ -206,9 +214,9 @@ function _(t, l, i, r) {
|
|
|
206
214
|
display: none;
|
|
207
215
|
`;
|
|
208
216
|
const B = document.createElement("div");
|
|
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;`,
|
|
210
|
-
const
|
|
211
|
-
|
|
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;`, y.appendChild(v), y.appendChild(o), y.appendChild(g), y.appendChild(B), C.appendChild(y);
|
|
218
|
+
const E = document.createElement("div");
|
|
219
|
+
E.style.cssText = `
|
|
212
220
|
display: flex;
|
|
213
221
|
gap: 12px;
|
|
214
222
|
padding: 16px 20px;
|
|
@@ -216,8 +224,8 @@ function _(t, l, i, r) {
|
|
|
216
224
|
background: ${e.panelBg};
|
|
217
225
|
justify-content: flex-end;
|
|
218
226
|
`;
|
|
219
|
-
const
|
|
220
|
-
|
|
227
|
+
const b = document.createElement("button");
|
|
228
|
+
b.textContent = "Cancel", b.style.cssText = `
|
|
221
229
|
padding: 8px 16px;
|
|
222
230
|
font-size: 14px;
|
|
223
231
|
font-weight: 500;
|
|
@@ -227,9 +235,9 @@ function _(t, l, i, r) {
|
|
|
227
235
|
transition: all 0.2s ease;
|
|
228
236
|
background: ${e.cancelBg};
|
|
229
237
|
color: ${e.cancelText};
|
|
230
|
-
`,
|
|
231
|
-
const
|
|
232
|
-
|
|
238
|
+
`, b.onmouseover = () => b.style.background = e.cancelHover, b.onmouseout = () => b.style.background = e.cancelBg;
|
|
239
|
+
const l = document.createElement("button");
|
|
240
|
+
l.textContent = t === "add" ? "Add Anchor" : "Save Changes", l.style.cssText = `
|
|
233
241
|
padding: 8px 16px;
|
|
234
242
|
font-size: 14px;
|
|
235
243
|
font-weight: 500;
|
|
@@ -239,19 +247,19 @@ function _(t, l, i, r) {
|
|
|
239
247
|
transition: all 0.2s ease;
|
|
240
248
|
background: ${e.saveBg};
|
|
241
249
|
color: white;
|
|
242
|
-
`,
|
|
250
|
+
`, l.disabled = !o.value.trim();
|
|
243
251
|
const $ = () => {
|
|
244
|
-
o.value.trim() ? (
|
|
252
|
+
o.value.trim() ? (l.disabled = !1, l.style.background = e.saveBg, l.style.color = "white", l.style.cursor = "pointer") : (l.disabled = !0, l.style.background = e.saveDisabledBg, l.style.color = e.saveDisabledText, l.style.cursor = "not-allowed");
|
|
245
253
|
};
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
},
|
|
249
|
-
|
|
250
|
-
},
|
|
251
|
-
const
|
|
252
|
-
if ($(),
|
|
253
|
-
const k = A(
|
|
254
|
-
k.valid ?
|
|
254
|
+
l.onmouseover = () => {
|
|
255
|
+
l.disabled || (l.style.background = e.saveHover, l.style.boxShadow = a ? "0 2px 8px rgba(59, 130, 246, 0.35)" : "0 2px 8px rgba(0, 102, 204, 0.3)");
|
|
256
|
+
}, l.onmouseout = () => {
|
|
257
|
+
l.disabled || (l.style.background = e.saveBg, l.style.boxShadow = "none");
|
|
258
|
+
}, E.appendChild(b), E.appendChild(l), o.oninput = () => {
|
|
259
|
+
const r = o.value;
|
|
260
|
+
if ($(), r.trim()) {
|
|
261
|
+
const k = A(r);
|
|
262
|
+
k.valid ? t === "add" && h.has(r) ? (c = `Anchor ID already exists: ${r}`, g.textContent = "⚠ " + c, g.style.display = "block", o.style.borderColor = e.fieldErrorBorder, o.style.background = e.fieldErrorBg) : t === "edit" && r !== d && h.has(r) ? (c = `Anchor ID already exists: ${r}`, 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);
|
|
255
263
|
} else
|
|
256
264
|
g.style.display = "none", o.style.borderColor = e.fieldBorder, o.style.background = e.fieldBg;
|
|
257
265
|
}, o.onfocus = () => {
|
|
@@ -260,58 +268,60 @@ function _(t, l, i, r) {
|
|
|
260
268
|
o.style.boxShadow = "none", c || (o.style.background = e.fieldBg);
|
|
261
269
|
};
|
|
262
270
|
const T = () => {
|
|
263
|
-
const
|
|
264
|
-
!
|
|
265
|
-
},
|
|
266
|
-
|
|
271
|
+
const r = o.value.trim();
|
|
272
|
+
!r || !A(r).valid || t === "add" && h.has(r) || t === "edit" && r !== d && h.has(r) || (s && s(r), i.remove());
|
|
273
|
+
}, w = () => {
|
|
274
|
+
i.remove();
|
|
267
275
|
};
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
},
|
|
271
|
-
|
|
272
|
-
}, f.appendChild(u), f.appendChild(C), f.appendChild(
|
|
276
|
+
l.onclick = T, b.onclick = w, p.onclick = w, o.onkeydown = (r) => {
|
|
277
|
+
r.key === "Enter" ? (r.preventDefault(), T()) : r.key === "Escape" && (r.preventDefault(), w());
|
|
278
|
+
}, i.onclick = (r) => {
|
|
279
|
+
r.target === i && w();
|
|
280
|
+
}, f.appendChild(u), f.appendChild(C), f.appendChild(E), i.appendChild(f), document.body.appendChild(i), setTimeout(() => o.focus(), 100);
|
|
273
281
|
}
|
|
274
|
-
function I(t,
|
|
282
|
+
function I(t, d) {
|
|
275
283
|
var c;
|
|
276
|
-
let
|
|
277
|
-
if (
|
|
278
|
-
|
|
284
|
+
let s;
|
|
285
|
+
if (d)
|
|
286
|
+
s = d;
|
|
279
287
|
else {
|
|
280
288
|
const u = window.getSelection();
|
|
281
|
-
if (!u || u.rangeCount === 0)
|
|
282
|
-
|
|
289
|
+
if (!u || u.rangeCount === 0)
|
|
290
|
+
return;
|
|
291
|
+
s = u.getRangeAt(0);
|
|
283
292
|
}
|
|
284
|
-
let
|
|
285
|
-
for (;
|
|
286
|
-
if (
|
|
287
|
-
const u =
|
|
293
|
+
let n = null, a = s.startContainer;
|
|
294
|
+
for (; a && a !== document.body; ) {
|
|
295
|
+
if (a.nodeType === Node.ELEMENT_NODE) {
|
|
296
|
+
const u = a;
|
|
288
297
|
if (u.getAttribute("contenteditable") === "true") {
|
|
289
|
-
|
|
298
|
+
n = u;
|
|
290
299
|
break;
|
|
291
300
|
}
|
|
292
301
|
}
|
|
293
|
-
|
|
302
|
+
a = a.parentNode;
|
|
294
303
|
}
|
|
295
|
-
const e = (c =
|
|
296
|
-
|
|
304
|
+
const e = (c = n == null ? void 0 : n.innerHTML) != null ? c : "", i = document.createElement("span");
|
|
305
|
+
i.id = t, i.className = "rte-anchor", i.setAttribute("data-type", "anchor"), i.setAttribute("data-anchor-id", t), i.setAttribute("title", `Anchor: ${t}`), i.style.cssText = `
|
|
297
306
|
display: inline;
|
|
298
307
|
position: relative;
|
|
299
308
|
cursor: pointer;
|
|
300
|
-
`,
|
|
309
|
+
`, s.insertNode(i), h.add(t), s.setStart(i.nextSibling || i.parentNode, 0), s.collapse(!0);
|
|
301
310
|
const f = window.getSelection();
|
|
302
|
-
if (f && (f.removeAllRanges(), f.addRange(
|
|
303
|
-
z(
|
|
311
|
+
if (f && (f.removeAllRanges(), f.addRange(s)), n)
|
|
312
|
+
z(n, e), n.dispatchEvent(new Event("input", { bubbles: !0 }));
|
|
304
313
|
else {
|
|
305
314
|
const u = D();
|
|
306
315
|
if (u) {
|
|
307
|
-
const
|
|
308
|
-
|
|
316
|
+
const x = S(u);
|
|
317
|
+
x && x.dispatchEvent(new Event("input", { bubbles: !0 }));
|
|
309
318
|
}
|
|
310
319
|
}
|
|
311
320
|
N();
|
|
312
321
|
}
|
|
313
322
|
function N() {
|
|
314
|
-
if (document.getElementById("rte-anchor-styles"))
|
|
323
|
+
if (document.getElementById("rte-anchor-styles"))
|
|
324
|
+
return;
|
|
315
325
|
const t = document.createElement("style");
|
|
316
326
|
t.id = "rte-anchor-styles", t.textContent = `
|
|
317
327
|
.rte-anchor {
|
|
@@ -409,10 +419,10 @@ const O = () => (typeof window != "undefined" && (R(), N()), {
|
|
|
409
419
|
const t = window.getSelection();
|
|
410
420
|
if (!t || t.rangeCount === 0)
|
|
411
421
|
return alert("Please place your cursor where you want to insert the anchor."), !1;
|
|
412
|
-
const
|
|
413
|
-
return _("add", "", (
|
|
414
|
-
I(
|
|
415
|
-
},
|
|
422
|
+
const d = t.getRangeAt(0).cloneRange();
|
|
423
|
+
return _("add", "", (s) => {
|
|
424
|
+
I(s, d);
|
|
425
|
+
}, d), !0;
|
|
416
426
|
} catch (t) {
|
|
417
427
|
return console.error("Failed to insert anchor:", t), !1;
|
|
418
428
|
}
|
|
@@ -425,4 +435,4 @@ const O = () => (typeof window != "undefined" && (R(), N()), {
|
|
|
425
435
|
export {
|
|
426
436
|
O as AnchorPlugin
|
|
427
437
|
};
|
|
428
|
-
//# sourceMappingURL=AnchorPlugin.native-
|
|
438
|
+
//# sourceMappingURL=AnchorPlugin.native-289a112a.mjs.map
|