@editora/plugins 1.0.10 → 1.0.12

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 (139) hide show
  1. package/README.md +1 -1
  2. package/dist/_commonjsHelpers-BH3jXuIh.js +1 -0
  3. package/dist/_commonjsHelpers-ByX85dGu.mjs +33 -0
  4. package/dist/a11y-checker.cjs.js +12 -12
  5. package/dist/a11y-checker.esm.js +80 -98
  6. package/dist/anchor.cjs.js +12 -12
  7. package/dist/anchor.esm.js +115 -128
  8. package/dist/anchoredPopover-BzqGPOAE.js +1 -0
  9. package/dist/anchoredPopover-Dts0IrgU.mjs +106 -0
  10. package/dist/approval-workflow.cjs.js +40 -40
  11. package/dist/approval-workflow.esm.js +208 -249
  12. package/dist/background-color.cjs.js +2 -2
  13. package/dist/background-color.esm.js +55 -68
  14. package/dist/blockquote.esm.js +1 -2
  15. package/dist/blocks-library.cjs.js +45 -45
  16. package/dist/blocks-library.esm.js +178 -245
  17. package/dist/capitalization.esm.js +1 -2
  18. package/dist/checklist.cjs.js +1 -1
  19. package/dist/checklist.esm.js +58 -82
  20. package/dist/citations.cjs.js +37 -37
  21. package/dist/citations.esm.js +439 -512
  22. package/dist/clear-formatting.cjs.js +1 -1
  23. package/dist/clear-formatting.esm.js +27 -33
  24. package/dist/code-sample.cjs.js +14 -14
  25. package/dist/code-sample.esm.js +82 -93
  26. package/dist/code.cjs.js +119 -42
  27. package/dist/code.esm.js +2560 -760
  28. package/dist/comments.cjs.js +6 -6
  29. package/dist/comments.esm.js +116 -158
  30. package/dist/conditional-content.cjs.js +90 -90
  31. package/dist/conditional-content.esm.js +371 -432
  32. package/dist/content-rules.cjs.js +7 -7
  33. package/dist/content-rules.esm.js +105 -159
  34. package/dist/data-binding.cjs.js +46 -46
  35. package/dist/data-binding.esm.js +328 -368
  36. package/dist/direction.esm.js +9 -18
  37. package/dist/doc-schema.cjs.js +29 -29
  38. package/dist/doc-schema.esm.js +240 -308
  39. package/dist/document-manager.cjs.js +1 -1
  40. package/dist/document-manager.esm.js +4 -5
  41. package/dist/documentManager-CTqRftU8.mjs +8369 -0
  42. package/dist/documentManager-Jf0RbSks.js +17 -0
  43. package/dist/{editorContainerHelpers-69585c07.mjs → editorContainerHelpers-C7kdWnS0.mjs} +1 -2
  44. package/dist/embed-iframe.cjs.js +4 -4
  45. package/dist/embed-iframe.esm.js +73 -81
  46. package/dist/emojis.cjs.js +8 -8
  47. package/dist/emojis.esm.js +65 -77
  48. package/dist/enterprise.cjs.js +1 -1
  49. package/dist/enterprise.esm.js +54 -56
  50. package/dist/font-family.cjs.js +1 -1
  51. package/dist/font-family.esm.js +39 -47
  52. package/dist/font-size.cjs.js +1 -1
  53. package/dist/font-size.esm.js +37 -53
  54. package/dist/footnote.cjs.js +2 -2
  55. package/dist/footnote.esm.js +76 -117
  56. package/dist/history.cjs.js +1 -1
  57. package/dist/history.esm.js +70 -92
  58. package/dist/html2canvas.esm-B5qzocYs.js +5 -0
  59. package/dist/{html2canvas.esm-1a1724a1.mjs → html2canvas.esm-BWVIUcAF.mjs} +141 -225
  60. package/dist/indent.cjs.js +1 -1
  61. package/dist/indent.esm.js +12 -24
  62. package/dist/{index-f04538f2.mjs → index-BFsKNTTj.mjs} +70 -71
  63. package/dist/index-CvJk4DKa.js +221 -0
  64. package/dist/index-D3CycEFU.mjs +16543 -0
  65. package/dist/index-tqLTHcO6.js +1 -0
  66. package/dist/index.cjs.js +1 -1
  67. package/dist/index.es-CE_A4QSm.js +5 -0
  68. package/dist/index.es-DQ78mYYo.mjs +6665 -0
  69. package/dist/index.esm.js +125 -128
  70. package/dist/italic.cjs.js +1 -1
  71. package/dist/italic.esm.js +8 -9
  72. package/dist/jspdf.es.min-BoS80556.js +77 -0
  73. package/dist/{jspdf.es.min-c36a4fd8.mjs → jspdf.es.min-DQCoX5yh.mjs} +3658 -4682
  74. package/dist/line-height.cjs.js +1 -1
  75. package/dist/line-height.esm.js +11 -24
  76. package/dist/link.cjs.js +5 -5
  77. package/dist/link.esm.js +24 -30
  78. package/dist/list.cjs.js +1 -1
  79. package/dist/list.esm.js +20 -25
  80. package/dist/lite.cjs.js +1 -1
  81. package/dist/lite.esm.js +59 -61
  82. package/dist/math.cjs.js +21 -21
  83. package/dist/math.esm.js +139 -146
  84. package/dist/media-manager.cjs.js +31 -31
  85. package/dist/media-manager.esm.js +285 -300
  86. package/dist/mentions.cjs.js +9 -9
  87. package/dist/mentions.esm.js +238 -286
  88. package/dist/merge-tag.cjs.js +2 -2
  89. package/dist/merge-tag.esm.js +177 -216
  90. package/dist/page-break.cjs.js +2 -2
  91. package/dist/page-break.esm.js +33 -49
  92. package/dist/pii-redaction.cjs.js +19 -19
  93. package/dist/pii-redaction.esm.js +393 -463
  94. package/dist/plugins.css +1 -0
  95. package/dist/preview.esm.js +5 -10
  96. package/dist/print.cjs.js +4 -4
  97. package/dist/print.esm.js +17 -20
  98. package/dist/{purify.es-35a15df8.mjs → purify.es-DHhaBdbu.mjs} +9 -19
  99. package/dist/{purify.es-a8d731c6.js → purify.es-T2a3nLiC.js} +1 -1
  100. package/dist/slash-commands.cjs.js +2 -2
  101. package/dist/slash-commands.esm.js +39 -75
  102. package/dist/smart-paste.cjs.js +27 -27
  103. package/dist/smart-paste.esm.js +280 -336
  104. package/dist/special-characters.cjs.js +7 -7
  105. package/dist/special-characters.esm.js +61 -69
  106. package/dist/spell-check.cjs.js +5 -5
  107. package/dist/spell-check.esm.js +97 -123
  108. package/dist/strikethrough.cjs.js +1 -1
  109. package/dist/strikethrough.esm.js +14 -19
  110. package/dist/table.cjs.js +4 -4
  111. package/dist/table.esm.js +191 -225
  112. package/dist/template.cjs.js +21 -20
  113. package/dist/template.esm.js +715 -196
  114. package/dist/text-alignment.cjs.js +1 -1
  115. package/dist/text-alignment.esm.js +21 -27
  116. package/dist/text-color.cjs.js +3 -3
  117. package/dist/text-color.esm.js +70 -87
  118. package/dist/track-changes.cjs.js +2 -2
  119. package/dist/track-changes.esm.js +100 -162
  120. package/dist/translation-workflow.cjs.js +74 -74
  121. package/dist/translation-workflow.esm.js +602 -678
  122. package/dist/version-diff.cjs.js +14 -14
  123. package/dist/version-diff.esm.js +128 -157
  124. package/package.json +1 -1
  125. package/dist/_commonjsHelpers-6763f629.js +0 -1
  126. package/dist/_commonjsHelpers-c5d32002.mjs +0 -30
  127. package/dist/anchoredPopover-33f1358d.mjs +0 -109
  128. package/dist/anchoredPopover-8151d535.js +0 -1
  129. package/dist/documentManager-25b6203c.mjs +0 -9122
  130. package/dist/documentManager-b69e7054.js +0 -17
  131. package/dist/html2canvas.esm-09133e29.js +0 -22
  132. package/dist/index-656d224b.js +0 -231
  133. package/dist/index-6a8c48bb.js +0 -1
  134. package/dist/index-d027b7e2.mjs +0 -16859
  135. package/dist/index.es-730f2d98.mjs +0 -5775
  136. package/dist/index.es-dd40173b.js +0 -18
  137. package/dist/jspdf.es.min-90db2c97.js +0 -243
  138. package/dist/style.css +0 -1
  139. /package/dist/{editorContainerHelpers-36b8ddf3.js → editorContainerHelpers-CFbfiOJI.js} +0 -0
@@ -1,4 +1,4 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const w=require("./editorContainerHelpers-36b8ddf3.js"),h=new Set,y='[data-theme="dark"], .dark, .editora-theme-dark';function $(t,l){if(l===t.innerHTML)return;const s=window.execEditorCommand||window.executeEditorCommand;if(typeof s=="function")try{s("recordDomTransaction",t,l,t.innerHTML)}catch{}}function z(){if(typeof window>"u"||window.__anchorObserverInitialized)return;window.__anchorObserverInitialized=!0,new MutationObserver(l=>{l.forEach(s=>{s.removedNodes.forEach(d=>{var a,e;if(d.nodeType===Node.ELEMENT_NODE){const i=d;if((a=i.classList)!=null&&a.contains("rte-anchor")){const r=i.id;r&&h.delete(r)}const u=(e=i.querySelectorAll)==null?void 0:e.call(i,".rte-anchor");u==null||u.forEach(r=>{const f=r.id;f&&h.delete(f)})}})})}).observe(document.body,{childList:!0,subtree:!0})}function S(t){return!t||t.trim().length===0?{valid:!1,error:"Anchor ID cannot be empty"}:t.length>256?{valid:!1,error:"Anchor ID must be less than 256 characters"}:/^[a-z_]/.test(t)?/^[a-z0-9\-_]+$/.test(t)?{valid:!0,error:""}:{valid:!1,error:"Anchor ID can only contain letters, numbers, hyphens, and underscores"}:{valid:!1,error:"Anchor ID must start with a letter or underscore"}}function M(){const t=w.findEditorContainerFromSelection();if(!t)return;const l=w.getContentElement(t);if(!l)return;const s=l.querySelectorAll(".rte-anchor"),d=new Set;s.forEach(a=>{const e=a.id;e&&d.add(e)}),h.clear(),d.forEach(a=>h.add(a))}function R(t){if(t){const d=t.startContainer,a=d.nodeType===Node.ELEMENT_NODE?d:d.parentElement;if(a!=null&&a.closest(y))return!0}const l=window.getSelection();if(l&&l.rangeCount>0){const d=l.getRangeAt(0).startContainer,a=d.nodeType===Node.ELEMENT_NODE?d:d.parentElement;if(a!=null&&a.closest(y))return!0}const s=document.activeElement;return s!=null&&s.closest(y)?!0:document.body.matches(y)||document.documentElement.matches(y)}function H(t,l,s,d){M();const a=R(d),e=a?{overlay:"rgba(0, 0, 0, 0.62)",dialogBg:"#1f2937",panelBg:"#222d3a",border:"#3b4657",text:"#e2e8f0",muted:"#94a3b8",closeHoverBg:"#334155",fieldBg:"#111827",fieldFocusBg:"#111827",fieldBorder:"#4b5563",fieldText:"#e2e8f0",fieldPlaceholder:"#94a3b8",fieldErrorBg:"#3f2124",fieldErrorBorder:"#ef4444",cancelBg:"#334155",cancelHover:"#475569",cancelText:"#e2e8f0",saveBg:"#3b82f6",saveHover:"#2563eb",saveDisabledBg:"#374151",saveDisabledText:"#7f8ca1",help:"#9fb0c6",focusRing:"rgba(88, 166, 255, 0.25)",errorRing:"rgba(239, 68, 68, 0.25)"}:{overlay:"rgba(0, 0, 0, 0.5)",dialogBg:"#ffffff",panelBg:"#f9f9f9",border:"#e0e0e0",text:"#333333",muted:"#999999",closeHoverBg:"#e0e0e0",fieldBg:"#ffffff",fieldFocusBg:"#f9f9ff",fieldBorder:"#d0d0d0",fieldText:"#333333",fieldPlaceholder:"#9ca3af",fieldErrorBg:"#ffebee",fieldErrorBorder:"#d32f2f",cancelBg:"#f0f0f0",cancelHover:"#e0e0e0",cancelText:"#333333",saveBg:"#0066cc",saveHover:"#0052a3",saveDisabledBg:"#d0d0d0",saveDisabledText:"#999999",help:"#999999",focusRing:"rgba(0, 102, 204, 0.1)",errorRing:"rgba(211, 47, 47, 0.1)"},i=document.createElement("div");i.className="rte-anchor-dialog-overlay",i.style.cssText=`
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const w=require("./editorContainerHelpers-CFbfiOJI.js"),b=new Set,x='[data-theme="dark"], .dark, .editora-theme-dark';function $(t,c){if(c===t.innerHTML)return;const i=window.execEditorCommand||window.executeEditorCommand;if(typeof i=="function")try{i("recordDomTransaction",t,c,t.innerHTML)}catch{}}function z(){if(typeof window>"u"||window.__anchorObserverInitialized)return;window.__anchorObserverInitialized=!0,new MutationObserver(c=>{c.forEach(i=>{i.removedNodes.forEach(r=>{if(r.nodeType===Node.ELEMENT_NODE){const d=r;if(d.classList?.contains("rte-anchor")){const n=d.id;n&&b.delete(n)}d.querySelectorAll?.(".rte-anchor")?.forEach(n=>{const u=n.id;u&&b.delete(u)})}})})}).observe(document.body,{childList:!0,subtree:!0})}function S(t){return!t||t.trim().length===0?{valid:!1,error:"Anchor ID cannot be empty"}:t.length>256?{valid:!1,error:"Anchor ID must be less than 256 characters"}:/^[a-z_]/.test(t)?/^[a-z0-9\-_]+$/.test(t)?{valid:!0,error:""}:{valid:!1,error:"Anchor ID can only contain letters, numbers, hyphens, and underscores"}:{valid:!1,error:"Anchor ID must start with a letter or underscore"}}function M(){const t=w.findEditorContainerFromSelection();if(!t)return;const c=w.getContentElement(t);if(!c)return;const i=c.querySelectorAll(".rte-anchor"),r=new Set;i.forEach(d=>{const e=d.id;e&&r.add(e)}),b.clear(),r.forEach(d=>b.add(d))}function R(t){if(t){const r=t.startContainer;if((r.nodeType===Node.ELEMENT_NODE?r:r.parentElement)?.closest(x))return!0}const c=window.getSelection();if(c&&c.rangeCount>0){const r=c.getRangeAt(0).startContainer;if((r.nodeType===Node.ELEMENT_NODE?r:r.parentElement)?.closest(x))return!0}return document.activeElement?.closest(x)?!0:document.body.matches(x)||document.documentElement.matches(x)}function H(t,c,i,r){M();const d=R(r),e=d?{overlay:"rgba(0, 0, 0, 0.62)",dialogBg:"#1f2937",panelBg:"#222d3a",border:"#3b4657",text:"#e2e8f0",muted:"#94a3b8",closeHoverBg:"#334155",fieldBg:"#111827",fieldFocusBg:"#111827",fieldBorder:"#4b5563",fieldText:"#e2e8f0",fieldErrorBg:"#3f2124",fieldErrorBorder:"#ef4444",cancelBg:"#334155",cancelHover:"#475569",cancelText:"#e2e8f0",saveBg:"#3b82f6",saveHover:"#2563eb",saveDisabledBg:"#374151",saveDisabledText:"#7f8ca1",help:"#9fb0c6",focusRing:"rgba(88, 166, 255, 0.25)",errorRing:"rgba(239, 68, 68, 0.25)"}:{overlay:"rgba(0, 0, 0, 0.5)",dialogBg:"#ffffff",panelBg:"#f9f9f9",border:"#e0e0e0",text:"#333333",muted:"#999999",closeHoverBg:"#e0e0e0",fieldBg:"#ffffff",fieldFocusBg:"#f9f9ff",fieldBorder:"#d0d0d0",fieldText:"#333333",fieldErrorBg:"#ffebee",fieldErrorBorder:"#d32f2f",cancelBg:"#f0f0f0",cancelHover:"#e0e0e0",cancelText:"#333333",saveBg:"#0066cc",saveHover:"#0052a3",saveDisabledBg:"#d0d0d0",saveDisabledText:"#999999",help:"#999999",focusRing:"rgba(0, 102, 204, 0.1)",errorRing:"rgba(211, 47, 47, 0.1)"},n=document.createElement("div");n.className="rte-anchor-dialog-overlay",n.style.cssText=`
2
2
  position: fixed;
3
3
  top: 0;
4
4
  left: 0;
@@ -19,7 +19,7 @@
19
19
  max-width: 450px;
20
20
  overflow: hidden;
21
21
  animation: rte-anchor-dialog-appear 0.2s ease;
22
- `,!document.getElementById("rte-anchor-dialog-styles")){const n=document.createElement("style");n.id="rte-anchor-dialog-styles",n.textContent=`
22
+ `,!document.getElementById("rte-anchor-dialog-styles")){const s=document.createElement("style");s.id="rte-anchor-dialog-styles",s.textContent=`
23
23
  @keyframes rte-anchor-dialog-appear {
24
24
  from { opacity: 0; transform: scale(0.95); }
25
25
  to { opacity: 1; transform: scale(1); }
@@ -27,14 +27,14 @@
27
27
  .rte-anchor-dialog input:focus {
28
28
  outline: none !important;
29
29
  }
30
- `,document.head.appendChild(n)}let r="";const f=document.createElement("div");f.style.cssText=`
30
+ `,document.head.appendChild(s)}let l="";const h=document.createElement("div");h.style.cssText=`
31
31
  display: flex;
32
32
  align-items: center;
33
33
  justify-content: space-between;
34
34
  padding: 16px 20px;
35
35
  border-bottom: 1px solid ${e.border};
36
36
  background: ${e.panelBg};
37
- `;const C=document.createElement("h3");C.style.cssText=`margin: 0; font-size: 18px; font-weight: 600; color: ${e.text};`,C.textContent=t==="add"?"Add Anchor":"Edit Anchor";const p=document.createElement("button");p.textContent="✕",p.style.cssText=`
37
+ `;const C=document.createElement("h3");C.style.cssText=`margin: 0; font-size: 18px; font-weight: 600; color: ${e.text};`,C.textContent="Add Anchor";const f=document.createElement("button");f.textContent="✕",f.style.cssText=`
38
38
  background: none;
39
39
  border: none;
40
40
  font-size: 24px;
@@ -48,7 +48,7 @@
48
48
  justify-content: center;
49
49
  border-radius: 4px;
50
50
  transition: all 0.2s ease;
51
- `,p.onmouseover=()=>{p.style.background=e.closeHoverBg,p.style.color="#f8fafc"},p.onmouseout=()=>{p.style.background="none",p.style.color=e.muted},f.appendChild(C),f.appendChild(p);const B=document.createElement("div");B.style.cssText="padding: 20px;";const x=document.createElement("div");x.style.cssText="margin-bottom: 0;";const m=document.createElement("label");m.textContent="Anchor ID",m.style.cssText=`display: block; font-size: 14px; font-weight: 500; color: ${e.text}; margin-bottom: 8px;`,m.setAttribute("for","anchor-id-input");const o=document.createElement("input");o.id="anchor-id-input",o.type="text",o.placeholder="e.g., section-introduction",o.value=l||"",o.style.cssText=`
51
+ `,f.onmouseover=()=>{f.style.background=e.closeHoverBg,f.style.color="#f8fafc"},f.onmouseout=()=>{f.style.background="none",f.style.color=e.muted},h.appendChild(C),h.appendChild(f);const B=document.createElement("div");B.style.cssText="padding: 20px;";const m=document.createElement("div");m.style.cssText="margin-bottom: 0;";const y=document.createElement("label");y.textContent="Anchor ID",y.style.cssText=`display: block; font-size: 14px; font-weight: 500; color: ${e.text}; margin-bottom: 8px;`,y.setAttribute("for","anchor-id-input");const o=document.createElement("input");o.id="anchor-id-input",o.type="text",o.placeholder="e.g., section-introduction",o.value="",o.style.cssText=`
52
52
  width: 100%;
53
53
  padding: 10px 12px;
54
54
  font-size: 14px;
@@ -59,19 +59,19 @@
59
59
  background: ${e.fieldBg};
60
60
  transition: all 0.2s ease;
61
61
  box-sizing: border-box;
62
- `,o.style.setProperty("caret-color",e.fieldText);const g=document.createElement("div");g.style.cssText=`
62
+ `,o.style.setProperty("caret-color",e.fieldText);const p=document.createElement("div");p.style.cssText=`
63
63
  color: #d32f2f;
64
64
  font-size: 12px;
65
65
  margin-top: 6px;
66
66
  display: none;
67
- `;const k=document.createElement("div");k.textContent="URL-safe ID (letters, numbers, hyphens, underscores). Must start with letter or underscore.",k.style.cssText=`color: ${e.help}; font-size: 12px; margin-top: 8px; line-height: 1.4;`,x.appendChild(m),x.appendChild(o),x.appendChild(g),x.appendChild(k),B.appendChild(x);const v=document.createElement("div");v.style.cssText=`
67
+ `;const k=document.createElement("div");k.textContent="URL-safe ID (letters, numbers, hyphens, underscores). Must start with letter or underscore.",k.style.cssText=`color: ${e.help}; font-size: 12px; margin-top: 8px; line-height: 1.4;`,m.appendChild(y),m.appendChild(o),m.appendChild(p),m.appendChild(k),B.appendChild(m);const v=document.createElement("div");v.style.cssText=`
68
68
  display: flex;
69
69
  gap: 12px;
70
70
  padding: 16px 20px;
71
71
  border-top: 1px solid ${e.border};
72
72
  background: ${e.panelBg};
73
73
  justify-content: flex-end;
74
- `;const b=document.createElement("button");b.textContent="Cancel",b.style.cssText=`
74
+ `;const g=document.createElement("button");g.textContent="Cancel",g.style.cssText=`
75
75
  padding: 8px 16px;
76
76
  font-size: 14px;
77
77
  font-weight: 500;
@@ -81,7 +81,7 @@
81
81
  transition: all 0.2s ease;
82
82
  background: ${e.cancelBg};
83
83
  color: ${e.cancelText};
84
- `,b.onmouseover=()=>b.style.background=e.cancelHover,b.onmouseout=()=>b.style.background=e.cancelBg;const c=document.createElement("button");c.textContent=t==="add"?"Add Anchor":"Save Changes",c.style.cssText=`
84
+ `,g.onmouseover=()=>g.style.background=e.cancelHover,g.onmouseout=()=>g.style.background=e.cancelBg;const a=document.createElement("button");a.textContent="Add Anchor",a.style.cssText=`
85
85
  padding: 8px 16px;
86
86
  font-size: 14px;
87
87
  font-weight: 500;
@@ -91,11 +91,11 @@
91
91
  transition: all 0.2s ease;
92
92
  background: ${e.saveBg};
93
93
  color: white;
94
- `,c.disabled=!o.value.trim();const N=()=>{o.value.trim()?(c.disabled=!1,c.style.background=e.saveBg,c.style.color="white",c.style.cursor="pointer"):(c.disabled=!0,c.style.background=e.saveDisabledBg,c.style.color=e.saveDisabledText,c.style.cursor="not-allowed")};c.onmouseover=()=>{c.disabled||(c.style.background=e.saveHover,c.style.boxShadow=a?"0 2px 8px rgba(59, 130, 246, 0.35)":"0 2px 8px rgba(0, 102, 204, 0.3)")},c.onmouseout=()=>{c.disabled||(c.style.background=e.saveBg,c.style.boxShadow="none")},v.appendChild(b),v.appendChild(c),o.oninput=()=>{const n=o.value;if(N(),n.trim()){const T=S(n);T.valid?t==="add"&&h.has(n)?(r=`Anchor ID already exists: ${n}`,g.textContent="⚠ "+r,g.style.display="block",o.style.borderColor=e.fieldErrorBorder,o.style.background=e.fieldErrorBg):t==="edit"&&n!==l&&h.has(n)?(r=`Anchor ID already exists: ${n}`,g.textContent="⚠ "+r,g.style.display="block",o.style.borderColor=e.fieldErrorBorder,o.style.background=e.fieldErrorBg):(r="",g.style.display="none",o.style.borderColor=e.fieldBorder,o.style.background=e.fieldBg):(r=T.error,g.textContent="⚠ "+r,g.style.display="block",o.style.borderColor=e.fieldErrorBorder,o.style.background=e.fieldErrorBg)}else g.style.display="none",o.style.borderColor=e.fieldBorder,o.style.background=e.fieldBg},o.onfocus=()=>{o.style.borderColor=r?e.fieldErrorBorder:e.saveBg,o.style.boxShadow=r?`0 0 0 3px ${e.errorRing}`:`0 0 0 3px ${e.focusRing}`,o.style.background=r?e.fieldErrorBg:e.fieldFocusBg},o.onblur=()=>{o.style.boxShadow="none",r||(o.style.background=e.fieldBg)};const A=()=>{const n=o.value.trim();!n||!S(n).valid||t==="add"&&h.has(n)||t==="edit"&&n!==l&&h.has(n)||(s&&s(n),i.remove())},E=()=>{i.remove()};c.onclick=A,b.onclick=E,p.onclick=E,o.onkeydown=n=>{n.key==="Enter"?(n.preventDefault(),A()):n.key==="Escape"&&(n.preventDefault(),E())},i.onclick=n=>{n.target===i&&E()},u.appendChild(f),u.appendChild(B),u.appendChild(v),i.appendChild(u),document.body.appendChild(i),setTimeout(()=>o.focus(),100)}function _(t,l){let s;if(l)s=l;else{const r=window.getSelection();if(!r||r.rangeCount===0)return;s=r.getRangeAt(0)}let d=null,a=s.startContainer;for(;a&&a!==document.body;){if(a.nodeType===Node.ELEMENT_NODE){const r=a;if(r.getAttribute("contenteditable")==="true"){d=r;break}}a=a.parentNode}const e=(d==null?void 0:d.innerHTML)??"",i=document.createElement("span");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=`
94
+ `,a.disabled=!o.value.trim();const N=()=>{o.value.trim()?(a.disabled=!1,a.style.background=e.saveBg,a.style.color="white",a.style.cursor="pointer"):(a.disabled=!0,a.style.background=e.saveDisabledBg,a.style.color=e.saveDisabledText,a.style.cursor="not-allowed")};a.onmouseover=()=>{a.disabled||(a.style.background=e.saveHover,a.style.boxShadow=d?"0 2px 8px rgba(59, 130, 246, 0.35)":"0 2px 8px rgba(0, 102, 204, 0.3)")},a.onmouseout=()=>{a.disabled||(a.style.background=e.saveBg,a.style.boxShadow="none")},v.appendChild(g),v.appendChild(a),o.oninput=()=>{const s=o.value;if(N(),s.trim()){const T=S(s);T.valid?b.has(s)?(l=`Anchor ID already exists: ${s}`,p.textContent="⚠ "+l,p.style.display="block",o.style.borderColor=e.fieldErrorBorder,o.style.background=e.fieldErrorBg):(l="",p.style.display="none",o.style.borderColor=e.fieldBorder,o.style.background=e.fieldBg):(l=T.error,p.textContent="⚠ "+l,p.style.display="block",o.style.borderColor=e.fieldErrorBorder,o.style.background=e.fieldErrorBg)}else p.style.display="none",o.style.borderColor=e.fieldBorder,o.style.background=e.fieldBg},o.onfocus=()=>{o.style.borderColor=l?e.fieldErrorBorder:e.saveBg,o.style.boxShadow=l?`0 0 0 3px ${e.errorRing}`:`0 0 0 3px ${e.focusRing}`,o.style.background=l?e.fieldErrorBg:e.fieldFocusBg},o.onblur=()=>{o.style.boxShadow="none",l||(o.style.background=e.fieldBg)};const A=()=>{const s=o.value.trim();!s||!S(s).valid||b.has(s)||(i&&i(s),n.remove())},E=()=>{n.remove()};a.onclick=A,g.onclick=E,f.onclick=E,o.onkeydown=s=>{s.key==="Enter"?(s.preventDefault(),A()):s.key==="Escape"&&(s.preventDefault(),E())},n.onclick=s=>{s.target===n&&E()},u.appendChild(h),u.appendChild(B),u.appendChild(v),n.appendChild(u),document.body.appendChild(n),setTimeout(()=>o.focus(),100)}function _(t,c){let i;if(c)i=c;else{const l=window.getSelection();if(!l||l.rangeCount===0)return;i=l.getRangeAt(0)}let r=null,d=i.startContainer;for(;d&&d!==document.body;){if(d.nodeType===Node.ELEMENT_NODE){const l=d;if(l.getAttribute("contenteditable")==="true"){r=l;break}}d=d.parentNode}const e=r?.innerHTML??"",n=document.createElement("span");n.id=t,n.className="rte-anchor",n.setAttribute("data-type","anchor"),n.setAttribute("data-anchor-id",t),n.setAttribute("title",`Anchor: ${t}`),n.style.cssText=`
95
95
  display: inline;
96
96
  position: relative;
97
97
  cursor: pointer;
98
- `,s.insertNode(i),h.add(t),s.setStart(i.nextSibling||i.parentNode,0),s.collapse(!0);const u=window.getSelection();if(u&&(u.removeAllRanges(),u.addRange(s)),d)$(d,e),d.dispatchEvent(new Event("input",{bubbles:!0}));else{const r=w.findEditorContainerFromSelection();if(r){const f=w.getContentElement(r);f&&f.dispatchEvent(new Event("input",{bubbles:!0}))}}D()}function D(){if(document.getElementById("rte-anchor-styles"))return;const t=document.createElement("style");t.id="rte-anchor-styles",t.textContent=`
98
+ `,i.insertNode(n),b.add(t),i.setStart(n.nextSibling||n.parentNode,0),i.collapse(!0);const u=window.getSelection();if(u&&(u.removeAllRanges(),u.addRange(i)),r)$(r,e),r.dispatchEvent(new Event("input",{bubbles:!0}));else{const l=w.findEditorContainerFromSelection();if(l){const h=w.getContentElement(l);h&&h.dispatchEvent(new Event("input",{bubbles:!0}))}}D()}function D(){if(document.getElementById("rte-anchor-styles"))return;const t=document.createElement("style");t.id="rte-anchor-styles",t.textContent=`
99
99
  .rte-anchor {
100
100
  display: inline;
101
101
  position: relative;
@@ -173,4 +173,4 @@
173
173
  outline: 2px solid #0066cc;
174
174
  outline-offset: 2px;
175
175
  }
176
- `,document.head.appendChild(t)}const I=()=>(typeof window<"u"&&(z(),D()),{name:"anchor",toolbar:[{label:"Anchor",command:"insertAnchor",icon:'<svg width="24px" height="24px" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"><g id="SVGRepo_bgCarrier" stroke-width="0"></g><g id="SVGRepo_tracerCarrier" stroke-linecap="round" stroke-linejoin="round"></g><g id="SVGRepo_iconCarrier"> <path d="M12 8.4C13.4912 8.4 14.7 7.19117 14.7 5.7C14.7 4.20883 13.4912 3 12 3C10.5088 3 9.3 4.20883 9.3 5.7C9.3 7.19117 10.5088 8.4 12 8.4ZM12 8.4V20.9999M12 20.9999C9.61305 20.9999 7.32387 20.0518 5.63604 18.364C3.94821 16.6761 3 14.3869 3 12H5M12 20.9999C14.3869 20.9999 16.6761 20.0518 18.364 18.364C20.0518 16.6761 21 14.3869 21 12H19" stroke="#000000" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"></path> </g></svg>',shortcut:"Mod-Shift-k"}],commands:{insertAnchor:()=>{try{const t=window.getSelection();if(!t||t.rangeCount===0)return alert("Please place your cursor where you want to insert the anchor."),!1;const l=t.getRangeAt(0).cloneRange();return H("add","",s=>{_(s,l)},l),!0}catch(t){return console.error("Failed to insert anchor:",t),!1}}},keymap:{"Mod-Shift-k":"insertAnchor"}});exports.AnchorPlugin=I;
176
+ `,document.head.appendChild(t)}const I=()=>(typeof window<"u"&&(z(),D()),{name:"anchor",toolbar:[{label:"Anchor",command:"insertAnchor",icon:'<svg width="24px" height="24px" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"><g id="SVGRepo_bgCarrier" stroke-width="0"></g><g id="SVGRepo_tracerCarrier" stroke-linecap="round" stroke-linejoin="round"></g><g id="SVGRepo_iconCarrier"> <path d="M12 8.4C13.4912 8.4 14.7 7.19117 14.7 5.7C14.7 4.20883 13.4912 3 12 3C10.5088 3 9.3 4.20883 9.3 5.7C9.3 7.19117 10.5088 8.4 12 8.4ZM12 8.4V20.9999M12 20.9999C9.61305 20.9999 7.32387 20.0518 5.63604 18.364C3.94821 16.6761 3 14.3869 3 12H5M12 20.9999C14.3869 20.9999 16.6761 20.0518 18.364 18.364C20.0518 16.6761 21 14.3869 21 12H19" stroke="#000000" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"></path> </g></svg>',shortcut:"Mod-Shift-k"}],commands:{insertAnchor:()=>{try{const t=window.getSelection();if(!t||t.rangeCount===0)return alert("Please place your cursor where you want to insert the anchor."),!1;const c=t.getRangeAt(0).cloneRange();return H("add","",i=>{_(i,c)},c),!0}catch(t){return console.error("Failed to insert anchor:",t),!1}}},keymap:{"Mod-Shift-k":"insertAnchor"}});exports.AnchorPlugin=I;
@@ -1,32 +1,28 @@
1
- import { f as D, g as S } from "./editorContainerHelpers-69585c07.mjs";
2
- const h = /* @__PURE__ */ new Set(), y = '[data-theme="dark"], .dark, .editora-theme-dark';
3
- function z(t, l) {
4
- if (l === t.innerHTML)
5
- return;
6
- const s = window.execEditorCommand || window.executeEditorCommand;
7
- if (typeof s == "function")
1
+ import { f as D, g as S } from "./editorContainerHelpers-C7kdWnS0.mjs";
2
+ const b = /* @__PURE__ */ new Set(), x = '[data-theme="dark"], .dark, .editora-theme-dark';
3
+ function z(t, c) {
4
+ if (c === t.innerHTML) return;
5
+ const i = window.execEditorCommand || window.executeEditorCommand;
6
+ if (typeof i == "function")
8
7
  try {
9
- s("recordDomTransaction", t, l, t.innerHTML);
8
+ i("recordDomTransaction", t, c, t.innerHTML);
10
9
  } catch {
11
10
  }
12
11
  }
13
12
  function R() {
14
- if (typeof window > "u" || window.__anchorObserverInitialized)
15
- return;
16
- window.__anchorObserverInitialized = !0, new MutationObserver((l) => {
17
- l.forEach((s) => {
18
- s.removedNodes.forEach((d) => {
19
- var a, e;
20
- if (d.nodeType === Node.ELEMENT_NODE) {
21
- const i = d;
22
- if ((a = i.classList) != null && a.contains("rte-anchor")) {
23
- const r = i.id;
24
- r && h.delete(r);
13
+ if (typeof window > "u" || window.__anchorObserverInitialized) return;
14
+ window.__anchorObserverInitialized = !0, new MutationObserver((c) => {
15
+ c.forEach((i) => {
16
+ i.removedNodes.forEach((n) => {
17
+ if (n.nodeType === Node.ELEMENT_NODE) {
18
+ const d = n;
19
+ if (d.classList?.contains("rte-anchor")) {
20
+ const r = d.id;
21
+ r && b.delete(r);
25
22
  }
26
- const u = (e = i.querySelectorAll) == null ? void 0 : e.call(i, ".rte-anchor");
27
- u == null || u.forEach((r) => {
28
- const f = r.id;
29
- f && h.delete(f);
23
+ d.querySelectorAll?.(".rte-anchor")?.forEach((r) => {
24
+ const u = r.id;
25
+ u && b.delete(u);
30
26
  });
31
27
  }
32
28
  });
@@ -41,35 +37,30 @@ function A(t) {
41
37
  }
42
38
  function M() {
43
39
  const t = D();
44
- if (!t)
45
- return;
46
- const l = S(t);
47
- if (!l)
48
- return;
49
- const s = l.querySelectorAll(".rte-anchor"), d = /* @__PURE__ */ new Set();
50
- s.forEach((a) => {
51
- const e = a.id;
52
- e && d.add(e);
53
- }), h.clear(), d.forEach((a) => h.add(a));
40
+ if (!t) return;
41
+ const c = S(t);
42
+ if (!c) return;
43
+ const i = c.querySelectorAll(".rte-anchor"), n = /* @__PURE__ */ new Set();
44
+ i.forEach((d) => {
45
+ const e = d.id;
46
+ e && n.add(e);
47
+ }), b.clear(), n.forEach((d) => b.add(d));
54
48
  }
55
49
  function H(t) {
56
50
  if (t) {
57
- const d = t.startContainer, a = d.nodeType === Node.ELEMENT_NODE ? d : d.parentElement;
58
- if (a != null && a.closest(y))
59
- return !0;
51
+ const n = t.startContainer;
52
+ if ((n.nodeType === Node.ELEMENT_NODE ? n : n.parentElement)?.closest(x)) return !0;
60
53
  }
61
- const l = window.getSelection();
62
- if (l && l.rangeCount > 0) {
63
- const d = l.getRangeAt(0).startContainer, a = d.nodeType === Node.ELEMENT_NODE ? d : d.parentElement;
64
- if (a != null && a.closest(y))
65
- return !0;
54
+ const c = window.getSelection();
55
+ if (c && c.rangeCount > 0) {
56
+ const n = c.getRangeAt(0).startContainer;
57
+ if ((n.nodeType === Node.ELEMENT_NODE ? n : n.parentElement)?.closest(x)) return !0;
66
58
  }
67
- const s = document.activeElement;
68
- return s != null && s.closest(y) ? !0 : document.body.matches(y) || document.documentElement.matches(y);
59
+ return document.activeElement?.closest(x) ? !0 : document.body.matches(x) || document.documentElement.matches(x);
69
60
  }
70
- function _(t, l, s, d) {
61
+ function _(t, c, i, n) {
71
62
  M();
72
- const a = H(d), e = a ? {
63
+ const d = H(n), e = d ? {
73
64
  overlay: "rgba(0, 0, 0, 0.62)",
74
65
  dialogBg: "#1f2937",
75
66
  panelBg: "#222d3a",
@@ -81,7 +72,6 @@ function _(t, l, s, d) {
81
72
  fieldFocusBg: "#111827",
82
73
  fieldBorder: "#4b5563",
83
74
  fieldText: "#e2e8f0",
84
- fieldPlaceholder: "#94a3b8",
85
75
  fieldErrorBg: "#3f2124",
86
76
  fieldErrorBorder: "#ef4444",
87
77
  cancelBg: "#334155",
@@ -106,7 +96,6 @@ function _(t, l, s, d) {
106
96
  fieldFocusBg: "#f9f9ff",
107
97
  fieldBorder: "#d0d0d0",
108
98
  fieldText: "#333333",
109
- fieldPlaceholder: "#9ca3af",
110
99
  fieldErrorBg: "#ffebee",
111
100
  fieldErrorBorder: "#d32f2f",
112
101
  cancelBg: "#f0f0f0",
@@ -119,8 +108,8 @@ function _(t, l, s, d) {
119
108
  help: "#999999",
120
109
  focusRing: "rgba(0, 102, 204, 0.1)",
121
110
  errorRing: "rgba(211, 47, 47, 0.1)"
122
- }, i = document.createElement("div");
123
- i.className = "rte-anchor-dialog-overlay", i.style.cssText = `
111
+ }, r = document.createElement("div");
112
+ r.className = "rte-anchor-dialog-overlay", r.style.cssText = `
124
113
  position: fixed;
125
114
  top: 0;
126
115
  left: 0;
@@ -144,8 +133,8 @@ function _(t, l, s, d) {
144
133
  overflow: hidden;
145
134
  animation: rte-anchor-dialog-appear 0.2s ease;
146
135
  `, !document.getElementById("rte-anchor-dialog-styles")) {
147
- const n = document.createElement("style");
148
- n.id = "rte-anchor-dialog-styles", n.textContent = `
136
+ const s = document.createElement("style");
137
+ s.id = "rte-anchor-dialog-styles", s.textContent = `
149
138
  @keyframes rte-anchor-dialog-appear {
150
139
  from { opacity: 0; transform: scale(0.95); }
151
140
  to { opacity: 1; transform: scale(1); }
@@ -153,11 +142,11 @@ function _(t, l, s, d) {
153
142
  .rte-anchor-dialog input:focus {
154
143
  outline: none !important;
155
144
  }
156
- `, document.head.appendChild(n);
145
+ `, document.head.appendChild(s);
157
146
  }
158
- let r = "";
159
- const f = document.createElement("div");
160
- f.style.cssText = `
147
+ let l = "";
148
+ const h = document.createElement("div");
149
+ h.style.cssText = `
161
150
  display: flex;
162
151
  align-items: center;
163
152
  justify-content: space-between;
@@ -166,9 +155,9 @@ function _(t, l, s, d) {
166
155
  background: ${e.panelBg};
167
156
  `;
168
157
  const w = document.createElement("h3");
169
- w.style.cssText = `margin: 0; font-size: 18px; font-weight: 600; color: ${e.text};`, w.textContent = t === "add" ? "Add Anchor" : "Edit Anchor";
170
- const p = document.createElement("button");
171
- p.textContent = "✕", p.style.cssText = `
158
+ w.style.cssText = `margin: 0; font-size: 18px; font-weight: 600; color: ${e.text};`, w.textContent = "Add Anchor";
159
+ const f = document.createElement("button");
160
+ f.textContent = "✕", f.style.cssText = `
172
161
  background: none;
173
162
  border: none;
174
163
  font-size: 24px;
@@ -182,19 +171,19 @@ function _(t, l, s, d) {
182
171
  justify-content: center;
183
172
  border-radius: 4px;
184
173
  transition: all 0.2s ease;
185
- `, p.onmouseover = () => {
186
- p.style.background = e.closeHoverBg, p.style.color = "#f8fafc";
187
- }, p.onmouseout = () => {
188
- p.style.background = "none", p.style.color = e.muted;
189
- }, f.appendChild(w), f.appendChild(p);
174
+ `, f.onmouseover = () => {
175
+ f.style.background = e.closeHoverBg, f.style.color = "#f8fafc";
176
+ }, f.onmouseout = () => {
177
+ f.style.background = "none", f.style.color = e.muted;
178
+ }, h.appendChild(w), h.appendChild(f);
190
179
  const C = document.createElement("div");
191
180
  C.style.cssText = "padding: 20px;";
192
- const x = document.createElement("div");
193
- x.style.cssText = "margin-bottom: 0;";
194
- const m = document.createElement("label");
195
- m.textContent = "Anchor ID", m.style.cssText = `display: block; font-size: 14px; font-weight: 500; color: ${e.text}; margin-bottom: 8px;`, m.setAttribute("for", "anchor-id-input");
181
+ const m = document.createElement("div");
182
+ m.style.cssText = "margin-bottom: 0;";
183
+ const y = document.createElement("label");
184
+ y.textContent = "Anchor ID", y.style.cssText = `display: block; font-size: 14px; font-weight: 500; color: ${e.text}; margin-bottom: 8px;`, y.setAttribute("for", "anchor-id-input");
196
185
  const o = document.createElement("input");
197
- o.id = "anchor-id-input", o.type = "text", o.placeholder = "e.g., section-introduction", o.value = l || "", o.style.cssText = `
186
+ o.id = "anchor-id-input", o.type = "text", o.placeholder = "e.g., section-introduction", o.value = "", o.style.cssText = `
198
187
  width: 100%;
199
188
  padding: 10px 12px;
200
189
  font-size: 14px;
@@ -206,15 +195,15 @@ function _(t, l, s, d) {
206
195
  transition: all 0.2s ease;
207
196
  box-sizing: border-box;
208
197
  `, o.style.setProperty("caret-color", e.fieldText);
209
- const g = document.createElement("div");
210
- g.style.cssText = `
198
+ const p = document.createElement("div");
199
+ p.style.cssText = `
211
200
  color: #d32f2f;
212
201
  font-size: 12px;
213
202
  margin-top: 6px;
214
203
  display: none;
215
204
  `;
216
205
  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;`, x.appendChild(m), x.appendChild(o), x.appendChild(g), x.appendChild(B), C.appendChild(x);
206
+ 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;`, m.appendChild(y), m.appendChild(o), m.appendChild(p), m.appendChild(B), C.appendChild(m);
218
207
  const v = document.createElement("div");
219
208
  v.style.cssText = `
220
209
  display: flex;
@@ -224,8 +213,8 @@ function _(t, l, s, d) {
224
213
  background: ${e.panelBg};
225
214
  justify-content: flex-end;
226
215
  `;
227
- const b = document.createElement("button");
228
- b.textContent = "Cancel", b.style.cssText = `
216
+ const g = document.createElement("button");
217
+ g.textContent = "Cancel", g.style.cssText = `
229
218
  padding: 8px 16px;
230
219
  font-size: 14px;
231
220
  font-weight: 500;
@@ -235,9 +224,9 @@ function _(t, l, s, d) {
235
224
  transition: all 0.2s ease;
236
225
  background: ${e.cancelBg};
237
226
  color: ${e.cancelText};
238
- `, b.onmouseover = () => b.style.background = e.cancelHover, b.onmouseout = () => b.style.background = e.cancelBg;
239
- const c = document.createElement("button");
240
- c.textContent = t === "add" ? "Add Anchor" : "Save Changes", c.style.cssText = `
227
+ `, g.onmouseover = () => g.style.background = e.cancelHover, g.onmouseout = () => g.style.background = e.cancelBg;
228
+ const a = document.createElement("button");
229
+ a.textContent = "Add Anchor", a.style.cssText = `
241
230
  padding: 8px 16px;
242
231
  font-size: 14px;
243
232
  font-weight: 500;
@@ -247,80 +236,78 @@ function _(t, l, s, d) {
247
236
  transition: all 0.2s ease;
248
237
  background: ${e.saveBg};
249
238
  color: white;
250
- `, c.disabled = !o.value.trim();
239
+ `, a.disabled = !o.value.trim();
251
240
  const $ = () => {
252
- o.value.trim() ? (c.disabled = !1, c.style.background = e.saveBg, c.style.color = "white", c.style.cursor = "pointer") : (c.disabled = !0, c.style.background = e.saveDisabledBg, c.style.color = e.saveDisabledText, c.style.cursor = "not-allowed");
241
+ o.value.trim() ? (a.disabled = !1, a.style.background = e.saveBg, a.style.color = "white", a.style.cursor = "pointer") : (a.disabled = !0, a.style.background = e.saveDisabledBg, a.style.color = e.saveDisabledText, a.style.cursor = "not-allowed");
253
242
  };
254
- c.onmouseover = () => {
255
- c.disabled || (c.style.background = e.saveHover, c.style.boxShadow = a ? "0 2px 8px rgba(59, 130, 246, 0.35)" : "0 2px 8px rgba(0, 102, 204, 0.3)");
256
- }, c.onmouseout = () => {
257
- c.disabled || (c.style.background = e.saveBg, c.style.boxShadow = "none");
258
- }, v.appendChild(b), v.appendChild(c), o.oninput = () => {
259
- const n = o.value;
260
- if ($(), n.trim()) {
261
- const k = A(n);
262
- k.valid ? t === "add" && h.has(n) ? (r = `Anchor ID already exists: ${n}`, g.textContent = "⚠ " + r, g.style.display = "block", o.style.borderColor = e.fieldErrorBorder, o.style.background = e.fieldErrorBg) : t === "edit" && n !== l && h.has(n) ? (r = `Anchor ID already exists: ${n}`, g.textContent = "⚠ " + r, g.style.display = "block", o.style.borderColor = e.fieldErrorBorder, o.style.background = e.fieldErrorBg) : (r = "", g.style.display = "none", o.style.borderColor = e.fieldBorder, o.style.background = e.fieldBg) : (r = k.error, g.textContent = "⚠ " + r, g.style.display = "block", o.style.borderColor = e.fieldErrorBorder, o.style.background = e.fieldErrorBg);
243
+ a.onmouseover = () => {
244
+ a.disabled || (a.style.background = e.saveHover, a.style.boxShadow = d ? "0 2px 8px rgba(59, 130, 246, 0.35)" : "0 2px 8px rgba(0, 102, 204, 0.3)");
245
+ }, a.onmouseout = () => {
246
+ a.disabled || (a.style.background = e.saveBg, a.style.boxShadow = "none");
247
+ }, v.appendChild(g), v.appendChild(a), o.oninput = () => {
248
+ const s = o.value;
249
+ if ($(), s.trim()) {
250
+ const k = A(s);
251
+ k.valid ? b.has(s) ? (l = `Anchor ID already exists: ${s}`, p.textContent = "⚠ " + l, p.style.display = "block", o.style.borderColor = e.fieldErrorBorder, o.style.background = e.fieldErrorBg) : (l = "", p.style.display = "none", o.style.borderColor = e.fieldBorder, o.style.background = e.fieldBg) : (l = k.error, p.textContent = "⚠ " + l, p.style.display = "block", o.style.borderColor = e.fieldErrorBorder, o.style.background = e.fieldErrorBg);
263
252
  } else
264
- g.style.display = "none", o.style.borderColor = e.fieldBorder, o.style.background = e.fieldBg;
253
+ p.style.display = "none", o.style.borderColor = e.fieldBorder, o.style.background = e.fieldBg;
265
254
  }, o.onfocus = () => {
266
- o.style.borderColor = r ? e.fieldErrorBorder : e.saveBg, o.style.boxShadow = r ? `0 0 0 3px ${e.errorRing}` : `0 0 0 3px ${e.focusRing}`, o.style.background = r ? e.fieldErrorBg : e.fieldFocusBg;
255
+ o.style.borderColor = l ? e.fieldErrorBorder : e.saveBg, o.style.boxShadow = l ? `0 0 0 3px ${e.errorRing}` : `0 0 0 3px ${e.focusRing}`, o.style.background = l ? e.fieldErrorBg : e.fieldFocusBg;
267
256
  }, o.onblur = () => {
268
- o.style.boxShadow = "none", r || (o.style.background = e.fieldBg);
257
+ o.style.boxShadow = "none", l || (o.style.background = e.fieldBg);
269
258
  };
270
259
  const T = () => {
271
- const n = o.value.trim();
272
- !n || !A(n).valid || t === "add" && h.has(n) || t === "edit" && n !== l && h.has(n) || (s && s(n), i.remove());
260
+ const s = o.value.trim();
261
+ !s || !A(s).valid || b.has(s) || (i && i(s), r.remove());
273
262
  }, E = () => {
274
- i.remove();
263
+ r.remove();
275
264
  };
276
- c.onclick = T, b.onclick = E, p.onclick = E, o.onkeydown = (n) => {
277
- n.key === "Enter" ? (n.preventDefault(), T()) : n.key === "Escape" && (n.preventDefault(), E());
278
- }, i.onclick = (n) => {
279
- n.target === i && E();
280
- }, u.appendChild(f), u.appendChild(C), u.appendChild(v), i.appendChild(u), document.body.appendChild(i), setTimeout(() => o.focus(), 100);
265
+ a.onclick = T, g.onclick = E, f.onclick = E, o.onkeydown = (s) => {
266
+ s.key === "Enter" ? (s.preventDefault(), T()) : s.key === "Escape" && (s.preventDefault(), E());
267
+ }, r.onclick = (s) => {
268
+ s.target === r && E();
269
+ }, u.appendChild(h), u.appendChild(C), u.appendChild(v), r.appendChild(u), document.body.appendChild(r), setTimeout(() => o.focus(), 100);
281
270
  }
282
- function I(t, l) {
283
- let s;
284
- if (l)
285
- s = l;
271
+ function I(t, c) {
272
+ let i;
273
+ if (c)
274
+ i = c;
286
275
  else {
287
- const r = window.getSelection();
288
- if (!r || r.rangeCount === 0)
289
- return;
290
- s = r.getRangeAt(0);
276
+ const l = window.getSelection();
277
+ if (!l || l.rangeCount === 0) return;
278
+ i = l.getRangeAt(0);
291
279
  }
292
- let d = null, a = s.startContainer;
293
- for (; a && a !== document.body; ) {
294
- if (a.nodeType === Node.ELEMENT_NODE) {
295
- const r = a;
296
- if (r.getAttribute("contenteditable") === "true") {
297
- d = r;
280
+ let n = null, d = i.startContainer;
281
+ for (; d && d !== document.body; ) {
282
+ if (d.nodeType === Node.ELEMENT_NODE) {
283
+ const l = d;
284
+ if (l.getAttribute("contenteditable") === "true") {
285
+ n = l;
298
286
  break;
299
287
  }
300
288
  }
301
- a = a.parentNode;
289
+ d = d.parentNode;
302
290
  }
303
- const e = (d == null ? void 0 : d.innerHTML) ?? "", i = document.createElement("span");
304
- 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 = `
291
+ const e = n?.innerHTML ?? "", r = document.createElement("span");
292
+ r.id = t, r.className = "rte-anchor", r.setAttribute("data-type", "anchor"), r.setAttribute("data-anchor-id", t), r.setAttribute("title", `Anchor: ${t}`), r.style.cssText = `
305
293
  display: inline;
306
294
  position: relative;
307
295
  cursor: pointer;
308
- `, s.insertNode(i), h.add(t), s.setStart(i.nextSibling || i.parentNode, 0), s.collapse(!0);
296
+ `, i.insertNode(r), b.add(t), i.setStart(r.nextSibling || r.parentNode, 0), i.collapse(!0);
309
297
  const u = window.getSelection();
310
- if (u && (u.removeAllRanges(), u.addRange(s)), d)
311
- z(d, e), d.dispatchEvent(new Event("input", { bubbles: !0 }));
298
+ if (u && (u.removeAllRanges(), u.addRange(i)), n)
299
+ z(n, e), n.dispatchEvent(new Event("input", { bubbles: !0 }));
312
300
  else {
313
- const r = D();
314
- if (r) {
315
- const f = S(r);
316
- f && f.dispatchEvent(new Event("input", { bubbles: !0 }));
301
+ const l = D();
302
+ if (l) {
303
+ const h = S(l);
304
+ h && h.dispatchEvent(new Event("input", { bubbles: !0 }));
317
305
  }
318
306
  }
319
307
  N();
320
308
  }
321
309
  function N() {
322
- if (document.getElementById("rte-anchor-styles"))
323
- return;
310
+ if (document.getElementById("rte-anchor-styles")) return;
324
311
  const t = document.createElement("style");
325
312
  t.id = "rte-anchor-styles", t.textContent = `
326
313
  .rte-anchor {
@@ -418,10 +405,10 @@ const O = () => (typeof window < "u" && (R(), N()), {
418
405
  const t = window.getSelection();
419
406
  if (!t || t.rangeCount === 0)
420
407
  return alert("Please place your cursor where you want to insert the anchor."), !1;
421
- const l = t.getRangeAt(0).cloneRange();
422
- return _("add", "", (s) => {
423
- I(s, l);
424
- }, l), !0;
408
+ const c = t.getRangeAt(0).cloneRange();
409
+ return _("add", "", (i) => {
410
+ I(i, c);
411
+ }, c), !0;
425
412
  } catch (t) {
426
413
  return console.error("Failed to insert anchor:", t), !1;
427
414
  }
@@ -0,0 +1 @@
1
+ "use strict";const b="p,div,li,ul,ol,table,thead,tbody,tfoot,tr,td,th,h1,h2,h3,h4,h5,h6,blockquote,pre";function p(e){return!!e.cloneContents().querySelector(b)}function v(e,t){return(e?.nodeType===Node.ELEMENT_NODE?e:e?.parentElement??null)?.closest('[contenteditable="true"]')||t()?.querySelector('[contenteditable="true"]')||document.querySelector('[contenteditable="true"]')}function C(e,t){const n=v(e,t);n&&n.dispatchEvent(new Event("input",{bubbles:!0}))}function A(e,t){let r=e.startContainer.nodeType===Node.TEXT_NODE?e.startContainer.parentElement:e.startContainer;for(;r&&r!==document.body;){if(r.classList.contains(t)){const c=document.createRange();if(c.selectNodeContents(r),c.compareBoundaryPoints(Range.START_TO_START,e)<=0&&c.compareBoundaryPoints(Range.END_TO_END,e)>=0)return r}r=r.parentElement}return null}function S(e){try{if(e.savedRange){const o=window.getSelection();o&&(o.removeAllRanges(),o.addRange(e.savedRange.cloneRange()))}const t=window.getSelection();if(!t||t.rangeCount===0||t.isCollapsed)return!1;const n=t.getRangeAt(0);if(n.collapsed)return!1;const r=A(n,e.className);if(r)return e.styleProperty==="backgroundColor"?r.style.backgroundColor=e.color:r.style.color=e.color,C(r,e.getActiveEditorRoot),!0;v(n.commonAncestorContainer,e.getActiveEditorRoot)?.focus({preventScroll:!0});try{document.execCommand("styleWithCSS",!1,"true")}catch{}let l=!1;if(e.commands.forEach(o=>{l||(l=document.execCommand(o,!1,e.color))}),!l&&!p(n)){const o=document.createElement("span");e.styleProperty==="backgroundColor"?o.style.backgroundColor=e.color:o.style.color=e.color,o.className=e.className;const a=n.extractContents();o.appendChild(a),n.insertNode(o),n.setStartAfter(o),n.collapse(!0),t.removeAllRanges(),t.addRange(n),l=!0}return l?(C(n.commonAncestorContainer,e.getActiveEditorRoot),!0):(e.warnMessage&&console.warn(e.warnMessage),!1)}catch(t){return e.warnMessage?console.error(e.warnMessage,t):console.error("[ColorApply] Failed to apply color",t),!1}}function T({popover:e,anchor:t,onClose:n,gap:r=6,margin:c=8,zIndex:l=1e4}){e.style.position="fixed",e.style.zIndex=`${l}`,e.style.visibility="hidden";const o=()=>{if(!e.isConnected||!t.isConnected){n();return}const s=t.getBoundingClientRect();if(s.width===0&&s.height===0){n();return}const i=e.getBoundingClientRect(),y=i.width||e.offsetWidth||220,f=i.height||e.offsetHeight||260,w=window.innerWidth,E=window.innerHeight;let u=s.left,d=s.bottom+r;if(u+y>w-c&&(u=w-y-c),u=Math.max(c,u),d+f>E-c){const g=s.top-f-r;g>=c?d=g:d=Math.max(c,E-f-c)}d<c&&(d=c),e.style.left=`${Math.round(u)}px`,e.style.top=`${Math.round(d)}px`,e.style.visibility="visible"},a=()=>{o()},m=s=>{const i=s.target;i&&(e.contains(i)||t.contains(i)||n())},h=s=>{s.key==="Escape"&&n()};window.addEventListener("resize",a),window.addEventListener("scroll",a,!0),document.addEventListener("keydown",h);const R=window.requestAnimationFrame(()=>{document.addEventListener("mousedown",m,!0)});return o(),{reposition:o,destroy:()=>{window.cancelAnimationFrame(R),window.removeEventListener("resize",a),window.removeEventListener("scroll",a,!0),document.removeEventListener("keydown",h),document.removeEventListener("mousedown",m,!0)}}}exports.applyColorToSelection=S;exports.attachAnchoredPopover=T;