@editora/plugins 1.0.8 → 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 (141) hide show
  1. package/README.md +27 -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 +447 -0
  11. package/dist/approval-workflow.esm.js +1111 -0
  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 +442 -0
  16. package/dist/blocks-library.esm.js +1384 -0
  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 +548 -0
  21. package/dist/citations.esm.js +1530 -0
  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 +626 -0
  31. package/dist/conditional-content.esm.js +1421 -0
  32. package/dist/content-rules.cjs.js +408 -0
  33. package/dist/content-rules.esm.js +1147 -0
  34. package/dist/data-binding.cjs.js +321 -0
  35. package/dist/data-binding.esm.js +953 -0
  36. package/dist/direction.esm.js +18 -9
  37. package/dist/doc-schema.cjs.js +398 -0
  38. package/dist/doc-schema.esm.js +1378 -0
  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 -0
  49. package/dist/enterprise.esm.js +58 -0
  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 +124 -93
  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 +105 -0
  87. package/dist/mentions.esm.js +774 -0
  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 +67 -51
  92. package/dist/pii-redaction.cjs.js +436 -0
  93. package/dist/pii-redaction.esm.js +1447 -0
  94. package/dist/preview.cjs.js +3 -3
  95. package/dist/preview.esm.js +37 -32
  96. package/dist/print.cjs.js +4 -4
  97. package/dist/print.esm.js +20 -17
  98. package/dist/{purify.es-DHhaBdbu.mjs → purify.es-35a15df8.mjs} +19 -9
  99. package/dist/{purify.es-T2a3nLiC.js → purify.es-a8d731c6.js} +1 -1
  100. package/dist/slash-commands.cjs.js +90 -0
  101. package/dist/slash-commands.esm.js +788 -0
  102. package/dist/smart-paste.cjs.js +398 -0
  103. package/dist/smart-paste.esm.js +1444 -0
  104. package/dist/special-characters.cjs.js +7 -7
  105. package/dist/special-characters.esm.js +69 -61
  106. package/dist/spell-check.cjs.js +5 -5
  107. package/dist/spell-check.esm.js +123 -97
  108. package/dist/strikethrough.cjs.js +1 -1
  109. package/dist/strikethrough.esm.js +19 -14
  110. package/dist/style.css +1 -0
  111. package/dist/table.cjs.js +4 -4
  112. package/dist/table.esm.js +225 -191
  113. package/dist/template.cjs.js +11 -11
  114. package/dist/template.esm.js +153 -124
  115. package/dist/text-alignment.cjs.js +1 -1
  116. package/dist/text-alignment.esm.js +27 -21
  117. package/dist/text-color.cjs.js +3 -3
  118. package/dist/text-color.esm.js +87 -70
  119. package/dist/track-changes.cjs.js +77 -0
  120. package/dist/track-changes.esm.js +817 -0
  121. package/dist/translation-workflow.cjs.js +626 -0
  122. package/dist/translation-workflow.esm.js +1794 -0
  123. package/dist/version-diff.cjs.js +362 -0
  124. package/dist/version-diff.esm.js +797 -0
  125. package/index.d.ts +798 -0
  126. package/package.json +114 -9
  127. package/dist/_commonjsHelpers-BH3jXuIh.js +0 -1
  128. package/dist/_commonjsHelpers-ByX85dGu.mjs +0 -33
  129. package/dist/anchoredPopover-BzqGPOAE.js +0 -1
  130. package/dist/anchoredPopover-Dts0IrgU.mjs +0 -106
  131. package/dist/documentManager-CTqRftU8.mjs +0 -8369
  132. package/dist/documentManager-Jf0RbSks.js +0 -17
  133. package/dist/html2canvas.esm-B5qzocYs.js +0 -5
  134. package/dist/index-CvJk4DKa.js +0 -221
  135. package/dist/index-D3CycEFU.mjs +0 -16543
  136. package/dist/index-tqLTHcO6.js +0 -1
  137. package/dist/index.es-CE_A4QSm.js +0 -5
  138. package/dist/index.es-DQ78mYYo.mjs +0 -6665
  139. package/dist/jspdf.es.min-BoS80556.js +0 -77
  140. package/dist/plugins.css +0 -1
  141. /package/dist/{editorContainerHelpers-CFbfiOJI.js → editorContainerHelpers-36b8ddf3.js} +0 -0
@@ -50,7 +50,8 @@ const i = () => {
50
50
  ],
51
51
  commands: {
52
52
  setCapitalization: (e) => {
53
- if (!e) return !1;
53
+ if (!e)
54
+ return !1;
54
55
  switch (e) {
55
56
  case "uppercase":
56
57
  return o();
@@ -1 +1 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const N="__editoraCommandEditorRoot",w=e=>{if(!e)return null;const t=e.querySelector('[contenteditable="true"]');return t instanceof HTMLElement?t:null},A=()=>{if(typeof window>"u")return null;const e=window[N];if(!(e instanceof HTMLElement))return null;window[N]=null;const t=e.closest("[data-editora-editor], .rte-editor, .editora-editor, editora-editor")||(e.matches("[data-editora-editor], .rte-editor, .editora-editor, editora-editor")?e:null);if(t){const r=w(t);if(r)return r;if(t.getAttribute("contenteditable")==="true")return t}if(e.getAttribute("contenteditable")==="true")return e;const n=e.closest('[contenteditable="true"]');return n instanceof HTMLElement?n:null},_=()=>{const e=A();if(e&&document.contains(e))return e;const t=window.getSelection();if(t&&t.rangeCount>0){let r=t.getRangeAt(0).startContainer;for(;r&&r!==document.body;){if(r.nodeType===Node.ELEMENT_NODE){const o=r;if(o.getAttribute("contenteditable")==="true")return o}r=r.parentNode}}const n=document.activeElement;if(n){if(n.getAttribute("contenteditable")==="true")return n;const r=n.closest('[contenteditable="true"]');if(r)return r}return document.querySelector('[contenteditable="true"]')},S=e=>e?e.nodeType===Node.ELEMENT_NODE?e:e.parentElement:null,H=e=>{const t=window.getSelection();if(!t||t.rangeCount===0)return null;const n=t.getRangeAt(0);return e.contains(n.commonAncestorContainer)?n:null},y=e=>{e.dispatchEvent(new Event("input",{bubbles:!0}))},M=(e,t)=>{if(t===e.innerHTML)return;const n=window.execEditorCommand||window.executeEditorCommand;if(typeof n=="function")try{n("recordDomTransaction",e,t,e.innerHTML)}catch{}},k=(e,t)=>{if(!e.isConnected){t.focus({preventScroll:!0});return}const n=window.getSelection();if(!n)return;const r=document.createRange();r.selectNodeContents(e),r.collapse(!1),n.removeAllRanges();try{n.addRange(r)}catch{t.focus({preventScroll:!0});return}t.focus({preventScroll:!0})},v=e=>{let t=e.querySelector(":scope > p");if(!t){t=document.createElement("p");const n=[];e.childNodes.forEach(r=>{r.nodeType===Node.ELEMENT_NODE&&["UL","OL"].includes(r.tagName)||n.push(r)}),n.forEach(r=>t.appendChild(r)),e.insertBefore(t,e.firstChild)}return t.innerHTML.trim()||(t.innerHTML="<br>"),t},C=e=>{const t=document.createElement("li");t.setAttribute("data-type","checklist-item"),t.setAttribute("data-checked","false");const n=document.createElement("p");return n.innerHTML=e.trim()||"<br>",t.appendChild(n),t},T=e=>Array.from(e.children).filter(t=>t instanceof HTMLLIElement),I=new Set(["P","DIV","H1","H2","H3","H4","H5","H6","BLOCKQUOTE","PRE","LI"]),b=e=>I.has(e.tagName)&&e.getAttribute("contenteditable")!=="true",R=(e,t)=>{const n=[],r=new Set,o=i=>{!i||r.has(i)||t.contains(i)&&b(i)&&(i.closest("ul, ol")||(r.add(i),n.push(i)))},u=i=>{let a=i;for(;a&&a!==document.body;){if(a.nodeType===Node.ELEMENT_NODE){const h=a;if(b(h))return h;if(h.getAttribute("contenteditable")==="true")break}a=a.parentNode}return null};if(e.collapsed)return o(u(e.startContainer)),n;const d=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT,{acceptNode:i=>{const a=i;if(!b(a)||a.closest("ul, ol"))return NodeFilter.FILTER_SKIP;if(typeof e.intersectsNode=="function")return e.intersectsNode(a)?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP;const h=document.createRange();return h.selectNodeContents(a),e.compareBoundaryPoints(Range.END_TO_START,h)>0&&e.compareBoundaryPoints(Range.START_TO_END,h)<0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});let l=d.nextNode();for(;l;)o(l),l=d.nextNode();if(n.length===0&&o(u(e.commonAncestorContainer)),n.length<=1)return n;const m=n.filter(i=>!n.some(a=>a!==i&&i.contains(a)));return m.length>0?m:n},O=e=>{const t=[],n=document.createElement("div"),r=()=>{const o=n.innerHTML.trim();if(!o)return;const u=document.createElement("p");u.innerHTML=o,t.push(u),n.innerHTML=""};if(e.childNodes.forEach(o=>{if(o.nodeType===Node.ELEMENT_NODE&&["UL","OL"].includes(o.tagName)){r();return}if(o.nodeType===Node.ELEMENT_NODE&&o.tagName==="P"){r();const u=o.innerHTML.trim(),d=document.createElement("p");d.innerHTML=u||"<br>",t.push(d);return}o.nodeType===Node.TEXT_NODE&&!(o.textContent||"").trim()||n.appendChild(o.cloneNode(!0))}),r(),t.length===0){const o=document.createElement("p");o.innerHTML="<br>",t.push(o)}return t},P=()=>({name:"checklist",init:()=>{if(typeof document>"u"||typeof window>"u"||window.__checklistPluginClickInitialized)return;window.__checklistPluginClickInitialized=!0;const e=t=>{const r=t.target.closest('li[data-type="checklist-item"]');if(!r)return;const o=r.getBoundingClientRect();if(!(t.clientX-o.left<32))return;t.preventDefault(),t.stopPropagation();const l=r.closest("[contenteditable], .rte-content, .editora-content");if(l?.getAttribute("contenteditable")==="false"||!!l?.closest('[data-readonly="true"], .editora-editor[readonly], editora-editor[readonly]'))return;const i=l?.innerHTML||"",a=r.getAttribute("data-checked")==="true";r.setAttribute("data-checked",(!a).toString()),l&&(M(l,i),y(l))};document.addEventListener("click",e)},nodes:{checklist:{content:"checklistItem+",group:"block",parseDOM:[{tag:'ul[data-type="checklist"]'}],toDOM:()=>["ul",{"data-type":"checklist"},0]},checklistItem:{content:"paragraph",attrs:{checked:{default:!1}},parseDOM:[{tag:'li[data-type="checklist-item"]',getAttrs:e=>({checked:e.getAttribute("data-checked")==="true"})}],toDOM:e=>["li",{"data-type":"checklist-item","data-checked":e?.attrs?.checked?"true":"false"},0]}},toolbar:[{label:"Checklist",command:"toggleChecklist",icon:'<svg width="24px" height="24px" viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg" fill="#000000"><g id="SVGRepo_bgCarrier" stroke-width="0"></g><g id="SVGRepo_tracerCarrier" stroke-linecap="round" stroke-linejoin="round"></g><g id="SVGRepo_iconCarrier"><path fill-rule="evenodd" clip-rule="evenodd" d="M3.75 4.48h-.71L2 3.43l.71-.7.69.68L4.81 2l.71.71-1.77 1.77zM6.99 3h8v1h-8V3zm0 3h8v1h-8V6zm8 3h-8v1h8V9zm-8 3h8v1h-8v-1zM3.04 7.48h.71l1.77-1.77-.71-.7L3.4 6.42l-.69-.69-.71.71 1.04 1.04zm.71 3.01h-.71L2 9.45l.71-.71.69.69 1.41-1.42.71.71-1.77 1.77zm-.71 3.01h.71l1.77-1.77-.71-.71-1.41 1.42-.69-.69-.71.7 1.04 1.05z"></path></g></svg>',shortcut:"Mod-Shift-9"}],commands:{toggleChecklist:()=>{try{const e=_();if(!e)return!1;const t=e.innerHTML,n=()=>(M(e,t),y(e),!0),r=H(e);if(!r)return!1;const o=S(r.startContainer);if(!o)return!1;const u=o.closest('ul[data-type="checklist"]');if(u&&e.contains(u)){const c=T(u);if(c.length===0)return!1;const p=document.createDocumentFragment();let s=null;return c.forEach((f,g)=>{const E=O(f);E.forEach(L=>{p.appendChild(L),!s&&(f.contains(r.startContainer)||g===0)&&(s=L)}),!s&&g===0&&E[0]&&(s=E[0])}),u.replaceWith(p),s&&k(s,e),n()}const d=o.closest("ul, ol");if(d&&e.contains(d)){let c;if(d.tagName.toLowerCase()==="ul")c=d;else{for(c=document.createElement("ul");d.firstChild;)c.appendChild(d.firstChild);d.replaceWith(c)}c.setAttribute("data-type","checklist");let p=T(c);p.length===0&&(c.appendChild(C("")),p=T(c));let s=null;p.forEach(g=>{g.setAttribute("data-type","checklist-item"),g.hasAttribute("data-checked")||g.setAttribute("data-checked","false");const E=v(g);g.contains(r.startContainer)&&(s=E)});const f=c.querySelector(':scope > li[data-type="checklist-item"] > p');return k(s||f||c,e),n()}const l=R(r,e);if(l.length>1){const c=document.createElement("ul");c.setAttribute("data-type","checklist"),l.forEach(f=>{c.appendChild(C(f.innerHTML))}),l[0].replaceWith(c),l.slice(1).forEach(f=>{f.isConnected&&f.remove()});const s=c.querySelector(':scope > li[data-type="checklist-item"] > p');return s&&k(s,e),n()}const m=l[0]||o.closest("p, h1, h2, h3, h4, h5, h6, blockquote, pre");if(m&&m!==e){const c=document.createElement("ul");c.setAttribute("data-type","checklist");const p=C(m.innerHTML);c.appendChild(p),m.replaceWith(c);const s=p.querySelector(":scope > p");return s&&k(s,e),n()}const i=document.createElement("ul");i.setAttribute("data-type","checklist");const a=C("");i.appendChild(a),r.deleteContents(),r.insertNode(i);const h=a.querySelector(":scope > p");return h&&k(h,e),n()}catch(e){return console.error("Failed to toggle checklist:",e),!1}}},keymap:{"Mod-Shift-9":"toggleChecklist"}});exports.ChecklistPlugin=P;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const N="__editoraCommandEditorRoot",w=t=>{if(!t)return null;const e=t.querySelector('[contenteditable="true"]');return e instanceof HTMLElement?e:null},A=()=>{if(typeof window>"u")return null;const t=window[N];if(!(t instanceof HTMLElement))return null;window[N]=null;const e=t.closest("[data-editora-editor], .rte-editor, .editora-editor, editora-editor")||(t.matches("[data-editora-editor], .rte-editor, .editora-editor, editora-editor")?t:null);if(e){const r=w(e);if(r)return r;if(e.getAttribute("contenteditable")==="true")return e}if(t.getAttribute("contenteditable")==="true")return t;const n=t.closest('[contenteditable="true"]');return n instanceof HTMLElement?n:null},_=()=>{const t=A();if(t&&document.contains(t))return t;const e=window.getSelection();if(e&&e.rangeCount>0){let r=e.getRangeAt(0).startContainer;for(;r&&r!==document.body;){if(r.nodeType===Node.ELEMENT_NODE){const o=r;if(o.getAttribute("contenteditable")==="true")return o}r=r.parentNode}}const n=document.activeElement;if(n){if(n.getAttribute("contenteditable")==="true")return n;const r=n.closest('[contenteditable="true"]');if(r)return r}return document.querySelector('[contenteditable="true"]')},S=t=>t?t.nodeType===Node.ELEMENT_NODE?t:t.parentElement:null,H=t=>{const e=window.getSelection();if(!e||e.rangeCount===0)return null;const n=e.getRangeAt(0);return t.contains(n.commonAncestorContainer)?n:null},y=t=>{t.dispatchEvent(new Event("input",{bubbles:!0}))},M=(t,e)=>{if(e===t.innerHTML)return;const n=window.execEditorCommand||window.executeEditorCommand;if(typeof n=="function")try{n("recordDomTransaction",t,e,t.innerHTML)}catch{}},k=(t,e)=>{if(!t.isConnected){e.focus({preventScroll:!0});return}const n=window.getSelection();if(!n)return;const r=document.createRange();r.selectNodeContents(t),r.collapse(!1),n.removeAllRanges();try{n.addRange(r)}catch{e.focus({preventScroll:!0});return}e.focus({preventScroll:!0})},v=t=>{let e=t.querySelector(":scope > p");if(!e){e=document.createElement("p");const n=[];t.childNodes.forEach(r=>{r.nodeType===Node.ELEMENT_NODE&&["UL","OL"].includes(r.tagName)||n.push(r)}),n.forEach(r=>e.appendChild(r)),t.insertBefore(e,t.firstChild)}return e.innerHTML.trim()||(e.innerHTML="<br>"),e},C=t=>{const e=document.createElement("li");e.setAttribute("data-type","checklist-item"),e.setAttribute("data-checked","false");const n=document.createElement("p");return n.innerHTML=t.trim()||"<br>",e.appendChild(n),e},T=t=>Array.from(t.children).filter(e=>e instanceof HTMLLIElement),I=new Set(["P","DIV","H1","H2","H3","H4","H5","H6","BLOCKQUOTE","PRE","LI"]),b=t=>I.has(t.tagName)&&t.getAttribute("contenteditable")!=="true",R=(t,e)=>{const n=[],r=new Set,o=a=>{!a||r.has(a)||e.contains(a)&&b(a)&&(a.closest("ul, ol")||(r.add(a),n.push(a)))},u=a=>{let l=a;for(;l&&l!==document.body;){if(l.nodeType===Node.ELEMENT_NODE){const h=l;if(b(h))return h;if(h.getAttribute("contenteditable")==="true")break}l=l.parentNode}return null};if(t.collapsed)return o(u(t.startContainer)),n;const d=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:a=>{const l=a;if(!b(l)||l.closest("ul, ol"))return NodeFilter.FILTER_SKIP;if(typeof t.intersectsNode=="function")return t.intersectsNode(l)?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP;const h=document.createRange();return h.selectNodeContents(l),t.compareBoundaryPoints(Range.END_TO_START,h)>0&&t.compareBoundaryPoints(Range.START_TO_END,h)<0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});let i=d.nextNode();for(;i;)o(i),i=d.nextNode();if(n.length===0&&o(u(t.commonAncestorContainer)),n.length<=1)return n;const m=n.filter(a=>!n.some(l=>l!==a&&a.contains(l)));return m.length>0?m:n},O=t=>{const e=[],n=document.createElement("div"),r=()=>{const o=n.innerHTML.trim();if(!o)return;const u=document.createElement("p");u.innerHTML=o,e.push(u),n.innerHTML=""};if(t.childNodes.forEach(o=>{if(o.nodeType===Node.ELEMENT_NODE&&["UL","OL"].includes(o.tagName)){r();return}if(o.nodeType===Node.ELEMENT_NODE&&o.tagName==="P"){r();const u=o.innerHTML.trim(),d=document.createElement("p");d.innerHTML=u||"<br>",e.push(d);return}o.nodeType===Node.TEXT_NODE&&!(o.textContent||"").trim()||n.appendChild(o.cloneNode(!0))}),r(),e.length===0){const o=document.createElement("p");o.innerHTML="<br>",e.push(o)}return e},P=()=>({name:"checklist",init:()=>{if(typeof document>"u"||typeof window>"u"||window.__checklistPluginClickInitialized)return;window.__checklistPluginClickInitialized=!0;const t=e=>{const r=e.target.closest('li[data-type="checklist-item"]');if(!r)return;const o=r.getBoundingClientRect();if(!(e.clientX-o.left<32))return;e.preventDefault(),e.stopPropagation();const i=r.closest("[contenteditable], .rte-content, .editora-content");if((i==null?void 0:i.getAttribute("contenteditable"))==="false"||!!(i!=null&&i.closest('[data-readonly="true"], .editora-editor[readonly], editora-editor[readonly]')))return;const a=(i==null?void 0:i.innerHTML)||"",l=r.getAttribute("data-checked")==="true";r.setAttribute("data-checked",(!l).toString()),i&&(M(i,a),y(i))};document.addEventListener("click",t)},nodes:{checklist:{content:"checklistItem+",group:"block",parseDOM:[{tag:'ul[data-type="checklist"]'}],toDOM:()=>["ul",{"data-type":"checklist"},0]},checklistItem:{content:"paragraph",attrs:{checked:{default:!1}},parseDOM:[{tag:'li[data-type="checklist-item"]',getAttrs:t=>({checked:t.getAttribute("data-checked")==="true"})}],toDOM:t=>{var e;return["li",{"data-type":"checklist-item","data-checked":(e=t==null?void 0:t.attrs)!=null&&e.checked?"true":"false"},0]}}},toolbar:[{label:"Checklist",command:"toggleChecklist",icon:'<svg width="24px" height="24px" viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg" fill="#000000"><g id="SVGRepo_bgCarrier" stroke-width="0"></g><g id="SVGRepo_tracerCarrier" stroke-linecap="round" stroke-linejoin="round"></g><g id="SVGRepo_iconCarrier"><path fill-rule="evenodd" clip-rule="evenodd" d="M3.75 4.48h-.71L2 3.43l.71-.7.69.68L4.81 2l.71.71-1.77 1.77zM6.99 3h8v1h-8V3zm0 3h8v1h-8V6zm8 3h-8v1h8V9zm-8 3h8v1h-8v-1zM3.04 7.48h.71l1.77-1.77-.71-.7L3.4 6.42l-.69-.69-.71.71 1.04 1.04zm.71 3.01h-.71L2 9.45l.71-.71.69.69 1.41-1.42.71.71-1.77 1.77zm-.71 3.01h.71l1.77-1.77-.71-.71-1.41 1.42-.69-.69-.71.7 1.04 1.05z"></path></g></svg>',shortcut:"Mod-Shift-9"}],commands:{toggleChecklist:()=>{try{const t=_();if(!t)return!1;const e=t.innerHTML,n=()=>(M(t,e),y(t),!0),r=H(t);if(!r)return!1;const o=S(r.startContainer);if(!o)return!1;const u=o.closest('ul[data-type="checklist"]');if(u&&t.contains(u)){const c=T(u);if(c.length===0)return!1;const p=document.createDocumentFragment();let s=null;return c.forEach((f,g)=>{const E=O(f);E.forEach(L=>{p.appendChild(L),!s&&(f.contains(r.startContainer)||g===0)&&(s=L)}),!s&&g===0&&E[0]&&(s=E[0])}),u.replaceWith(p),s&&k(s,t),n()}const d=o.closest("ul, ol");if(d&&t.contains(d)){let c;if(d.tagName.toLowerCase()==="ul")c=d;else{for(c=document.createElement("ul");d.firstChild;)c.appendChild(d.firstChild);d.replaceWith(c)}c.setAttribute("data-type","checklist");let p=T(c);p.length===0&&(c.appendChild(C("")),p=T(c));let s=null;p.forEach(g=>{g.setAttribute("data-type","checklist-item"),g.hasAttribute("data-checked")||g.setAttribute("data-checked","false");const E=v(g);g.contains(r.startContainer)&&(s=E)});const f=c.querySelector(':scope > li[data-type="checklist-item"] > p');return k(s||f||c,t),n()}const i=R(r,t);if(i.length>1){const c=document.createElement("ul");c.setAttribute("data-type","checklist"),i.forEach(f=>{c.appendChild(C(f.innerHTML))}),i[0].replaceWith(c),i.slice(1).forEach(f=>{f.isConnected&&f.remove()});const s=c.querySelector(':scope > li[data-type="checklist-item"] > p');return s&&k(s,t),n()}const m=i[0]||o.closest("p, h1, h2, h3, h4, h5, h6, blockquote, pre");if(m&&m!==t){const c=document.createElement("ul");c.setAttribute("data-type","checklist");const p=C(m.innerHTML);c.appendChild(p),m.replaceWith(c);const s=p.querySelector(":scope > p");return s&&k(s,t),n()}const a=document.createElement("ul");a.setAttribute("data-type","checklist");const l=C("");a.appendChild(l),r.deleteContents(),r.insertNode(a);const h=l.querySelector(":scope > p");return h&&k(h,t),n()}catch(t){return console.error("Failed to toggle checklist:",t),!1}}},keymap:{"Mod-Shift-9":"toggleChecklist"}});exports.ChecklistPlugin=P;
@@ -1,17 +1,22 @@
1
1
  const N = "__editoraCommandEditorRoot", w = (t) => {
2
- if (!t) return null;
2
+ if (!t)
3
+ return null;
3
4
  const e = t.querySelector('[contenteditable="true"]');
4
5
  return e instanceof HTMLElement ? e : null;
5
6
  }, A = () => {
6
- if (typeof window > "u") return null;
7
+ if (typeof window > "u")
8
+ return null;
7
9
  const t = window[N];
8
- if (!(t instanceof HTMLElement)) return null;
10
+ if (!(t instanceof HTMLElement))
11
+ return null;
9
12
  window[N] = null;
10
13
  const e = t.closest("[data-editora-editor], .rte-editor, .editora-editor, editora-editor") || (t.matches("[data-editora-editor], .rte-editor, .editora-editor, editora-editor") ? t : null);
11
14
  if (e) {
12
15
  const r = w(e);
13
- if (r) return r;
14
- if (e.getAttribute("contenteditable") === "true") return e;
16
+ if (r)
17
+ return r;
18
+ if (e.getAttribute("contenteditable") === "true")
19
+ return e;
15
20
  }
16
21
  if (t.getAttribute("contenteditable") === "true")
17
22
  return t;
@@ -38,18 +43,21 @@ const N = "__editoraCommandEditorRoot", w = (t) => {
38
43
  if (n.getAttribute("contenteditable") === "true")
39
44
  return n;
40
45
  const r = n.closest('[contenteditable="true"]');
41
- if (r) return r;
46
+ if (r)
47
+ return r;
42
48
  }
43
49
  return document.querySelector('[contenteditable="true"]');
44
50
  }, H = (t) => t ? t.nodeType === Node.ELEMENT_NODE ? t : t.parentElement : null, S = (t) => {
45
51
  const e = window.getSelection();
46
- if (!e || e.rangeCount === 0) return null;
52
+ if (!e || e.rangeCount === 0)
53
+ return null;
47
54
  const n = e.getRangeAt(0);
48
55
  return t.contains(n.commonAncestorContainer) ? n : null;
49
56
  }, y = (t) => {
50
57
  t.dispatchEvent(new Event("input", { bubbles: !0 }));
51
58
  }, M = (t, e) => {
52
- if (e === t.innerHTML) return;
59
+ if (e === t.innerHTML)
60
+ return;
53
61
  const n = window.execEditorCommand || window.executeEditorCommand;
54
62
  if (typeof n == "function")
55
63
  try {
@@ -62,7 +70,8 @@ const N = "__editoraCommandEditorRoot", w = (t) => {
62
70
  return;
63
71
  }
64
72
  const n = window.getSelection();
65
- if (!n) return;
73
+ if (!n)
74
+ return;
66
75
  const r = document.createRange();
67
76
  r.selectNodeContents(t), r.collapse(!1), n.removeAllRanges();
68
77
  try {
@@ -102,17 +111,19 @@ const N = "__editoraCommandEditorRoot", w = (t) => {
102
111
  "PRE",
103
112
  "LI"
104
113
  ]), b = (t) => R.has(t.tagName) && t.getAttribute("contenteditable") !== "true", v = (t, e) => {
105
- const n = [], r = /* @__PURE__ */ new Set(), o = (i) => {
106
- !i || r.has(i) || e.contains(i) && b(i) && (i.closest("ul, ol") || (r.add(i), n.push(i)));
107
- }, u = (i) => {
108
- let a = i;
109
- for (; a && a !== document.body; ) {
110
- if (a.nodeType === Node.ELEMENT_NODE) {
111
- const h = a;
112
- if (b(h)) return h;
113
- if (h.getAttribute("contenteditable") === "true") break;
114
+ const n = [], r = /* @__PURE__ */ new Set(), o = (a) => {
115
+ !a || r.has(a) || e.contains(a) && b(a) && (a.closest("ul, ol") || (r.add(a), n.push(a)));
116
+ }, u = (a) => {
117
+ let l = a;
118
+ for (; l && l !== document.body; ) {
119
+ if (l.nodeType === Node.ELEMENT_NODE) {
120
+ const h = l;
121
+ if (b(h))
122
+ return h;
123
+ if (h.getAttribute("contenteditable") === "true")
124
+ break;
114
125
  }
115
- a = a.parentNode;
126
+ l = l.parentNode;
116
127
  }
117
128
  return null;
118
129
  };
@@ -122,27 +133,29 @@ const N = "__editoraCommandEditorRoot", w = (t) => {
122
133
  e,
123
134
  NodeFilter.SHOW_ELEMENT,
124
135
  {
125
- acceptNode: (i) => {
126
- const a = i;
127
- if (!b(a) || a.closest("ul, ol")) return NodeFilter.FILTER_SKIP;
136
+ acceptNode: (a) => {
137
+ const l = a;
138
+ if (!b(l) || l.closest("ul, ol"))
139
+ return NodeFilter.FILTER_SKIP;
128
140
  if (typeof t.intersectsNode == "function")
129
- return t.intersectsNode(a) ? NodeFilter.FILTER_ACCEPT : NodeFilter.FILTER_SKIP;
141
+ return t.intersectsNode(l) ? NodeFilter.FILTER_ACCEPT : NodeFilter.FILTER_SKIP;
130
142
  const h = document.createRange();
131
- return h.selectNodeContents(a), t.compareBoundaryPoints(Range.END_TO_START, h) > 0 && t.compareBoundaryPoints(Range.START_TO_END, h) < 0 ? NodeFilter.FILTER_ACCEPT : NodeFilter.FILTER_SKIP;
143
+ return h.selectNodeContents(l), t.compareBoundaryPoints(Range.END_TO_START, h) > 0 && t.compareBoundaryPoints(Range.START_TO_END, h) < 0 ? NodeFilter.FILTER_ACCEPT : NodeFilter.FILTER_SKIP;
132
144
  }
133
145
  }
134
146
  );
135
- let l = d.nextNode();
136
- for (; l; )
137
- o(l), l = d.nextNode();
147
+ let i = d.nextNode();
148
+ for (; i; )
149
+ o(i), i = d.nextNode();
138
150
  if (n.length === 0 && o(u(t.commonAncestorContainer)), n.length <= 1)
139
151
  return n;
140
- const m = n.filter((i) => !n.some((a) => a !== i && i.contains(a)));
152
+ const m = n.filter((a) => !n.some((l) => l !== a && a.contains(l)));
141
153
  return m.length > 0 ? m : n;
142
154
  }, O = (t) => {
143
155
  const e = [], n = document.createElement("div"), r = () => {
144
156
  const o = n.innerHTML.trim();
145
- if (!o) return;
157
+ if (!o)
158
+ return;
146
159
  const u = document.createElement("p");
147
160
  u.innerHTML = o, e.push(u), n.innerHTML = "";
148
161
  };
@@ -167,18 +180,22 @@ const N = "__editoraCommandEditorRoot", w = (t) => {
167
180
  name: "checklist",
168
181
  // Initialize click handler when plugin is loaded
169
182
  init: () => {
170
- if (typeof document > "u" || typeof window > "u" || window.__checklistPluginClickInitialized) return;
183
+ if (typeof document > "u" || typeof window > "u" || window.__checklistPluginClickInitialized)
184
+ return;
171
185
  window.__checklistPluginClickInitialized = !0;
172
186
  const t = (e) => {
173
187
  const r = e.target.closest('li[data-type="checklist-item"]');
174
- if (!r) return;
188
+ if (!r)
189
+ return;
175
190
  const o = r.getBoundingClientRect();
176
- if (!(e.clientX - o.left < 32)) return;
191
+ if (!(e.clientX - o.left < 32))
192
+ return;
177
193
  e.preventDefault(), e.stopPropagation();
178
- const l = r.closest("[contenteditable], .rte-content, .editora-content");
179
- if (l?.getAttribute("contenteditable") === "false" || !!l?.closest('[data-readonly="true"], .editora-editor[readonly], editora-editor[readonly]')) return;
180
- const i = l?.innerHTML || "", a = r.getAttribute("data-checked") === "true";
181
- r.setAttribute("data-checked", (!a).toString()), l && (M(l, i), y(l));
194
+ const i = r.closest("[contenteditable], .rte-content, .editora-content");
195
+ if ((i == null ? void 0 : i.getAttribute("contenteditable")) === "false" || !!(i != null && i.closest('[data-readonly="true"], .editora-editor[readonly], editora-editor[readonly]')))
196
+ return;
197
+ const a = (i == null ? void 0 : i.innerHTML) || "", l = r.getAttribute("data-checked") === "true";
198
+ r.setAttribute("data-checked", (!l).toString()), i && (M(i, a), y(i));
182
199
  };
183
200
  document.addEventListener("click", t);
184
201
  },
@@ -203,14 +220,17 @@ const N = "__editoraCommandEditorRoot", w = (t) => {
203
220
  })
204
221
  }
205
222
  ],
206
- toDOM: (t) => [
207
- "li",
208
- {
209
- "data-type": "checklist-item",
210
- "data-checked": t?.attrs?.checked ? "true" : "false"
211
- },
212
- 0
213
- ]
223
+ toDOM: (t) => {
224
+ var e;
225
+ return [
226
+ "li",
227
+ {
228
+ "data-type": "checklist-item",
229
+ "data-checked": (e = t == null ? void 0 : t.attrs) != null && e.checked ? "true" : "false"
230
+ },
231
+ 0
232
+ ];
233
+ }
214
234
  }
215
235
  },
216
236
  toolbar: [
@@ -225,15 +245,19 @@ const N = "__editoraCommandEditorRoot", w = (t) => {
225
245
  toggleChecklist: () => {
226
246
  try {
227
247
  const t = _();
228
- if (!t) return !1;
248
+ if (!t)
249
+ return !1;
229
250
  const e = t.innerHTML, n = () => (M(t, e), y(t), !0), r = S(t);
230
- if (!r) return !1;
251
+ if (!r)
252
+ return !1;
231
253
  const o = H(r.startContainer);
232
- if (!o) return !1;
254
+ if (!o)
255
+ return !1;
233
256
  const u = o.closest('ul[data-type="checklist"]');
234
257
  if (u && t.contains(u)) {
235
258
  const c = T(u);
236
- if (c.length === 0) return !1;
259
+ if (c.length === 0)
260
+ return !1;
237
261
  const p = document.createDocumentFragment();
238
262
  let s = null;
239
263
  return c.forEach((f, g) => {
@@ -265,18 +289,18 @@ const N = "__editoraCommandEditorRoot", w = (t) => {
265
289
  const f = c.querySelector(':scope > li[data-type="checklist-item"] > p');
266
290
  return k(s || f || c, t), n();
267
291
  }
268
- const l = v(r, t);
269
- if (l.length > 1) {
292
+ const i = v(r, t);
293
+ if (i.length > 1) {
270
294
  const c = document.createElement("ul");
271
- c.setAttribute("data-type", "checklist"), l.forEach((f) => {
295
+ c.setAttribute("data-type", "checklist"), i.forEach((f) => {
272
296
  c.appendChild(C(f.innerHTML));
273
- }), l[0].replaceWith(c), l.slice(1).forEach((f) => {
297
+ }), i[0].replaceWith(c), i.slice(1).forEach((f) => {
274
298
  f.isConnected && f.remove();
275
299
  });
276
300
  const s = c.querySelector(':scope > li[data-type="checklist-item"] > p');
277
301
  return s && k(s, t), n();
278
302
  }
279
- const m = l[0] || o.closest("p, h1, h2, h3, h4, h5, h6, blockquote, pre");
303
+ const m = i[0] || o.closest("p, h1, h2, h3, h4, h5, h6, blockquote, pre");
280
304
  if (m && m !== t) {
281
305
  const c = document.createElement("ul");
282
306
  c.setAttribute("data-type", "checklist");
@@ -285,11 +309,11 @@ const N = "__editoraCommandEditorRoot", w = (t) => {
285
309
  const s = p.querySelector(":scope > p");
286
310
  return s && k(s, t), n();
287
311
  }
288
- const i = document.createElement("ul");
289
- i.setAttribute("data-type", "checklist");
290
- const a = C("");
291
- i.appendChild(a), r.deleteContents(), r.insertNode(i);
292
- const h = a.querySelector(":scope > p");
312
+ const a = document.createElement("ul");
313
+ a.setAttribute("data-type", "checklist");
314
+ const l = C("");
315
+ a.appendChild(l), r.deleteContents(), r.insertNode(a);
316
+ const h = l.querySelector(":scope > p");
293
317
  return h && k(h, t), n();
294
318
  } catch (t) {
295
319
  return console.error("Failed to toggle checklist:", t), !1;