@editora/plugins 1.0.6 → 1.0.8

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 (58) hide show
  1. package/README.md +57 -4
  2. package/dist/_commonjsHelpers-BH3jXuIh.js +1 -0
  3. package/dist/_commonjsHelpers-ByX85dGu.mjs +33 -0
  4. package/dist/anchor.cjs.js +11 -11
  5. package/dist/anchor.esm.js +130 -107
  6. package/dist/anchoredPopover-BzqGPOAE.js +1 -0
  7. package/dist/anchoredPopover-Dts0IrgU.mjs +106 -0
  8. package/dist/background-color.cjs.js +3 -3
  9. package/dist/background-color.esm.js +116 -119
  10. package/dist/code.cjs.js +82 -102
  11. package/dist/code.esm.js +1172 -662
  12. package/dist/comments.cjs.js +10 -10
  13. package/dist/comments.esm.js +195 -177
  14. package/dist/document-manager.cjs.js +1 -1
  15. package/dist/document-manager.esm.js +1 -1
  16. package/dist/documentManager-CTqRftU8.mjs +8369 -0
  17. package/dist/documentManager-Jf0RbSks.js +17 -0
  18. package/dist/embed-iframe.cjs.js +2 -2
  19. package/dist/embed-iframe.esm.js +8 -5
  20. package/dist/emojis.cjs.js +64 -39
  21. package/dist/emojis.esm.js +133 -104
  22. package/dist/html2canvas.esm-B5qzocYs.js +5 -0
  23. package/dist/html2canvas.esm-BWVIUcAF.mjs +4802 -0
  24. package/dist/{index-Bskk414V.mjs → index-BFsKNTTj.mjs} +50 -50
  25. package/dist/index-CvJk4DKa.js +221 -0
  26. package/dist/index-D3CycEFU.mjs +16543 -0
  27. package/dist/index-tqLTHcO6.js +1 -0
  28. package/dist/index.cjs.js +1 -1
  29. package/dist/{index.es-Cz1qItab.js → index.es-CE_A4QSm.js} +5 -5
  30. package/dist/{index.es-DEcRmSTY.mjs → index.es-DQ78mYYo.mjs} +4 -3
  31. package/dist/index.esm.js +87 -79
  32. package/dist/jspdf.es.min-BoS80556.js +77 -0
  33. package/dist/jspdf.es.min-DQCoX5yh.mjs +7889 -0
  34. package/dist/link.cjs.js +6 -6
  35. package/dist/link.esm.js +41 -39
  36. package/dist/math.cjs.js +21 -21
  37. package/dist/math.esm.js +151 -112
  38. package/dist/media-manager.cjs.js +15 -15
  39. package/dist/media-manager.esm.js +227 -206
  40. package/dist/merge-tag.cjs.js +44 -12
  41. package/dist/merge-tag.esm.js +368 -241
  42. package/dist/page-break.cjs.js +2 -2
  43. package/dist/page-break.esm.js +77 -69
  44. package/dist/special-characters.cjs.js +83 -45
  45. package/dist/special-characters.esm.js +149 -100
  46. package/dist/spell-check.cjs.js +9 -9
  47. package/dist/spell-check.esm.js +235 -216
  48. package/dist/template.cjs.js +14 -14
  49. package/dist/template.esm.js +157 -131
  50. package/dist/text-color.cjs.js +9 -9
  51. package/dist/text-color.esm.js +131 -115
  52. package/index.d.ts +51 -1
  53. package/package.json +6 -4
  54. package/dist/colorSelectionApply-C0iOfMWb.js +0 -1
  55. package/dist/colorSelectionApply-D8r_gV32.mjs +0 -63
  56. package/dist/documentManager-DRUc1-Cs.mjs +0 -37581
  57. package/dist/documentManager-_tQQfQi9.js +0 -317
  58. package/dist/index-D3pJyAsj.js +0 -1
@@ -1,26 +1,26 @@
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 h(e){return k+=1,`${e}-${Date.now()}-${k}`}function v(e){if(!e)return null;const t=e instanceof Element?e:e.parentElement;return t?t.closest("[data-editora-editor]")||t.closest(".rte-editor")||t.closest(".editora-editor"):null}function w(e,t){return t.contains(e.commonAncestorContainer)}function I(){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 e=document.activeElement,t=e?v(e):null;if(t)return t;const r=window.getSelection();if(r&&r.rangeCount>0){const o=v(r.getRangeAt(0).commonAncestorContainer);if(o)return o}return x}function B(e){const t=C.get(e);if(t)return t;const r={root:e,comments:new Map,panelVisible:!1,panelElement:null,expandedComments:new Set,replyTexts:{},savedSelection:null,newCommentText:"",selectionChangeListener:null};return C.set(e,r),r}function f(){const e=I();return e?(x=e,B(e)):null}function T(e){const t=window.getSelection();if(!t||t.rangeCount===0||t.isCollapsed)return null;const r=t.getRangeAt(0);return w(r,e)?r.cloneRange():null}function R(e,t){if(!t.anchorId)return;const r=e.root.querySelector(`#${t.anchorId}`);r&&r.classList.toggle("rte-comment-anchor-resolved",t.resolved)}function b(e,t,r){const o=e.comments.get(t);if(!o||!o.anchorId)return;const a=e.root.querySelector(`#${o.anchorId}`);a&&a.classList.toggle("highlighted",r)}function $(e,t,r){t.onclick=o=>{o.preventDefault(),o.stopPropagation(),x=e.root,e.expandedComments.add(r),y(e,!0),m(e)}}function q(e){const t=e.parentNode;if(t){for(;e.firstChild;)t.insertBefore(e.firstChild,e);e.remove()}}function y(e,t){F(),H(e),e.panelVisible=t,e.root.setAttribute("data-rte-comments-open",t?"true":"false"),e.panelElement&&(e.panelElement.classList.toggle("is-open",t),e.panelElement.setAttribute("aria-hidden",t?"false":"true")),t?N(e):z(e)}function H(e){if(e.panelElement)return;const t=document.createElement("aside");t.className="rte-comments-panel",t.setAttribute("role","complementary"),t.setAttribute("aria-label","Comments"),t.setAttribute("aria-hidden","true"),window.getComputedStyle(e.root).position==="static"&&(e.root.style.position="relative"),e.root.appendChild(t),e.panelElement=t}function N(e){e.selectionChangeListener||(e.selectionChangeListener=()=>{const t=window.getSelection();if(!t||t.rangeCount===0||t.isCollapsed)return;const r=t.getRangeAt(0);w(r,e.root)&&(e.savedSelection=r.cloneRange(),x=e.root)},document.addEventListener("selectionchange",e.selectionChangeListener))}function z(e){e.selectionChangeListener&&(document.removeEventListener("selectionchange",e.selectionChangeListener),e.selectionChangeListener=null)}function V(e){return Array.from(e.comments.values()).sort((t,r)=>r.createdAt.localeCompare(t.createdAt))}function A(e){return new Date(e).toLocaleString()}function M(e,t){const r=e.expandedComments.has(t.id),o=document.createElement("article");o.className=`rte-comment-item${t.resolved?" resolved":""}`,o.innerHTML=`
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=`
2
2
  <header class="rte-comment-header">
3
3
  <div class="rte-comment-meta">
4
- <strong class="rte-comment-author">${t.author}</strong>
5
- <time class="rte-comment-date">${A(t.createdAt)}</time>
4
+ <strong class="rte-comment-author">${e.author}</strong>
5
+ <time class="rte-comment-date">${L(e.createdAt)}</time>
6
6
  </div>
7
7
  <button class="rte-comment-expand" type="button" aria-label="Toggle details">
8
8
  ${r?"▾":"▸"}
9
9
  </button>
10
10
  </header>
11
11
  <div class="rte-comment-text"></div>
12
- ${t.selectedText?`<blockquote class="rte-comment-selection">${t.selectedText}</blockquote>`:""}
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=t.text),o.querySelector(".rte-comment-expand")?.addEventListener("click",()=>{e.expandedComments.has(t.id)?e.expandedComments.delete(t.id):e.expandedComments.add(t.id),m(e)});const p=o.querySelector(".rte-comment-expanded");if(p&&r){if(t.replies.length>0){const n=document.createElement("div");n.className="rte-comment-replies",t.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),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=`
15
15
  <div class="rte-comment-reply-header">
16
16
  <strong>${s.author}</strong>
17
- <time>${A(s.createdAt)}</time>
17
+ <time>${L(s.createdAt)}</time>
18
18
  </div>
19
19
  <div class="rte-comment-reply-text"></div>
20
- `;const u=l.querySelector(".rte-comment-reply-text");u&&(u.textContent=s.text),n.appendChild(l)}),p.appendChild(n)}if(!t.resolved){const n=document.createElement("div");n.className="rte-comment-reply-composer",n.innerHTML=`
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=`
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=e.replyTexts[t.id]||"";const u=()=>{const g=!!s.value.trim();l.disabled=!g};u(),s.addEventListener("input",()=>{e.replyTexts[t.id]=s.value,u()}),l.addEventListener("click",()=>{const g=s.value.trim();g&&(_(t.id,E,g),e.replyTexts[t.id]="",m(e))})}p.appendChild(n)}const i=document.createElement("div");if(i.className="rte-comment-actions",t.anchorId){const n=document.createElement("button");n.type="button",n.className="rte-comment-btn ghost",n.textContent="Jump to text",n.onclick=()=>{const s=e.root.querySelector(`#${t.anchorId}`);s&&(s.scrollIntoView({behavior:"smooth",block:"center",inline:"nearest"}),b(e,t.id,!0),window.setTimeout(()=>b(e,t.id,!1),1200))},i.appendChild(n)}if(t.resolved){const n=document.createElement("button");n.type="button",n.className="rte-comment-btn ghost",n.textContent="Reopen",n.onclick=()=>P(t.id),i.appendChild(n)}else{const n=document.createElement("button");n.type="button",n.className="rte-comment-btn success",n.textContent="Resolve",n.onclick=()=>O(t.id,E),i.appendChild(n)}const c=document.createElement("button");c.type="button",c.className="rte-comment-btn danger",c.textContent="Delete",c.onclick=()=>j(t.id),i.appendChild(c),p.appendChild(i)}return o.addEventListener("mouseenter",()=>b(e,t.id,!0)),o.addEventListener("mouseleave",()=>b(e,t.id,!1)),o}function m(e){const t=e||f();if(!t?.panelElement)return;const r=V(t);t.panelElement.innerHTML=`
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=`
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
- `,t.panelElement.querySelector(".rte-comments-close")?.addEventListener("click",()=>{y(t,!1)});const a=t.panelElement.querySelector(".new-comment-textarea"),d=t.panelElement.querySelector(".add-comment-btn");if(a&&d){a.value=t.newCommentText;const i=()=>{const c=!!a.value.trim();d.disabled=!c};i(),a.addEventListener("input",()=>{t.newCommentText=a.value,i()}),a.addEventListener("keydown",c=>{(c.ctrlKey||c.metaKey)&&c.key==="Enter"&&(c.preventDefault(),d.click())}),d.addEventListener("click",()=>{const c=a.value.trim();if(!c)return;const n=!!t.savedSelection;D(E,c,!n),t.newCommentText="",m(t)})}const p=t.panelElement.querySelector(".rte-comments-list");p&&r.forEach(i=>{p.appendChild(M(t,i))})}function L(){S||(S=!0,document.addEventListener("focusin",e=>{const t=v(e.target);t&&(x=t)}),document.addEventListener("selectionchange",()=>{const e=window.getSelection();if(!e||e.rangeCount===0)return;const t=e.getRangeAt(0),r=v(t.commonAncestorContainer);if(!r)return;x=r;const o=C.get(r);!o||e.isCollapsed||w(t,r)&&(o.savedSelection=t.cloneRange())}))}function D(e,t,r=!1){const o=f();if(!o)return"";const a=t.trim();if(!a)return"";if(r){const l=h("comment");return o.comments.set(l,{id:l,anchorId:"",selectedText:"",author:e,text:a,createdAt:new Date().toISOString(),resolved:!1,replies:[]}),m(o),l}const d=o.savedSelection||T(o.root);if(!d||!w(d,o.root))return"";const p=d.toString().trim();if(!p)return"";const i=h("comment"),c=h("comment-anchor"),n=document.createElement("span");n.id=c,n.className="rte-comment-anchor",n.setAttribute("data-comment-id",i),n.setAttribute("title","Commented text");try{const l=d.cloneRange(),u=l.extractContents();if(!u.textContent?.trim())return"";n.appendChild(u),l.insertNode(n)}catch{return""}return $(o,n,i),o.comments.set(i,{id:i,anchorId:c,selectedText:p,author:e,text:a,createdAt:new Date().toISOString(),resolved:!1,replies:[]}),o.savedSelection=null,window.getSelection()?.removeAllRanges(),m(o),i}function O(e,t){const r=f();if(!r)return;const o=r.comments.get(e);o&&(o.resolved=!0,o.resolvedBy=t,o.resolvedAt=new Date().toISOString(),R(r,o),m(r))}function P(e){const t=f();if(!t)return;const r=t.comments.get(e);r&&(r.resolved=!1,r.resolvedBy=void 0,r.resolvedAt=void 0,R(t,r),m(t))}function j(e){const t=f();if(!t)return;const r=t.comments.get(e);if(r){if(r.anchorId){const o=t.root.querySelector(`#${r.anchorId}`);o&&q(o)}t.comments.delete(e),t.expandedComments.delete(e),delete t.replyTexts[e],m(t)}}function _(e,t,r){const o=f();if(!o)return;const a=o.comments.get(e);if(!a)return;const d=r.trim();d&&(a.replies.push({id:h("reply"),author:t,text:d,createdAt:new Date().toISOString()}),m(o))}function F(){if(document.getElementById("rte-comments-panel-styles"))return;const e=document.createElement("style");e.id="rte-comments-panel-styles",e.textContent=`
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=`
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(e)}const Z=()=>({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:()=>{L();const e=f();return e?(e.savedSelection=T(e.root),e.savedSelection&&window.getSelection()?.removeAllRanges(),y(e,!0),m(e),e.panelElement?.querySelector(".new-comment-textarea")?.focus({preventScroll:!0}),!0):!1},toggleComments:()=>{L();const e=f();return e?(y(e,!e.panelVisible),e.panelVisible&&m(e),!0):!1}},keymap:{}});exports.CommentsPlugin=Z;
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;