@editora/plugins 1.0.9 → 1.0.10

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 (140) hide show
  1. package/README.md +5 -0
  2. package/dist/_commonjsHelpers-6763f629.js +1 -0
  3. package/dist/_commonjsHelpers-c5d32002.mjs +30 -0
  4. package/dist/a11y-checker.cjs.js +12 -12
  5. package/dist/a11y-checker.esm.js +98 -80
  6. package/dist/anchor.cjs.js +12 -12
  7. package/dist/anchor.esm.js +128 -115
  8. package/dist/anchoredPopover-33f1358d.mjs +109 -0
  9. package/dist/anchoredPopover-8151d535.js +1 -0
  10. package/dist/approval-workflow.cjs.js +40 -40
  11. package/dist/approval-workflow.esm.js +249 -208
  12. package/dist/background-color.cjs.js +2 -2
  13. package/dist/background-color.esm.js +68 -55
  14. package/dist/blockquote.esm.js +2 -1
  15. package/dist/blocks-library.cjs.js +45 -45
  16. package/dist/blocks-library.esm.js +245 -178
  17. package/dist/capitalization.esm.js +2 -1
  18. package/dist/checklist.cjs.js +1 -1
  19. package/dist/checklist.esm.js +82 -58
  20. package/dist/citations.cjs.js +37 -37
  21. package/dist/citations.esm.js +512 -439
  22. package/dist/clear-formatting.cjs.js +1 -1
  23. package/dist/clear-formatting.esm.js +33 -27
  24. package/dist/code-sample.cjs.js +14 -14
  25. package/dist/code-sample.esm.js +93 -82
  26. package/dist/code.cjs.js +32 -32
  27. package/dist/code.esm.js +653 -594
  28. package/dist/comments.cjs.js +6 -6
  29. package/dist/comments.esm.js +158 -116
  30. package/dist/conditional-content.cjs.js +90 -90
  31. package/dist/conditional-content.esm.js +432 -371
  32. package/dist/content-rules.cjs.js +7 -7
  33. package/dist/content-rules.esm.js +159 -105
  34. package/dist/data-binding.cjs.js +46 -46
  35. package/dist/data-binding.esm.js +368 -328
  36. package/dist/direction.esm.js +18 -9
  37. package/dist/doc-schema.cjs.js +29 -29
  38. package/dist/doc-schema.esm.js +308 -240
  39. package/dist/document-manager.cjs.js +1 -1
  40. package/dist/document-manager.esm.js +5 -4
  41. package/dist/documentManager-25b6203c.mjs +9122 -0
  42. package/dist/documentManager-b69e7054.js +17 -0
  43. package/dist/{editorContainerHelpers-C7kdWnS0.mjs → editorContainerHelpers-69585c07.mjs} +2 -1
  44. package/dist/embed-iframe.cjs.js +4 -4
  45. package/dist/embed-iframe.esm.js +81 -73
  46. package/dist/emojis.cjs.js +8 -8
  47. package/dist/emojis.esm.js +77 -65
  48. package/dist/enterprise.cjs.js +1 -1
  49. package/dist/enterprise.esm.js +56 -54
  50. package/dist/font-family.cjs.js +1 -1
  51. package/dist/font-family.esm.js +47 -39
  52. package/dist/font-size.cjs.js +1 -1
  53. package/dist/font-size.esm.js +53 -37
  54. package/dist/footnote.cjs.js +2 -2
  55. package/dist/footnote.esm.js +117 -76
  56. package/dist/history.cjs.js +1 -1
  57. package/dist/history.esm.js +92 -70
  58. package/dist/html2canvas.esm-09133e29.js +22 -0
  59. package/dist/{html2canvas.esm-BWVIUcAF.mjs → html2canvas.esm-1a1724a1.mjs} +225 -141
  60. package/dist/indent.cjs.js +1 -1
  61. package/dist/indent.esm.js +24 -12
  62. package/dist/index-656d224b.js +231 -0
  63. package/dist/index-6a8c48bb.js +1 -0
  64. package/dist/index-d027b7e2.mjs +16859 -0
  65. package/dist/{index-BFsKNTTj.mjs → index-f04538f2.mjs} +71 -70
  66. package/dist/index.cjs.js +1 -1
  67. package/dist/index.es-730f2d98.mjs +5775 -0
  68. package/dist/index.es-dd40173b.js +18 -0
  69. package/dist/index.esm.js +128 -125
  70. package/dist/italic.cjs.js +1 -1
  71. package/dist/italic.esm.js +9 -8
  72. package/dist/jspdf.es.min-90db2c97.js +243 -0
  73. package/dist/{jspdf.es.min-DQCoX5yh.mjs → jspdf.es.min-c36a4fd8.mjs} +4682 -3658
  74. package/dist/line-height.cjs.js +1 -1
  75. package/dist/line-height.esm.js +24 -11
  76. package/dist/link.cjs.js +5 -5
  77. package/dist/link.esm.js +30 -24
  78. package/dist/list.cjs.js +1 -1
  79. package/dist/list.esm.js +25 -20
  80. package/dist/lite.cjs.js +1 -1
  81. package/dist/lite.esm.js +61 -59
  82. package/dist/math.cjs.js +21 -21
  83. package/dist/math.esm.js +146 -139
  84. package/dist/media-manager.cjs.js +38 -38
  85. package/dist/media-manager.esm.js +325 -308
  86. package/dist/mentions.cjs.js +9 -9
  87. package/dist/mentions.esm.js +286 -238
  88. package/dist/merge-tag.cjs.js +2 -2
  89. package/dist/merge-tag.esm.js +216 -177
  90. package/dist/page-break.cjs.js +2 -2
  91. package/dist/page-break.esm.js +49 -33
  92. package/dist/pii-redaction.cjs.js +19 -19
  93. package/dist/pii-redaction.esm.js +463 -393
  94. package/dist/preview.esm.js +10 -5
  95. package/dist/print.cjs.js +4 -4
  96. package/dist/print.esm.js +20 -17
  97. package/dist/{purify.es-DHhaBdbu.mjs → purify.es-35a15df8.mjs} +19 -9
  98. package/dist/{purify.es-T2a3nLiC.js → purify.es-a8d731c6.js} +1 -1
  99. package/dist/slash-commands.cjs.js +3 -3
  100. package/dist/slash-commands.esm.js +212 -176
  101. package/dist/smart-paste.cjs.js +27 -27
  102. package/dist/smart-paste.esm.js +336 -280
  103. package/dist/special-characters.cjs.js +7 -7
  104. package/dist/special-characters.esm.js +69 -61
  105. package/dist/spell-check.cjs.js +5 -5
  106. package/dist/spell-check.esm.js +123 -97
  107. package/dist/strikethrough.cjs.js +1 -1
  108. package/dist/strikethrough.esm.js +19 -14
  109. package/dist/style.css +1 -0
  110. package/dist/table.cjs.js +4 -4
  111. package/dist/table.esm.js +225 -191
  112. package/dist/template.cjs.js +11 -11
  113. package/dist/template.esm.js +153 -124
  114. package/dist/text-alignment.cjs.js +1 -1
  115. package/dist/text-alignment.esm.js +27 -21
  116. package/dist/text-color.cjs.js +3 -3
  117. package/dist/text-color.esm.js +87 -70
  118. package/dist/track-changes.cjs.js +2 -2
  119. package/dist/track-changes.esm.js +162 -100
  120. package/dist/translation-workflow.cjs.js +74 -74
  121. package/dist/translation-workflow.esm.js +678 -602
  122. package/dist/version-diff.cjs.js +14 -14
  123. package/dist/version-diff.esm.js +157 -128
  124. package/package.json +13 -7
  125. package/LICENSE +0 -21
  126. package/dist/_commonjsHelpers-BH3jXuIh.js +0 -1
  127. package/dist/_commonjsHelpers-ByX85dGu.mjs +0 -33
  128. package/dist/anchoredPopover-BzqGPOAE.js +0 -1
  129. package/dist/anchoredPopover-Dts0IrgU.mjs +0 -106
  130. package/dist/documentManager-CTqRftU8.mjs +0 -8369
  131. package/dist/documentManager-Jf0RbSks.js +0 -17
  132. package/dist/html2canvas.esm-B5qzocYs.js +0 -5
  133. package/dist/index-CvJk4DKa.js +0 -221
  134. package/dist/index-D3CycEFU.mjs +0 -16543
  135. package/dist/index-tqLTHcO6.js +0 -1
  136. package/dist/index.es-CE_A4QSm.js +0 -5
  137. package/dist/index.es-DQ78mYYo.mjs +0 -6665
  138. package/dist/jspdf.es.min-BoS80556.js +0 -77
  139. package/dist/plugins.css +0 -1
  140. /package/dist/{editorContainerHelpers-CFbfiOJI.js → editorContainerHelpers-36b8ddf3.js} +0 -0
@@ -1,4 +1,4 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const C=new WeakMap;let x=null,S=!1,k=0;const E="User";function v(t){return k+=1,`${t}-${Date.now()}-${k}`}function y(t){if(!t)return null;const e=t instanceof Element?t:t.parentElement;return e?e.closest("[data-editora-editor]")||e.closest(".rte-editor")||e.closest(".editora-editor"):null}function A(t){const e=t?.editorElement||t?.contentElement||null;if(!(e instanceof HTMLElement))return;const r=e.closest("[data-editora-editor], .rte-editor, .editora-editor, editora-editor")||(e.matches("[data-editora-editor], .rte-editor, .editora-editor, editora-editor")?e:null);r&&(x=r)}function w(t,e){return e.contains(t.commonAncestorContainer)}function B(){if(typeof window<"u"){const o=window.__editoraCommandEditorRoot;if(o instanceof HTMLElement){const a=o.closest("[data-editora-editor], .rte-editor, .editora-editor, editora-editor")||(o.matches("[data-editora-editor], .rte-editor, .editora-editor, editora-editor")?o:null);if(a)return x=a,window.__editoraCommandEditorRoot=null,a}}const t=document.activeElement,e=t?y(t):null;if(e)return e;const r=window.getSelection();if(r&&r.rangeCount>0){const o=y(r.getRangeAt(0).commonAncestorContainer);if(o)return o}return x}function H(t){const e=C.get(t);if(e)return e;const r={root:t,comments:new Map,panelVisible:!1,panelElement:null,expandedComments:new Set,replyTexts:{},savedSelection:null,newCommentText:"",selectionChangeListener:null};return C.set(t,r),r}function u(){const t=B();return t?(x=t,H(t)):null}function R(t){const e=window.getSelection();if(!e||e.rangeCount===0||e.isCollapsed)return null;const r=e.getRangeAt(0);return w(r,t)?r.cloneRange():null}function I(t,e){if(!e.anchorId)return;const r=t.root.querySelector(`#${e.anchorId}`);r&&r.classList.toggle("rte-comment-anchor-resolved",e.resolved)}function h(t,e,r){const o=t.comments.get(e);if(!o||!o.anchorId)return;const a=t.root.querySelector(`#${o.anchorId}`);a&&a.classList.toggle("highlighted",r)}function $(t,e,r){e.onclick=o=>{o.preventDefault(),o.stopPropagation(),x=t.root,t.expandedComments.add(r),g(t,!0),m(t)}}function q(t){const e=t.parentNode;if(e){for(;t.firstChild;)e.insertBefore(t.firstChild,t);t.remove()}}function g(t,e){if(t.panelVisible=e,e){Z(),N(t),t.root.setAttribute("data-rte-comments-open","true"),t.panelElement&&(t.panelElement.classList.add("is-open"),t.panelElement.setAttribute("aria-hidden","false")),z(t);return}t.root.removeAttribute("data-rte-comments-open"),V(t),t.panelElement&&(t.panelElement.remove(),t.panelElement=null)}function N(t){if(t.panelElement)return;const e=document.createElement("aside");e.className="rte-comments-panel",e.setAttribute("role","complementary"),e.setAttribute("aria-label","Comments"),e.setAttribute("aria-hidden","true"),window.getComputedStyle(t.root).position==="static"&&(t.root.style.position="relative"),t.root.appendChild(e),t.panelElement=e}function z(t){t.selectionChangeListener||(t.selectionChangeListener=()=>{const e=window.getSelection();if(!e||e.rangeCount===0||e.isCollapsed)return;const r=e.getRangeAt(0);w(r,t.root)&&(t.savedSelection=r.cloneRange(),x=t.root)},document.addEventListener("selectionchange",t.selectionChangeListener))}function V(t){t.selectionChangeListener&&(document.removeEventListener("selectionchange",t.selectionChangeListener),t.selectionChangeListener=null)}function M(t){return Array.from(t.comments.values()).sort((e,r)=>r.createdAt.localeCompare(e.createdAt))}function L(t){return new Date(t).toLocaleString()}function D(t,e){const r=t.expandedComments.has(e.id),o=document.createElement("article");o.className=`rte-comment-item${e.resolved?" resolved":""}`,o.innerHTML=`
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const C=new WeakMap;let g=null,S=!1,k=0;const E="User";function v(t){return k+=1,`${t}-${Date.now()}-${k}`}function y(t){if(!t)return null;const e=t instanceof Element?t:t.parentElement;return e?e.closest("[data-editora-editor]")||e.closest(".rte-editor")||e.closest(".editora-editor"):null}function A(t){const e=(t==null?void 0:t.editorElement)||(t==null?void 0:t.contentElement)||null;if(!(e instanceof HTMLElement))return;const r=e.closest("[data-editora-editor], .rte-editor, .editora-editor, editora-editor")||(e.matches("[data-editora-editor], .rte-editor, .editora-editor, editora-editor")?e:null);r&&(g=r)}function w(t,e){return e.contains(t.commonAncestorContainer)}function H(){if(typeof window<"u"){const o=window.__editoraCommandEditorRoot;if(o instanceof HTMLElement){const a=o.closest("[data-editora-editor], .rte-editor, .editora-editor, editora-editor")||(o.matches("[data-editora-editor], .rte-editor, .editora-editor, editora-editor")?o:null);if(a)return g=a,window.__editoraCommandEditorRoot=null,a}}const t=document.activeElement,e=t?y(t):null;if(e)return e;const r=window.getSelection();if(r&&r.rangeCount>0){const o=y(r.getRangeAt(0).commonAncestorContainer);if(o)return o}return g}function $(t){const e=C.get(t);if(e)return e;const r={root:t,comments:new Map,panelVisible:!1,panelElement:null,expandedComments:new Set,replyTexts:{},savedSelection:null,newCommentText:"",selectionChangeListener:null};return C.set(t,r),r}function f(){const t=H();return t?(g=t,$(t)):null}function R(t){const e=window.getSelection();if(!e||e.rangeCount===0||e.isCollapsed)return null;const r=e.getRangeAt(0);return w(r,t)?r.cloneRange():null}function I(t,e){if(!e.anchorId)return;const r=t.root.querySelector(`#${e.anchorId}`);r&&r.classList.toggle("rte-comment-anchor-resolved",e.resolved)}function h(t,e,r){const o=t.comments.get(e);if(!o||!o.anchorId)return;const a=t.root.querySelector(`#${o.anchorId}`);a&&a.classList.toggle("highlighted",r)}function q(t,e,r){e.onclick=o=>{o.preventDefault(),o.stopPropagation(),g=t.root,t.expandedComments.add(r),b(t,!0),m(t)}}function N(t){const e=t.parentNode;if(e){for(;t.firstChild;)e.insertBefore(t.firstChild,t);t.remove()}}function b(t,e){if(t.panelVisible=e,e){Z(),z(t),t.root.setAttribute("data-rte-comments-open","true"),t.panelElement&&(t.panelElement.classList.add("is-open"),t.panelElement.setAttribute("aria-hidden","false")),V(t);return}t.root.removeAttribute("data-rte-comments-open"),M(t),t.panelElement&&(t.panelElement.remove(),t.panelElement=null)}function z(t){if(t.panelElement)return;const e=document.createElement("aside");e.className="rte-comments-panel",e.setAttribute("role","complementary"),e.setAttribute("aria-label","Comments"),e.setAttribute("aria-hidden","true"),window.getComputedStyle(t.root).position==="static"&&(t.root.style.position="relative"),t.root.appendChild(e),t.panelElement=e}function V(t){t.selectionChangeListener||(t.selectionChangeListener=()=>{const e=window.getSelection();if(!e||e.rangeCount===0||e.isCollapsed)return;const r=e.getRangeAt(0);w(r,t.root)&&(t.savedSelection=r.cloneRange(),g=t.root)},document.addEventListener("selectionchange",t.selectionChangeListener))}function M(t){t.selectionChangeListener&&(document.removeEventListener("selectionchange",t.selectionChangeListener),t.selectionChangeListener=null)}function B(t){return Array.from(t.comments.values()).sort((e,r)=>r.createdAt.localeCompare(e.createdAt))}function L(t){return new Date(t).toLocaleString()}function D(t,e){const r=t.expandedComments.has(e.id),o=document.createElement("article");o.className=`rte-comment-item${e.resolved?" resolved":""}`,o.innerHTML=`
2
2
  <header class="rte-comment-header">
3
3
  <div class="rte-comment-meta">
4
4
  <strong class="rte-comment-author">${e.author}</strong>
@@ -11,16 +11,16 @@
11
11
  <div class="rte-comment-text"></div>
12
12
  ${e.selectedText?`<blockquote class="rte-comment-selection">${e.selectedText}</blockquote>`:""}
13
13
  <section class="rte-comment-expanded${r?" show":""}"></section>
14
- `;const a=o.querySelector(".rte-comment-text");a&&(a.textContent=e.text),o.querySelector(".rte-comment-expand")?.addEventListener("click",()=>{t.expandedComments.has(e.id)?t.expandedComments.delete(e.id):t.expandedComments.add(e.id),m(t)});const p=o.querySelector(".rte-comment-expanded");if(p&&r){if(e.replies.length>0){const n=document.createElement("div");n.className="rte-comment-replies",e.replies.forEach(s=>{const l=document.createElement("div");l.className="rte-comment-reply",l.innerHTML=`
14
+ `;const a=o.querySelector(".rte-comment-text");a&&(a.textContent=e.text);const i=o.querySelector(".rte-comment-expand");i==null||i.addEventListener("click",()=>{t.expandedComments.has(e.id)?t.expandedComments.delete(e.id):t.expandedComments.add(e.id),m(t)});const u=o.querySelector(".rte-comment-expanded");if(u&&r){if(e.replies.length>0){const n=document.createElement("div");n.className="rte-comment-replies",e.replies.forEach(s=>{const p=document.createElement("div");p.className="rte-comment-reply",p.innerHTML=`
15
15
  <div class="rte-comment-reply-header">
16
16
  <strong>${s.author}</strong>
17
17
  <time>${L(s.createdAt)}</time>
18
18
  </div>
19
19
  <div class="rte-comment-reply-text"></div>
20
- `;const f=l.querySelector(".rte-comment-reply-text");f&&(f.textContent=s.text),n.appendChild(l)}),p.appendChild(n)}if(!e.resolved){const n=document.createElement("div");n.className="rte-comment-reply-composer",n.innerHTML=`
20
+ `;const d=p.querySelector(".rte-comment-reply-text");d&&(d.textContent=s.text),n.appendChild(p)}),u.appendChild(n)}if(!e.resolved){const n=document.createElement("div");n.className="rte-comment-reply-composer",n.innerHTML=`
21
21
  <textarea class="rte-comment-reply-textarea" rows="2" placeholder="Reply..."></textarea>
22
22
  <button type="button" class="rte-comment-btn primary">Reply</button>
23
- `;const s=n.querySelector(".rte-comment-reply-textarea"),l=n.querySelector(".rte-comment-btn.primary");if(s&&l){s.value=t.replyTexts[e.id]||"";const f=()=>{const b=!!s.value.trim();l.disabled=!b};f(),s.addEventListener("input",()=>{t.replyTexts[e.id]=s.value,f()}),l.addEventListener("click",()=>{const b=s.value.trim();b&&(F(e.id,E,b),t.replyTexts[e.id]="",m(t))})}p.appendChild(n)}const c=document.createElement("div");if(c.className="rte-comment-actions",e.anchorId){const n=document.createElement("button");n.type="button",n.className="rte-comment-btn ghost",n.textContent="Jump to text",n.onclick=()=>{const s=t.root.querySelector(`#${e.anchorId}`);s&&(s.scrollIntoView({behavior:"smooth",block:"center",inline:"nearest"}),h(t,e.id,!0),window.setTimeout(()=>h(t,e.id,!1),1200))},c.appendChild(n)}if(e.resolved){const n=document.createElement("button");n.type="button",n.className="rte-comment-btn ghost",n.textContent="Reopen",n.onclick=()=>_(e.id),c.appendChild(n)}else{const n=document.createElement("button");n.type="button",n.className="rte-comment-btn success",n.textContent="Resolve",n.onclick=()=>P(e.id,E),c.appendChild(n)}const i=document.createElement("button");i.type="button",i.className="rte-comment-btn danger",i.textContent="Delete",i.onclick=()=>j(e.id),c.appendChild(i),p.appendChild(c)}return o.addEventListener("mouseenter",()=>h(t,e.id,!0)),o.addEventListener("mouseleave",()=>h(t,e.id,!1)),o}function m(t){const e=t||u();if(!e?.panelElement)return;const r=M(e);e.panelElement.innerHTML=`
23
+ `;const s=n.querySelector(".rte-comment-reply-textarea"),p=n.querySelector(".rte-comment-btn.primary");if(s&&p){s.value=t.replyTexts[e.id]||"";const d=()=>{const x=!!s.value.trim();p.disabled=!x};d(),s.addEventListener("input",()=>{t.replyTexts[e.id]=s.value,d()}),p.addEventListener("click",()=>{const x=s.value.trim();x&&(F(e.id,E,x),t.replyTexts[e.id]="",m(t))})}u.appendChild(n)}const l=document.createElement("div");if(l.className="rte-comment-actions",e.anchorId){const n=document.createElement("button");n.type="button",n.className="rte-comment-btn ghost",n.textContent="Jump to text",n.onclick=()=>{const s=t.root.querySelector(`#${e.anchorId}`);s&&(s.scrollIntoView({behavior:"smooth",block:"center",inline:"nearest"}),h(t,e.id,!0),window.setTimeout(()=>h(t,e.id,!1),1200))},l.appendChild(n)}if(e.resolved){const n=document.createElement("button");n.type="button",n.className="rte-comment-btn ghost",n.textContent="Reopen",n.onclick=()=>_(e.id),l.appendChild(n)}else{const n=document.createElement("button");n.type="button",n.className="rte-comment-btn success",n.textContent="Resolve",n.onclick=()=>P(e.id,E),l.appendChild(n)}const c=document.createElement("button");c.type="button",c.className="rte-comment-btn danger",c.textContent="Delete",c.onclick=()=>j(e.id),l.appendChild(c),u.appendChild(l)}return o.addEventListener("mouseenter",()=>h(t,e.id,!0)),o.addEventListener("mouseleave",()=>h(t,e.id,!1)),o}function m(t){const e=t||f();if(!(e!=null&&e.panelElement))return;const r=B(e);e.panelElement.innerHTML=`
24
24
  <div class="rte-comments-header">
25
25
  <div>
26
26
  <h3>Comments (${r.length})</h3>
@@ -35,7 +35,7 @@
35
35
  </div>
36
36
  </div>
37
37
  ${r.length===0?'<div class="rte-comments-empty">No comments yet.</div>':'<div class="rte-comments-list"></div>'}
38
- `,e.panelElement.querySelector(".rte-comments-close")?.addEventListener("click",()=>{g(e,!1)});const a=e.panelElement.querySelector(".new-comment-textarea"),d=e.panelElement.querySelector(".add-comment-btn");if(a&&d){a.value=e.newCommentText;const c=()=>{const i=!!a.value.trim();d.disabled=!i};c(),a.addEventListener("input",()=>{e.newCommentText=a.value,c()}),a.addEventListener("keydown",i=>{(i.ctrlKey||i.metaKey)&&i.key==="Enter"&&(i.preventDefault(),d.click())}),d.addEventListener("click",()=>{const i=a.value.trim();if(!i)return;const n=!!e.savedSelection;O(E,i,!n),e.newCommentText="",m(e)})}const p=e.panelElement.querySelector(".rte-comments-list");p&&r.forEach(c=>{p.appendChild(D(e,c))})}function T(){S||(S=!0,document.addEventListener("focusin",t=>{const e=y(t.target);e&&(x=e)}),document.addEventListener("selectionchange",()=>{const t=window.getSelection();if(!t||t.rangeCount===0)return;const e=t.getRangeAt(0),r=y(e.commonAncestorContainer);if(!r)return;x=r;const o=C.get(r);!o||t.isCollapsed||w(e,r)&&(o.savedSelection=e.cloneRange())}),document.addEventListener("keydown",t=>{if(t.key!=="Escape")return;const e=u();!e||!e.panelVisible||(t.preventDefault(),t.stopPropagation(),g(e,!1))},!0))}function O(t,e,r=!1){const o=u();if(!o)return"";const a=e.trim();if(!a)return"";if(r){const l=v("comment");return o.comments.set(l,{id:l,anchorId:"",selectedText:"",author:t,text:a,createdAt:new Date().toISOString(),resolved:!1,replies:[]}),m(o),l}const d=o.savedSelection||R(o.root);if(!d||!w(d,o.root))return"";const p=d.toString().trim();if(!p)return"";const c=v("comment"),i=v("comment-anchor"),n=document.createElement("span");n.id=i,n.className="rte-comment-anchor",n.setAttribute("data-comment-id",c),n.setAttribute("title","Commented text");try{const l=d.cloneRange(),f=l.extractContents();if(!f.textContent?.trim())return"";n.appendChild(f),l.insertNode(n)}catch{return""}return $(o,n,c),o.comments.set(c,{id:c,anchorId:i,selectedText:p,author:t,text:a,createdAt:new Date().toISOString(),resolved:!1,replies:[]}),o.savedSelection=null,window.getSelection()?.removeAllRanges(),m(o),c}function P(t,e){const r=u();if(!r)return;const o=r.comments.get(t);o&&(o.resolved=!0,o.resolvedBy=e,o.resolvedAt=new Date().toISOString(),I(r,o),m(r))}function _(t){const e=u();if(!e)return;const r=e.comments.get(t);r&&(r.resolved=!1,r.resolvedBy=void 0,r.resolvedAt=void 0,I(e,r),m(e))}function j(t){const e=u();if(!e)return;const r=e.comments.get(t);if(r){if(r.anchorId){const o=e.root.querySelector(`#${r.anchorId}`);o&&q(o)}e.comments.delete(t),e.expandedComments.delete(t),delete e.replyTexts[t],m(e)}}function F(t,e,r){const o=u();if(!o)return;const a=o.comments.get(t);if(!a)return;const d=r.trim();d&&(a.replies.push({id:v("reply"),author:e,text:d,createdAt:new Date().toISOString()}),m(o))}function Z(){if(document.getElementById("rte-comments-panel-styles"))return;const t=document.createElement("style");t.id="rte-comments-panel-styles",t.textContent=`
38
+ `;const o=e.panelElement.querySelector(".rte-comments-close");o==null||o.addEventListener("click",()=>{b(e,!1)});const a=e.panelElement.querySelector(".new-comment-textarea"),i=e.panelElement.querySelector(".add-comment-btn");if(a&&i){a.value=e.newCommentText;const l=()=>{const c=!!a.value.trim();i.disabled=!c};l(),a.addEventListener("input",()=>{e.newCommentText=a.value,l()}),a.addEventListener("keydown",c=>{(c.ctrlKey||c.metaKey)&&c.key==="Enter"&&(c.preventDefault(),i.click())}),i.addEventListener("click",()=>{const c=a.value.trim();if(!c)return;const n=!!e.savedSelection;O(E,c,!n),e.newCommentText="",m(e)})}const u=e.panelElement.querySelector(".rte-comments-list");u&&r.forEach(l=>{u.appendChild(D(e,l))})}function T(){S||(S=!0,document.addEventListener("focusin",t=>{const e=y(t.target);e&&(g=e)}),document.addEventListener("selectionchange",()=>{const t=window.getSelection();if(!t||t.rangeCount===0)return;const e=t.getRangeAt(0),r=y(e.commonAncestorContainer);if(!r)return;g=r;const o=C.get(r);!o||t.isCollapsed||w(e,r)&&(o.savedSelection=e.cloneRange())}),document.addEventListener("keydown",t=>{if(t.key!=="Escape")return;const e=f();!e||!e.panelVisible||(t.preventDefault(),t.stopPropagation(),b(e,!1))},!0))}function O(t,e,r=!1){var p;const o=f();if(!o)return"";const a=e.trim();if(!a)return"";if(r){const d=v("comment");return o.comments.set(d,{id:d,anchorId:"",selectedText:"",author:t,text:a,createdAt:new Date().toISOString(),resolved:!1,replies:[]}),m(o),d}const i=o.savedSelection||R(o.root);if(!i||!w(i,o.root))return"";const u=i.toString().trim();if(!u)return"";const l=v("comment"),c=v("comment-anchor"),n=document.createElement("span");n.id=c,n.className="rte-comment-anchor",n.setAttribute("data-comment-id",l),n.setAttribute("title","Commented text");try{const d=i.cloneRange(),x=d.extractContents();if(!((p=x.textContent)!=null&&p.trim()))return"";n.appendChild(x),d.insertNode(n)}catch{return""}q(o,n,l),o.comments.set(l,{id:l,anchorId:c,selectedText:u,author:t,text:a,createdAt:new Date().toISOString(),resolved:!1,replies:[]}),o.savedSelection=null;const s=window.getSelection();return s==null||s.removeAllRanges(),m(o),l}function P(t,e){const r=f();if(!r)return;const o=r.comments.get(t);o&&(o.resolved=!0,o.resolvedBy=e,o.resolvedAt=new Date().toISOString(),I(r,o),m(r))}function _(t){const e=f();if(!e)return;const r=e.comments.get(t);r&&(r.resolved=!1,r.resolvedBy=void 0,r.resolvedAt=void 0,I(e,r),m(e))}function j(t){const e=f();if(!e)return;const r=e.comments.get(t);if(r){if(r.anchorId){const o=e.root.querySelector(`#${r.anchorId}`);o&&N(o)}e.comments.delete(t),e.expandedComments.delete(t),delete e.replyTexts[t],m(e)}}function F(t,e,r){const o=f();if(!o)return;const a=o.comments.get(t);if(!a)return;const i=r.trim();i&&(a.replies.push({id:v("reply"),author:e,text:i,createdAt:new Date().toISOString()}),m(o))}function Z(){if(document.getElementById("rte-comments-panel-styles"))return;const t=document.createElement("style");t.id="rte-comments-panel-styles",t.textContent=`
39
39
  .rte-comments-panel {
40
40
  --rte-comments-panel-width: min(360px, 42vw);
41
41
  position: absolute;
@@ -351,4 +351,4 @@
351
351
  margin-right: 0;
352
352
  }
353
353
  }
354
- `,document.head.appendChild(t)}const K=()=>({name:"comments",toolbar:[{label:"Add Comment",command:"addComment",type:"button",icon:'<svg fill="#000000" width="24px" height="24px" viewBox="0 0 32 32" id="icon" xmlns="http://www.w3.org/2000/svg"><defs><style>.cls-1{fill:none;}</style></defs><title>add-comment</title><path d="M17.74,30,16,29l4-7h6a2,2,0,0,0,2-2V8a2,2,0,0,0-2-2H6A2,2,0,0,0,4,8V20a2,2,0,0,0,2,2h9v2H6a4,4,0,0,1-4-4V8A4,4,0,0,1,6,4H26a4,4,0,0,1,4,4V20a4,4,0,0,1-4,4H21.16Z"></path><polygon points="17 9 15 9 15 13 11 13 11 15 15 15 15 19 17 19 17 15 21 15 21 13 17 13 17 9"></polygon><rect class="cls-1" width="32" height="32"></rect></svg>'},{label:"Show / Hide Comments",command:"toggleComments",type:"button",icon:'<svg width="24px" height="24px" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M16 1H4V11H8L10 13L12 11H16V1Z" fill="#000000"></path><path d="M2 5V13H7.17157L8.70711 14.5355L7.29289 15.9497L6.34315 15H0V5H2Z" fill="#000000"></path></svg>'}],commands:{addComment:(t,e)=>{A(e),T();const r=u();return r?(r.savedSelection=R(r.root),r.savedSelection&&window.getSelection()?.removeAllRanges(),g(r,!0),m(r),r.panelElement?.querySelector(".new-comment-textarea")?.focus({preventScroll:!0}),!0):!1},toggleComments:(t,e)=>{A(e),T();const r=u();return r?(g(r,!r.panelVisible),r.panelVisible&&m(r),!0):!1}},keymap:{}});exports.CommentsPlugin=K;
354
+ `,document.head.appendChild(t)}const K=()=>({name:"comments",toolbar:[{label:"Add Comment",command:"addComment",type:"button",icon:'<svg fill="#000000" width="24px" height="24px" viewBox="0 0 32 32" id="icon" xmlns="http://www.w3.org/2000/svg"><defs><style>.cls-1{fill:none;}</style></defs><title>add-comment</title><path d="M17.74,30,16,29l4-7h6a2,2,0,0,0,2-2V8a2,2,0,0,0-2-2H6A2,2,0,0,0,4,8V20a2,2,0,0,0,2,2h9v2H6a4,4,0,0,1-4-4V8A4,4,0,0,1,6,4H26a4,4,0,0,1,4,4V20a4,4,0,0,1-4,4H21.16Z"></path><polygon points="17 9 15 9 15 13 11 13 11 15 15 15 15 19 17 19 17 15 21 15 21 13 17 13 17 9"></polygon><rect class="cls-1" width="32" height="32"></rect></svg>'},{label:"Show / Hide Comments",command:"toggleComments",type:"button",icon:'<svg width="24px" height="24px" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M16 1H4V11H8L10 13L12 11H16V1Z" fill="#000000"></path><path d="M2 5V13H7.17157L8.70711 14.5355L7.29289 15.9497L6.34315 15H0V5H2Z" fill="#000000"></path></svg>'}],commands:{addComment:(t,e)=>{var a;A(e),T();const r=f();if(!r)return!1;if(r.savedSelection=R(r.root),r.savedSelection){const i=window.getSelection();i==null||i.removeAllRanges()}b(r,!0),m(r);const o=(a=r.panelElement)==null?void 0:a.querySelector(".new-comment-textarea");return o==null||o.focus({preventScroll:!0}),!0},toggleComments:(t,e)=>{A(e),T();const r=f();return r?(b(r,!r.panelVisible),r.panelVisible&&m(r),!0):!1}},keymap:{}});exports.CommentsPlugin=K;
@@ -5,20 +5,22 @@ function v(t) {
5
5
  return k += 1, `${t}-${Date.now()}-${k}`;
6
6
  }
7
7
  function y(t) {
8
- if (!t) return null;
8
+ if (!t)
9
+ return null;
9
10
  const e = t instanceof Element ? t : t.parentElement;
10
11
  return e ? e.closest("[data-editora-editor]") || e.closest(".rte-editor") || e.closest(".editora-editor") : null;
11
12
  }
12
13
  function A(t) {
13
- const e = t?.editorElement || t?.contentElement || null;
14
- if (!(e instanceof HTMLElement)) return;
14
+ const e = (t == null ? void 0 : t.editorElement) || (t == null ? void 0 : t.contentElement) || null;
15
+ if (!(e instanceof HTMLElement))
16
+ return;
15
17
  const r = e.closest("[data-editora-editor], .rte-editor, .editora-editor, editora-editor") || (e.matches("[data-editora-editor], .rte-editor, .editora-editor, editora-editor") ? e : null);
16
18
  r && (x = r);
17
19
  }
18
20
  function w(t, e) {
19
21
  return e.contains(t.commonAncestorContainer);
20
22
  }
21
- function B() {
23
+ function H() {
22
24
  if (typeof window < "u") {
23
25
  const o = window.__editoraCommandEditorRoot;
24
26
  if (o instanceof HTMLElement) {
@@ -28,19 +30,22 @@ function B() {
28
30
  }
29
31
  }
30
32
  const t = document.activeElement, e = t ? y(t) : null;
31
- if (e) return e;
33
+ if (e)
34
+ return e;
32
35
  const r = window.getSelection();
33
36
  if (r && r.rangeCount > 0) {
34
37
  const o = y(
35
38
  r.getRangeAt(0).commonAncestorContainer
36
39
  );
37
- if (o) return o;
40
+ if (o)
41
+ return o;
38
42
  }
39
43
  return x;
40
44
  }
41
- function H(t) {
45
+ function $(t) {
42
46
  const e = C.get(t);
43
- if (e) return e;
47
+ if (e)
48
+ return e;
44
49
  const r = {
45
50
  root: t,
46
51
  comments: /* @__PURE__ */ new Map(),
@@ -54,33 +59,36 @@ function H(t) {
54
59
  };
55
60
  return C.set(t, r), r;
56
61
  }
57
- function u() {
58
- const t = B();
59
- return t ? (x = t, H(t)) : null;
62
+ function f() {
63
+ const t = H();
64
+ return t ? (x = t, $(t)) : null;
60
65
  }
61
66
  function R(t) {
62
67
  const e = window.getSelection();
63
- if (!e || e.rangeCount === 0 || e.isCollapsed) return null;
68
+ if (!e || e.rangeCount === 0 || e.isCollapsed)
69
+ return null;
64
70
  const r = e.getRangeAt(0);
65
71
  return w(r, t) ? r.cloneRange() : null;
66
72
  }
67
73
  function I(t, e) {
68
- if (!e.anchorId) return;
74
+ if (!e.anchorId)
75
+ return;
69
76
  const r = t.root.querySelector(`#${e.anchorId}`);
70
77
  r && r.classList.toggle("rte-comment-anchor-resolved", e.resolved);
71
78
  }
72
79
  function h(t, e, r) {
73
80
  const o = t.comments.get(e);
74
- if (!o || !o.anchorId) return;
81
+ if (!o || !o.anchorId)
82
+ return;
75
83
  const a = t.root.querySelector(`#${o.anchorId}`);
76
84
  a && a.classList.toggle("highlighted", r);
77
85
  }
78
- function $(t, e, r) {
86
+ function q(t, e, r) {
79
87
  e.onclick = (o) => {
80
- o.preventDefault(), o.stopPropagation(), x = t.root, t.expandedComments.add(r), g(t, !0), m(t);
88
+ o.preventDefault(), o.stopPropagation(), x = t.root, t.expandedComments.add(r), b(t, !0), m(t);
81
89
  };
82
90
  }
83
- function q(t) {
91
+ function N(t) {
84
92
  const e = t.parentNode;
85
93
  if (e) {
86
94
  for (; t.firstChild; )
@@ -88,27 +96,29 @@ function q(t) {
88
96
  t.remove();
89
97
  }
90
98
  }
91
- function g(t, e) {
99
+ function b(t, e) {
92
100
  if (t.panelVisible = e, e) {
93
- Z(), N(t), t.root.setAttribute("data-rte-comments-open", "true"), t.panelElement && (t.panelElement.classList.add("is-open"), t.panelElement.setAttribute("aria-hidden", "false")), z(t);
101
+ Z(), z(t), t.root.setAttribute("data-rte-comments-open", "true"), t.panelElement && (t.panelElement.classList.add("is-open"), t.panelElement.setAttribute("aria-hidden", "false")), V(t);
94
102
  return;
95
103
  }
96
- t.root.removeAttribute("data-rte-comments-open"), V(t), t.panelElement && (t.panelElement.remove(), t.panelElement = null);
104
+ t.root.removeAttribute("data-rte-comments-open"), B(t), t.panelElement && (t.panelElement.remove(), t.panelElement = null);
97
105
  }
98
- function N(t) {
99
- if (t.panelElement) return;
106
+ function z(t) {
107
+ if (t.panelElement)
108
+ return;
100
109
  const e = document.createElement("aside");
101
110
  e.className = "rte-comments-panel", e.setAttribute("role", "complementary"), e.setAttribute("aria-label", "Comments"), e.setAttribute("aria-hidden", "true"), window.getComputedStyle(t.root).position === "static" && (t.root.style.position = "relative"), t.root.appendChild(e), t.panelElement = e;
102
111
  }
103
- function z(t) {
112
+ function V(t) {
104
113
  t.selectionChangeListener || (t.selectionChangeListener = () => {
105
114
  const e = window.getSelection();
106
- if (!e || e.rangeCount === 0 || e.isCollapsed) return;
115
+ if (!e || e.rangeCount === 0 || e.isCollapsed)
116
+ return;
107
117
  const r = e.getRangeAt(0);
108
118
  w(r, t.root) && (t.savedSelection = r.cloneRange(), x = t.root);
109
119
  }, document.addEventListener("selectionchange", t.selectionChangeListener));
110
120
  }
111
- function V(t) {
121
+ function B(t) {
112
122
  t.selectionChangeListener && (document.removeEventListener("selectionchange", t.selectionChangeListener), t.selectionChangeListener = null);
113
123
  }
114
124
  function M(t) {
@@ -136,25 +146,27 @@ function D(t, e) {
136
146
  <section class="rte-comment-expanded${r ? " show" : ""}"></section>
137
147
  `;
138
148
  const a = o.querySelector(".rte-comment-text");
139
- a && (a.textContent = e.text), o.querySelector(".rte-comment-expand")?.addEventListener("click", () => {
149
+ a && (a.textContent = e.text);
150
+ const i = o.querySelector(".rte-comment-expand");
151
+ i == null || i.addEventListener("click", () => {
140
152
  t.expandedComments.has(e.id) ? t.expandedComments.delete(e.id) : t.expandedComments.add(e.id), m(t);
141
153
  });
142
- const p = o.querySelector(".rte-comment-expanded");
143
- if (p && r) {
154
+ const u = o.querySelector(".rte-comment-expanded");
155
+ if (u && r) {
144
156
  if (e.replies.length > 0) {
145
157
  const n = document.createElement("div");
146
158
  n.className = "rte-comment-replies", e.replies.forEach((s) => {
147
- const l = document.createElement("div");
148
- l.className = "rte-comment-reply", l.innerHTML = `
159
+ const p = document.createElement("div");
160
+ p.className = "rte-comment-reply", p.innerHTML = `
149
161
  <div class="rte-comment-reply-header">
150
162
  <strong>${s.author}</strong>
151
163
  <time>${L(s.createdAt)}</time>
152
164
  </div>
153
165
  <div class="rte-comment-reply-text"></div>
154
166
  `;
155
- const f = l.querySelector(".rte-comment-reply-text");
156
- f && (f.textContent = s.text), n.appendChild(l);
157
- }), p.appendChild(n);
167
+ const d = p.querySelector(".rte-comment-reply-text");
168
+ d && (d.textContent = s.text), n.appendChild(p);
169
+ }), u.appendChild(n);
158
170
  }
159
171
  if (!e.resolved) {
160
172
  const n = document.createElement("div");
@@ -164,47 +176,48 @@ function D(t, e) {
164
176
  `;
165
177
  const s = n.querySelector(
166
178
  ".rte-comment-reply-textarea"
167
- ), l = n.querySelector(
179
+ ), p = n.querySelector(
168
180
  ".rte-comment-btn.primary"
169
181
  );
170
- if (s && l) {
182
+ if (s && p) {
171
183
  s.value = t.replyTexts[e.id] || "";
172
- const f = () => {
173
- const b = !!s.value.trim();
174
- l.disabled = !b;
184
+ const d = () => {
185
+ const g = !!s.value.trim();
186
+ p.disabled = !g;
175
187
  };
176
- f(), s.addEventListener("input", () => {
177
- t.replyTexts[e.id] = s.value, f();
178
- }), l.addEventListener("click", () => {
179
- const b = s.value.trim();
180
- b && (F(e.id, E, b), t.replyTexts[e.id] = "", m(t));
188
+ d(), s.addEventListener("input", () => {
189
+ t.replyTexts[e.id] = s.value, d();
190
+ }), p.addEventListener("click", () => {
191
+ const g = s.value.trim();
192
+ g && (F(e.id, E, g), t.replyTexts[e.id] = "", m(t));
181
193
  });
182
194
  }
183
- p.appendChild(n);
195
+ u.appendChild(n);
184
196
  }
185
- const c = document.createElement("div");
186
- if (c.className = "rte-comment-actions", e.anchorId) {
197
+ const l = document.createElement("div");
198
+ if (l.className = "rte-comment-actions", e.anchorId) {
187
199
  const n = document.createElement("button");
188
200
  n.type = "button", n.className = "rte-comment-btn ghost", n.textContent = "Jump to text", n.onclick = () => {
189
201
  const s = t.root.querySelector(`#${e.anchorId}`);
190
202
  s && (s.scrollIntoView({ behavior: "smooth", block: "center", inline: "nearest" }), h(t, e.id, !0), window.setTimeout(() => h(t, e.id, !1), 1200));
191
- }, c.appendChild(n);
203
+ }, l.appendChild(n);
192
204
  }
193
205
  if (e.resolved) {
194
206
  const n = document.createElement("button");
195
- n.type = "button", n.className = "rte-comment-btn ghost", n.textContent = "Reopen", n.onclick = () => _(e.id), c.appendChild(n);
207
+ n.type = "button", n.className = "rte-comment-btn ghost", n.textContent = "Reopen", n.onclick = () => _(e.id), l.appendChild(n);
196
208
  } else {
197
209
  const n = document.createElement("button");
198
- n.type = "button", n.className = "rte-comment-btn success", n.textContent = "Resolve", n.onclick = () => P(e.id, E), c.appendChild(n);
210
+ n.type = "button", n.className = "rte-comment-btn success", n.textContent = "Resolve", n.onclick = () => P(e.id, E), l.appendChild(n);
199
211
  }
200
- const i = document.createElement("button");
201
- i.type = "button", i.className = "rte-comment-btn danger", i.textContent = "Delete", i.onclick = () => j(e.id), c.appendChild(i), p.appendChild(c);
212
+ const c = document.createElement("button");
213
+ c.type = "button", c.className = "rte-comment-btn danger", c.textContent = "Delete", c.onclick = () => j(e.id), l.appendChild(c), u.appendChild(l);
202
214
  }
203
215
  return o.addEventListener("mouseenter", () => h(t, e.id, !0)), o.addEventListener("mouseleave", () => h(t, e.id, !1)), o;
204
216
  }
205
217
  function m(t) {
206
- const e = t || u();
207
- if (!e?.panelElement) return;
218
+ const e = t || f();
219
+ if (!(e != null && e.panelElement))
220
+ return;
208
221
  const r = M(e);
209
222
  e.panelElement.innerHTML = `
210
223
  <div class="rte-comments-header">
@@ -221,34 +234,37 @@ function m(t) {
221
234
  </div>
222
235
  </div>
223
236
  ${r.length === 0 ? '<div class="rte-comments-empty">No comments yet.</div>' : '<div class="rte-comments-list"></div>'}
224
- `, e.panelElement.querySelector(".rte-comments-close")?.addEventListener("click", () => {
225
- g(e, !1);
237
+ `;
238
+ const o = e.panelElement.querySelector(".rte-comments-close");
239
+ o == null || o.addEventListener("click", () => {
240
+ b(e, !1);
226
241
  });
227
242
  const a = e.panelElement.querySelector(
228
243
  ".new-comment-textarea"
229
- ), d = e.panelElement.querySelector(
244
+ ), i = e.panelElement.querySelector(
230
245
  ".add-comment-btn"
231
246
  );
232
- if (a && d) {
247
+ if (a && i) {
233
248
  a.value = e.newCommentText;
234
- const c = () => {
235
- const i = !!a.value.trim();
236
- d.disabled = !i;
249
+ const l = () => {
250
+ const c = !!a.value.trim();
251
+ i.disabled = !c;
237
252
  };
238
- c(), a.addEventListener("input", () => {
239
- e.newCommentText = a.value, c();
240
- }), a.addEventListener("keydown", (i) => {
241
- (i.ctrlKey || i.metaKey) && i.key === "Enter" && (i.preventDefault(), d.click());
242
- }), d.addEventListener("click", () => {
243
- const i = a.value.trim();
244
- if (!i) return;
253
+ l(), a.addEventListener("input", () => {
254
+ e.newCommentText = a.value, l();
255
+ }), a.addEventListener("keydown", (c) => {
256
+ (c.ctrlKey || c.metaKey) && c.key === "Enter" && (c.preventDefault(), i.click());
257
+ }), i.addEventListener("click", () => {
258
+ const c = a.value.trim();
259
+ if (!c)
260
+ return;
245
261
  const n = !!e.savedSelection;
246
- O(E, i, !n), e.newCommentText = "", m(e);
262
+ O(E, c, !n), e.newCommentText = "", m(e);
247
263
  });
248
264
  }
249
- const p = e.panelElement.querySelector(".rte-comments-list");
250
- p && r.forEach((c) => {
251
- p.appendChild(D(e, c));
265
+ const u = e.panelElement.querySelector(".rte-comments-list");
266
+ u && r.forEach((l) => {
267
+ u.appendChild(D(e, l));
252
268
  });
253
269
  }
254
270
  function T() {
@@ -257,31 +273,37 @@ function T() {
257
273
  e && (x = e);
258
274
  }), document.addEventListener("selectionchange", () => {
259
275
  const t = window.getSelection();
260
- if (!t || t.rangeCount === 0) return;
276
+ if (!t || t.rangeCount === 0)
277
+ return;
261
278
  const e = t.getRangeAt(0), r = y(e.commonAncestorContainer);
262
- if (!r) return;
279
+ if (!r)
280
+ return;
263
281
  x = r;
264
282
  const o = C.get(r);
265
283
  !o || t.isCollapsed || w(e, r) && (o.savedSelection = e.cloneRange());
266
284
  }), document.addEventListener(
267
285
  "keydown",
268
286
  (t) => {
269
- if (t.key !== "Escape") return;
270
- const e = u();
271
- !e || !e.panelVisible || (t.preventDefault(), t.stopPropagation(), g(e, !1));
287
+ if (t.key !== "Escape")
288
+ return;
289
+ const e = f();
290
+ !e || !e.panelVisible || (t.preventDefault(), t.stopPropagation(), b(e, !1));
272
291
  },
273
292
  !0
274
293
  ));
275
294
  }
276
295
  function O(t, e, r = !1) {
277
- const o = u();
278
- if (!o) return "";
296
+ var p;
297
+ const o = f();
298
+ if (!o)
299
+ return "";
279
300
  const a = e.trim();
280
- if (!a) return "";
301
+ if (!a)
302
+ return "";
281
303
  if (r) {
282
- const l = v("comment");
283
- return o.comments.set(l, {
284
- id: l,
304
+ const d = v("comment");
305
+ return o.comments.set(d, {
306
+ id: d,
285
307
  anchorId: "",
286
308
  selectedText: "",
287
309
  author: t,
@@ -289,71 +311,82 @@ function O(t, e, r = !1) {
289
311
  createdAt: (/* @__PURE__ */ new Date()).toISOString(),
290
312
  resolved: !1,
291
313
  replies: []
292
- }), m(o), l;
314
+ }), m(o), d;
293
315
  }
294
- const d = o.savedSelection || R(o.root);
295
- if (!d || !w(d, o.root)) return "";
296
- const p = d.toString().trim();
297
- if (!p) return "";
298
- const c = v("comment"), i = v("comment-anchor"), n = document.createElement("span");
299
- n.id = i, n.className = "rte-comment-anchor", n.setAttribute("data-comment-id", c), n.setAttribute("title", "Commented text");
316
+ const i = o.savedSelection || R(o.root);
317
+ if (!i || !w(i, o.root))
318
+ return "";
319
+ const u = i.toString().trim();
320
+ if (!u)
321
+ return "";
322
+ const l = v("comment"), c = v("comment-anchor"), n = document.createElement("span");
323
+ n.id = c, n.className = "rte-comment-anchor", n.setAttribute("data-comment-id", l), n.setAttribute("title", "Commented text");
300
324
  try {
301
- const l = d.cloneRange(), f = l.extractContents();
302
- if (!f.textContent?.trim()) return "";
303
- n.appendChild(f), l.insertNode(n);
325
+ const d = i.cloneRange(), g = d.extractContents();
326
+ if (!((p = g.textContent) != null && p.trim()))
327
+ return "";
328
+ n.appendChild(g), d.insertNode(n);
304
329
  } catch {
305
330
  return "";
306
331
  }
307
- return $(o, n, c), o.comments.set(c, {
308
- id: c,
309
- anchorId: i,
310
- selectedText: p,
332
+ q(o, n, l), o.comments.set(l, {
333
+ id: l,
334
+ anchorId: c,
335
+ selectedText: u,
311
336
  author: t,
312
337
  text: a,
313
338
  createdAt: (/* @__PURE__ */ new Date()).toISOString(),
314
339
  resolved: !1,
315
340
  replies: []
316
- }), o.savedSelection = null, window.getSelection()?.removeAllRanges(), m(o), c;
341
+ }), o.savedSelection = null;
342
+ const s = window.getSelection();
343
+ return s == null || s.removeAllRanges(), m(o), l;
317
344
  }
318
345
  function P(t, e) {
319
- const r = u();
320
- if (!r) return;
346
+ const r = f();
347
+ if (!r)
348
+ return;
321
349
  const o = r.comments.get(t);
322
350
  o && (o.resolved = !0, o.resolvedBy = e, o.resolvedAt = (/* @__PURE__ */ new Date()).toISOString(), I(r, o), m(r));
323
351
  }
324
352
  function _(t) {
325
- const e = u();
326
- if (!e) return;
353
+ const e = f();
354
+ if (!e)
355
+ return;
327
356
  const r = e.comments.get(t);
328
357
  r && (r.resolved = !1, r.resolvedBy = void 0, r.resolvedAt = void 0, I(e, r), m(e));
329
358
  }
330
359
  function j(t) {
331
- const e = u();
332
- if (!e) return;
360
+ const e = f();
361
+ if (!e)
362
+ return;
333
363
  const r = e.comments.get(t);
334
364
  if (r) {
335
365
  if (r.anchorId) {
336
366
  const o = e.root.querySelector(`#${r.anchorId}`);
337
- o && q(o);
367
+ o && N(o);
338
368
  }
339
369
  e.comments.delete(t), e.expandedComments.delete(t), delete e.replyTexts[t], m(e);
340
370
  }
341
371
  }
342
372
  function F(t, e, r) {
343
- const o = u();
344
- if (!o) return;
373
+ const o = f();
374
+ if (!o)
375
+ return;
345
376
  const a = o.comments.get(t);
346
- if (!a) return;
347
- const d = r.trim();
348
- d && (a.replies.push({
377
+ if (!a)
378
+ return;
379
+ const i = r.trim();
380
+ i && (a.replies.push({
349
381
  id: v("reply"),
350
382
  author: e,
351
- text: d,
383
+ text: i,
352
384
  createdAt: (/* @__PURE__ */ new Date()).toISOString()
353
385
  }), m(o));
354
386
  }
355
387
  function Z() {
356
- if (document.getElementById("rte-comments-panel-styles")) return;
388
+ if (document.getElementById("rte-comments-panel-styles"))
389
+ return;
357
390
  const t = document.createElement("style");
358
391
  t.id = "rte-comments-panel-styles", t.textContent = `
359
392
  .rte-comments-panel {
@@ -691,16 +724,25 @@ const K = () => ({
691
724
  ],
692
725
  commands: {
693
726
  addComment: (t, e) => {
727
+ var a;
694
728
  A(e), T();
695
- const r = u();
696
- return r ? (r.savedSelection = R(r.root), r.savedSelection && window.getSelection()?.removeAllRanges(), g(r, !0), m(r), r.panelElement?.querySelector(
729
+ const r = f();
730
+ if (!r)
731
+ return !1;
732
+ if (r.savedSelection = R(r.root), r.savedSelection) {
733
+ const i = window.getSelection();
734
+ i == null || i.removeAllRanges();
735
+ }
736
+ b(r, !0), m(r);
737
+ const o = (a = r.panelElement) == null ? void 0 : a.querySelector(
697
738
  ".new-comment-textarea"
698
- )?.focus({ preventScroll: !0 }), !0) : !1;
739
+ );
740
+ return o == null || o.focus({ preventScroll: !0 }), !0;
699
741
  },
700
742
  toggleComments: (t, e) => {
701
743
  A(e), T();
702
- const r = u();
703
- return r ? (g(r, !r.panelVisible), r.panelVisible && m(r), !0) : !1;
744
+ const r = f();
745
+ return r ? (b(r, !r.panelVisible), r.panelVisible && m(r), !0) : !1;
704
746
  }
705
747
  },
706
748
  keymap: {}