@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.
Files changed (87) hide show
  1. package/README.md +5 -0
  2. package/dist/{A11yCheckerPlugin.native-BRdGYMju.mjs → A11yCheckerPlugin.native-58d12bed.mjs} +23 -12
  3. package/dist/{AnchorPlugin.native-BcYGEtd9.mjs → AnchorPlugin.native-289a112a.mjs} +112 -102
  4. package/dist/ApprovalWorkflowPlugin.native-449ce66c.mjs +1115 -0
  5. package/dist/{BackgroundColorPlugin.native-50iAT9xU.mjs → BackgroundColorPlugin.native-8aceb5cc.mjs} +16 -9
  6. package/dist/{BlockquotePlugin.native-JFmOLsxN.mjs → BlockquotePlugin.native-3541c714.mjs} +3 -2
  7. package/dist/BlocksLibraryPlugin.native-1cc51e63.mjs +1386 -0
  8. package/dist/{BoldPlugin.native-BAzzoqU5.mjs → BoldPlugin.native-f9d7f8e4.mjs} +1 -1
  9. package/dist/{CapitalizationPlugin.native-DOMsh5R7.mjs → CapitalizationPlugin.native-42c135dc.mjs} +3 -2
  10. package/dist/{ChecklistPlugin.native-nuSSEFNI.mjs → ChecklistPlugin.native-3b397ee9.mjs} +43 -22
  11. package/dist/CitationsPlugin.native-169fb1e8.mjs +1532 -0
  12. package/dist/{ClearFormattingPlugin.native-Bq_XcTh2.mjs → ClearFormattingPlugin.native-77baa514.mjs} +11 -6
  13. package/dist/{CodePlugin.native-DlpTPdkd.mjs → CodePlugin.native-989cf0aa.mjs} +629 -580
  14. package/dist/{CodeSamplePlugin.native-CgGoH-X4.mjs → CodeSamplePlugin.native-6cc0148e.mjs} +19 -10
  15. package/dist/{CommentsPlugin.native-DPSqTkiv.mjs → CommentsPlugin.native-03659874.mjs} +55 -28
  16. package/dist/ConditionalContentPlugin.native-4983143a.mjs +1424 -0
  17. package/dist/ContentRulesPlugin.native-63ed405b.mjs +1149 -0
  18. package/dist/DataBindingPlugin.native-427e9d75.mjs +956 -0
  19. package/dist/{DirectionPlugin.native-CDnbdNyl.mjs → DirectionPlugin.native-4e742f42.mjs} +19 -10
  20. package/dist/DocSchemaPlugin.native-8e41eda0.mjs +1382 -0
  21. package/dist/{DocumentManagerPlugin.native-C2cs_1w4.mjs → DocumentManagerPlugin.native-e69895ad.mjs} +4 -4
  22. package/dist/{EmbedIframePlugin.native-DKJx2OS7.mjs → EmbedIframePlugin.native-55209c87.mjs} +70 -70
  23. package/dist/{EmojisPlugin.native-CitxxlWX.mjs → EmojisPlugin.native-65c5ac47.mjs} +11 -6
  24. package/dist/{FontFamilyPlugin.native-j8hMTbg4.mjs → FontFamilyPlugin.native-f9bc255a.mjs} +7 -4
  25. package/dist/{FontSizePlugin.native-B_jCh7dY.mjs → FontSizePlugin.native-f5647872.mjs} +19 -10
  26. package/dist/{FootnotePlugin.native-D730OGRm.mjs → FootnotePlugin.native-494657b3.mjs} +77 -39
  27. package/dist/{FullscreenPlugin.native-ChXyxeNw.mjs → FullscreenPlugin.native-87ce92e9.mjs} +1 -1
  28. package/dist/{HeadingPlugin.native-DrLYwQnQ.mjs → HeadingPlugin.native-e38c4a16.mjs} +1 -1
  29. package/dist/{HistoryPlugin.native-TDnVMsEO.mjs → HistoryPlugin.native-92ed4be4.mjs} +43 -22
  30. package/dist/{IndentPlugin.native-BHixp8sP.mjs → IndentPlugin.native-e4ee902b.mjs} +23 -12
  31. package/dist/{ItalicPlugin.native-CQjjDyUL.mjs → ItalicPlugin.native-7c95cfbc.mjs} +1 -1
  32. package/dist/{LineHeightPlugin.native-CM7iXdQj.mjs → LineHeightPlugin.native-5668f78c.mjs} +19 -10
  33. package/dist/{LinkPlugin.native-DYCIcdTm.mjs → LinkPlugin.native-6df29111.mjs} +9 -5
  34. package/dist/{ListPlugin.native-V7EZC1lM.mjs → ListPlugin.native-fe2e115a.mjs} +9 -5
  35. package/dist/{MathPlugin.native-f_mDp8VL.mjs → MathPlugin.native-735bbac2.mjs} +9 -5
  36. package/dist/{MediaManagerPlugin.native-BiXiK8FC.mjs → MediaManagerPlugin.native-3cf48a00.mjs} +219 -207
  37. package/dist/MentionPlugin.native-3b1e8c05.mjs +778 -0
  38. package/dist/{MergeTagPlugin.native-C3eOfEgw.mjs → MergeTagPlugin.native-31cf7d48.mjs} +51 -26
  39. package/dist/PIIRedactionPlugin.native-7ab10b9f.mjs +1449 -0
  40. package/dist/{PageBreakPlugin.native-CXdX5fAv.mjs → PageBreakPlugin.native-1794c5fb.mjs} +67 -52
  41. package/dist/{PreviewPlugin.native-DBvfpmIv.mjs → PreviewPlugin.native-f7b67cc0.mjs} +38 -33
  42. package/dist/{PrintPlugin.native-7qt5v7L5.mjs → PrintPlugin.native-f6a168c2.mjs} +5 -3
  43. package/dist/SlashCommandsPlugin.native-8d45e511.mjs +790 -0
  44. package/dist/SmartPastePlugin.native-a6c5efec.mjs +1447 -0
  45. package/dist/{SpecialCharactersPlugin.native-CZDato89.mjs → SpecialCharactersPlugin.native-7f06d4ba.mjs} +17 -9
  46. package/dist/{SpellCheckPlugin.native-BZB9AewP.mjs → SpellCheckPlugin.native-04e20834.mjs} +41 -21
  47. package/dist/{StrikethroughPlugin.native-0Be7j49s.mjs → StrikethroughPlugin.native-905e9501.mjs} +9 -5
  48. package/dist/{TablePlugin.native-DrHX-efe.mjs → TablePlugin.native-7d5458c1.mjs} +58 -30
  49. package/dist/{TemplatePlugin.native-CrpfKRJ8.mjs → TemplatePlugin.native-580f0f63.mjs} +32 -17
  50. package/dist/{TextAlignmentPlugin.native-sM_1s00t.mjs → TextAlignmentPlugin.native-9357b3ed.mjs} +11 -6
  51. package/dist/{TextColorPlugin.native-Bwl_bSmc.mjs → TextColorPlugin.native-d53ed459.mjs} +26 -14
  52. package/dist/TrackChangesPlugin.native-e96da509.mjs +818 -0
  53. package/dist/TranslationWorkflowPlugin.native-4e711b1e.mjs +1797 -0
  54. package/dist/{UnderlinePlugin.native-QpIcK4L2.mjs → UnderlinePlugin.native-8080c998.mjs} +1 -1
  55. package/dist/VersionDiffPlugin.native-5bbeff85.mjs +801 -0
  56. package/dist/_commonjsHelpers-69d58be2.mjs +31 -0
  57. package/dist/{anchoredPopover-Bxds0VoB.mjs → anchoredPopover-5cca53ba.mjs} +1 -1
  58. package/dist/documentManager-8327fb6e.mjs +9166 -0
  59. package/dist/{editorContainerHelpers-C7kdWnS0.mjs → editorContainerHelpers-69585c07.mjs} +3 -2
  60. package/dist/editora.min.js +14 -13
  61. package/dist/editora.umd.js +14 -13
  62. package/dist/{html2canvas.esm-AYkPY5LS.mjs → html2canvas.esm-c51cb3b9.mjs} +978 -894
  63. package/dist/index-072ef022.js +11 -0
  64. package/dist/index-49d31221.mjs +16860 -0
  65. package/dist/{index-yzU4NdPT.mjs → index-7da30697.mjs} +490 -358
  66. package/dist/index.cjs.js +1 -1
  67. package/dist/index.es-b47a189f.mjs +5782 -0
  68. package/dist/index.esm.js +12 -7
  69. package/dist/{jspdf.es.min-BJGtOnRT.mjs → jspdf.es.min-780c82db.mjs} +4808 -3784
  70. package/dist/plugin-loader.js +77 -40
  71. package/dist/{purify.es-CKpwg8Tk.mjs → purify.es-3bdbcfc5.mjs} +20 -10
  72. package/dist/style.css +1 -0
  73. package/dist/webcomponent-core.js +546 -414
  74. package/dist/webcomponent-core.min.css +1 -1
  75. package/dist/webcomponent-core.min.js +40 -39
  76. package/dist/webcomponent.cjs.js +1 -1
  77. package/dist/webcomponent.esm.js +1 -1
  78. package/dist/webcomponent.js +484 -315
  79. package/dist/webcomponent.min.css +1 -1
  80. package/dist/webcomponent.min.js +6035 -558
  81. package/package.json +11 -5
  82. package/dist/_commonjsHelpers-DOllISpa.mjs +0 -32
  83. package/dist/core.css +0 -1
  84. package/dist/documentManager-vQ1VkbUY.mjs +0 -8418
  85. package/dist/index-BpE6GFbz.js +0 -10
  86. package/dist/index-BslAFzmv.mjs +0 -16544
  87. 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>
@@ -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") return null;
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") return null;
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") return null;
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") return null;
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") return null;
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") return null;
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) return 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)) return !0;
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)) return !0;
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) return [];
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))) continue;
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-BRdGYMju.mjs.map
538
+ //# sourceMappingURL=A11yCheckerPlugin.native-58d12bed.mjs.map
@@ -1,30 +1,32 @@
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")
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
- i("recordDomTransaction", t, l, t.innerHTML);
9
- } catch (r) {
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) 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);
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 = a.querySelectorAll) == null ? void 0 : e.call(a, ".rte-anchor");
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 && b.delete(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) 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));
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 r = t.startContainer, n = r.nodeType === Node.ELEMENT_NODE ? r : r.parentElement;
54
- if (n != null && n.closest(y)) return !0;
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 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;
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 i = document.activeElement;
62
- return i != null && i.closest(y) ? !0 : document.body.matches(y) || document.documentElement.matches(y);
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, l, i, r) {
70
+ function _(t, d, s, n) {
65
71
  M();
66
- const n = H(r), e = n ? {
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
- }, a = document.createElement("div");
115
- a.className = "rte-anchor-dialog-overlay", a.style.cssText = `
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 d = document.createElement("style");
140
- d.id = "rte-anchor-dialog-styles", d.textContent = `
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(d);
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 m = document.createElement("h3");
161
- m.style.cssText = `margin: 0; font-size: 18px; font-weight: 600; color: ${e.text};`, m.textContent = "Add Anchor";
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(m), u.appendChild(p);
189
+ }, u.appendChild(x), u.appendChild(p);
182
190
  const C = document.createElement("div");
183
191
  C.style.cssText = "padding: 20px;";
184
- const x = document.createElement("div");
185
- x.style.cssText = "margin-bottom: 0;";
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;`, 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 = `
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 h = document.createElement("button");
220
- h.textContent = "Cancel", h.style.cssText = `
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
- `, 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 = `
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
- `, s.disabled = !o.value.trim();
250
+ `, l.disabled = !o.value.trim();
243
251
  const $ = () => {
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");
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
- 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);
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 d = o.value.trim();
264
- !d || !A(d).valid || b.has(d) || (i && i(d), a.remove());
265
- }, E = () => {
266
- a.remove();
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
- 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);
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, l) {
282
+ function I(t, d) {
275
283
  var c;
276
- let i;
277
- if (l)
278
- i = l;
284
+ let s;
285
+ if (d)
286
+ s = d;
279
287
  else {
280
288
  const u = window.getSelection();
281
- if (!u || u.rangeCount === 0) return;
282
- i = u.getRangeAt(0);
289
+ if (!u || u.rangeCount === 0)
290
+ return;
291
+ s = u.getRangeAt(0);
283
292
  }
284
- let r = null, n = i.startContainer;
285
- for (; n && n !== document.body; ) {
286
- if (n.nodeType === Node.ELEMENT_NODE) {
287
- const u = n;
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
- r = u;
298
+ n = u;
290
299
  break;
291
300
  }
292
301
  }
293
- n = n.parentNode;
302
+ a = a.parentNode;
294
303
  }
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 = `
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
- `, i.insertNode(a), b.add(t), i.setStart(a.nextSibling || a.parentNode, 0), i.collapse(!0);
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(i)), r)
303
- z(r, e), r.dispatchEvent(new Event("input", { bubbles: !0 }));
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 m = S(u);
308
- m && m.dispatchEvent(new Event("input", { bubbles: !0 }));
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")) return;
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 l = t.getRangeAt(0).cloneRange();
413
- return _("add", "", (i) => {
414
- I(i, l);
415
- }, l), !0;
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-BcYGEtd9.mjs.map
438
+ //# sourceMappingURL=AnchorPlugin.native-289a112a.mjs.map