@editora/plugins 1.0.5 → 1.0.7

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 (45) hide show
  1. package/README.md +7 -0
  2. package/dist/a11y-checker.cjs.js +1 -1
  3. package/dist/anchor.cjs.js +3 -3
  4. package/dist/background-color.cjs.js +2 -2
  5. package/dist/blockquote.cjs.js +1 -1
  6. package/dist/bold.cjs.js +1 -1
  7. package/dist/capitalization.cjs.js +1 -1
  8. package/dist/checklist.cjs.js +1 -1
  9. package/dist/clear-formatting.cjs.js +1 -1
  10. package/dist/code-sample.cjs.js +1 -1
  11. package/dist/code.cjs.js +1 -1
  12. package/dist/comments.cjs.js +1 -1
  13. package/dist/direction.cjs.js +1 -1
  14. package/dist/document-manager.cjs.js +1 -1
  15. package/dist/embed-iframe.cjs.js +1 -1
  16. package/dist/emojis.cjs.js +1 -1
  17. package/dist/font-family.cjs.js +1 -1
  18. package/dist/font-size.cjs.js +1 -1
  19. package/dist/footnote.cjs.js +2 -2
  20. package/dist/fullscreen.cjs.js +1 -1
  21. package/dist/heading.cjs.js +1 -1
  22. package/dist/history.cjs.js +1 -1
  23. package/dist/indent.cjs.js +1 -1
  24. package/dist/index.cjs.js +1 -1
  25. package/dist/italic.cjs.js +1 -1
  26. package/dist/line-height.cjs.js +1 -1
  27. package/dist/link.cjs.js +3 -3
  28. package/dist/list.cjs.js +1 -1
  29. package/dist/lite.cjs.js +1 -1
  30. package/dist/math.cjs.js +2 -2
  31. package/dist/media-manager.cjs.js +4 -4
  32. package/dist/merge-tag.cjs.js +3 -3
  33. package/dist/page-break.cjs.js +2 -2
  34. package/dist/preview.cjs.js +3 -3
  35. package/dist/print.cjs.js +1 -1
  36. package/dist/shared-config.cjs.js +1 -1
  37. package/dist/special-characters.cjs.js +3 -3
  38. package/dist/spell-check.cjs.js +1 -1
  39. package/dist/strikethrough.cjs.js +1 -1
  40. package/dist/table.cjs.js +3 -3
  41. package/dist/template.cjs.js +5 -5
  42. package/dist/text-alignment.cjs.js +1 -1
  43. package/dist/text-color.cjs.js +1 -1
  44. package/dist/underline.cjs.js +1 -1
  45. package/package.json +92 -47
@@ -1,4 +1,4 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const R=".rte-content, .editora-content",C='.rte-footnotes[data-type="footnotes"]',m=".rte-footnote-ref[data-footnote-id]",g='li.rte-footnote-item[data-type="footnote"]',x="__editoraCommandEditorRoot";let y=!1,S=!1,A=0;function M(){if(y||typeof document>"u")return;y=!0;const t=document.createElement("style");t.id="editora-footnote-plugin-styles",t.textContent=`
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const v=".rte-content, .editora-content",C='.rte-footnotes[data-type="footnotes"]',m=".rte-footnote-ref[data-footnote-id]",g='li.rte-footnote-item[data-type="footnote"]',x="__editoraCommandEditorRoot";let y=!1,S=!1,A=0;function D(){if(y||typeof document>"u")return;y=!0;const t=document.createElement("style");t.id="editora-footnote-plugin-styles",t.textContent=`
2
2
  .rte-footnote-ref {
3
3
  display: inline-block;
4
4
  font-size: 0.72em;
@@ -82,4 +82,4 @@
82
82
  :is([data-theme="dark"], .dark, .editora-theme-dark) .rte-footnote-backref {
83
83
  color: #8ab4ff;
84
84
  }
85
- `,document.head.appendChild(t)}function v(t){return t?t.nodeType===Node.ELEMENT_NODE?t:t.parentElement:null}function _(t){if(!t)return null;const e=t.querySelector('[contenteditable="true"]');return e instanceof HTMLElement?e:null}function q(){if(typeof window>"u")return null;const t=window[x];if(!(t instanceof HTMLElement))return null;window[x]=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 o=_(e);if(o)return o;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}function $(t){const e=t.closest('[contenteditable="true"]');if(!e)return null;let n=e,o=n.parentElement;for(;o;)o.getAttribute("contenteditable")==="true"&&(n=o),o=o.parentElement;return n}function u(t){const e=v(t);if(!e)return null;const n=e.closest(R);return n||$(e)}function B(){const t=window.getSelection();return!t||t.rangeCount===0?null:u(t.getRangeAt(0).startContainer)}function H(){const t=q();if(t&&document.contains(t))return t;const e=B();if(e)return e;const n=document.activeElement,o=n?u(n):null;if(o)return o;const r=document.querySelector(R);return r||document.querySelector('[contenteditable="true"]')}function P(){const t=document.createElement("section");t.className="rte-footnotes",t.setAttribute("data-type","footnotes"),t.setAttribute("contenteditable","false");const e=document.createElement("ol");return t.appendChild(e),t}function b(t,e){let n=t.querySelector(C);return!n&&e&&(n=P(),t.appendChild(n)),n?(n.querySelector("ol")||n.appendChild(document.createElement("ol")),n):null}function O(t){let e=t.querySelector("ol");return e||(e=document.createElement("ol"),t.appendChild(e)),e}function z(t){const e=document.createElement("sup");return e.className="rte-footnote-ref",e.setAttribute("data-footnote-id",t),e.setAttribute("data-number","0"),e.setAttribute("contenteditable","false"),e.setAttribute("tabindex","0"),e.setAttribute("role","doc-noteref"),e.id=`ref-${t}`,e.textContent="0",e}function F(t,e){const n=document.createElement("li");n.id=t,n.className="rte-footnote-item",n.setAttribute("data-type","footnote"),n.setAttribute("data-number","0"),n.setAttribute("contenteditable","false");const o=document.createElement("div");o.className="rte-footnote-content",o.setAttribute("contenteditable","true"),o.textContent=e;const r=document.createElement("a");return r.className="rte-footnote-backref",r.href=`#ref-${t}`,r.setAttribute("aria-label","Back to reference"),r.setAttribute("contenteditable","false"),r.textContent="↩",n.appendChild(o),n.appendChild(r),n}function j(t){let e="";do A+=1,e=`fn-${Date.now().toString(36)}-${A.toString(36)}`;while(t.querySelector(`#${CSS.escape(e)}`));return e}function k(t){t.classList.remove("rte-footnote-highlighted"),t.classList.add("rte-footnote-highlighted"),window.setTimeout(()=>{t.classList.remove("rte-footnote-highlighted")},1e3)}function L(t){t&&t.dispatchEvent(new Event("input",{bubbles:!0}))}function I(t,e){if(!t||e===t.innerHTML)return;const n=window.execEditorCommand||window.executeEditorCommand;if(typeof n=="function")try{n("recordDomTransaction",t,e,t.innerHTML)}catch{}}function X(t,e){return Array.from(t.querySelectorAll(m)).find(o=>o.getAttribute("data-footnote-id")===e)||null}function V(t){const e=window.getSelection();if(!e)throw new Error("Selection unavailable");let n=null;if(e.rangeCount>0){const r=e.getRangeAt(0);t.contains(r.commonAncestorContainer)&&(n=r.cloneRange())}if(!n){n=document.createRange();const r=b(t,!1);r?(n.setStartBefore(r),n.collapse(!0)):(n.selectNodeContents(t),n.collapse(!1))}if(v(n.commonAncestorContainer)?.closest(C)){const r=b(t,!0);r&&(n.setStartBefore(r),n.collapse(!0))}return e.removeAllRanges(),e.addRange(n),n}function w(t){const e=t.parentNode;if(!e)return;const n=Array.from(e.childNodes).indexOf(t);if(n<0)return;const o=window.getSelection();if(!o)return;const r=document.createRange();r.setStart(e,n),r.setEnd(e,n+1),o.removeAllRanges(),o.addRange(r),t.focus({preventScroll:!0})}function T(t,e){const n=window.getSelection();if(!n)return;const o=Math.max(0,Math.min(e,t.childNodes.length)),r=document.createRange();r.setStart(t,o),r.collapse(!0),n.removeAllRanges(),n.addRange(r)}function K(t){if(t.collapsed||t.startContainer!==t.endContainer||t.endOffset!==t.startOffset+1||!(t.startContainer instanceof Element||t.startContainer instanceof DocumentFragment))return null;const e=t.startContainer.childNodes[t.startOffset];return!(e instanceof HTMLElement)||!e.matches(m)?null:e}function p(t,e,n){const{startContainer:o,startOffset:r}=t;if(o.nodeType===Node.ELEMENT_NODE){const i=o;if(n==="previous"){if(r>0)return i.childNodes[r-1]||null}else if(r<i.childNodes.length)return i.childNodes[r]||null}if(o.nodeType===Node.TEXT_NODE&&(n==="previous"&&r<o.data.length||n==="next"&&r>0))return null;let c=o;for(;c&&c!==e;){const i=n==="previous"?c.previousSibling:c.nextSibling;if(i)return i;c=c.parentNode}return null}function Y(t,e,n){if(!t.collapsed)return null;const o=i=>i instanceof HTMLElement&&i.matches(m)?i:null,{startContainer:r,startOffset:c}=t;if(r.nodeType===Node.ELEMENT_NODE){const i=r;return n==="Backspace"&&c>0?o(i.childNodes[c-1]||null):n==="Delete"?o(i.childNodes[c]||null):null}if(r.nodeType===Node.TEXT_NODE){const i=r;if(n==="Backspace"&&c===0){const a=o(i.previousSibling);return a||o(p(t,e,"previous"))}if(n==="Delete"&&c===i.data.length){const a=o(i.nextSibling);return a||o(p(t,e,"next"))}}return o(n==="Backspace"?p(t,e,"previous"):p(t,e,"next"))}function D(t){const e=Array.from(t.querySelectorAll(m)).filter(a=>!a.closest(C)),n=b(t,e.length>0);if(!n)return;const o=O(n),r=Array.from(o.querySelectorAll(g)),c=new Map;r.forEach(a=>c.set(a.id,a));const i=[];e.forEach((a,f)=>{const l=a.getAttribute("data-footnote-id");if(!l)return;const s=f+1;a.setAttribute("data-number",String(s)),a.id=`ref-${l}`,a.textContent=String(s);let d=c.get(l);d||(d=F(l,`Footnote ${s}`)),d.setAttribute("data-number",String(s));const h=d.querySelector(".rte-footnote-content");h&&!(h.textContent||"").trim()&&(h.textContent=`Footnote ${s}`);const E=d.querySelector(".rte-footnote-backref");E&&(E.href=`#ref-${l}`,E.setAttribute("aria-label",`Back to reference ${s}`)),i.push(d)}),o.innerHTML="",i.forEach(a=>o.appendChild(a)),i.length===0&&n.remove()}function N(t,e){const n=u(t),o=t.parentNode;if(!n||!o)return!1;const r=n.innerHTML,c=Array.from(o.childNodes).indexOf(t);if(c<0)return!1;const i=t.getAttribute("data-footnote-id")||"";return t.remove(),i&&n.querySelector(`${g}#${CSS.escape(i)}`)?.remove(),T(o,c),D(n),I(n,r),L(n),!0}function G(){S||typeof document>"u"||(S=!0,document.addEventListener("click",t=>{const e=t.target;if(!e)return;const n=e.closest(m);if(n){const f=u(n);if(!f||!f.contains(n))return;t.preventDefault(),t.stopPropagation(),w(n),n.classList.add("rte-footnote-selected"),window.setTimeout(()=>n.classList.remove("rte-footnote-selected"),1200);const l=n.getAttribute("data-footnote-id");if(!l)return;const s=f.querySelector(`${g}#${CSS.escape(l)}`);if(!s)return;s.scrollIntoView({behavior:"smooth",block:"center"}),k(s);return}const o=e.closest(".rte-footnote-backref");if(!o)return;const r=o.closest(g);if(!r)return;const c=u(r);if(!c||!c.contains(r))return;t.preventDefault(),t.stopPropagation();const i=r.id;if(!i)return;const a=X(c,i);a&&(a.scrollIntoView({behavior:"smooth",block:"center"}),k(a),w(a))}),document.addEventListener("keydown",t=>{if(t.key!=="Backspace"&&t.key!=="Delete")return;const e=window.getSelection();if(!e||e.rangeCount===0)return;const n=e.getRangeAt(0),o=u(n.commonAncestorContainer);if(!o||!o.contains(n.commonAncestorContainer))return;const r=K(n);if(r){t.preventDefault(),t.stopPropagation(),N(r,t.key);return}const c=Y(n,o,t.key);c&&(t.preventDefault(),t.stopPropagation(),N(c,t.key))}))}const J=(t="")=>{const e=H();if(!e)return!1;const n=e.innerHTML,o=window.getSelection();if(!o)return!1;let r;try{r=V(e)}catch{return!1}r.collapsed||(r.collapse(!1),o.removeAllRanges(),o.addRange(r));const c=j(e),i=z(c);try{r.insertNode(i)}catch{return!1}const a=document.createRange();a.setStartAfter(i),a.collapse(!0),o.removeAllRanges(),o.addRange(a);const f=b(e,!0);if(!f)return!1;const l=O(f),s=t.trim()||"Footnote";return l.appendChild(F(c,s)),D(e),I(e,n),L(e),!0},Q=()=>(M(),G(),{name:"footnote",toolbar:[{label:"Footnote",command:"insertFootnote",icon:'<svg width="24" height="24" viewBox="0 0 24 24" fill="currentColor"><rect x="3" y="4" width="14" height="2" rx="1"></rect><rect x="3" y="8" width="18" height="2" rx="1"></rect><rect x="3" y="12" width="16" height="2" rx="1"></rect><rect x="3" y="16" width="10" height="1.5" rx="0.75"></rect><text x="19" y="11" font-size="9" font-weight="600" fill="currentColor" font-family="system-ui, sans-serif">1</text></svg>'}],commands:{insertFootnote:()=>J()},keymap:{}});exports.FootnotePlugin=Q;
85
+ `,document.head.appendChild(t)}function R(t){return t?t.nodeType===Node.ELEMENT_NODE?t:t.parentElement:null}function _(t){if(!t)return null;const e=t.querySelector('[contenteditable="true"]');return e instanceof HTMLElement?e:null}function q(){if(typeof window>"u")return null;const t=window[x];if(!(t instanceof HTMLElement))return null;window[x]=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 o=_(e);if(o)return o;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}function $(t){const e=t.closest('[contenteditable="true"]');if(!e)return null;let n=e,o=n.parentElement;for(;o;)o.getAttribute("contenteditable")==="true"&&(n=o),o=o.parentElement;return n}function u(t){const e=R(t);if(!e)return null;const n=e.closest(v);return n||$(e)}function B(){const t=window.getSelection();return!t||t.rangeCount===0?null:u(t.getRangeAt(0).startContainer)}function H(){const t=q();if(t&&document.contains(t))return t;const e=B();if(e)return e;const n=document.activeElement,o=n?u(n):null;if(o)return o;const r=document.querySelector(v);return r||document.querySelector('[contenteditable="true"]')}function P(){const t=document.createElement("section");t.className="rte-footnotes",t.setAttribute("data-type","footnotes"),t.setAttribute("contenteditable","false");const e=document.createElement("ol");return t.appendChild(e),t}function b(t,e){let n=t.querySelector(C);return!n&&e&&(n=P(),t.appendChild(n)),n?(n.querySelector("ol")||n.appendChild(document.createElement("ol")),n):null}function O(t){let e=t.querySelector("ol");return e||(e=document.createElement("ol"),t.appendChild(e)),e}function z(t){const e=document.createElement("sup");return e.className="rte-footnote-ref",e.setAttribute("data-footnote-id",t),e.setAttribute("data-number","0"),e.setAttribute("contenteditable","false"),e.setAttribute("tabindex","0"),e.setAttribute("role","doc-noteref"),e.id=`ref-${t}`,e.textContent="0",e}function F(t,e){const n=document.createElement("li");n.id=t,n.className="rte-footnote-item",n.setAttribute("data-type","footnote"),n.setAttribute("data-number","0"),n.setAttribute("contenteditable","false");const o=document.createElement("div");o.className="rte-footnote-content",o.setAttribute("contenteditable","true"),o.textContent=e;const r=document.createElement("a");return r.className="rte-footnote-backref",r.href=`#ref-${t}`,r.setAttribute("aria-label","Back to reference"),r.setAttribute("contenteditable","false"),r.textContent="↩",n.appendChild(o),n.appendChild(r),n}function j(t){let e="";do A+=1,e=`fn-${Date.now().toString(36)}-${A.toString(36)}`;while(t.querySelector(`#${CSS.escape(e)}`));return e}function k(t){t.classList.remove("rte-footnote-highlighted"),t.classList.add("rte-footnote-highlighted"),window.setTimeout(()=>{t.classList.remove("rte-footnote-highlighted")},1e3)}function L(t){t&&t.dispatchEvent(new Event("input",{bubbles:!0}))}function I(t,e){if(!t||e===t.innerHTML)return;const n=window.execEditorCommand||window.executeEditorCommand;if(typeof n=="function")try{n("recordDomTransaction",t,e,t.innerHTML)}catch{}}function X(t,e){return Array.from(t.querySelectorAll(m)).find(o=>o.getAttribute("data-footnote-id")===e)||null}function V(t){const e=window.getSelection();if(!e)throw new Error("Selection unavailable");let n=null;if(e.rangeCount>0){const r=e.getRangeAt(0);t.contains(r.commonAncestorContainer)&&(n=r.cloneRange())}if(!n){n=document.createRange();const r=b(t,!1);r?(n.setStartBefore(r),n.collapse(!0)):(n.selectNodeContents(t),n.collapse(!1))}if(R(n.commonAncestorContainer)?.closest(C)){const r=b(t,!0);r&&(n.setStartBefore(r),n.collapse(!0))}return e.removeAllRanges(),e.addRange(n),n}function w(t){const e=t.parentNode;if(!e)return;const n=Array.from(e.childNodes).indexOf(t);if(n<0)return;const o=window.getSelection();if(!o)return;const r=document.createRange();r.setStart(e,n),r.setEnd(e,n+1),o.removeAllRanges(),o.addRange(r),t.focus({preventScroll:!0})}function T(t,e){const n=window.getSelection();if(!n)return;const o=Math.max(0,Math.min(e,t.childNodes.length)),r=document.createRange();r.setStart(t,o),r.collapse(!0),n.removeAllRanges(),n.addRange(r)}function K(t){if(t.collapsed||t.startContainer!==t.endContainer||t.endOffset!==t.startOffset+1||!(t.startContainer instanceof Element||t.startContainer instanceof DocumentFragment))return null;const e=t.startContainer.childNodes[t.startOffset];return!(e instanceof HTMLElement)||!e.matches(m)?null:e}function p(t,e,n){const{startContainer:o,startOffset:r}=t;if(o.nodeType===Node.ELEMENT_NODE){const i=o;if(n==="previous"){if(r>0)return i.childNodes[r-1]||null}else if(r<i.childNodes.length)return i.childNodes[r]||null}if(o.nodeType===Node.TEXT_NODE&&(n==="previous"&&r<o.data.length||n==="next"&&r>0))return null;let c=o;for(;c&&c!==e;){const i=n==="previous"?c.previousSibling:c.nextSibling;if(i)return i;c=c.parentNode}return null}function Y(t,e,n){if(!t.collapsed)return null;const o=i=>i instanceof HTMLElement&&i.matches(m)?i:null,{startContainer:r,startOffset:c}=t;if(r.nodeType===Node.ELEMENT_NODE){const i=r;return n==="Backspace"&&c>0?o(i.childNodes[c-1]||null):n==="Delete"?o(i.childNodes[c]||null):null}if(r.nodeType===Node.TEXT_NODE){const i=r;if(n==="Backspace"&&c===0){const a=o(i.previousSibling);return a||o(p(t,e,"previous"))}if(n==="Delete"&&c===i.data.length){const a=o(i.nextSibling);return a||o(p(t,e,"next"))}}return o(n==="Backspace"?p(t,e,"previous"):p(t,e,"next"))}function M(t){const e=Array.from(t.querySelectorAll(m)).filter(a=>!a.closest(C)),n=b(t,e.length>0);if(!n)return;const o=O(n),r=Array.from(o.querySelectorAll(g)),c=new Map;r.forEach(a=>c.set(a.id,a));const i=[];e.forEach((a,f)=>{const l=a.getAttribute("data-footnote-id");if(!l)return;const s=f+1;a.setAttribute("data-number",String(s)),a.id=`ref-${l}`,a.textContent=String(s);let d=c.get(l);d||(d=F(l,`Footnote ${s}`)),d.setAttribute("data-number",String(s));const h=d.querySelector(".rte-footnote-content");h&&!(h.textContent||"").trim()&&(h.textContent=`Footnote ${s}`);const E=d.querySelector(".rte-footnote-backref");E&&(E.href=`#ref-${l}`,E.setAttribute("aria-label",`Back to reference ${s}`)),i.push(d)}),o.innerHTML="",i.forEach(a=>o.appendChild(a)),i.length===0&&n.remove()}function N(t,e){const n=u(t),o=t.parentNode;if(!n||!o)return!1;const r=n.innerHTML,c=Array.from(o.childNodes).indexOf(t);if(c<0)return!1;const i=t.getAttribute("data-footnote-id")||"";return t.remove(),i&&n.querySelector(`${g}#${CSS.escape(i)}`)?.remove(),T(o,c),M(n),I(n,r),L(n),!0}function G(){S||typeof document>"u"||(S=!0,document.addEventListener("click",t=>{const e=t.target;if(!e)return;const n=e.closest(m);if(n){const f=u(n);if(!f||!f.contains(n))return;t.preventDefault(),t.stopPropagation(),w(n),n.classList.add("rte-footnote-selected"),window.setTimeout(()=>n.classList.remove("rte-footnote-selected"),1200);const l=n.getAttribute("data-footnote-id");if(!l)return;const s=f.querySelector(`${g}#${CSS.escape(l)}`);if(!s)return;s.scrollIntoView({behavior:"smooth",block:"center"}),k(s);return}const o=e.closest(".rte-footnote-backref");if(!o)return;const r=o.closest(g);if(!r)return;const c=u(r);if(!c||!c.contains(r))return;t.preventDefault(),t.stopPropagation();const i=r.id;if(!i)return;const a=X(c,i);a&&(a.scrollIntoView({behavior:"smooth",block:"center"}),k(a),w(a))}),document.addEventListener("keydown",t=>{if(t.key!=="Backspace"&&t.key!=="Delete")return;const e=window.getSelection();if(!e||e.rangeCount===0)return;const n=e.getRangeAt(0),o=u(n.commonAncestorContainer);if(!o||!o.contains(n.commonAncestorContainer))return;const r=K(n);if(r){t.preventDefault(),t.stopPropagation(),N(r,t.key);return}const c=Y(n,o,t.key);c&&(t.preventDefault(),t.stopPropagation(),N(c,t.key))}))}const J=(t="")=>{const e=H();if(!e)return!1;const n=e.innerHTML,o=window.getSelection();if(!o)return!1;let r;try{r=V(e)}catch{return!1}r.collapsed||(r.collapse(!1),o.removeAllRanges(),o.addRange(r));const c=j(e),i=z(c);try{r.insertNode(i)}catch{return!1}const a=document.createRange();a.setStartAfter(i),a.collapse(!0),o.removeAllRanges(),o.addRange(a);const f=b(e,!0);if(!f)return!1;const l=O(f),s=t.trim()||"Footnote";return l.appendChild(F(c,s)),M(e),I(e,n),L(e),!0},Q=()=>(D(),G(),{name:"footnote",toolbar:[{label:"Footnote",command:"insertFootnote",icon:'<svg width="24" height="24" viewBox="0 0 24 24" fill="currentColor"><rect x="3" y="4" width="14" height="2" rx="1"></rect><rect x="3" y="8" width="18" height="2" rx="1"></rect><rect x="3" y="12" width="16" height="2" rx="1"></rect><rect x="3" y="16" width="10" height="1.5" rx="0.75"></rect><text x="19" y="11" font-size="9" font-weight="600" fill="currentColor" font-family="system-ui, sans-serif">1</text></svg>'}],commands:{insertFootnote:()=>J()},keymap:{}});exports.FootnotePlugin=Q;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=new WeakMap,a="rte-fullscreen-active",t=e=>(o.has(e)||o.set(e,{isFullscreen:!1,fullscreenButton:null}),o.get(e)),y=(e,s)=>{if(e.classList.add(a),e.style.position="fixed",e.style.top="0",e.style.left="0",e.style.right="0",e.style.bottom="0",e.style.width="100%",e.style.height="100%",e.style.maxWidth="100%",e.style.maxHeight="100%",e.style.borderRadius="0",e.style.zIndex="9999",e.style.margin="0",e.style.padding="0",e.style.boxShadow="none",e.style.display="flex",e.style.flexDirection="column",e.style.background="white",document.body.style.overflow="hidden",document.body.classList.add("fullscreen-active"),s.fullscreenButton){s.fullscreenButton.setAttribute("data-active","true"),s.fullscreenButton.style.backgroundColor="var(--rte-color-primary, #007bff)",s.fullscreenButton.style.color="white";const l=s.fullscreenButton.querySelector("svg");l&&(l.style.fill="white",l.style.stroke="white")}},c=(e,s)=>{if(e.classList.remove(a),e.style.position="",e.style.top="",e.style.left="",e.style.right="",e.style.bottom="",e.style.width="",e.style.height="",e.style.maxWidth="",e.style.maxHeight="",e.style.borderRadius="",e.style.zIndex="",e.style.margin="",e.style.padding="",e.style.boxShadow="",e.style.display="",e.style.flexDirection="",e.style.background="",document.body.style.overflow="",document.body.classList.remove("fullscreen-active"),s.fullscreenButton){s.fullscreenButton.setAttribute("data-active","false"),s.fullscreenButton.style.backgroundColor="",s.fullscreenButton.style.color="";const l=s.fullscreenButton.querySelector("svg");l&&(l.style.fill="",l.style.stroke="")}},f=e=>{try{if(!e){const l=document.activeElement;l&&l.closest("[data-editora-editor]")&&(e=l.closest("[data-editora-editor]"))}if(e||(e=document.querySelector("[data-editora-editor]")),!e)return console.warn("Editor element not found"),!1;const s=t(e);return s.fullscreenButton||(s.fullscreenButton=e.querySelector('[data-command="toggleFullscreen"]')),s.isFullscreen=!s.isFullscreen,s.isFullscreen?y(e,s):c(e,s),!0}catch(s){return console.error("Fullscreen toggle failed:",s),!1}},i=e=>{if(!e){document.querySelectorAll("[data-editora-editor]").forEach(l=>{const u=l,n=t(u);n.isFullscreen&&(n.isFullscreen=!1,c(u,n))});return}const s=t(e);s.isFullscreen&&(s.isFullscreen=!1,c(e,s))},d=e=>t(e).isFullscreen,r=()=>{const e=s=>{s.key==="Escape"&&i()};return typeof window<"u"&&window.addEventListener("keydown",e),()=>{typeof window<"u"&&window.removeEventListener("keydown",e)}};typeof window<"u"&&(document.readyState==="loading"?document.addEventListener("DOMContentLoaded",r):r());const g=()=>({name:"fullscreen",toolbar:[{label:"Fullscreen",command:"toggleFullscreen",type:"button",icon:'<svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M8 3H5a2 2 0 0 0-2 2v3m18 0V5a2 2 0 0 0-2-2h-3m0 18h3a2 2 0 0 0 2-2v-3M3 16v3a2 2 0 0 0 2 2h3"></path></svg>'}],commands:{toggleFullscreen:f},keymap:{Escape:()=>{const e=document.querySelectorAll("[data-editora-editor]");for(const s of e)if(d(s))return i(s),!0;return!1}}});exports.FullscreenPlugin=g;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const o=new WeakMap,a="rte-fullscreen-active",t=e=>(o.has(e)||o.set(e,{isFullscreen:!1,fullscreenButton:null}),o.get(e)),f=(e,s)=>{if(e.classList.add(a),e.style.position="fixed",e.style.top="0",e.style.left="0",e.style.right="0",e.style.bottom="0",e.style.width="100%",e.style.height="100%",e.style.maxWidth="100%",e.style.maxHeight="100%",e.style.borderRadius="0",e.style.zIndex="9999",e.style.margin="0",e.style.padding="0",e.style.boxShadow="none",e.style.display="flex",e.style.flexDirection="column",e.style.background="white",document.body.style.overflow="hidden",document.body.classList.add("fullscreen-active"),s.fullscreenButton){s.fullscreenButton.setAttribute("data-active","true"),s.fullscreenButton.style.backgroundColor="var(--rte-color-primary, #007bff)",s.fullscreenButton.style.color="white";const l=s.fullscreenButton.querySelector("svg");l&&(l.style.fill="white",l.style.stroke="white")}},c=(e,s)=>{if(e.classList.remove(a),e.style.position="",e.style.top="",e.style.left="",e.style.right="",e.style.bottom="",e.style.width="",e.style.height="",e.style.maxWidth="",e.style.maxHeight="",e.style.borderRadius="",e.style.zIndex="",e.style.margin="",e.style.padding="",e.style.boxShadow="",e.style.display="",e.style.flexDirection="",e.style.background="",document.body.style.overflow="",document.body.classList.remove("fullscreen-active"),s.fullscreenButton){s.fullscreenButton.setAttribute("data-active","false"),s.fullscreenButton.style.backgroundColor="",s.fullscreenButton.style.color="";const l=s.fullscreenButton.querySelector("svg");l&&(l.style.fill="",l.style.stroke="")}},y=e=>{try{if(!e){const l=document.activeElement;l&&l.closest("[data-editora-editor]")&&(e=l.closest("[data-editora-editor]"))}if(e||(e=document.querySelector("[data-editora-editor]")),!e)return console.warn("Editor element not found"),!1;const s=t(e);return s.fullscreenButton||(s.fullscreenButton=e.querySelector('[data-command="toggleFullscreen"]')),s.isFullscreen=!s.isFullscreen,s.isFullscreen?f(e,s):c(e,s),!0}catch(s){return console.error("Fullscreen toggle failed:",s),!1}},i=e=>{if(!e){document.querySelectorAll("[data-editora-editor]").forEach(l=>{const u=l,n=t(u);n.isFullscreen&&(n.isFullscreen=!1,c(u,n))});return}const s=t(e);s.isFullscreen&&(s.isFullscreen=!1,c(e,s))},d=e=>t(e).isFullscreen,r=()=>{const e=s=>{s.key==="Escape"&&i()};return typeof window<"u"&&window.addEventListener("keydown",e),()=>{typeof window<"u"&&window.removeEventListener("keydown",e)}};typeof window<"u"&&(document.readyState==="loading"?document.addEventListener("DOMContentLoaded",r):r());const g=()=>({name:"fullscreen",toolbar:[{label:"Fullscreen",command:"toggleFullscreen",type:"button",icon:'<svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M8 3H5a2 2 0 0 0-2 2v3m18 0V5a2 2 0 0 0-2-2h-3m0 18h3a2 2 0 0 0 2-2v-3M3 16v3a2 2 0 0 0 2 2h3"></path></svg>'}],commands:{toggleFullscreen:y},keymap:{Escape:()=>{const e=document.querySelectorAll("[data-editora-editor]");for(const s of e)if(d(s))return i(s),!0;return!1}}});exports.FullscreenPlugin=g;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=()=>{const e=a=>{try{return document.execCommand("formatBlock",!1,a),!0}catch(l){return console.error(`Failed to set block type to ${a}:`,l),!1}};return{name:"heading",toolbar:[{label:"Heading",command:"setBlockType",type:"dropdown",options:[{value:"p",label:"Paragraph"},{value:"h1",label:"Heading 1"},{value:"h2",label:"Heading 2"},{value:"h3",label:"Heading 3"},{value:"h4",label:"Heading 4"},{value:"h5",label:"Heading 5"},{value:"h6",label:"Heading 6"}],icon:'<svg width="24" height="24" focusable="false"><path d="M16.1 8.6 14.2 4l-1.4.5 2.8 7.4c.1.4.5.6.9.6h.1c.4-.1.6-.5.6-.9l1.8-4.8-1.4-.5-1.5 2.3ZM4 11.5h6V10H4v1.5ZM18.5 3v1L17 7l.9.9L20.7 3h-2.2ZM5.5 12h1v7h1v-7h1v-.5h-3V12Zm4 0h1v7h1v-7h1v-.5h-3V12Zm10 1.5a2 2 0 0 0-2-2h-1v7.5h1v-2.7h1a2 2 0 0 0 2-2v-.8Zm-2 1.3h-1v-2.3h1a.8.8 0 1 1 0 1.6v.7Z" fill-rule="evenodd"></path></svg>'}],commands:{setBlockType:a=>a?e(a):!1,setHeading1:()=>e("h1"),setHeading2:()=>e("h2"),setHeading3:()=>e("h3"),setParagraph:()=>e("p")},keymap:{"Mod-Alt-1":"setHeading1","Mod-Alt-2":"setHeading2","Mod-Alt-3":"setHeading3","Mod-Alt-0":"setParagraph"}}};exports.HeadingPlugin=t;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const t=()=>{const e=a=>{try{return document.execCommand("formatBlock",!1,a),!0}catch(l){return console.error(`Failed to set block type to ${a}:`,l),!1}};return{name:"heading",toolbar:[{label:"Heading",command:"setBlockType",type:"dropdown",options:[{value:"p",label:"Paragraph"},{value:"h1",label:"Heading 1"},{value:"h2",label:"Heading 2"},{value:"h3",label:"Heading 3"},{value:"h4",label:"Heading 4"},{value:"h5",label:"Heading 5"},{value:"h6",label:"Heading 6"}],icon:'<svg width="24" height="24" focusable="false"><path d="M16.1 8.6 14.2 4l-1.4.5 2.8 7.4c.1.4.5.6.9.6h.1c.4-.1.6-.5.6-.9l1.8-4.8-1.4-.5-1.5 2.3ZM4 11.5h6V10H4v1.5ZM18.5 3v1L17 7l.9.9L20.7 3h-2.2ZM5.5 12h1v7h1v-7h1v-.5h-3V12Zm4 0h1v7h1v-7h1v-.5h-3V12Zm10 1.5a2 2 0 0 0-2-2h-1v7.5h1v-2.7h1a2 2 0 0 0 2-2v-.8Zm-2 1.3h-1v-2.3h1a.8.8 0 1 1 0 1.6v.7Z" fill-rule="evenodd"></path></svg>'}],commands:{setBlockType:a=>a?e(a):!1,setHeading1:()=>e("h1"),setHeading2:()=>e("h2"),setHeading3:()=>e("h3"),setParagraph:()=>e("p")},keymap:{"Mod-Alt-1":"setHeading1","Mod-Alt-2":"setHeading2","Mod-Alt-3":"setHeading3","Mod-Alt-0":"setParagraph"}}};exports.HeadingPlugin=t;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const v=".rte-content, .editora-content",y=100,T="__editoraCommandEditorRoot",d=new Map,E={};let h=!1,c=null;function I(t){if(!t)return null;const e=t.querySelector('[contenteditable="true"]');return e instanceof HTMLElement?e:null}function z(){if(typeof window>"u")return null;const t=window[T];if(!(t instanceof HTMLElement))return null;window[T]=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 o=I(e);if(o)return o;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}function F(t){return t?t.nodeType===Node.ELEMENT_NODE?t:t.parentElement:null}function a(t){const e=F(t);if(!e)return null;const n=e.closest(v);if(n)return n;const o=e.closest('[contenteditable="true"]');if(!o)return null;let r=o,i=r.parentElement;for(;i;)i.getAttribute("contenteditable")==="true"&&(r=i),i=i.parentElement;return r}function l(){const t=z();if(t&&document.contains(t))return t;const e=window.getSelection();if(e&&e.rangeCount>0){const i=a(e.getRangeAt(0).startContainer);if(i)return i}const n=document.activeElement;if(n){const i=a(n);if(i)return i}if(c?.isConnected)return c;const o=Array.from(d.keys()).find(i=>i.isConnected);if(o)return o;const r=document.querySelector(v);return r||document.querySelector('[contenteditable="true"]')}function A(){for(const t of d.keys())t.isConnected||(d.delete(t),c===t&&(c=null))}function C(t){A();let e=d.get(t);return e||(e={undoStack:[],redoStack:[]},d.set(t,e)),e}function s(t){t&&t.dispatchEvent(new Event("input",{bubbles:!0}))}function M(t){return t?t.innerHTML:""}function m(t,e){if(!t)return;const n=C(t);n.undoStack.push(e),n.redoStack.length=0,n.undoStack.length>y&&n.undoStack.splice(0,n.undoStack.length-y),c=t}function L(t,e="undo"){if(A(),t?.isConnected)return t;const n=l();if(n?.isConnected)return n;if(c?.isConnected)return c;const o=r=>e==="undo"?r.undoStack.length>0:r.redoStack.length>0;for(const[r,i]of d.entries())if(r.isConnected&&o(i))return r;return null}function w(t){const e={};for(const r of t.getAttributeNames()){const i=t.getAttribute(r);i!==null&&(e[r]=i)}const n=t instanceof HTMLInputElement||t instanceof HTMLTextAreaElement||t instanceof HTMLSelectElement,o=t instanceof HTMLInputElement;return{attributes:e,innerHTML:t.innerHTML,value:n?t.value:null,checked:o?t.checked:null}}function H(t,e){const n=new Set(t.getAttributeNames());Object.keys(e.attributes).forEach(o=>n.delete(o)),n.forEach(o=>t.removeAttribute(o)),Object.entries(e.attributes).forEach(([o,r])=>{t.setAttribute(o,r)}),t.innerHTML!==e.innerHTML&&(t.innerHTML=e.innerHTML),e.value!==null&&(t instanceof HTMLInputElement||t instanceof HTMLTextAreaElement||t instanceof HTMLSelectElement)&&(t.value=e.value),e.checked!==null&&t instanceof HTMLInputElement&&(t.checked=e.checked)}function u(t,e){if(E[t]=e,typeof window>"u")return;const n=window.registerEditorCommand;typeof n=="function"?n(t,e):(window.registerEditorCommand=(o,r)=>{E[o]=r},window.registerEditorCommand(t,e))}const S=(t,...e)=>{const n=E[t];return n?n(...e):!1};function p(){h||typeof window>"u"||(h=!0,window.execEditorCommand||(window.execEditorCommand=S),window.executeEditorCommand||(window.executeEditorCommand=S),u("undo",k),u("redo",D),u("setAttribute",O),u("setText",N),u("autoFixA11y",R),u("recordDomTransaction",_),u("undoDom",b),u("redoDom",g))}function x(t,e){const n=e||l(),o=M(n);n?.focus({preventScroll:!0});let r=!1;try{r=!!document.execCommand(t,!1)}catch{r=!1}const i=M(n),f=o!==i;return f&&s(n),{executed:r,changed:f}}const k=()=>{const t=l();return x("undo",t).changed?!0:b(t??void 0)},D=()=>{const t=l();return x("redo",t).changed?!0:g(t??void 0)},O=(t,e,n)=>{if(!(t instanceof HTMLElement))return;const o=a(t),r=t.hasAttribute(e),i=t.getAttribute(e);t.setAttribute(e,n),m(o,{undo:()=>{t.isConnected&&(r&&i!==null?t.setAttribute(e,i):t.removeAttribute(e))},redo:()=>{t.isConnected&&t.setAttribute(e,n)}}),s(o)},N=(t,e)=>{if(!(t instanceof HTMLElement))return;const n=a(t),o=t.textContent??"";t.textContent=e,m(n,{undo:()=>{t.isConnected&&(t.textContent=o)},redo:()=>{t.isConnected&&(t.textContent=e)}}),s(n)},R=t=>{const e=t?.element;if(!(e instanceof HTMLElement))return;const n=a(e),o=window.a11yRuleRegistry?.find(f=>f.id===t.rule);if(!o||typeof o.fix!="function")return;const r=w(e);o.fix(t);const i=w(e);m(n,{undo:()=>{e.isConnected&&H(e,r)},redo:()=>{e.isConnected&&H(e,i)}}),s(n)},_=(t,e,n)=>{if(!(t instanceof HTMLElement))return!1;const o=typeof n=="string"?n:t.innerHTML;return e===o?!1:(m(t,{undo:()=>{t.isConnected&&(t.innerHTML=e)},redo:()=>{t.isConnected&&(t.innerHTML=o)}}),!0)},b=t=>{const e=L(t,"undo");if(!e)return!1;const n=C(e),o=n.undoStack.pop();return o?(o.undo(),n.redoStack.push(o),c=e,s(e),!0):!1},g=t=>{const e=L(t,"redo");if(!e)return!1;const n=C(e),o=n.redoStack.pop();return o?(o.redo(),n.undoStack.push(o),c=e,s(e),!0):!1};typeof window<"u"&&(document.readyState==="loading"?document.addEventListener("DOMContentLoaded",p,{once:!0}):p());const Z=()=>(p(),{name:"history",toolbar:[{label:"Undo",command:"undo",type:"button",icon:'<svg width="24" height="24" focusable="false"><path d="M6.4 8H12c3.7 0 6.2 2 6.8 5.1.6 2.7-.4 5.6-2.3 6.8a1 1 0 0 1-1-1.8c1.1-.6 1.8-2.7 1.4-4.6-.5-2.1-2.1-3.5-4.9-3.5H6.4l3.3 3.3a1 1 0 1 1-1.4 1.4l-5-5a1 1 0 0 1 0-1.4l5-5a1 1 0 0 1 1.4 1.4L6.4 8Z" fill-rule="nonzero"></path></svg>',shortcut:"Mod-z"},{label:"Redo",command:"redo",type:"button",icon:'<svg width="24" height="24" focusable="false"><path d="M17.6 10H12c-2.8 0-4.4 1.4-4.9 3.5-.4 2 .3 4 1.4 4.6a1 1 0 1 1-1 1.8c-2-1.2-2.9-4.1-2.3-6.8.6-3 3-5.1 6.8-5.1h5.6l-3.3-3.3a1 1 0 1 1 1.4-1.4l5 5a1 1 0 0 1 0 1.4l-5 5a1 1 0 0 1-1.4-1.4l3.3-3.3Z" fill-rule="nonzero"></path></svg>',shortcut:"Mod-y"}],commands:{undo:k,redo:D,setAttribute:O,setText:N,autoFixA11y:R,recordDomTransaction:_,undoDom:b,redoDom:g},keymap:{"Mod-z":"undo","Mod-Z":"undo","Mod-y":"redo","Mod-Y":"redo","Mod-Shift-z":"redo","Mod-Shift-Z":"redo"}});exports.HistoryPlugin=Z;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const v=".rte-content, .editora-content",y=100,M="__editoraCommandEditorRoot",d=new Map,E={};let T=!1,c=null;function I(t){if(!t)return null;const e=t.querySelector('[contenteditable="true"]');return e instanceof HTMLElement?e:null}function z(){if(typeof window>"u")return null;const t=window[M];if(!(t instanceof HTMLElement))return null;window[M]=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 o=I(e);if(o)return o;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}function F(t){return t?t.nodeType===Node.ELEMENT_NODE?t:t.parentElement:null}function a(t){const e=F(t);if(!e)return null;const n=e.closest(v);if(n)return n;const o=e.closest('[contenteditable="true"]');if(!o)return null;let r=o,i=r.parentElement;for(;i;)i.getAttribute("contenteditable")==="true"&&(r=i),i=i.parentElement;return r}function l(){const t=z();if(t&&document.contains(t))return t;const e=window.getSelection();if(e&&e.rangeCount>0){const i=a(e.getRangeAt(0).startContainer);if(i)return i}const n=document.activeElement;if(n){const i=a(n);if(i)return i}if(c?.isConnected)return c;const o=Array.from(d.keys()).find(i=>i.isConnected);if(o)return o;const r=document.querySelector(v);return r||document.querySelector('[contenteditable="true"]')}function A(){for(const t of d.keys())t.isConnected||(d.delete(t),c===t&&(c=null))}function C(t){A();let e=d.get(t);return e||(e={undoStack:[],redoStack:[]},d.set(t,e)),e}function s(t){t&&t.dispatchEvent(new Event("input",{bubbles:!0}))}function h(t){return t?t.innerHTML:""}function m(t,e){if(!t)return;const n=C(t);n.undoStack.push(e),n.redoStack.length=0,n.undoStack.length>y&&n.undoStack.splice(0,n.undoStack.length-y),c=t}function L(t,e="undo"){if(A(),t?.isConnected)return t;const n=l();if(n?.isConnected)return n;if(c?.isConnected)return c;const o=r=>e==="undo"?r.undoStack.length>0:r.redoStack.length>0;for(const[r,i]of d.entries())if(r.isConnected&&o(i))return r;return null}function w(t){const e={};for(const r of t.getAttributeNames()){const i=t.getAttribute(r);i!==null&&(e[r]=i)}const n=t instanceof HTMLInputElement||t instanceof HTMLTextAreaElement||t instanceof HTMLSelectElement,o=t instanceof HTMLInputElement;return{attributes:e,innerHTML:t.innerHTML,value:n?t.value:null,checked:o?t.checked:null}}function H(t,e){const n=new Set(t.getAttributeNames());Object.keys(e.attributes).forEach(o=>n.delete(o)),n.forEach(o=>t.removeAttribute(o)),Object.entries(e.attributes).forEach(([o,r])=>{t.setAttribute(o,r)}),t.innerHTML!==e.innerHTML&&(t.innerHTML=e.innerHTML),e.value!==null&&(t instanceof HTMLInputElement||t instanceof HTMLTextAreaElement||t instanceof HTMLSelectElement)&&(t.value=e.value),e.checked!==null&&t instanceof HTMLInputElement&&(t.checked=e.checked)}function u(t,e){if(E[t]=e,typeof window>"u")return;const n=window.registerEditorCommand;typeof n=="function"?n(t,e):(window.registerEditorCommand=(o,r)=>{E[o]=r},window.registerEditorCommand(t,e))}const S=(t,...e)=>{const n=E[t];return n?n(...e):!1};function p(){T||typeof window>"u"||(T=!0,window.execEditorCommand||(window.execEditorCommand=S),window.executeEditorCommand||(window.executeEditorCommand=S),u("undo",k),u("redo",D),u("setAttribute",O),u("setText",_),u("autoFixA11y",N),u("recordDomTransaction",R),u("undoDom",b),u("redoDom",g))}function x(t,e){const n=e||l(),o=h(n);n?.focus({preventScroll:!0});let r=!1;try{r=!!document.execCommand(t,!1)}catch{r=!1}const i=h(n),f=o!==i;return f&&s(n),{executed:r,changed:f}}const k=()=>{const t=l();return x("undo",t).changed?!0:b(t??void 0)},D=()=>{const t=l();return x("redo",t).changed?!0:g(t??void 0)},O=(t,e,n)=>{if(!(t instanceof HTMLElement))return;const o=a(t),r=t.hasAttribute(e),i=t.getAttribute(e);t.setAttribute(e,n),m(o,{undo:()=>{t.isConnected&&(r&&i!==null?t.setAttribute(e,i):t.removeAttribute(e))},redo:()=>{t.isConnected&&t.setAttribute(e,n)}}),s(o)},_=(t,e)=>{if(!(t instanceof HTMLElement))return;const n=a(t),o=t.textContent??"";t.textContent=e,m(n,{undo:()=>{t.isConnected&&(t.textContent=o)},redo:()=>{t.isConnected&&(t.textContent=e)}}),s(n)},N=t=>{const e=t?.element;if(!(e instanceof HTMLElement))return;const n=a(e),o=window.a11yRuleRegistry?.find(f=>f.id===t.rule);if(!o||typeof o.fix!="function")return;const r=w(e);o.fix(t);const i=w(e);m(n,{undo:()=>{e.isConnected&&H(e,r)},redo:()=>{e.isConnected&&H(e,i)}}),s(n)},R=(t,e,n)=>{if(!(t instanceof HTMLElement))return!1;const o=typeof n=="string"?n:t.innerHTML;return e===o?!1:(m(t,{undo:()=>{t.isConnected&&(t.innerHTML=e)},redo:()=>{t.isConnected&&(t.innerHTML=o)}}),!0)},b=t=>{const e=L(t,"undo");if(!e)return!1;const n=C(e),o=n.undoStack.pop();return o?(o.undo(),n.redoStack.push(o),c=e,s(e),!0):!1},g=t=>{const e=L(t,"redo");if(!e)return!1;const n=C(e),o=n.redoStack.pop();return o?(o.redo(),n.undoStack.push(o),c=e,s(e),!0):!1};typeof window<"u"&&(document.readyState==="loading"?document.addEventListener("DOMContentLoaded",p,{once:!0}):p());const Z=()=>(p(),{name:"history",toolbar:[{label:"Undo",command:"undo",type:"button",icon:'<svg width="24" height="24" focusable="false"><path d="M6.4 8H12c3.7 0 6.2 2 6.8 5.1.6 2.7-.4 5.6-2.3 6.8a1 1 0 0 1-1-1.8c1.1-.6 1.8-2.7 1.4-4.6-.5-2.1-2.1-3.5-4.9-3.5H6.4l3.3 3.3a1 1 0 1 1-1.4 1.4l-5-5a1 1 0 0 1 0-1.4l5-5a1 1 0 0 1 1.4 1.4L6.4 8Z" fill-rule="nonzero"></path></svg>',shortcut:"Mod-z"},{label:"Redo",command:"redo",type:"button",icon:'<svg width="24" height="24" focusable="false"><path d="M17.6 10H12c-2.8 0-4.4 1.4-4.9 3.5-.4 2 .3 4 1.4 4.6a1 1 0 1 1-1 1.8c-2-1.2-2.9-4.1-2.3-6.8.6-3 3-5.1 6.8-5.1h5.6l-3.3-3.3a1 1 0 1 1 1.4-1.4l5 5a1 1 0 0 1 0 1.4l-5 5a1 1 0 0 1-1.4-1.4l3.3-3.3Z" fill-rule="nonzero"></path></svg>',shortcut:"Mod-y"}],commands:{undo:k,redo:D,setAttribute:O,setText:_,autoFixA11y:N,recordDomTransaction:R,undoDom:b,redoDom:g},keymap:{"Mod-z":"undo","Mod-Z":"undo","Mod-y":"redo","Mod-Y":"redo","Mod-Shift-z":"redo","Mod-Shift-Z":"redo"}});exports.HistoryPlugin=Z;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const m=40,s=e=>["P","DIV","H1","H2","H3","H4","H5","H6","LI","BLOCKQUOTE","PRE"].includes(e.tagName)&&e.getAttribute("contenteditable")!=="true",E=()=>{const e=window.getSelection();if(e&&e.rangeCount>0){let t=e.getRangeAt(0).startContainer;for(;t&&t!==document.body;){if(t.nodeType===Node.ELEMENT_NODE){const o=t;if(o.getAttribute("contenteditable")==="true")return o}t=t.parentNode}}const n=document.activeElement;if(n){if(n.getAttribute("contenteditable")==="true")return n;const t=n.closest('[contenteditable="true"]');if(t)return t}return document.querySelector('[contenteditable="true"]')},l=e=>{let n=e;if(n.nodeType===Node.ELEMENT_NODE){const t=n;if(s(t))return t}for(;n;){if(n.nodeType===Node.ELEMENT_NODE){const t=n;if(s(t))return t;if(t.getAttribute("contenteditable")==="true")break}n=n.parentNode}return null},p=(e,n)=>{const t=[],o=new Set,c=r=>{!r||o.has(r)||n.contains(r)&&s(r)&&(o.add(r),t.push(r))};if(e.collapsed)return c(l(e.startContainer)),t;const i=document.createTreeWalker(n,NodeFilter.SHOW_ELEMENT,{acceptNode:r=>{const a=r;if(!s(a))return NodeFilter.FILTER_SKIP;if(typeof e.intersectsNode=="function")return e.intersectsNode(a)?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP;const u=document.createRange();return u.selectNodeContents(a),e.compareBoundaryPoints(Range.END_TO_START,u)>0&&e.compareBoundaryPoints(Range.START_TO_END,u)<0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});let d=i.nextNode();for(;d;)c(d),d=i.nextNode();return t.length===0&&c(l(e.commonAncestorContainer)),t},h=e=>{const n=window.getComputedStyle(e),t=n.paddingLeft;if(t.endsWith("px"))return parseFloat(t);if(t.endsWith("em")){const o=parseFloat(n.fontSize);return parseFloat(t)*o}return 0},T=(e,n)=>{if(n===e.innerHTML)return;const t=window.execEditorCommand||window.executeEditorCommand;if(typeof t=="function")try{t("recordDomTransaction",e,n,e.innerHTML)}catch{}},b=()=>{const e=E();if(!e)return!1;const n=window.getSelection();if(!n||n.rangeCount===0)return!1;const t=n.getRangeAt(0);if(!e.contains(t.commonAncestorContainer))return!1;const o=p(t,e);if(o.length===0)return!1;const c=e.innerHTML;return o.forEach(i=>{const r=h(i)+m;i.style.paddingLeft=`${r}px`}),T(e,c),e.dispatchEvent(new Event("input",{bubbles:!0})),!0},w=()=>{const e=E();if(!e)return!1;const n=window.getSelection();if(!n||n.rangeCount===0)return!1;const t=n.getRangeAt(0);if(!e.contains(t.commonAncestorContainer))return!1;const o=p(t,e);if(o.length===0)return!1;const c=e.innerHTML;return o.forEach(i=>{const d=h(i),r=Math.max(0,d-m);i.style.paddingLeft=`${r}px`}),T(e,c),e.dispatchEvent(new Event("input",{bubbles:!0})),!0},f=(e,n)=>{typeof window<"u"&&window.registerEditorCommand?.(e,n)},g=()=>{f("increaseIndent",b),f("decreaseIndent",w)};typeof window<"u"&&(document.readyState==="loading"?document.addEventListener("DOMContentLoaded",g):g());const v=()=>({name:"indent",toolbar:[{label:"Increase Indent",command:"increaseIndent",type:"button",icon:'<svg width="24" height="24" viewBox="0 0 24 24" fill="currentColor"><path d="M3 4h18v2H3V4zm0 14h18v2H3v-2zm8-7h10v2H11v-2zm0 4h10v2H11v-2zM3 8l4 4-4 4V8z"/></svg>',shortcut:"Mod-]"},{label:"Decrease Indent",command:"decreaseIndent",type:"button",icon:'<svg width="24" height="24" viewBox="0 0 24 24" fill="currentColor"><path d="M3 4h18v2H3V4zm0 14h18v2H3v-2zm8-7h10v2H11v-2zm0 4h10v2H11v-2zM7 8v8l-4-4 4-4z"/></svg>',shortcut:"Mod-["}],commands:{increaseIndent:b,decreaseIndent:w},keymap:{"Mod-]":"increaseIndent","Mod-[":"decreaseIndent",Tab:"increaseIndent","Shift-Tab":"decreaseIndent"}});exports.IndentPlugin=v;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const m=40,s=e=>["P","DIV","H1","H2","H3","H4","H5","H6","LI","BLOCKQUOTE","PRE"].includes(e.tagName)&&e.getAttribute("contenteditable")!=="true",E=()=>{const e=window.getSelection();if(e&&e.rangeCount>0){let t=e.getRangeAt(0).startContainer;for(;t&&t!==document.body;){if(t.nodeType===Node.ELEMENT_NODE){const o=t;if(o.getAttribute("contenteditable")==="true")return o}t=t.parentNode}}const n=document.activeElement;if(n){if(n.getAttribute("contenteditable")==="true")return n;const t=n.closest('[contenteditable="true"]');if(t)return t}return document.querySelector('[contenteditable="true"]')},l=e=>{let n=e;if(n.nodeType===Node.ELEMENT_NODE){const t=n;if(s(t))return t}for(;n;){if(n.nodeType===Node.ELEMENT_NODE){const t=n;if(s(t))return t;if(t.getAttribute("contenteditable")==="true")break}n=n.parentNode}return null},p=(e,n)=>{const t=[],o=new Set,c=r=>{!r||o.has(r)||n.contains(r)&&s(r)&&(o.add(r),t.push(r))};if(e.collapsed)return c(l(e.startContainer)),t;const i=document.createTreeWalker(n,NodeFilter.SHOW_ELEMENT,{acceptNode:r=>{const a=r;if(!s(a))return NodeFilter.FILTER_SKIP;if(typeof e.intersectsNode=="function")return e.intersectsNode(a)?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP;const u=document.createRange();return u.selectNodeContents(a),e.compareBoundaryPoints(Range.END_TO_START,u)>0&&e.compareBoundaryPoints(Range.START_TO_END,u)<0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});let d=i.nextNode();for(;d;)c(d),d=i.nextNode();return t.length===0&&c(l(e.commonAncestorContainer)),t},h=e=>{const n=window.getComputedStyle(e),t=n.paddingLeft;if(t.endsWith("px"))return parseFloat(t);if(t.endsWith("em")){const o=parseFloat(n.fontSize);return parseFloat(t)*o}return 0},T=(e,n)=>{if(n===e.innerHTML)return;const t=window.execEditorCommand||window.executeEditorCommand;if(typeof t=="function")try{t("recordDomTransaction",e,n,e.innerHTML)}catch{}},b=()=>{const e=E();if(!e)return!1;const n=window.getSelection();if(!n||n.rangeCount===0)return!1;const t=n.getRangeAt(0);if(!e.contains(t.commonAncestorContainer))return!1;const o=p(t,e);if(o.length===0)return!1;const c=e.innerHTML;return o.forEach(i=>{const r=h(i)+m;i.style.paddingLeft=`${r}px`}),T(e,c),e.dispatchEvent(new Event("input",{bubbles:!0})),!0},v=()=>{const e=E();if(!e)return!1;const n=window.getSelection();if(!n||n.rangeCount===0)return!1;const t=n.getRangeAt(0);if(!e.contains(t.commonAncestorContainer))return!1;const o=p(t,e);if(o.length===0)return!1;const c=e.innerHTML;return o.forEach(i=>{const d=h(i),r=Math.max(0,d-m);i.style.paddingLeft=`${r}px`}),T(e,c),e.dispatchEvent(new Event("input",{bubbles:!0})),!0},f=(e,n)=>{typeof window<"u"&&window.registerEditorCommand?.(e,n)},g=()=>{f("increaseIndent",b),f("decreaseIndent",v)};typeof window<"u"&&(document.readyState==="loading"?document.addEventListener("DOMContentLoaded",g):g());const w=()=>({name:"indent",toolbar:[{label:"Increase Indent",command:"increaseIndent",type:"button",icon:'<svg width="24" height="24" viewBox="0 0 24 24" fill="currentColor"><path d="M3 4h18v2H3V4zm0 14h18v2H3v-2zm8-7h10v2H11v-2zm0 4h10v2H11v-2zM3 8l4 4-4 4V8z"/></svg>',shortcut:"Mod-]"},{label:"Decrease Indent",command:"decreaseIndent",type:"button",icon:'<svg width="24" height="24" viewBox="0 0 24 24" fill="currentColor"><path d="M3 4h18v2H3V4zm0 14h18v2H3v-2zm8-7h10v2H11v-2zm0 4h10v2H11v-2zM7 8v8l-4-4 4-4z"/></svg>',shortcut:"Mod-["}],commands:{increaseIndent:b,decreaseIndent:v},keymap:{"Mod-]":"increaseIndent","Mod-[":"decreaseIndent",Tab:"increaseIndent","Shift-Tab":"decreaseIndent"}});exports.IndentPlugin=w;
package/dist/index.cjs.js CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("./heading.cjs.js"),l=require("./bold.cjs.js"),t=require("./italic.cjs.js"),u=require("./underline.cjs.js"),g=require("./strikethrough.cjs.js"),o=require("./list.cjs.js"),a=require("./checklist.cjs.js"),c=require("./history.cjs.js"),P=require("./link.cjs.js"),s=require("./blockquote.cjs.js"),q=require("./clear-formatting.cjs.js"),m=require("./code.cjs.js"),d=require("./table.cjs.js"),C=require("./font-size.cjs.js"),h=require("./font-family.cjs.js"),p=require("./text-alignment.cjs.js"),M=require("./text-color.cjs.js"),k=require("./background-color.cjs.js"),f=require("./line-height.cjs.js"),b=require("./indent.cjs.js"),A=require("./direction.cjs.js"),F=require("./capitalization.cjs.js"),S=require("./math.cjs.js"),T=require("./special-characters.cjs.js"),y=require("./emojis.cjs.js"),B=require("./embed-iframe.cjs.js"),H=require("./anchor.cjs.js"),i=require("./media-manager.cjs.js"),n=require("./index-D3pJyAsj.js"),D=require("./preview.cjs.js"),I=require("./fullscreen.cjs.js"),x=require("./print.cjs.js"),z=require("./page-break.cjs.js"),G=require("./footnote.cjs.js"),L=require("./code-sample.cjs.js"),j=require("./merge-tag.cjs.js"),v=require("./template.cjs.js"),E=require("./comments.cjs.js"),U=require("./spell-check.cjs.js"),w=require("./a11y-checker.cjs.js"),e=require("./shared-config.cjs.js");exports.HeadingPlugin=r.HeadingPlugin;exports.BoldPlugin=l.BoldPlugin;exports.ItalicPlugin=t.ItalicPlugin;exports.UnderlinePlugin=u.UnderlinePlugin;exports.StrikethroughPlugin=g.StrikethroughPlugin;exports.ListPlugin=o.ListPlugin;exports.ChecklistPlugin=a.ChecklistPlugin;exports.HistoryPlugin=c.HistoryPlugin;exports.LinkPlugin=P.LinkPlugin;exports.BlockquotePlugin=s.BlockquotePlugin;exports.ClearFormattingPlugin=q.ClearFormattingPlugin;exports.CodePlugin=m.CodePlugin;exports.TablePlugin=d.TablePlugin;exports.FontSizePlugin=C.FontSizePlugin;exports.FontFamilyPlugin=h.FontFamilyPlugin;exports.TextAlignmentPlugin=p.TextAlignmentPlugin;exports.TextColorPlugin=M.TextColorPlugin;exports.BackgroundColorPlugin=k.BackgroundColorPlugin;exports.LineHeightPlugin=f.LineHeightPlugin;exports.IndentPlugin=b.IndentPlugin;exports.DirectionPlugin=A.DirectionPlugin;exports.CapitalizationPlugin=F.CapitalizationPlugin;exports.MathPlugin=S.MathPlugin;exports.SpecialCharactersPlugin=T.SpecialCharactersPlugin;exports.EmojisPlugin=y.EmojisPlugin;exports.EmbedIframePlugin=B.EmbedIframePlugin;exports.AnchorPlugin=H.AnchorPlugin;exports.MediaManagerPlugin=i.MediaManagerPlugin;exports.getMediaManagerConfig=i.getMediaManagerConfig;exports.setMediaManagerConfig=i.setMediaManagerConfig;exports.DocumentManagerPlugin=n.DocumentManagerPlugin;exports.getDocumentManagerConfig=n.getDocumentManagerConfig;exports.setDocumentManagerConfig=n.setDocumentManagerConfig;exports.PreviewPlugin=D.PreviewPlugin;exports.FullscreenPlugin=I.FullscreenPlugin;exports.PrintPlugin=x.PrintPlugin;exports.PageBreakPlugin=z.PageBreakPlugin;exports.FootnotePlugin=G.FootnotePlugin;exports.CodeSamplePlugin=L.CodeSamplePlugin;exports.MergeTagPlugin=j.MergeTagPlugin;exports.TemplatePlugin=v.TemplatePlugin;exports.CommentsPlugin=E.CommentsPlugin;exports.SpellCheckPlugin=U.SpellCheckPlugin;exports.A11yCheckerPlugin=w.A11yCheckerPlugin;exports.buildApiUrl=e.buildApiUrl;exports.getGlobalApiConfig=e.getGlobalApiConfig;exports.getGlobalApiHeaders=e.getGlobalApiHeaders;exports.setGlobalApiConfig=e.setGlobalApiConfig;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const r=require("./heading.cjs.js"),l=require("./bold.cjs.js"),t=require("./italic.cjs.js"),u=require("./underline.cjs.js"),g=require("./strikethrough.cjs.js"),o=require("./list.cjs.js"),a=require("./checklist.cjs.js"),c=require("./history.cjs.js"),P=require("./link.cjs.js"),s=require("./blockquote.cjs.js"),q=require("./clear-formatting.cjs.js"),d=require("./code.cjs.js"),m=require("./table.cjs.js"),C=require("./font-size.cjs.js"),h=require("./font-family.cjs.js"),p=require("./text-alignment.cjs.js"),M=require("./text-color.cjs.js"),k=require("./background-color.cjs.js"),f=require("./line-height.cjs.js"),b=require("./indent.cjs.js"),A=require("./direction.cjs.js"),F=require("./capitalization.cjs.js"),S=require("./math.cjs.js"),T=require("./special-characters.cjs.js"),y=require("./emojis.cjs.js"),B=require("./embed-iframe.cjs.js"),H=require("./anchor.cjs.js"),i=require("./media-manager.cjs.js"),n=require("./index-D3pJyAsj.js"),D=require("./preview.cjs.js"),I=require("./fullscreen.cjs.js"),x=require("./print.cjs.js"),z=require("./page-break.cjs.js"),G=require("./footnote.cjs.js"),L=require("./code-sample.cjs.js"),v=require("./merge-tag.cjs.js"),j=require("./template.cjs.js"),E=require("./comments.cjs.js"),U=require("./spell-check.cjs.js"),w=require("./a11y-checker.cjs.js"),e=require("./shared-config.cjs.js");exports.HeadingPlugin=r.HeadingPlugin;exports.BoldPlugin=l.BoldPlugin;exports.ItalicPlugin=t.ItalicPlugin;exports.UnderlinePlugin=u.UnderlinePlugin;exports.StrikethroughPlugin=g.StrikethroughPlugin;exports.ListPlugin=o.ListPlugin;exports.ChecklistPlugin=a.ChecklistPlugin;exports.HistoryPlugin=c.HistoryPlugin;exports.LinkPlugin=P.LinkPlugin;exports.BlockquotePlugin=s.BlockquotePlugin;exports.ClearFormattingPlugin=q.ClearFormattingPlugin;exports.CodePlugin=d.CodePlugin;exports.TablePlugin=m.TablePlugin;exports.FontSizePlugin=C.FontSizePlugin;exports.FontFamilyPlugin=h.FontFamilyPlugin;exports.TextAlignmentPlugin=p.TextAlignmentPlugin;exports.TextColorPlugin=M.TextColorPlugin;exports.BackgroundColorPlugin=k.BackgroundColorPlugin;exports.LineHeightPlugin=f.LineHeightPlugin;exports.IndentPlugin=b.IndentPlugin;exports.DirectionPlugin=A.DirectionPlugin;exports.CapitalizationPlugin=F.CapitalizationPlugin;exports.MathPlugin=S.MathPlugin;exports.SpecialCharactersPlugin=T.SpecialCharactersPlugin;exports.EmojisPlugin=y.EmojisPlugin;exports.EmbedIframePlugin=B.EmbedIframePlugin;exports.AnchorPlugin=H.AnchorPlugin;exports.MediaManagerPlugin=i.MediaManagerPlugin;exports.getMediaManagerConfig=i.getMediaManagerConfig;exports.setMediaManagerConfig=i.setMediaManagerConfig;exports.DocumentManagerPlugin=n.DocumentManagerPlugin;exports.getDocumentManagerConfig=n.getDocumentManagerConfig;exports.setDocumentManagerConfig=n.setDocumentManagerConfig;exports.PreviewPlugin=D.PreviewPlugin;exports.FullscreenPlugin=I.FullscreenPlugin;exports.PrintPlugin=x.PrintPlugin;exports.PageBreakPlugin=z.PageBreakPlugin;exports.FootnotePlugin=G.FootnotePlugin;exports.CodeSamplePlugin=L.CodeSamplePlugin;exports.MergeTagPlugin=v.MergeTagPlugin;exports.TemplatePlugin=j.TemplatePlugin;exports.CommentsPlugin=E.CommentsPlugin;exports.SpellCheckPlugin=U.SpellCheckPlugin;exports.A11yCheckerPlugin=w.A11yCheckerPlugin;exports.buildApiUrl=e.buildApiUrl;exports.getGlobalApiConfig=e.getGlobalApiConfig;exports.getGlobalApiHeaders=e.getGlobalApiHeaders;exports.setGlobalApiConfig=e.setGlobalApiConfig;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=()=>(document.execCommand("italic",!1),!0),l=(i,o)=>{typeof window<"u"&&window.registerEditorCommand?.(i,o)},t=()=>{l("toggleItalic",e)};typeof window<"u"&&(document.readyState==="loading"?document.addEventListener("DOMContentLoaded",t):t());const a=()=>({name:"italic",marks:{italic:{parseDOM:[{tag:"i"},{tag:"em"},{style:"font-style=italic"}],toDOM:()=>["em",0]}},toolbar:[{label:"Italic",command:"toggleItalic",type:"button",icon:'<svg width="24" height="24" focusable="false"><path d="M16.7 4.7l-.1.9h-.3c-.6 0-1 0-1.4.3-.3.3-.4.6-.5 1.1l-2.1 9.8v.6c0 .5.4.8 1.4.8h.2l-.2.8H8l.2-.8h.2c1.1 0 1.8-.5 2-1.5l2-9.8.1-.5c0-.6-.4-.8-1.4-.8h-.3l.2-.9h5.8Z" fill-rule="evenodd"></path></svg>',shortcut:"Mod-i"}],commands:{toggleItalic:e},keymap:{"Mod-i":"toggleItalic","Mod-I":"toggleItalic"}});exports.ItalicPlugin=a;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=()=>(document.execCommand("italic",!1),!0),o=(i,l)=>{typeof window<"u"&&window.registerEditorCommand?.(i,l)},t=()=>{o("toggleItalic",e)};typeof window<"u"&&(document.readyState==="loading"?document.addEventListener("DOMContentLoaded",t):t());const a=()=>({name:"italic",marks:{italic:{parseDOM:[{tag:"i"},{tag:"em"},{style:"font-style=italic"}],toDOM:()=>["em",0]}},toolbar:[{label:"Italic",command:"toggleItalic",type:"button",icon:'<svg width="24" height="24" focusable="false"><path d="M16.7 4.7l-.1.9h-.3c-.6 0-1 0-1.4.3-.3.3-.4.6-.5 1.1l-2.1 9.8v.6c0 .5.4.8 1.4.8h.2l-.2.8H8l.2-.8h.2c1.1 0 1.8-.5 2-1.5l2-9.8.1-.5c0-.6-.4-.8-1.4-.8h-.3l.2-.9h5.8Z" fill-rule="evenodd"></path></svg>',shortcut:"Mod-i"}],commands:{toggleItalic:e},keymap:{"Mod-i":"toggleItalic","Mod-I":"toggleItalic"}});exports.ItalicPlugin=a;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const g=[{label:"1.0",value:"1.0"},{label:"1.15",value:"1.15"},{label:"1.5",value:"1.5"},{label:"2.0",value:"2.0"},{label:"2.5",value:"2.5"},{label:"3.0",value:"3.0"}],m=new Set(["P","DIV","H1","H2","H3","H4","H5","H6","LI","BLOCKQUOTE","PRE"]),d=e=>m.has(e.tagName)&&e.getAttribute("contenteditable")!=="true",E=()=>{const e=window.getSelection();if(e&&e.rangeCount>0){let n=e.getRangeAt(0).startContainer;for(;n&&n!==document.body;){if(n.nodeType===Node.ELEMENT_NODE){const o=n;if(o.getAttribute("contenteditable")==="true")return o}n=n.parentNode}}const t=document.activeElement;if(t){if(t.getAttribute("contenteditable")==="true")return t;const n=t.closest('[contenteditable="true"]');if(n)return n}return document.querySelector('[contenteditable="true"]')},u=e=>{let t=e;for(;t;){if(t.nodeType===Node.ELEMENT_NODE){const n=t;if(d(n))return n;if(n.getAttribute("contenteditable")==="true")break}t=t.parentNode}return null},H=(e,t)=>{const n=[],o=new Set,r=i=>{!i||o.has(i)||t.contains(i)&&d(i)&&(o.add(i),n.push(i))};if(e.collapsed)return r(u(e.startContainer)),n;const s=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT,{acceptNode:i=>{const c=i;if(!d(c))return NodeFilter.FILTER_SKIP;if(typeof e.intersectsNode=="function")return e.intersectsNode(c)?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP;const l=document.createRange();return l.selectNodeContents(c),e.compareBoundaryPoints(Range.END_TO_START,l)>0&&e.compareBoundaryPoints(Range.START_TO_END,l)<0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});let a=s.nextNode();for(;a;)r(a),a=s.nextNode();return n.length===0&&r(u(e.commonAncestorContainer)),n},b=e=>{e.dispatchEvent(new Event("input",{bubbles:!0}))},L=(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{}},h=e=>{if(!e)return!1;try{const t=E();if(!t)return!1;const n=window.getSelection();if(!n||n.rangeCount===0)return!1;const o=n.getRangeAt(0);if(!t.contains(o.commonAncestorContainer))return!1;const r=H(o,t);if(r.length===0)return!1;const s=t.innerHTML;return r.forEach(a=>{a.style.lineHeight=e}),L(t,s),b(t),!0}catch(t){return console.error("Failed to set line height:",t),!1}},T=(e,t)=>{typeof window<"u"&&window.registerEditorCommand?.(e,t)},f=()=>{T("setLineHeight",h)};typeof window<"u"&&(document.readyState==="loading"?document.addEventListener("DOMContentLoaded",f):f());const p=()=>({name:"lineHeight",marks:{lineHeight:{attrs:{height:{default:null}},parseDOM:[{tag:'span[style*="line-height"]',getAttrs:e=>{const n=e.style.lineHeight;return n?{height:n}:!1}}],toDOM:e=>["span",{style:`line-height: ${e.attrs?.height}`},0]}},toolbar:[{label:"Line Height",command:"setLineHeight",type:"inline-menu",options:g,icon:'<svg width="24" height="24" focusable="false"><path d="M21 5a1 1 0 0 1 .1 2H13a1 1 0 0 1-.1-2H21zm0 4a1 1 0 0 1 .1 2H13a1 1 0 0 1-.1-2H21zm0 4a1 1 0 0 1 .1 2H13a1 1 0 0 1-.1-2H21zm0 4a1 1 0 0 1 .1 2H13a1 1 0 0 1-.1-2H21zM7 3.6l3.7 3.7a1 1 0 0 1-1.3 1.5h-.1L8 7.3v9.2l1.3-1.3a1 1 0 0 1 1.3 0h.1c.4.4.4 1 0 1.3v.1L7 20.4l-3.7-3.7a1 1 0 0 1 1.3-1.5h.1L6 16.7V7.4L4.7 8.7a1 1 0 0 1-1.3 0h-.1a1 1 0 0 1 0-1.3v-.1L7 3.6z"></path></svg>'}],commands:{setLineHeight:h}});exports.LineHeightPlugin=p;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const g=[{label:"1.0",value:"1.0"},{label:"1.15",value:"1.15"},{label:"1.5",value:"1.5"},{label:"2.0",value:"2.0"},{label:"2.5",value:"2.5"},{label:"3.0",value:"3.0"}],m=new Set(["P","DIV","H1","H2","H3","H4","H5","H6","LI","BLOCKQUOTE","PRE"]),u=e=>m.has(e.tagName)&&e.getAttribute("contenteditable")!=="true",E=()=>{const e=window.getSelection();if(e&&e.rangeCount>0){let n=e.getRangeAt(0).startContainer;for(;n&&n!==document.body;){if(n.nodeType===Node.ELEMENT_NODE){const o=n;if(o.getAttribute("contenteditable")==="true")return o}n=n.parentNode}}const t=document.activeElement;if(t){if(t.getAttribute("contenteditable")==="true")return t;const n=t.closest('[contenteditable="true"]');if(n)return n}return document.querySelector('[contenteditable="true"]')},d=e=>{let t=e;for(;t;){if(t.nodeType===Node.ELEMENT_NODE){const n=t;if(u(n))return n;if(n.getAttribute("contenteditable")==="true")break}t=t.parentNode}return null},H=(e,t)=>{const n=[],o=new Set,r=i=>{!i||o.has(i)||t.contains(i)&&u(i)&&(o.add(i),n.push(i))};if(e.collapsed)return r(d(e.startContainer)),n;const s=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT,{acceptNode:i=>{const c=i;if(!u(c))return NodeFilter.FILTER_SKIP;if(typeof e.intersectsNode=="function")return e.intersectsNode(c)?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP;const l=document.createRange();return l.selectNodeContents(c),e.compareBoundaryPoints(Range.END_TO_START,l)>0&&e.compareBoundaryPoints(Range.START_TO_END,l)<0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});let a=s.nextNode();for(;a;)r(a),a=s.nextNode();return n.length===0&&r(d(e.commonAncestorContainer)),n},b=e=>{e.dispatchEvent(new Event("input",{bubbles:!0}))},L=(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{}},h=e=>{if(!e)return!1;try{const t=E();if(!t)return!1;const n=window.getSelection();if(!n||n.rangeCount===0)return!1;const o=n.getRangeAt(0);if(!t.contains(o.commonAncestorContainer))return!1;const r=H(o,t);if(r.length===0)return!1;const s=t.innerHTML;return r.forEach(a=>{a.style.lineHeight=e}),L(t,s),b(t),!0}catch(t){return console.error("Failed to set line height:",t),!1}},T=(e,t)=>{typeof window<"u"&&window.registerEditorCommand?.(e,t)},f=()=>{T("setLineHeight",h)};typeof window<"u"&&(document.readyState==="loading"?document.addEventListener("DOMContentLoaded",f):f());const p=()=>({name:"lineHeight",marks:{lineHeight:{attrs:{height:{default:null}},parseDOM:[{tag:'span[style*="line-height"]',getAttrs:e=>{const n=e.style.lineHeight;return n?{height:n}:!1}}],toDOM:e=>["span",{style:`line-height: ${e.attrs?.height}`},0]}},toolbar:[{label:"Line Height",command:"setLineHeight",type:"inline-menu",options:g,icon:'<svg width="24" height="24" focusable="false"><path d="M21 5a1 1 0 0 1 .1 2H13a1 1 0 0 1-.1-2H21zm0 4a1 1 0 0 1 .1 2H13a1 1 0 0 1-.1-2H21zm0 4a1 1 0 0 1 .1 2H13a1 1 0 0 1-.1-2H21zm0 4a1 1 0 0 1 .1 2H13a1 1 0 0 1-.1-2H21zM7 3.6l3.7 3.7a1 1 0 0 1-1.3 1.5h-.1L8 7.3v9.2l1.3-1.3a1 1 0 0 1 1.3 0h.1c.4.4.4 1 0 1.3v.1L7 20.4l-3.7-3.7a1 1 0 0 1 1.3-1.5h.1L6 16.7V7.4L4.7 8.7a1 1 0 0 1-1.3 0h-.1a1 1 0 0 1 0-1.3v-.1L7 3.6z"></path></svg>'}],commands:{setLineHeight:h}});exports.LineHeightPlugin=p;
package/dist/link.cjs.js CHANGED
@@ -1,4 +1,4 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});let a=null,p=!1,l=null;const c='[data-theme="dark"], .dark, .editora-theme-dark',L=e=>{if(!e)return null;let t=e;for(;t;){if(t.hasAttribute("contenteditable")&&t.getAttribute("contenteditable")==="true"||t.hasAttribute("data-editora-content"))return t;t=t.parentElement}return null},w=e=>{if(e){const n=e.startContainer;if((n.nodeType===Node.ELEMENT_NODE?n:n.parentElement)?.closest(c))return!0}return document.activeElement?.closest(c)?!0:document.body.matches(c)||document.documentElement.matches(c)},C=()=>{if(document.getElementById("rte-link-dialog-theme-styles"))return;const e=document.createElement("style");e.id="rte-link-dialog-theme-styles",e.textContent=`
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});let a=null,u=!1,l=null;const c='[data-theme="dark"], .dark, .editora-theme-dark',L=e=>{if(!e)return null;let t=e;for(;t;){if(t.hasAttribute("contenteditable")&&t.getAttribute("contenteditable")==="true"||t.hasAttribute("data-editora-content"))return t;t=t.parentElement}return null},w=e=>{if(e){const n=e.startContainer;if((n.nodeType===Node.ELEMENT_NODE?n:n.parentElement)?.closest(c))return!0}return document.activeElement?.closest(c)?!0:document.body.matches(c)||document.documentElement.matches(c)},C=()=>{if(document.getElementById("rte-link-dialog-theme-styles"))return;const e=document.createElement("style");e.id="rte-link-dialog-theme-styles",e.textContent=`
2
2
  .link-dialog-overlay.rte-theme-dark .link-dialog {
3
3
  background: #1f2937 !important;
4
4
  border: 1px solid #4b5563 !important;
@@ -61,7 +61,7 @@
61
61
  .link-dialog-overlay.rte-theme-dark .btn-submit:hover {
62
62
  background: #2563eb !important;
63
63
  }
64
- `,document.head.appendChild(e)},T=e=>{if(!a){console.warn("No selection range stored");return}const t=a.startContainer,n=t.nodeType===Node.TEXT_NODE?t.parentElement:t,o=L(n);if(o){if(p&&l){l.href=e.url,l.textContent=e.text,l.target=e.target,e.target==="_blank"?l.setAttribute("rel","noopener noreferrer"):l.removeAttribute("rel"),e.title?l.title=e.title:l.removeAttribute("title");const r=document.createRange();r.selectNodeContents(l);const i=window.getSelection();i&&(i.removeAllRanges(),i.addRange(r))}else{const r=document.createElement("a");r.href=e.url,r.textContent=e.text,r.target=e.target,e.target==="_blank"&&r.setAttribute("rel","noopener noreferrer"),e.title&&(r.title=e.title),a.deleteContents(),a.insertNode(r),a.setStartAfter(r),a.setEndAfter(r);const i=window.getSelection();i&&(i.removeAllRanges(),i.addRange(a))}o.focus(),a=null,p=!1,l=null}},b=(e,t)=>{C();const n=document.createElement("div");n.className="link-dialog-overlay",t&&n.classList.add("rte-theme-dark"),n.style.cssText=`
64
+ `,document.head.appendChild(e)},T=e=>{if(!a){console.warn("No selection range stored");return}const t=a.startContainer,n=t.nodeType===Node.TEXT_NODE?t.parentElement:t,o=L(n);if(o){if(u&&l){l.href=e.url,l.textContent=e.text,l.target=e.target,e.target==="_blank"?l.setAttribute("rel","noopener noreferrer"):l.removeAttribute("rel"),e.title?l.title=e.title:l.removeAttribute("title");const r=document.createRange();r.selectNodeContents(l);const i=window.getSelection();i&&(i.removeAllRanges(),i.addRange(r))}else{const r=document.createElement("a");r.href=e.url,r.textContent=e.text,r.target=e.target,e.target==="_blank"&&r.setAttribute("rel","noopener noreferrer"),e.title&&(r.title=e.title),a.deleteContents(),a.insertNode(r),a.setStartAfter(r),a.setEndAfter(r);const i=window.getSelection();i&&(i.removeAllRanges(),i.addRange(a))}o.focus(),a=null,u=!1,l=null}},b=(e,t)=>{C();const n=document.createElement("div");n.className="link-dialog-overlay",t&&n.classList.add("rte-theme-dark"),n.style.cssText=`
65
65
  position: fixed;
66
66
  top: 0;
67
67
  left: 0;
@@ -135,4 +135,4 @@
135
135
  </button>
136
136
  </div>
137
137
  </form>
138
- `,n.appendChild(o),document.body.appendChild(n);const r=o.querySelector("#link-form"),i=o.querySelector("#link-text"),d=o.querySelector("#link-url"),x=o.querySelector("#link-title"),y=o.querySelector("#link-target"),v=o.querySelector(".link-dialog-close"),E=o.querySelector(".btn-cancel"),s=()=>{document.body.removeChild(n)};v.addEventListener("click",s),E.addEventListener("click",s),n.addEventListener("click",u=>{u.target===n&&s()}),r.addEventListener("submit",u=>{u.preventDefault();const m=d.value.trim();m&&(T({text:i.value.trim()||m,url:m,target:y.checked?"_blank":"_self",title:x.value.trim()||void 0}),s())}),setTimeout(()=>i.focus(),100)},f=()=>{const e=window.getSelection();if(!e||e.rangeCount===0)return!1;const t=e.getRangeAt(0).cloneRange();a=t;const n=w(t),o=e.toString()||"",r=t.startContainer,d=(r.nodeType===Node.TEXT_NODE?r.parentElement:r)?.closest("a");return d?(p=!0,l=d,b({text:d.textContent||"",url:d.href,target:d.target||"_self",title:d.title||"",isEditing:!0},n)):(p=!1,l=null,b({text:o,url:"",target:"_self",isEditing:!1},n)),!0},h=()=>(document.execCommand("unlink",!1),!0),g=(e,t)=>{typeof window<"u"&&window.registerEditorCommand?.(e,t)},k=()=>{g("openLinkDialog",f),g("removeLink",h),g("createLink",e=>{e&&document.execCommand("createLink",!1,e)})};typeof window<"u"&&(document.readyState==="loading"?document.addEventListener("DOMContentLoaded",k):k());const A=()=>({name:"link",marks:{link:{attrs:{href:{},title:{default:null},target:{default:null}},parseDOM:[{tag:"a[href]",getAttrs:e=>({href:e.getAttribute("href"),title:e.getAttribute("title"),target:e.getAttribute("target")})}],toDOM:e=>["a",{href:e.attrs.href,title:e.attrs.title,target:e.attrs.target,rel:e.attrs.target==="_blank"?"noopener noreferrer":null},0]}},toolbar:[{label:"Link",command:"openLinkDialog",type:"button",icon:'<svg width="24" height="24" focusable="false"><path d="M6.2 12.3a1 1 0 0 1 1.4 1.4l-2 2a2 2 0 1 0 2.6 2.8l4.8-4.8a1 1 0 0 0 0-1.4 1 1 0 1 1 1.4-1.3 2.9 2.9 0 0 1 0 4L9.6 20a3.9 3.9 0 0 1-5.5-5.5l2-2Zm11.6-.6a1 1 0 0 1-1.4-1.4l2-2a2 2 0 1 0-2.6-2.8L11 10.3a1 1 0 0 0 0 1.4A1 1 0 1 1 9.6 13a2.9 2.9 0 0 1 0-4L14.4 4a3.9 3.9 0 0 1 5.5 5.5l-2 2Z" fill-rule="nonzero"></path></svg>',shortcut:"Mod-k"}],commands:{openLinkDialog:f,removeLink:h},keymap:{"Mod-k":"openLinkDialog"}});exports.LinkPlugin=A;
138
+ `,n.appendChild(o),document.body.appendChild(n);const r=o.querySelector("#link-form"),i=o.querySelector("#link-text"),d=o.querySelector("#link-url"),x=o.querySelector("#link-title"),y=o.querySelector("#link-target"),v=o.querySelector(".link-dialog-close"),E=o.querySelector(".btn-cancel"),s=()=>{document.body.removeChild(n)};v.addEventListener("click",s),E.addEventListener("click",s),n.addEventListener("click",p=>{p.target===n&&s()}),r.addEventListener("submit",p=>{p.preventDefault();const m=d.value.trim();m&&(T({text:i.value.trim()||m,url:m,target:y.checked?"_blank":"_self",title:x.value.trim()||void 0}),s())}),setTimeout(()=>i.focus(),100)},f=()=>{const e=window.getSelection();if(!e||e.rangeCount===0)return!1;const t=e.getRangeAt(0).cloneRange();a=t;const n=w(t),o=e.toString()||"",r=t.startContainer,d=(r.nodeType===Node.TEXT_NODE?r.parentElement:r)?.closest("a");return d?(u=!0,l=d,b({text:d.textContent||"",url:d.href,target:d.target||"_self",title:d.title||"",isEditing:!0},n)):(u=!1,l=null,b({text:o,url:"",target:"_self",isEditing:!1},n)),!0},h=()=>(document.execCommand("unlink",!1),!0),g=(e,t)=>{typeof window<"u"&&window.registerEditorCommand?.(e,t)},k=()=>{g("openLinkDialog",f),g("removeLink",h),g("createLink",e=>{e&&document.execCommand("createLink",!1,e)})};typeof window<"u"&&(document.readyState==="loading"?document.addEventListener("DOMContentLoaded",k):k());const A=()=>({name:"link",marks:{link:{attrs:{href:{},title:{default:null},target:{default:null}},parseDOM:[{tag:"a[href]",getAttrs:e=>({href:e.getAttribute("href"),title:e.getAttribute("title"),target:e.getAttribute("target")})}],toDOM:e=>["a",{href:e.attrs.href,title:e.attrs.title,target:e.attrs.target,rel:e.attrs.target==="_blank"?"noopener noreferrer":null},0]}},toolbar:[{label:"Link",command:"openLinkDialog",type:"button",icon:'<svg width="24" height="24" focusable="false"><path d="M6.2 12.3a1 1 0 0 1 1.4 1.4l-2 2a2 2 0 1 0 2.6 2.8l4.8-4.8a1 1 0 0 0 0-1.4 1 1 0 1 1 1.4-1.3 2.9 2.9 0 0 1 0 4L9.6 20a3.9 3.9 0 0 1-5.5-5.5l2-2Zm11.6-.6a1 1 0 0 1-1.4-1.4l2-2a2 2 0 1 0-2.6-2.8L11 10.3a1 1 0 0 0 0 1.4A1 1 0 1 1 9.6 13a2.9 2.9 0 0 1 0-4L14.4 4a3.9 3.9 0 0 1 5.5 5.5l-2 2Z" fill-rule="nonzero"></path></svg>',shortcut:"Mod-k"}],commands:{openLinkDialog:f,removeLink:h},keymap:{"Mod-k":"openLinkDialog"}});exports.LinkPlugin=A;
package/dist/list.cjs.js CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const d=()=>m("insertUnorderedList"),u=()=>m("insertOrderedList");function g(){const o=window.getSelection();if(o&&o.rangeCount>0){const n=o.getRangeAt(0).startContainer,e=(n.nodeType===Node.ELEMENT_NODE?n:n.parentElement)?.closest('[contenteditable="true"], .rte-content, .editora-content');if(e)return e}const t=document.activeElement;return t?t.getAttribute("contenteditable")==="true"?t:t.closest('[contenteditable="true"], .rte-content, .editora-content'):null}function f(o){o.querySelectorAll('ul:not([data-type="checklist"]), ol').forEach(n=>{Array.from(n.childNodes).forEach(e=>{if(e.nodeType===Node.TEXT_NODE){const l=(e.textContent||"").trim();if(!l){n.removeChild(e);return}const s=document.createElement("li");s.textContent=l,n.replaceChild(s,e);return}if(!(e instanceof HTMLElement)){n.removeChild(e);return}if(e.tagName==="LI")return;const i=document.createElement("li");for(;e.firstChild;)i.appendChild(e.firstChild);n.replaceChild(i,e)})})}function m(o){const t=g();if(!t)return!1;const n=window.getSelection();if(!n||n.rangeCount===0)return!1;const r=n.getRangeAt(0);if(!t.contains(r.commonAncestorContainer))return!1;t.focus({preventScroll:!0});const e=document.execCommand(o,!1);return f(t),t.dispatchEvent(new Event("input",{bubbles:!0})),e!==!1}const c=(o,t)=>{typeof window<"u"&&window.registerEditorCommand?.(o,t)},a=()=>{c("toggleBulletList",d),c("toggleOrderedList",u)};typeof window<"u"&&(document.readyState==="loading"?document.addEventListener("DOMContentLoaded",a):a());const h=()=>({name:"list",nodes:{bulletList:{content:"listItem+",group:"block",parseDOM:[{tag:"ul"}],toDOM:()=>["ul",0]},orderedList:{content:"listItem+",group:"block",parseDOM:[{tag:"ol"}],toDOM:()=>["ol",0]},listItem:{content:"paragraph",parseDOM:[{tag:"li"}],toDOM:()=>["li",0]}},toolbar:[{label:"Bullet List",command:"toggleBulletList",type:"button",icon:'<svg width="24" height="24" focusable="false"><path d="M11 5h8c.6 0 1 .4 1 1s-.4 1-1 1h-8a1 1 0 0 1 0-2Zm0 6h8c.6 0 1 .4 1 1s-.4 1-1 1h-8a1 1 0 0 1 0-2Zm0 6h8c.6 0 1 .4 1 1s-.4 1-1 1h-8a1 1 0 0 1 0-2ZM4.5 6c0 .4.1.8.4 1 .3.4.7.5 1.1.5.4 0 .8-.1 1-.4.4-.3.5-.7.5-1.1 0-.4-.1-.8-.4-1-.3-.4-.7-.5-1.1-.5-.4 0-.8.1-1 .4-.4.3-.5.7-.5 1.1Zm0 6c0 .4.1.8.4 1 .3.4.7.5 1.1.5.4 0 .8-.1 1-.4.4-.3.5-.7.5-1.1 0-.4-.1-.8-.4-1-.3-.4-.7-.5-1.1-.5-.4 0-.8.1-1 .4-.4.3-.5.7-.5 1.1Zm0 6c0 .4.1.8.4 1 .3.4.7.5 1.1.5.4 0 .8-.1 1-.4.4-.3.5-.7.5-1.1 0-.4-.1-.8-.4-1-.3-.4-.7-.5-1.1-.5-.4 0-.8.1-1 .4-.4.3-.5.7-.5 1.1Z" fill-rule="evenodd"></path></svg>',shortcut:"Mod-Shift-8"},{label:"Numbered List",command:"toggleOrderedList",type:"button",icon:'<svg width="24" height="24" focusable="false"><path d="M10 17h8c.6 0 1 .4 1 1s-.4 1-1 1h-8a1 1 0 0 1 0-2Zm0-6h8c.6 0 1 .4 1 1s-.4 1-1 1h-8a1 1 0 0 1 0-2Zm0-6h8c.6 0 1 .4 1 1s-.4 1-1 1h-8a1 1 0 1 1 0-2ZM6 4v3.5c0 .3-.2.5-.5.5a.5.5 0 0 1-.5-.5V5h-.5a.5.5 0 0 1 0-1H6Zm-1 8.8l.2.2h1.3c.3 0 .5.2.5.5s-.2.5-.5.5H4.9a1 1 0 0 1-.9-1V13c0-.4.3-.8.6-1l1.2-.4.2-.3a.2.2 0 0 0 0-.2l-.7.3a.5.5 0 0 1-.7-.3.5.5 0 0 1 .3-.6l.7-.4c.5-.2 1.1 0 1.4.4.3.5.3 1.1-.1 1.5l-1.2.7Zm0 3.7v.5c0 .3.2.5.5.5h1c.3 0 .5.2.5.5s-.2.5-.5.5h-1a1.5 1.5 0 0 1-1.5-1.5v-.5c0-.3.1-.6.3-.8l1.3-1.4c.3-.4.1-.9-.2-1-.1 0-.2 0-.3.2l-.4.5a.5.5 0 0 1-.7.1.5.5 0 0 1-.1-.7l.4-.5c.5-.5 1.2-.6 1.8-.4.6.3 1 .9 1 1.6 0 .4-.2.8-.5 1.1l-1.3 1.4-.3.4Z" fill-rule="evenodd"></path></svg>',shortcut:"Mod-Shift-7"}],commands:{toggleBulletList:d,toggleOrderedList:u},keymap:{"Mod-Shift-8":"toggleBulletList","Mod-Shift-7":"toggleOrderedList"}});exports.ListPlugin=h;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const d=()=>m("insertUnorderedList"),u=()=>m("insertOrderedList");function g(){const o=window.getSelection();if(o&&o.rangeCount>0){const n=o.getRangeAt(0).startContainer,e=(n.nodeType===Node.ELEMENT_NODE?n:n.parentElement)?.closest('[contenteditable="true"], .rte-content, .editora-content');if(e)return e}const t=document.activeElement;return t?t.getAttribute("contenteditable")==="true"?t:t.closest('[contenteditable="true"], .rte-content, .editora-content'):null}function f(o){o.querySelectorAll('ul:not([data-type="checklist"]), ol').forEach(n=>{Array.from(n.childNodes).forEach(e=>{if(e.nodeType===Node.TEXT_NODE){const l=(e.textContent||"").trim();if(!l){n.removeChild(e);return}const s=document.createElement("li");s.textContent=l,n.replaceChild(s,e);return}if(!(e instanceof HTMLElement)){n.removeChild(e);return}if(e.tagName==="LI")return;const i=document.createElement("li");for(;e.firstChild;)i.appendChild(e.firstChild);n.replaceChild(i,e)})})}function m(o){const t=g();if(!t)return!1;const n=window.getSelection();if(!n||n.rangeCount===0)return!1;const r=n.getRangeAt(0);if(!t.contains(r.commonAncestorContainer))return!1;t.focus({preventScroll:!0});const e=document.execCommand(o,!1);return f(t),t.dispatchEvent(new Event("input",{bubbles:!0})),e!==!1}const c=(o,t)=>{typeof window<"u"&&window.registerEditorCommand?.(o,t)},a=()=>{c("toggleBulletList",d),c("toggleOrderedList",u)};typeof window<"u"&&(document.readyState==="loading"?document.addEventListener("DOMContentLoaded",a):a());const h=()=>({name:"list",nodes:{bulletList:{content:"listItem+",group:"block",parseDOM:[{tag:"ul"}],toDOM:()=>["ul",0]},orderedList:{content:"listItem+",group:"block",parseDOM:[{tag:"ol"}],toDOM:()=>["ol",0]},listItem:{content:"paragraph",parseDOM:[{tag:"li"}],toDOM:()=>["li",0]}},toolbar:[{label:"Bullet List",command:"toggleBulletList",type:"button",icon:'<svg width="24" height="24" focusable="false"><path d="M11 5h8c.6 0 1 .4 1 1s-.4 1-1 1h-8a1 1 0 0 1 0-2Zm0 6h8c.6 0 1 .4 1 1s-.4 1-1 1h-8a1 1 0 0 1 0-2Zm0 6h8c.6 0 1 .4 1 1s-.4 1-1 1h-8a1 1 0 0 1 0-2ZM4.5 6c0 .4.1.8.4 1 .3.4.7.5 1.1.5.4 0 .8-.1 1-.4.4-.3.5-.7.5-1.1 0-.4-.1-.8-.4-1-.3-.4-.7-.5-1.1-.5-.4 0-.8.1-1 .4-.4.3-.5.7-.5 1.1Zm0 6c0 .4.1.8.4 1 .3.4.7.5 1.1.5.4 0 .8-.1 1-.4.4-.3.5-.7.5-1.1 0-.4-.1-.8-.4-1-.3-.4-.7-.5-1.1-.5-.4 0-.8.1-1 .4-.4.3-.5.7-.5 1.1Zm0 6c0 .4.1.8.4 1 .3.4.7.5 1.1.5.4 0 .8-.1 1-.4.4-.3.5-.7.5-1.1 0-.4-.1-.8-.4-1-.3-.4-.7-.5-1.1-.5-.4 0-.8.1-1 .4-.4.3-.5.7-.5 1.1Z" fill-rule="evenodd"></path></svg>',shortcut:"Mod-Shift-8"},{label:"Numbered List",command:"toggleOrderedList",type:"button",icon:'<svg width="24" height="24" focusable="false"><path d="M10 17h8c.6 0 1 .4 1 1s-.4 1-1 1h-8a1 1 0 0 1 0-2Zm0-6h8c.6 0 1 .4 1 1s-.4 1-1 1h-8a1 1 0 0 1 0-2Zm0-6h8c.6 0 1 .4 1 1s-.4 1-1 1h-8a1 1 0 1 1 0-2ZM6 4v3.5c0 .3-.2.5-.5.5a.5.5 0 0 1-.5-.5V5h-.5a.5.5 0 0 1 0-1H6Zm-1 8.8l.2.2h1.3c.3 0 .5.2.5.5s-.2.5-.5.5H4.9a1 1 0 0 1-.9-1V13c0-.4.3-.8.6-1l1.2-.4.2-.3a.2.2 0 0 0 0-.2l-.7.3a.5.5 0 0 1-.7-.3.5.5 0 0 1 .3-.6l.7-.4c.5-.2 1.1 0 1.4.4.3.5.3 1.1-.1 1.5l-1.2.7Zm0 3.7v.5c0 .3.2.5.5.5h1c.3 0 .5.2.5.5s-.2.5-.5.5h-1a1.5 1.5 0 0 1-1.5-1.5v-.5c0-.3.1-.6.3-.8l1.3-1.4c.3-.4.1-.9-.2-1-.1 0-.2 0-.3.2l-.4.5a.5.5 0 0 1-.7.1.5.5 0 0 1-.1-.7l.4-.5c.5-.5 1.2-.6 1.8-.4.6.3 1 .9 1 1.6 0 .4-.2.8-.5 1.1l-1.3 1.4-.3.4Z" fill-rule="evenodd"></path></svg>',shortcut:"Mod-Shift-7"}],commands:{toggleBulletList:d,toggleOrderedList:u},keymap:{"Mod-Shift-8":"toggleBulletList","Mod-Shift-7":"toggleOrderedList"}});exports.ListPlugin=h;
package/dist/lite.cjs.js CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("./heading.cjs.js"),e=require("./bold.cjs.js"),l=require("./italic.cjs.js"),r=require("./underline.cjs.js"),t=require("./strikethrough.cjs.js"),o=require("./list.cjs.js"),u=require("./checklist.cjs.js"),g=require("./history.cjs.js"),P=require("./link.cjs.js"),c=require("./blockquote.cjs.js"),a=require("./clear-formatting.cjs.js"),s=require("./table.cjs.js"),q=require("./font-size.cjs.js"),d=require("./font-family.cjs.js"),h=require("./text-alignment.cjs.js"),k=require("./text-color.cjs.js"),C=require("./background-color.cjs.js"),b=require("./line-height.cjs.js"),p=require("./indent.cjs.js"),F=require("./direction.cjs.js"),A=require("./capitalization.cjs.js"),f=require("./anchor.cjs.js"),m=require("./page-break.cjs.js"),B=require("./footnote.cjs.js"),H=require("./fullscreen.cjs.js"),y=require("./preview.cjs.js"),S=require("./print.cjs.js"),i=require("./shared-config.cjs.js");exports.HeadingPlugin=n.HeadingPlugin;exports.BoldPlugin=e.BoldPlugin;exports.ItalicPlugin=l.ItalicPlugin;exports.UnderlinePlugin=r.UnderlinePlugin;exports.StrikethroughPlugin=t.StrikethroughPlugin;exports.ListPlugin=o.ListPlugin;exports.ChecklistPlugin=u.ChecklistPlugin;exports.HistoryPlugin=g.HistoryPlugin;exports.LinkPlugin=P.LinkPlugin;exports.BlockquotePlugin=c.BlockquotePlugin;exports.ClearFormattingPlugin=a.ClearFormattingPlugin;exports.TablePlugin=s.TablePlugin;exports.FontSizePlugin=q.FontSizePlugin;exports.FontFamilyPlugin=d.FontFamilyPlugin;exports.TextAlignmentPlugin=h.TextAlignmentPlugin;exports.TextColorPlugin=k.TextColorPlugin;exports.BackgroundColorPlugin=C.BackgroundColorPlugin;exports.LineHeightPlugin=b.LineHeightPlugin;exports.IndentPlugin=p.IndentPlugin;exports.DirectionPlugin=F.DirectionPlugin;exports.CapitalizationPlugin=A.CapitalizationPlugin;exports.AnchorPlugin=f.AnchorPlugin;exports.PageBreakPlugin=m.PageBreakPlugin;exports.FootnotePlugin=B.FootnotePlugin;exports.FullscreenPlugin=H.FullscreenPlugin;exports.PreviewPlugin=y.PreviewPlugin;exports.PrintPlugin=S.PrintPlugin;exports.buildApiUrl=i.buildApiUrl;exports.getGlobalApiConfig=i.getGlobalApiConfig;exports.getGlobalApiHeaders=i.getGlobalApiHeaders;exports.setGlobalApiConfig=i.setGlobalApiConfig;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("./heading.cjs.js"),n=require("./bold.cjs.js"),l=require("./italic.cjs.js"),r=require("./underline.cjs.js"),t=require("./strikethrough.cjs.js"),u=require("./list.cjs.js"),o=require("./checklist.cjs.js"),g=require("./history.cjs.js"),P=require("./link.cjs.js"),c=require("./blockquote.cjs.js"),s=require("./clear-formatting.cjs.js"),a=require("./table.cjs.js"),q=require("./font-size.cjs.js"),d=require("./font-family.cjs.js"),h=require("./text-alignment.cjs.js"),k=require("./text-color.cjs.js"),C=require("./background-color.cjs.js"),b=require("./line-height.cjs.js"),p=require("./indent.cjs.js"),F=require("./direction.cjs.js"),A=require("./capitalization.cjs.js"),f=require("./anchor.cjs.js"),m=require("./page-break.cjs.js"),B=require("./footnote.cjs.js"),H=require("./fullscreen.cjs.js"),y=require("./preview.cjs.js"),S=require("./print.cjs.js"),i=require("./shared-config.cjs.js");exports.HeadingPlugin=e.HeadingPlugin;exports.BoldPlugin=n.BoldPlugin;exports.ItalicPlugin=l.ItalicPlugin;exports.UnderlinePlugin=r.UnderlinePlugin;exports.StrikethroughPlugin=t.StrikethroughPlugin;exports.ListPlugin=u.ListPlugin;exports.ChecklistPlugin=o.ChecklistPlugin;exports.HistoryPlugin=g.HistoryPlugin;exports.LinkPlugin=P.LinkPlugin;exports.BlockquotePlugin=c.BlockquotePlugin;exports.ClearFormattingPlugin=s.ClearFormattingPlugin;exports.TablePlugin=a.TablePlugin;exports.FontSizePlugin=q.FontSizePlugin;exports.FontFamilyPlugin=d.FontFamilyPlugin;exports.TextAlignmentPlugin=h.TextAlignmentPlugin;exports.TextColorPlugin=k.TextColorPlugin;exports.BackgroundColorPlugin=C.BackgroundColorPlugin;exports.LineHeightPlugin=b.LineHeightPlugin;exports.IndentPlugin=p.IndentPlugin;exports.DirectionPlugin=F.DirectionPlugin;exports.CapitalizationPlugin=A.CapitalizationPlugin;exports.AnchorPlugin=f.AnchorPlugin;exports.PageBreakPlugin=m.PageBreakPlugin;exports.FootnotePlugin=B.FootnotePlugin;exports.FullscreenPlugin=H.FullscreenPlugin;exports.PreviewPlugin=y.PreviewPlugin;exports.PrintPlugin=S.PrintPlugin;exports.buildApiUrl=i.buildApiUrl;exports.getGlobalApiConfig=i.getGlobalApiConfig;exports.getGlobalApiHeaders=i.getGlobalApiHeaders;exports.setGlobalApiConfig=i.setGlobalApiConfig;
package/dist/math.cjs.js CHANGED
@@ -1,4 +1,4 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const C={latex:[{name:"Fraction",formula:"\\frac{a}{b}",description:"Simple fraction"},{name:"Square Root",formula:"\\sqrt{x}",description:"Square root"},{name:"Power",formula:"x^{2}",description:"Exponent/power"},{name:"Subscript",formula:"x_{sub}",description:"Subscript"},{name:"Integral",formula:"\\int_{a}^{b} f(x) \\, dx",description:"Definite integral"},{name:"Summation",formula:"\\sum_{i=1}^{n} x_{i}",description:"Summation"},{name:"Limit",formula:"\\lim_{x \\to 0} f(x)",description:"Limit"},{name:"Derivative",formula:"\\frac{d}{dx} f(x)",description:"Derivative"},{name:"Matrix 2x2",formula:"\\begin{pmatrix} a & b \\\\ c & d \\end{pmatrix}",description:"2x2 matrix"},{name:"System",formula:"\\begin{cases} x + y = 1 \\\\ 2x - y = 0 \\end{cases}",description:"System of equations"}],mathml:[{name:"Fraction",formula:"<mfrac><mi>a</mi><mi>b</mi></mfrac>",description:"Simple fraction"},{name:"Square Root",formula:"<msqrt><mi>x</mi></msqrt>",description:"Square root"},{name:"Power",formula:"<msup><mi>x</mi><mn>2</mn></msup>",description:"Exponent/power"},{name:"Subscript",formula:"<msub><mi>x</mi><mi>sub</mi></msub>",description:"Subscript"},{name:"Parentheses",formula:'<mfenced open="(" close=")"><mi>a</mi><mo>+</mo><mi>b</mi></mfenced>',description:"Grouped expression"}]};let h=null,w=null,E=!1;const y='[data-theme="dark"], .dark, .editora-theme-dark',q=()=>new Promise((a,s)=>{if(window.katex){a(window.katex);return}if(E){const i=setInterval(()=>{window.katex&&(clearInterval(i),a(window.katex))},100);return}E=!0;const o=document.createElement("link");o.rel="stylesheet",o.href="https://cdn.jsdelivr.net/npm/katex@0.16.9/dist/katex.min.css",document.head.appendChild(o);const e=document.createElement("script");e.src="https://cdn.jsdelivr.net/npm/katex@0.16.9/dist/katex.min.js",e.onload=()=>a(window.katex),e.onerror=s,document.head.appendChild(e)}),H=()=>{const a=window.getSelection();if(a&&a.rangeCount>0){const o=a.getRangeAt(0).startContainer;if((o.nodeType===Node.ELEMENT_NODE?o:o.parentElement)?.closest(y))return!0}return document.activeElement?.closest(y)?!0:document.body.matches(y)||document.documentElement.matches(y)},T=async a=>{const s=window.getSelection();s&&s.rangeCount>0&&(h=s.getRangeAt(0).cloneRange()),await q();const o=H(),e=o?{overlay:"rgba(0, 0, 0, 0.62)",dialogBg:"#1f2937",border:"#3b4657",panelBg:"#222d3a",fieldBg:"#111827",fieldBorder:"#4b5563",text:"#e2e8f0",muted:"#94a3b8",templateBtnBg:"#273244",templateBtnHover:"#334155",templateBtnText:"#dbe7f7",templateSubText:"#9fb0c6",previewBg:"#111827",previewText:"#cbd5e1",cancelBg:"#334155",cancelText:"#e2e8f0",cancelBorder:"#4b5563",insertBg:"#3b82f6",insertHover:"#2563eb",invalid:"#f87171"}:{overlay:"rgba(0, 0, 0, 0.5)",dialogBg:"#ffffff",border:"#e1e5e9",panelBg:"#f8f9fa",fieldBg:"#ffffff",fieldBorder:"#ced4da",text:"#1f2937",muted:"#6c757d",templateBtnBg:"#ffffff",templateBtnHover:"#f8f9fa",templateBtnText:"#1f2937",templateSubText:"#6c757d",previewBg:"#f8f9fa",previewText:"#6c757d",cancelBg:"#ffffff",cancelText:"#1f2937",cancelBorder:"#ced4da",insertBg:"#007bff",insertHover:"#0069d9",invalid:"#cc0000"},i=document.createElement("div");i.style.cssText=`position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: ${e.overlay}; display: flex; align-items: center; justify-content: center; z-index: 99999;`;const l=document.createElement("div");l.style.cssText=`background: ${e.dialogBg}; border: 1px solid ${e.border}; border-radius: 8px; width: 90%; max-width: 600px; max-height: 90vh; overflow: hidden; display: flex; flex-direction: column; box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2); color: ${e.text};`;let d=a?.format||"latex",u=a?.formula||"",M=a?.inline!==!1;l.innerHTML=`
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const C={latex:[{name:"Fraction",formula:"\\frac{a}{b}",description:"Simple fraction"},{name:"Square Root",formula:"\\sqrt{x}",description:"Square root"},{name:"Power",formula:"x^{2}",description:"Exponent/power"},{name:"Subscript",formula:"x_{sub}",description:"Subscript"},{name:"Integral",formula:"\\int_{a}^{b} f(x) \\, dx",description:"Definite integral"},{name:"Summation",formula:"\\sum_{i=1}^{n} x_{i}",description:"Summation"},{name:"Limit",formula:"\\lim_{x \\to 0} f(x)",description:"Limit"},{name:"Derivative",formula:"\\frac{d}{dx} f(x)",description:"Derivative"},{name:"Matrix 2x2",formula:"\\begin{pmatrix} a & b \\\\ c & d \\end{pmatrix}",description:"2x2 matrix"},{name:"System",formula:"\\begin{cases} x + y = 1 \\\\ 2x - y = 0 \\end{cases}",description:"System of equations"}],mathml:[{name:"Fraction",formula:"<mfrac><mi>a</mi><mi>b</mi></mfrac>",description:"Simple fraction"},{name:"Square Root",formula:"<msqrt><mi>x</mi></msqrt>",description:"Square root"},{name:"Power",formula:"<msup><mi>x</mi><mn>2</mn></msup>",description:"Exponent/power"},{name:"Subscript",formula:"<msub><mi>x</mi><mi>sub</mi></msub>",description:"Subscript"},{name:"Parentheses",formula:'<mfenced open="(" close=")"><mi>a</mi><mo>+</mo><mi>b</mi></mfenced>',description:"Grouped expression"}]};let h=null,w=null,E=!1;const y='[data-theme="dark"], .dark, .editora-theme-dark',q=()=>new Promise((a,s)=>{if(window.katex){a(window.katex);return}if(E){const i=setInterval(()=>{window.katex&&(clearInterval(i),a(window.katex))},100);return}E=!0;const o=document.createElement("link");o.rel="stylesheet",o.href="https://cdn.jsdelivr.net/npm/katex@0.16.9/dist/katex.min.css",document.head.appendChild(o);const e=document.createElement("script");e.src="https://cdn.jsdelivr.net/npm/katex@0.16.9/dist/katex.min.js",e.onload=()=>a(window.katex),e.onerror=s,document.head.appendChild(e)}),H=()=>{const a=window.getSelection();if(a&&a.rangeCount>0){const o=a.getRangeAt(0).startContainer;if((o.nodeType===Node.ELEMENT_NODE?o:o.parentElement)?.closest(y))return!0}return document.activeElement?.closest(y)?!0:document.body.matches(y)||document.documentElement.matches(y)},T=async a=>{const s=window.getSelection();s&&s.rangeCount>0&&(h=s.getRangeAt(0).cloneRange()),await q();const o=H(),e=o?{overlay:"rgba(0, 0, 0, 0.62)",dialogBg:"#1f2937",border:"#3b4657",panelBg:"#222d3a",fieldBg:"#111827",fieldBorder:"#4b5563",text:"#e2e8f0",muted:"#94a3b8",templateBtnBg:"#273244",templateBtnHover:"#334155",templateBtnText:"#dbe7f7",templateSubText:"#9fb0c6",previewBg:"#111827",previewText:"#cbd5e1",cancelBg:"#334155",cancelText:"#e2e8f0",cancelBorder:"#4b5563",insertBg:"#3b82f6",insertHover:"#2563eb",invalid:"#f87171"}:{overlay:"rgba(0, 0, 0, 0.5)",dialogBg:"#ffffff",border:"#e1e5e9",panelBg:"#f8f9fa",fieldBg:"#ffffff",fieldBorder:"#ced4da",text:"#1f2937",muted:"#6c757d",templateBtnBg:"#ffffff",templateBtnHover:"#f8f9fa",templateBtnText:"#1f2937",templateSubText:"#6c757d",previewBg:"#f8f9fa",previewText:"#6c757d",cancelBg:"#ffffff",cancelText:"#1f2937",cancelBorder:"#ced4da",insertBg:"#007bff",insertHover:"#0069d9",invalid:"#cc0000"},i=document.createElement("div");i.style.cssText=`position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: ${e.overlay}; display: flex; align-items: center; justify-content: center; z-index: 99999;`;const l=document.createElement("div");l.style.cssText=`background: ${e.dialogBg}; border: 1px solid ${e.border}; border-radius: 8px; width: 90%; max-width: 600px; max-height: 90vh; overflow: hidden; display: flex; flex-direction: column; box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2); color: ${e.text};`;let d=a?.format||"latex",u=a?.formula||"",M=a?.inline!==!1;l.innerHTML=`
2
2
  <div style="display: flex; justify-content: space-between; align-items: center; padding: 16px 20px; border-bottom: 1px solid ${e.border}; background: ${e.panelBg};">
3
3
  <h2 style="margin: 0; font-size: 18px; font-weight: 600; color: ${e.text};">${a?"Edit":"Insert"} Math Formula</h2>
4
4
  <button class="close-btn" style="background: none; border: none; font-size: 28px; cursor: pointer; color: ${e.muted}; padding: 0; width: 30px; height: 30px; line-height: 1;">×</button>
@@ -42,4 +42,4 @@
42
42
  <div style="font-weight: 600; font-size: 12px; color: ${e.templateBtnText};">${n.name}</div>
43
43
  <div style="font-size: 10px; color: ${e.templateSubText}; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;">${n.formula.substring(0,20)}...</div>
44
44
  </button>
45
- `).join(""),k.querySelectorAll("button").forEach(n=>{const r=n;r.onmouseover=()=>{r.style.background=e.templateBtnHover},r.onmouseout=()=>{r.style.background=e.templateBtnBg},n.addEventListener("click",()=>{c.value=n.getAttribute("data-formula")||"",u=c.value,b()})})},b=()=>{const t=c.value.trim();if(!t){f.innerHTML=`<span style="color: ${e.previewText};">Enter a formula to see preview</span>`,m.disabled=!0;return}m.disabled=!1;try{if(d==="latex"){const n=window.katex;f.innerHTML=n.renderToString(t,{displayMode:!1,throwOnError:!1})}else t.trim().startsWith("<math")?f.innerHTML=t:f.innerHTML=`<math xmlns="http://www.w3.org/1998/Math/MathML" display="inline">${t}</math>`}catch{f.innerHTML=`<span style="color: ${e.invalid};">Invalid formula</span>`}},g=()=>document.body.removeChild(i);p.onmouseover=()=>{p.style.color="#f8fafc",p.style.background=o?"#334155":"#e5e7eb",p.style.borderRadius="4px"},p.onmouseout=()=>{p.style.color=e.muted,p.style.background="none"},x.onmouseover=()=>{x.style.background=o?"#475569":"#f3f4f6"},x.onmouseout=()=>{x.style.background=e.cancelBg},m.onmouseover=()=>{m.disabled||(m.style.background=e.insertHover)},m.onmouseout=()=>{m.style.background=e.insertBg};const B=()=>{const t=c.value.trim();if(!t)return;const n={formula:t,format:d,inline:L.checked},r=n.inline?document.createElement("span"):document.createElement("div");if(r.className=n.inline?"math-formula":"math-block",r.setAttribute("data-math-formula",t),r.setAttribute("data-math-format",d),r.contentEditable="false",r.style.cssText=n.inline?"background: #f0f8ff; border: 1px solid #b8daff; border-radius: 4px; padding: 2px 6px; margin: 0 2px; color: #004085; display: inline-block; cursor: pointer;":"background: #f8f9fa; border: 1px solid #dee2e6; border-radius: 4px; padding: 12px; margin: 8px 0; text-align: center; display: block; cursor: pointer;",d==="latex"){const v=window.katex;try{r.innerHTML=v.renderToString(t,{displayMode:!n.inline,throwOnError:!1})}catch{r.textContent=n.inline?`$${t}$`:`$$${t}$$`}}else if(t.trim().startsWith("<math"))r.innerHTML=t;else{const v=`<math xmlns="http://www.w3.org/1998/Math/MathML" display="${n.inline?"inline":"block"}">${t}</math>`;r.innerHTML=v}w?w.replaceWith(r):h&&(h.deleteContents(),h.insertNode(r)),g()};p.addEventListener("click",g),x.addEventListener("click",g),m.addEventListener("click",B),i.addEventListener("click",t=>{t.target===i&&g()}),S.forEach(t=>{t.addEventListener("change",n=>{d=n.target.value,$(),b()})}),c.addEventListener("input",()=>{u=c.value,b()}),c.addEventListener("keydown",t=>{(t.ctrlKey||t.metaKey)&&t.key==="Enter"&&(t.preventDefault(),B())}),$(),b(),c.focus()};if(typeof window<"u"&&!window.__mathPluginDoubleClickInitialized){window.__mathPluginDoubleClickInitialized=!0;const a=o=>{const i=o.target.closest(".math-formula, .math-block");if(i){o.preventDefault(),o.stopPropagation(),o.stopImmediatePropagation(),w=i;const l=i.getAttribute("data-math-formula")||"",d=i.getAttribute("data-math-format")||"latex",u=i.classList.contains("math-formula");T({formula:l,format:d,inline:u})}},s=()=>{document.addEventListener("dblclick",a,{capture:!0})};document.readyState==="loading"?document.addEventListener("DOMContentLoaded",s):setTimeout(s,100)}const z=()=>({name:"math",toolbar:[{label:"Insert Math",command:"insertMath",icon:'<svg width="24" height="24" focusable="false"><path fill-rule="evenodd" clip-rule="evenodd" d="M9 4.8c.1-.5.5-.8 1-.8h10a1 1 0 1 1 0 2h-9.2L8.3 19.2a1 1 0 0 1-1.7.4l-3.4-4.2a1 1 0 0 1 1.6-1.2l2 2.5L9 4.8Zm9.7 5.5c.4.4.4 1 0 1.4L17 13.5l1.8 1.8a1 1 0 0 1-1.4 1.4L15.5 15l-1.8 1.8a1 1 0 0 1-1.4-1.4l1.8-1.8-1.8-1.8a1 1 0 0 1 1.4-1.4l1.8 1.8 1.8-1.8a1 1 0 0 1 1.4 0Z"></path></svg>'}],commands:{insertMath:()=>(T(),!0)},keymap:{"Mod-Shift-m":"insertMath"}});exports.MathPlugin=z;
45
+ `).join(""),k.querySelectorAll("button").forEach(n=>{const r=n;r.onmouseover=()=>{r.style.background=e.templateBtnHover},r.onmouseout=()=>{r.style.background=e.templateBtnBg},n.addEventListener("click",()=>{c.value=n.getAttribute("data-formula")||"",u=c.value,b()})})},b=()=>{const t=c.value.trim();if(!t){f.innerHTML=`<span style="color: ${e.previewText};">Enter a formula to see preview</span>`,m.disabled=!0;return}m.disabled=!1;try{if(d==="latex"){const n=window.katex;f.innerHTML=n.renderToString(t,{displayMode:!1,throwOnError:!1})}else t.trim().startsWith("<math")?f.innerHTML=t:f.innerHTML=`<math xmlns="http://www.w3.org/1998/Math/MathML" display="inline">${t}</math>`}catch{f.innerHTML=`<span style="color: ${e.invalid};">Invalid formula</span>`}},g=()=>document.body.removeChild(i);p.onmouseover=()=>{p.style.color="#f8fafc",p.style.background=o?"#334155":"#e5e7eb",p.style.borderRadius="4px"},p.onmouseout=()=>{p.style.color=e.muted,p.style.background="none"},x.onmouseover=()=>{x.style.background=o?"#475569":"#f3f4f6"},x.onmouseout=()=>{x.style.background=e.cancelBg},m.onmouseover=()=>{m.disabled||(m.style.background=e.insertHover)},m.onmouseout=()=>{m.style.background=e.insertBg};const B=()=>{const t=c.value.trim();if(!t)return;const n={formula:t,format:d,inline:L.checked},r=n.inline?document.createElement("span"):document.createElement("div");if(r.className=n.inline?"math-formula":"math-block",r.setAttribute("data-math-formula",t),r.setAttribute("data-math-format",d),r.contentEditable="false",r.style.cssText=n.inline?"background: #f0f8ff; border: 1px solid #b8daff; border-radius: 4px; padding: 2px 6px; margin: 0 2px; color: #004085; display: inline-block; cursor: pointer;":"background: #f8f9fa; border: 1px solid #dee2e6; border-radius: 4px; padding: 12px; margin: 8px 0; text-align: center; display: block; cursor: pointer;",d==="latex"){const v=window.katex;try{r.innerHTML=v.renderToString(t,{displayMode:!n.inline,throwOnError:!1})}catch{r.textContent=n.inline?`$${t}$`:`$$${t}$$`}}else if(t.trim().startsWith("<math"))r.innerHTML=t;else{const v=`<math xmlns="http://www.w3.org/1998/Math/MathML" display="${n.inline?"inline":"block"}">${t}</math>`;r.innerHTML=v}w?w.replaceWith(r):h&&(h.deleteContents(),h.insertNode(r)),g()};p.addEventListener("click",g),x.addEventListener("click",g),m.addEventListener("click",B),i.addEventListener("click",t=>{t.target===i&&g()}),S.forEach(t=>{t.addEventListener("change",n=>{d=n.target.value,$(),b()})}),c.addEventListener("input",()=>{u=c.value,b()}),c.addEventListener("keydown",t=>{(t.ctrlKey||t.metaKey)&&t.key==="Enter"&&(t.preventDefault(),B())}),$(),b(),c.focus()};if(typeof window<"u"&&!window.__mathPluginDoubleClickInitialized){window.__mathPluginDoubleClickInitialized=!0;const a=o=>{const i=o.target.closest(".math-formula, .math-block");if(i){o.preventDefault(),o.stopPropagation(),o.stopImmediatePropagation(),w=i;const l=i.getAttribute("data-math-formula")||"",d=i.getAttribute("data-math-format")||"latex",u=i.classList.contains("math-formula");T({formula:l,format:d,inline:u})}},s=()=>{document.addEventListener("dblclick",a,{capture:!0})};document.readyState==="loading"?document.addEventListener("DOMContentLoaded",s):setTimeout(s,100)}const _=()=>({name:"math",toolbar:[{label:"Insert Math",command:"insertMath",icon:'<svg width="24" height="24" focusable="false"><path fill-rule="evenodd" clip-rule="evenodd" d="M9 4.8c.1-.5.5-.8 1-.8h10a1 1 0 1 1 0 2h-9.2L8.3 19.2a1 1 0 0 1-1.7.4l-3.4-4.2a1 1 0 0 1 1.6-1.2l2 2.5L9 4.8Zm9.7 5.5c.4.4.4 1 0 1.4L17 13.5l1.8 1.8a1 1 0 0 1-1.4 1.4L15.5 15l-1.8 1.8a1 1 0 0 1-1.4-1.4l1.8-1.8-1.8-1.8a1 1 0 0 1 1.4-1.4l1.8 1.8 1.8-1.8a1 1 0 0 1 1.4 0Z"></path></svg>'}],commands:{insertMath:()=>(T(),!0)},keymap:{"Mod-Shift-m":"insertMath"}});exports.MathPlugin=_;
@@ -1,4 +1,4 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("./shared-config.cjs.js");let T=null,s=null,d=null,R=[],A=!1,q=null,U=0,P=0,z=0,$=0,_=1,I=null;const j='[data-theme="dark"], .dark, .editora-theme-dark',O=()=>{if(typeof document>"u"||document.getElementById("rte-media-dialog-styles"))return;const e=document.createElement("style");e.id="rte-media-dialog-styles",e.textContent=`
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});require("./shared-config.cjs.js");let T=null,s=null,d=null,R=[],A=!1,q=null,U=0,P=0,z=0,$=0,_=1,I=null;const j='[data-theme="dark"], .dark, .editora-theme-dark',O=()=>{if(typeof document>"u"||document.getElementById("rte-media-dialog-styles"))return;const e=document.createElement("style");e.id="rte-media-dialog-styles",e.textContent=`
2
2
  .rte-media-overlay {
3
3
  --rte-media-overlay-bg: rgba(15, 23, 36, 0.56);
4
4
  --rte-media-bg: #ffffff;
@@ -490,7 +490,7 @@
490
490
  <button class="cancel-btn rte-media-btn rte-media-btn-secondary" type="button">Cancel</button>
491
491
  <button id="insert-btn" class="rte-media-btn rte-media-btn-primary" type="button" ${!n&&o==="url"?"disabled":""}>Insert</button>
492
492
  </div>
493
- `};v(),i.appendChild(a),document.body.appendChild(i);const h=()=>{i.parentNode&&i.parentNode.removeChild(i)},E=()=>{if(!n)return;const l=e==="image"?document.createElement("img"):document.createElement("video");l.src=n,l.setAttribute("data-media-type",e),e==="image"&&b&&(l.alt=b),c&&(l.style.width=`${c}px`,l.setAttribute("width",c)),m&&(l.style.height=`${m}px`,l.setAttribute("height",m)),e==="video"&&(l.controls=!0),!c&&!m?l.style.cssText="max-width: 100%; height: auto; display: block; margin: 1em 0; cursor: pointer;":l.style.cssText=`display: block; margin: 1em 0; cursor: pointer; ${c?`width: ${c}px;`:"max-width: 100%;"} ${m?`height: ${m}px;`:"height: auto;"}`,T&&(T.deleteContents(),T.insertNode(l)),h()},y=async l=>{const g=a.querySelector("#upload-progress"),p=a.querySelector("#progress-bar"),x=a.querySelector("#progress-text");if(g&&p&&x){g.style.display="block";let M=0;const f=setInterval(()=>{M+=Math.random()*30,M>90&&(M=90),p.style.width=`${M}%`},200);try{const k=new FileReader;k.onload=()=>{clearInterval(f),p.style.width="100%",x.textContent="Upload complete",setTimeout(()=>{n=k.result,o="url",v(),u()},500)},k.readAsDataURL(l)}catch{clearInterval(f),x.textContent="Upload failed"}}},u=()=>{const l=a.querySelector(".close-btn"),g=a.querySelector(".cancel-btn"),p=a.querySelector("#insert-btn"),x=a.querySelector(".tab-upload"),M=a.querySelector(".tab-url");if(l?.addEventListener("click",h),g?.addEventListener("click",h),p?.addEventListener("click",E),x?.addEventListener("click",()=>{o="upload",v(),u()}),M?.addEventListener("click",()=>{o="url",v(),u()}),o==="upload"){const f=a.querySelector(".dropzone"),k=a.querySelector("#file-input");f?.addEventListener("click",()=>k?.click()),f?.addEventListener("dragover",L=>{L.preventDefault(),f.classList.add("is-dragover")}),f?.addEventListener("dragleave",()=>{f.classList.remove("is-dragover")}),f?.addEventListener("drop",L=>{L.preventDefault(),f.classList.remove("is-dragover");const S=L.dataTransfer?.files[0];S&&y(S)}),k?.addEventListener("change",L=>{const S=L.target.files?.[0];S&&y(S)})}if(o==="url"){const f=a.querySelector("#url-input"),k=a.querySelector("#alt-input"),L=a.querySelector("#width-input"),S=a.querySelector("#height-input");f?.addEventListener("input",()=>{n=f.value,v(),u()}),k?.addEventListener("input",()=>{b=k.value}),L?.addEventListener("input",()=>{c=L.value}),S?.addEventListener("input",()=>{m=S.value})}};u(),i.addEventListener("click",l=>{l.target===i&&h()})},Y=()=>{["nw","ne","sw","se"].forEach(t=>{const r=document.createElement("div");r.className=`media-resize-handle-${t}`,r.style.cssText=`
493
+ `};v(),i.appendChild(a),document.body.appendChild(i);const h=()=>{i.parentNode&&i.parentNode.removeChild(i)},E=()=>{if(!n)return;const l=e==="image"?document.createElement("img"):document.createElement("video");l.src=n,l.setAttribute("data-media-type",e),e==="image"&&b&&(l.alt=b),c&&(l.style.width=`${c}px`,l.setAttribute("width",c)),m&&(l.style.height=`${m}px`,l.setAttribute("height",m)),e==="video"&&(l.controls=!0),!c&&!m?l.style.cssText="max-width: 100%; height: auto; display: block; margin: 1em 0; cursor: pointer;":l.style.cssText=`display: block; margin: 1em 0; cursor: pointer; ${c?`width: ${c}px;`:"max-width: 100%;"} ${m?`height: ${m}px;`:"height: auto;"}`,T&&(T.deleteContents(),T.insertNode(l)),h()},y=async l=>{const g=a.querySelector("#upload-progress"),p=a.querySelector("#progress-bar"),x=a.querySelector("#progress-text");if(g&&p&&x){g.style.display="block";let C=0;const f=setInterval(()=>{C+=Math.random()*30,C>90&&(C=90),p.style.width=`${C}%`},200);try{const k=new FileReader;k.onload=()=>{clearInterval(f),p.style.width="100%",x.textContent="Upload complete",setTimeout(()=>{n=k.result,o="url",v(),u()},500)},k.readAsDataURL(l)}catch{clearInterval(f),x.textContent="Upload failed"}}},u=()=>{const l=a.querySelector(".close-btn"),g=a.querySelector(".cancel-btn"),p=a.querySelector("#insert-btn"),x=a.querySelector(".tab-upload"),C=a.querySelector(".tab-url");if(l?.addEventListener("click",h),g?.addEventListener("click",h),p?.addEventListener("click",E),x?.addEventListener("click",()=>{o="upload",v(),u()}),C?.addEventListener("click",()=>{o="url",v(),u()}),o==="upload"){const f=a.querySelector(".dropzone"),k=a.querySelector("#file-input");f?.addEventListener("click",()=>k?.click()),f?.addEventListener("dragover",L=>{L.preventDefault(),f.classList.add("is-dragover")}),f?.addEventListener("dragleave",()=>{f.classList.remove("is-dragover")}),f?.addEventListener("drop",L=>{L.preventDefault(),f.classList.remove("is-dragover");const S=L.dataTransfer?.files[0];S&&y(S)}),k?.addEventListener("change",L=>{const S=L.target.files?.[0];S&&y(S)})}if(o==="url"){const f=a.querySelector("#url-input"),k=a.querySelector("#alt-input"),L=a.querySelector("#width-input"),S=a.querySelector("#height-input");f?.addEventListener("input",()=>{n=f.value,v(),u()}),k?.addEventListener("input",()=>{b=k.value}),L?.addEventListener("input",()=>{c=L.value}),S?.addEventListener("input",()=>{m=S.value})}};u(),i.addEventListener("click",l=>{l.target===i&&h()})},Y=()=>{["nw","ne","sw","se"].forEach(t=>{const r=document.createElement("div");r.className=`media-resize-handle-${t}`,r.style.cssText=`
494
494
  position: fixed;
495
495
  width: 10px;
496
496
  height: 10px;
@@ -501,7 +501,7 @@
501
501
  z-index: 10001;
502
502
  display: none;
503
503
  box-shadow: 0 1px 3px rgba(0,0,0,0.3);
504
- `,r.setAttribute("data-position",t),document.body.appendChild(r),R.push(r)})},C=()=>{if(!s){R.forEach(r=>r.style.display="none");return}const e=s.getBoundingClientRect(),t={nw:{x:e.left-5,y:e.top-5},ne:{x:e.right-5,y:e.top-5},sw:{x:e.left-5,y:e.bottom-5},se:{x:e.right-5,y:e.bottom-5}};R.forEach(r=>{const i=r.getAttribute("data-position"),a=t[i];r.style.left=`${a.x}px`,r.style.top=`${a.y}px`,r.style.display="block"})},Z=e=>{const t=D(e),r=B(!0);r.innerHTML=`
504
+ `,r.setAttribute("data-position",t),document.body.appendChild(r),R.push(r)})},M=()=>{if(!s){R.forEach(r=>r.style.display="none");return}const e=s.getBoundingClientRect(),t={nw:{x:e.left-5,y:e.top-5},ne:{x:e.right-5,y:e.top-5},sw:{x:e.left-5,y:e.bottom-5},se:{x:e.right-5,y:e.bottom-5}};R.forEach(r=>{const i=r.getAttribute("data-position"),a=t[i];r.style.left=`${a.x}px`,r.style.top=`${a.y}px`,r.style.display="block"})},Z=e=>{const t=D(e),r=B(!0);r.innerHTML=`
505
505
  <div class="rte-media-header">
506
506
  <h2 class="rte-media-title">Edit Alt Text</h2>
507
507
  <button class="close-btn rte-media-close-btn" type="button" aria-label="Close">×</button>
@@ -616,4 +616,4 @@
616
616
  <button class="media-floating-toolbar-btn btn-remove" title="Remove" type="button">
617
617
  <svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><polyline points="3 6 5 6 21 6"></polyline><path d="M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"></path></svg>
618
618
  </button>
619
- `,setTimeout(()=>{w()},0);const a=()=>w();let o=s.parentElement;for(;o;)o.addEventListener("scroll",a),o=o.parentElement;window.addEventListener("scroll",a),window.addEventListener("resize",a),d._cleanup=()=>{let n=s?.parentElement;for(;n;)n.removeEventListener("scroll",a),n=n.parentElement;window.removeEventListener("scroll",a),window.removeEventListener("resize",a)},d.querySelector(".btn-align-left")?.addEventListener("click",()=>{e.style.display="block",e.style.marginLeft="0",e.style.marginRight="auto",w()}),d.querySelector(".btn-align-center")?.addEventListener("click",()=>{e.style.display="block",e.style.marginLeft="auto",e.style.marginRight="auto",w()}),d.querySelector(".btn-align-right")?.addEventListener("click",()=>{e.style.display="block",e.style.marginLeft="auto",e.style.marginRight="0",w()}),d.querySelector(".btn-alt")?.addEventListener("click",()=>{e.tagName==="IMG"&&Z(e)}),d.querySelector(".btn-link")?.addEventListener("click",()=>{K(e)}),d.querySelector(".btn-replace")?.addEventListener("click",()=>{e.tagName==="IMG"&&J(e)}),d.querySelector(".btn-resize")?.addEventListener("click",()=>{const n=prompt("Enter width in pixels:",String(e.width||e.offsetWidth));if(n&&!isNaN(parseInt(n))){const c=parseInt(n);e.style.width=`${c}px`,e.setAttribute("width",String(c)),C(),w()}}),d.querySelector(".btn-remove")?.addEventListener("click",()=>{confirm("Remove this media?")&&(e.remove(),d&&(d._cleanup&&d._cleanup(),d.remove(),d=null),s=null,C())}),d._cleanup=()=>{window.removeEventListener("scroll",w),window.removeEventListener("resize",w)}},W=e=>{I=e||null,Y(),document.addEventListener("click",t=>{const r=t.target;if(r.tagName==="IMG"||r.tagName==="VIDEO"){const i=r;let a=!1;if(I?a=I.contains(i):a=!!i.closest('[contenteditable="true"]'),a){t.preventDefault(),t.stopPropagation(),s=i,s.style.display="block",H(i),C();return}}if(!r.closest(".btn-link, .btn-resize, .btn-remove")&&d&&!r.closest("button")){if(d._cleanup&&d._cleanup(),d.remove(),d=null,s&&s.parentElement){const i=s.parentElement;i._originalPosition!==void 0&&(i.style.position=i._originalPosition,delete i._originalPosition)}s=null,C()}}),R.forEach(t=>{t.addEventListener("mousedown",r=>{if(!s)return;r.preventDefault(),r.stopPropagation(),A=!0,q=t.getAttribute("data-position"),U=r.clientX,P=r.clientY;const i=s.getBoundingClientRect();z=i.width,$=i.height,_=z/$,document.body.style.userSelect="none",document.body.style.cursor=`${q}-resize`})}),document.addEventListener("mousemove",t=>{if(!A||!s||!q)return;const r=t.clientX-U,i=t.clientY-P;let a=z,o=$;switch(q){case"se":a=z+r,o=$+i;break;case"sw":a=z-r,o=$+i;break;case"ne":a=z+r,o=$-i;break;case"nw":a=z-r,o=$-i;break}Math.abs(r)>Math.abs(i)?o=a/_:a=o*_,a=Math.max(50,a),o=Math.max(50,o),s.style.width=`${a}px`,s.style.height=`${o}px`,s.setAttribute("width",String(Math.round(a))),s.setAttribute("height",String(Math.round(o))),C(),w()}),document.addEventListener("mouseup",()=>{A&&(A=!1,q=null,document.body.style.userSelect="",document.body.style.cursor="")}),window.addEventListener("scroll",C),window.addEventListener("resize",C)};typeof window<"u"&&!window.__mediaManagerInitialized&&(window.__mediaManagerInitialized=!0,W());const Q=()=>({name:"image",initialize:e=>{const t=e?.editorElement;W(t)},toolbar:[{label:"Image",command:"insertImage",icon:'<svg width="24px" height="24px" viewBox="0 0 32 32" enable-background="new 0 0 32 32"><g><rect fill="none" height="22" stroke="#000000" stroke-linejoin="round" stroke-miterlimit="10" stroke-width="2" width="30" x="1" y="5"></rect><polygon fill="none" points="31,27 21,17 11,27" stroke="#000000" stroke-linejoin="round" stroke-miterlimit="10" stroke-width="2"></polygon><polygon fill="none" points="18,20 9,11 1,19 1,27 11,27" stroke="#000000" stroke-linejoin="round" stroke-miterlimit="10" stroke-width="2"></polygon><circle cx="19" cy="11" fill="none" r="2" stroke="#000000" stroke-linejoin="round" stroke-miterlimit="10" stroke-width="2"></circle></g></svg>'},{label:"Video",command:"insertVideo",icon:'<svg width="24" height="24" focusable="false"><path d="M4 3h16c.6 0 1 .4 1 1v16c0 .6-.4 1-1 1H4a1 1 0 0 1-1-1V4c0-.6.4-1 1-1Zm1 2v14h14V5H5Zm4.8 2.6 5.6 4a.5.5 0 0 1 0 .8l-5.6 4A.5.5 0 0 1 9 16V8a.5.5 0 0 1 .8-.4Z" fill-rule="nonzero"></path></svg>'}],commands:{insertImage:(e,t)=>{const r=t?.contentElement instanceof HTMLElement?t.contentElement:void 0;return V("image",r),!0},insertVideo:(e,t)=>{const r=t?.contentElement instanceof HTMLElement?t.contentElement:void 0;return V("video",r),!0}},keymap:{"Mod-Shift-i":"insertImage"}}),ee={apiEndpoints:{upload:"/media/upload",library:"/media/library",delete:"/media/library"},maxFileSize:10*1024*1024,allowedTypes:["image/jpeg","image/png","image/gif","video/mp4","video/webm"],headers:{}};let N={...ee};function te(e){N={...N,...e}}function re(){return{...N}}exports.MediaManagerPlugin=Q;exports.getMediaManagerConfig=re;exports.setMediaManagerConfig=te;
619
+ `,setTimeout(()=>{w()},0);const a=()=>w();let o=s.parentElement;for(;o;)o.addEventListener("scroll",a),o=o.parentElement;window.addEventListener("scroll",a),window.addEventListener("resize",a),d._cleanup=()=>{let n=s?.parentElement;for(;n;)n.removeEventListener("scroll",a),n=n.parentElement;window.removeEventListener("scroll",a),window.removeEventListener("resize",a)},d.querySelector(".btn-align-left")?.addEventListener("click",()=>{e.style.display="block",e.style.marginLeft="0",e.style.marginRight="auto",w()}),d.querySelector(".btn-align-center")?.addEventListener("click",()=>{e.style.display="block",e.style.marginLeft="auto",e.style.marginRight="auto",w()}),d.querySelector(".btn-align-right")?.addEventListener("click",()=>{e.style.display="block",e.style.marginLeft="auto",e.style.marginRight="0",w()}),d.querySelector(".btn-alt")?.addEventListener("click",()=>{e.tagName==="IMG"&&Z(e)}),d.querySelector(".btn-link")?.addEventListener("click",()=>{K(e)}),d.querySelector(".btn-replace")?.addEventListener("click",()=>{e.tagName==="IMG"&&J(e)}),d.querySelector(".btn-resize")?.addEventListener("click",()=>{const n=prompt("Enter width in pixels:",String(e.width||e.offsetWidth));if(n&&!isNaN(parseInt(n))){const c=parseInt(n);e.style.width=`${c}px`,e.setAttribute("width",String(c)),M(),w()}}),d.querySelector(".btn-remove")?.addEventListener("click",()=>{confirm("Remove this media?")&&(e.remove(),d&&(d._cleanup&&d._cleanup(),d.remove(),d=null),s=null,M())}),d._cleanup=()=>{window.removeEventListener("scroll",w),window.removeEventListener("resize",w)}},W=e=>{I=e||null,Y(),document.addEventListener("click",t=>{const r=t.target;if(r.tagName==="IMG"||r.tagName==="VIDEO"){const i=r;let a=!1;if(I?a=I.contains(i):a=!!i.closest('[contenteditable="true"]'),a){t.preventDefault(),t.stopPropagation(),s=i,s.style.display="block",H(i),M();return}}if(!r.closest(".btn-link, .btn-resize, .btn-remove")&&d&&!r.closest("button")){if(d._cleanup&&d._cleanup(),d.remove(),d=null,s&&s.parentElement){const i=s.parentElement;i._originalPosition!==void 0&&(i.style.position=i._originalPosition,delete i._originalPosition)}s=null,M()}}),R.forEach(t=>{t.addEventListener("mousedown",r=>{if(!s)return;r.preventDefault(),r.stopPropagation(),A=!0,q=t.getAttribute("data-position"),U=r.clientX,P=r.clientY;const i=s.getBoundingClientRect();z=i.width,$=i.height,_=z/$,document.body.style.userSelect="none",document.body.style.cursor=`${q}-resize`})}),document.addEventListener("mousemove",t=>{if(!A||!s||!q)return;const r=t.clientX-U,i=t.clientY-P;let a=z,o=$;switch(q){case"se":a=z+r,o=$+i;break;case"sw":a=z-r,o=$+i;break;case"ne":a=z+r,o=$-i;break;case"nw":a=z-r,o=$-i;break}Math.abs(r)>Math.abs(i)?o=a/_:a=o*_,a=Math.max(50,a),o=Math.max(50,o),s.style.width=`${a}px`,s.style.height=`${o}px`,s.setAttribute("width",String(Math.round(a))),s.setAttribute("height",String(Math.round(o))),M(),w()}),document.addEventListener("mouseup",()=>{A&&(A=!1,q=null,document.body.style.userSelect="",document.body.style.cursor="")}),window.addEventListener("scroll",M),window.addEventListener("resize",M)};typeof window<"u"&&!window.__mediaManagerInitialized&&(window.__mediaManagerInitialized=!0,W());const Q=()=>({name:"image",initialize:e=>{const t=e?.editorElement;W(t)},toolbar:[{label:"Image",command:"insertImage",icon:'<svg width="24px" height="24px" viewBox="0 0 32 32" enable-background="new 0 0 32 32"><g><rect fill="none" height="22" stroke="#000000" stroke-linejoin="round" stroke-miterlimit="10" stroke-width="2" width="30" x="1" y="5"></rect><polygon fill="none" points="31,27 21,17 11,27" stroke="#000000" stroke-linejoin="round" stroke-miterlimit="10" stroke-width="2"></polygon><polygon fill="none" points="18,20 9,11 1,19 1,27 11,27" stroke="#000000" stroke-linejoin="round" stroke-miterlimit="10" stroke-width="2"></polygon><circle cx="19" cy="11" fill="none" r="2" stroke="#000000" stroke-linejoin="round" stroke-miterlimit="10" stroke-width="2"></circle></g></svg>'},{label:"Video",command:"insertVideo",icon:'<svg width="24" height="24" focusable="false"><path d="M4 3h16c.6 0 1 .4 1 1v16c0 .6-.4 1-1 1H4a1 1 0 0 1-1-1V4c0-.6.4-1 1-1Zm1 2v14h14V5H5Zm4.8 2.6 5.6 4a.5.5 0 0 1 0 .8l-5.6 4A.5.5 0 0 1 9 16V8a.5.5 0 0 1 .8-.4Z" fill-rule="nonzero"></path></svg>'}],commands:{insertImage:(e,t)=>{const r=t?.contentElement instanceof HTMLElement?t.contentElement:void 0;return V("image",r),!0},insertVideo:(e,t)=>{const r=t?.contentElement instanceof HTMLElement?t.contentElement:void 0;return V("video",r),!0}},keymap:{"Mod-Shift-i":"insertImage"}}),ee={apiEndpoints:{upload:"/media/upload",library:"/media/library",delete:"/media/library"},maxFileSize:10*1024*1024,allowedTypes:["image/jpeg","image/png","image/gif","video/mp4","video/webm"],headers:{}};let N={...ee};function te(e){N={...N,...e}}function re(){return{...N}}exports.MediaManagerPlugin=Q;exports.getMediaManagerConfig=re;exports.setMediaManagerConfig=te;
@@ -1,4 +1,4 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const R={USER:{name:"User",tags:[{key:"first_name",label:"First Name",category:"User",preview:"John"},{key:"last_name",label:"Last Name",category:"User",preview:"Doe"},{key:"email",label:"Email",category:"User",preview:"john@example.com"},{key:"phone",label:"Phone",category:"User",preview:"+1-555-1234"},{key:"full_name",label:"Full Name",category:"User",preview:"John Doe"},{key:"username",label:"Username",category:"User",preview:"johndoe"}]},COMPANY:{name:"Company",tags:[{key:"company_name",label:"Company Name",category:"Company",preview:"Acme Corp"},{key:"company_address",label:"Company Address",category:"Company",preview:"123 Main St"},{key:"company_phone",label:"Company Phone",category:"Company",preview:"+1-555-0000"},{key:"company_email",label:"Company Email",category:"Company",preview:"info@acme.com"}]},DATE:{name:"Date",tags:[{key:"today",label:"Today",category:"Date",preview:new Date().toLocaleDateString()},{key:"tomorrow",label:"Tomorrow",category:"Date",preview:new Date(Date.now()+864e5).toLocaleDateString()},{key:"next_week",label:"Next Week",category:"Date",preview:new Date(Date.now()+6048e5).toLocaleDateString()}]},CUSTOM:{name:"Custom",tags:[]}},v=".rte-content, .editora-content",X='[data-theme="dark"], .dark, .editora-theme-dark',L=Object.keys(R),Y=L.reduce((t,e)=>(t[e]=R[e].tags.map(r=>({...r,searchIndex:`${r.label} ${r.key} ${r.category} ${"description"in r?r.description??"":""}`.toLowerCase()})),t),{});let B=!1,P=!1,C=null,k=null,h=null,j=!1;function A(){if(B||typeof document>"u")return;B=!0;const t=document.createElement("style");t.id="merge-tag-plugin-styles",t.textContent=`
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const R={USER:{name:"User",tags:[{key:"first_name",label:"First Name",category:"User",preview:"John"},{key:"last_name",label:"Last Name",category:"User",preview:"Doe"},{key:"email",label:"Email",category:"User",preview:"john@example.com"},{key:"phone",label:"Phone",category:"User",preview:"+1-555-1234"},{key:"full_name",label:"Full Name",category:"User",preview:"John Doe"},{key:"username",label:"Username",category:"User",preview:"johndoe"}]},COMPANY:{name:"Company",tags:[{key:"company_name",label:"Company Name",category:"Company",preview:"Acme Corp"},{key:"company_address",label:"Company Address",category:"Company",preview:"123 Main St"},{key:"company_phone",label:"Company Phone",category:"Company",preview:"+1-555-0000"},{key:"company_email",label:"Company Email",category:"Company",preview:"info@acme.com"}]},DATE:{name:"Date",tags:[{key:"today",label:"Today",category:"Date",preview:new Date().toLocaleDateString()},{key:"tomorrow",label:"Tomorrow",category:"Date",preview:new Date(Date.now()+864e5).toLocaleDateString()},{key:"next_week",label:"Next Week",category:"Date",preview:new Date(Date.now()+6048e5).toLocaleDateString()}]},CUSTOM:{name:"Custom",tags:[]}},v=".rte-content, .editora-content",X='[data-theme="dark"], .dark, .editora-theme-dark',L=Object.keys(R),Y=L.reduce((t,e)=>(t[e]=R[e].tags.map(r=>({...r,searchIndex:`${r.label} ${r.key} ${r.category} ${"description"in r?r.description??"":""}`.toLowerCase()})),t),{});let B=!1,P=!1,C=null,k=null,y=null,j=!1;function A(){if(B||typeof document>"u")return;B=!0;const t=document.createElement("style");t.id="merge-tag-plugin-styles",t.textContent=`
2
2
  .rte-merge-tag-overlay {
3
3
  --rte-mt-overlay-bg: rgba(15, 23, 36, 0.56);
4
4
  --rte-mt-dialog-bg: #ffffff;
@@ -87,7 +87,7 @@
87
87
  border-color: #3f5f84;
88
88
  color: #8dc4ff;
89
89
  }
90
- `,document.head.appendChild(t)}function H(){P||typeof document>"u"||(P=!0,document.addEventListener("focusin",t=>{const r=t.target?.closest(v);r&&(C=r)}),document.addEventListener("selectionchange",()=>{const t=V();t&&(C=t)}))}function V(){const t=window.getSelection();if(!t||t.rangeCount===0)return null;const r=t.getRangeAt(0).startContainer;return(r.nodeType===Node.ELEMENT_NODE?r:r.parentElement)?.closest(v)||null}function J(){const t=V();if(t)return t;const r=document.activeElement?.closest(v);return r||(C?.isConnected?C:document.querySelector(v))}function Q(t){const e=t.parentNode;if(!e)return;const r=window.getSelection();if(!r)return;const n=document.createRange(),i=Array.from(e.childNodes).indexOf(t);i<0||(n.setStart(e,i),n.setEnd(e,i+1),r.removeAllRanges(),r.addRange(n))}function $(t,e){t instanceof Text&&t.data.length!==0&&(e?(t.data.startsWith(" ")||t.data.startsWith(" "))&&t.deleteData(0,1):(t.data.endsWith(" ")||t.data.endsWith(" "))&&t.deleteData(t.data.length-1,1),t.data.length===0&&t.parentNode?.removeChild(t))}function G(t,e){const r=window.getSelection();if(!r)return;const n=document.createRange(),o=Math.max(0,Math.min(e,t.childNodes.length));n.setStart(t,o),n.collapse(!0),r.removeAllRanges(),r.addRange(n)}function Z(t,e){const r=t.parentNode;if(!r)return!1;const o=Array.from(r.childNodes).indexOf(t);if(o<0)return!1;const i=t.previousSibling,c=t.nextSibling;r.removeChild(t),e==="Backspace"?($(c,!0),G(r,o)):($(i,!1),G(r,o));const d=r instanceof HTMLElement?r.closest(v):r.parentElement?.closest(v)||null;return d&&d.dispatchEvent(new Event("input",{bubbles:!0})),!0}function ee(t){if(t.collapsed||!(t.startContainer instanceof HTMLElement||t.startContainer instanceof Text)||t.startContainer!==t.endContainer||t.endOffset!==t.startOffset+1)return null;const e=t.startContainer;if(!(e instanceof Element||e instanceof DocumentFragment))return null;const r=e.childNodes[t.startOffset];return r instanceof HTMLElement&&r.classList.contains("rte-merge-tag")?r:null}function te(t,e){if(!t.collapsed)return null;const{startContainer:r,startOffset:n}=t,o=i=>i instanceof HTMLElement&&i.classList.contains("rte-merge-tag")?i:null;if(r.nodeType===Node.ELEMENT_NODE){const i=r;return e==="Backspace"&&n>0?o(i.childNodes[n-1]||null):e==="Delete"?o(i.childNodes[n]||null):null}if(r.nodeType===Node.TEXT_NODE){const i=r;return e==="Backspace"?n===0?o(i.previousSibling):n===1&&(i.data[0]===" "||i.data[0]===" ")&&i.previousSibling instanceof HTMLElement&&i.previousSibling.classList.contains("rte-merge-tag")?i.previousSibling:null:n===i.data.length?o(i.nextSibling):null}return null}function q(){j||typeof document>"u"||(j=!0,document.addEventListener("click",t=>{const r=t.target?.closest(".rte-merge-tag");if(!r)return;const n=r.closest(v);n&&(t.preventDefault(),t.stopPropagation(),n.focus({preventScroll:!0}),Q(r))}),document.addEventListener("keydown",t=>{if(t.key!=="Backspace"&&t.key!=="Delete")return;const e=window.getSelection();if(!e||e.rangeCount===0)return;const r=e.getRangeAt(0),n=J();if(!n||!n.contains(r.commonAncestorContainer))return;let o=ee(r);o||(o=te(r,t.key)),o&&(t.preventDefault(),t.stopPropagation(),Z(o,t.key))}))}function re(t){return t?!!t.closest(X):!1}function ne(){h&&(h(),h=null),k=null}function W(t){const e=document.createRange();return e.selectNodeContents(t),e.collapse(!1),e}function ae(t,e){const r=window.getSelection(),n=e?e.cloneRange():W(t),i=n.startContainer.isConnected&&n.endContainer.isConnected&&t.contains(n.commonAncestorContainer)?n:W(t);return r&&(r.removeAllRanges(),r.addRange(i)),i}function oe(t){const e=document.createElement("span");return e.className="rte-merge-tag",e.setAttribute("contenteditable","false"),e.setAttribute("data-key",t.key),e.setAttribute("data-category",t.category),e.setAttribute("data-label",t.label),e.setAttribute("aria-label",`Merge tag: ${t.label}`),e.textContent=`{{ ${t.label} }}`,e}function ie(t,e,r){const n=window.getSelection();if(!n)return!1;t.focus({preventScroll:!0});const o=ae(t,e),c=(o.startContainer.nodeType===Node.ELEMENT_NODE?o.startContainer:o.startContainer.parentElement)?.closest(".rte-merge-tag");c&&t.contains(c)&&(o.setStartAfter(c),o.setEndAfter(c));try{o.deleteContents();const d=oe(r),g=document.createTextNode(" "),u=document.createDocumentFragment();u.appendChild(d),u.appendChild(g),o.insertNode(u);const f=document.createRange();return f.setStartAfter(g),f.collapse(!0),n.removeAllRanges(),n.addRange(f),t.dispatchEvent(new Event("input",{bubbles:!0})),!0}catch(d){return console.error("Failed to insert merge tag:",d),!1}}function le(t,e){const r=Y[t],n=e.trim().toLowerCase();return n?r.filter(o=>o.searchIndex.includes(n)):r}function se(t){ne(),A();const e={category:"USER",searchTerm:"",filteredTags:Y.USER,selectedIndex:0,savedRange:(()=>{const a=window.getSelection();if(!a||a.rangeCount===0)return null;const l=a.getRangeAt(0);return t.contains(l.commonAncestorContainer)?l.cloneRange():null})(),searchRaf:null},r=document.createElement("div");r.className="rte-merge-tag-overlay",r.setAttribute("role","dialog"),r.setAttribute("aria-modal","true"),re(t)&&r.classList.add("rte-ui-theme-dark");const n=document.createElement("div");n.className="rte-merge-tag-dialog";const o=document.createElement("div");o.className="rte-merge-tag-header",o.innerHTML=`
90
+ `,document.head.appendChild(t)}function H(){P||typeof document>"u"||(P=!0,document.addEventListener("focusin",t=>{const r=t.target?.closest(v);r&&(C=r)}),document.addEventListener("selectionchange",()=>{const t=V();t&&(C=t)}))}function V(){const t=window.getSelection();if(!t||t.rangeCount===0)return null;const r=t.getRangeAt(0).startContainer;return(r.nodeType===Node.ELEMENT_NODE?r:r.parentElement)?.closest(v)||null}function J(){const t=V();if(t)return t;const r=document.activeElement?.closest(v);return r||(C?.isConnected?C:document.querySelector(v))}function Q(t){const e=t.parentNode;if(!e)return;const r=window.getSelection();if(!r)return;const n=document.createRange(),i=Array.from(e.childNodes).indexOf(t);i<0||(n.setStart(e,i),n.setEnd(e,i+1),r.removeAllRanges(),r.addRange(n))}function $(t,e){t instanceof Text&&t.data.length!==0&&(e?(t.data.startsWith(" ")||t.data.startsWith(" "))&&t.deleteData(0,1):(t.data.endsWith(" ")||t.data.endsWith(" "))&&t.deleteData(t.data.length-1,1),t.data.length===0&&t.parentNode?.removeChild(t))}function G(t,e){const r=window.getSelection();if(!r)return;const n=document.createRange(),o=Math.max(0,Math.min(e,t.childNodes.length));n.setStart(t,o),n.collapse(!0),r.removeAllRanges(),r.addRange(n)}function Z(t,e){const r=t.parentNode;if(!r)return!1;const o=Array.from(r.childNodes).indexOf(t);if(o<0)return!1;const i=t.previousSibling,c=t.nextSibling;r.removeChild(t),e==="Backspace"?($(c,!0),G(r,o)):($(i,!1),G(r,o));const d=r instanceof HTMLElement?r.closest(v):r.parentElement?.closest(v)||null;return d&&d.dispatchEvent(new Event("input",{bubbles:!0})),!0}function ee(t){if(t.collapsed||!(t.startContainer instanceof HTMLElement||t.startContainer instanceof Text)||t.startContainer!==t.endContainer||t.endOffset!==t.startOffset+1)return null;const e=t.startContainer;if(!(e instanceof Element||e instanceof DocumentFragment))return null;const r=e.childNodes[t.startOffset];return r instanceof HTMLElement&&r.classList.contains("rte-merge-tag")?r:null}function te(t,e){if(!t.collapsed)return null;const{startContainer:r,startOffset:n}=t,o=i=>i instanceof HTMLElement&&i.classList.contains("rte-merge-tag")?i:null;if(r.nodeType===Node.ELEMENT_NODE){const i=r;return e==="Backspace"&&n>0?o(i.childNodes[n-1]||null):e==="Delete"?o(i.childNodes[n]||null):null}if(r.nodeType===Node.TEXT_NODE){const i=r;return e==="Backspace"?n===0?o(i.previousSibling):n===1&&(i.data[0]===" "||i.data[0]===" ")&&i.previousSibling instanceof HTMLElement&&i.previousSibling.classList.contains("rte-merge-tag")?i.previousSibling:null:n===i.data.length?o(i.nextSibling):null}return null}function q(){j||typeof document>"u"||(j=!0,document.addEventListener("click",t=>{const r=t.target?.closest(".rte-merge-tag");if(!r)return;const n=r.closest(v);n&&(t.preventDefault(),t.stopPropagation(),n.focus({preventScroll:!0}),Q(r))}),document.addEventListener("keydown",t=>{if(t.key!=="Backspace"&&t.key!=="Delete")return;const e=window.getSelection();if(!e||e.rangeCount===0)return;const r=e.getRangeAt(0),n=J();if(!n||!n.contains(r.commonAncestorContainer))return;let o=ee(r);o||(o=te(r,t.key)),o&&(t.preventDefault(),t.stopPropagation(),Z(o,t.key))}))}function re(t){return t?!!t.closest(X):!1}function ne(){y&&(y(),y=null),k=null}function W(t){const e=document.createRange();return e.selectNodeContents(t),e.collapse(!1),e}function ae(t,e){const r=window.getSelection(),n=e?e.cloneRange():W(t),i=n.startContainer.isConnected&&n.endContainer.isConnected&&t.contains(n.commonAncestorContainer)?n:W(t);return r&&(r.removeAllRanges(),r.addRange(i)),i}function oe(t){const e=document.createElement("span");return e.className="rte-merge-tag",e.setAttribute("contenteditable","false"),e.setAttribute("data-key",t.key),e.setAttribute("data-category",t.category),e.setAttribute("data-label",t.label),e.setAttribute("aria-label",`Merge tag: ${t.label}`),e.textContent=`{{ ${t.label} }}`,e}function ie(t,e,r){const n=window.getSelection();if(!n)return!1;t.focus({preventScroll:!0});const o=ae(t,e),c=(o.startContainer.nodeType===Node.ELEMENT_NODE?o.startContainer:o.startContainer.parentElement)?.closest(".rte-merge-tag");c&&t.contains(c)&&(o.setStartAfter(c),o.setEndAfter(c));try{o.deleteContents();const d=oe(r),g=document.createTextNode(" "),u=document.createDocumentFragment();u.appendChild(d),u.appendChild(g),o.insertNode(u);const f=document.createRange();return f.setStartAfter(g),f.collapse(!0),n.removeAllRanges(),n.addRange(f),t.dispatchEvent(new Event("input",{bubbles:!0})),!0}catch(d){return console.error("Failed to insert merge tag:",d),!1}}function le(t,e){const r=Y[t],n=e.trim().toLowerCase();return n?r.filter(o=>o.searchIndex.includes(n)):r}function se(t){ne(),A();const e={category:"USER",searchTerm:"",filteredTags:Y.USER,selectedIndex:0,savedRange:(()=>{const a=window.getSelection();if(!a||a.rangeCount===0)return null;const l=a.getRangeAt(0);return t.contains(l.commonAncestorContainer)?l.cloneRange():null})(),searchRaf:null},r=document.createElement("div");r.className="rte-merge-tag-overlay",r.setAttribute("role","dialog"),r.setAttribute("aria-modal","true"),re(t)&&r.classList.add("rte-ui-theme-dark");const n=document.createElement("div");n.className="rte-merge-tag-dialog";const o=document.createElement("div");o.className="rte-merge-tag-header",o.innerHTML=`
91
91
  <h2 style="margin:0; font-size:18px; font-weight:700;">Insert Merge Tag</h2>
92
92
  <button class="rte-merge-tag-close" aria-label="Close" style="background:none;border:none;color:inherit;cursor:pointer;font-size:20px;">✕</button>
93
- `;const i=document.createElement("div");i.className="rte-merge-tag-body";const c=document.createElement("input");c.type="text",c.className="rte-merge-tag-input",c.placeholder="Search merge tags...",c.setAttribute("aria-label","Search merge tags");const d=document.createElement("div");d.className="rte-merge-tag-tabs",L.forEach(a=>{const l=document.createElement("button");l.type="button",l.className="rte-merge-tag-tab",l.setAttribute("data-category",a),l.textContent=R[a].name,d.appendChild(l)});const g=document.createElement("div");g.className="rte-merge-tag-list";const u=document.createElement("div");u.className="rte-merge-tag-preview",i.appendChild(c),i.appendChild(d),i.appendChild(g),i.appendChild(u);const f=document.createElement("div");f.className="rte-merge-tag-footer";const x=document.createElement("button");x.type="button",x.className="rte-merge-tag-btn-secondary",x.textContent="Cancel";const p=document.createElement("button");p.type="button",p.className="rte-merge-tag-btn-primary",p.textContent="Insert",f.appendChild(x),f.appendChild(p),n.appendChild(o),n.appendChild(i),n.appendChild(f),r.appendChild(n),document.body.appendChild(r),k=r;const D=()=>{d.querySelectorAll(".rte-merge-tag-tab").forEach(l=>{const m=l.dataset.category===e.category;l.classList.toggle("active",m)})},w=()=>{if(e.filteredTags.length===0){e.selectedIndex=-1;return}e.selectedIndex<0&&(e.selectedIndex=0),e.selectedIndex>=e.filteredTags.length&&(e.selectedIndex=e.filteredTags.length-1)},I=()=>{w();const a=e.selectedIndex>=0?e.filteredTags[e.selectedIndex]:null;if(!a){u.style.display="none",p.disabled=!0;return}u.style.display="block",u.innerHTML=`<strong>Preview:</strong> {{ ${a.label} }}`,p.disabled=!1},K=()=>{if(e.selectedIndex<0)return;g.querySelector(`.rte-merge-tag-item[data-index="${e.selectedIndex}"]`)?.scrollIntoView({block:"nearest"})},y=()=>{if(e.filteredTags=le(e.category,e.searchTerm),e.filteredTags.length>0&&e.selectedIndex<0&&(e.selectedIndex=0),w(),g.innerHTML="",e.filteredTags.length===0){const l=document.createElement("div");l.className="rte-merge-tag-empty",l.textContent="No merge tags found",g.appendChild(l),I();return}const a=document.createDocumentFragment();e.filteredTags.forEach((l,m)=>{const s=document.createElement("div");s.className="rte-merge-tag-item",s.setAttribute("data-index",String(m)),s.classList.toggle("selected",m===e.selectedIndex);const N=document.createElement("div");if(N.className="rte-merge-tag-item-label",N.textContent=l.label,s.appendChild(N),l.preview){const S=document.createElement("div");S.className="rte-merge-tag-item-preview",S.textContent=l.preview,s.appendChild(S)}a.appendChild(s)}),g.appendChild(a),I(),K()},M=()=>{e.searchRaf!==null&&cancelAnimationFrame(e.searchRaf),e.searchRaf=requestAnimationFrame(()=>{e.searchRaf=null,e.searchTerm=c.value,e.selectedIndex=0,y()})},b=()=>{e.searchRaf!==null&&(cancelAnimationFrame(e.searchRaf),e.searchRaf=null),r.remove(),k===r&&(k=null,h=null)},E=()=>{if(w(),e.selectedIndex<0)return;const a=e.filteredTags[e.selectedIndex];ie(t,e.savedRange,a)&&b()},O=a=>{const m=a.target.closest(".rte-merge-tag-tab");if(!m)return;const s=m.dataset.category;!s||!L.includes(s)||(e.category=s,e.searchTerm="",c.value="",e.selectedIndex=0,D(),y())},_=a=>{const m=a.target.closest(".rte-merge-tag-item");if(!m)return;const s=Number(m.dataset.index||"-1");Number.isNaN(s)||s<0||s>=e.filteredTags.length||(e.selectedIndex=s,y())},F=a=>{const m=a.target.closest(".rte-merge-tag-item");if(!m)return;const s=Number(m.dataset.index||"-1");Number.isNaN(s)||s<0||s>=e.filteredTags.length||(e.selectedIndex=s,E())},T=a=>{if(a.key==="Escape"){a.preventDefault(),b();return}if(a.key==="ArrowDown"){if(a.preventDefault(),e.filteredTags.length===0)return;e.selectedIndex=Math.min(e.filteredTags.length-1,e.selectedIndex+1),y();return}if(a.key==="ArrowUp"){if(a.preventDefault(),e.filteredTags.length===0)return;e.selectedIndex=Math.max(0,e.selectedIndex-1),y();return}a.key==="Enter"&&(a.preventDefault(),E())},U=a=>{a.target===r&&b()},z=o.querySelector(".rte-merge-tag-close");d.addEventListener("click",O),g.addEventListener("click",_),g.addEventListener("dblclick",F),c.addEventListener("input",M),c.addEventListener("keydown",T),r.addEventListener("click",U),n.addEventListener("keydown",T),z?.addEventListener("click",b),x.addEventListener("click",b),p.addEventListener("click",E),h=()=>{d.removeEventListener("click",O),g.removeEventListener("click",_),g.removeEventListener("dblclick",F),c.removeEventListener("input",M),c.removeEventListener("keydown",T),r.removeEventListener("click",U),n.removeEventListener("keydown",T),z?.removeEventListener("click",b),x.removeEventListener("click",b),p.removeEventListener("click",E),e.searchRaf!==null&&(cancelAnimationFrame(e.searchRaf),e.searchRaf=null),r.remove()},D(),y(),setTimeout(()=>{c.focus()},0)}const ce=()=>({name:"mergeTag",init:()=>{A(),H(),q()},toolbar:[{label:"Merge Tag",command:"insertMergeTag",icon:"{{ }}"}],commands:{insertMergeTag:()=>{A(),H(),q();const t=J();return t?(se(t),!0):!1}}});exports.MergeTagPlugin=ce;
93
+ `;const i=document.createElement("div");i.className="rte-merge-tag-body";const c=document.createElement("input");c.type="text",c.className="rte-merge-tag-input",c.placeholder="Search merge tags...",c.setAttribute("aria-label","Search merge tags");const d=document.createElement("div");d.className="rte-merge-tag-tabs",L.forEach(a=>{const l=document.createElement("button");l.type="button",l.className="rte-merge-tag-tab",l.setAttribute("data-category",a),l.textContent=R[a].name,d.appendChild(l)});const g=document.createElement("div");g.className="rte-merge-tag-list";const u=document.createElement("div");u.className="rte-merge-tag-preview",i.appendChild(c),i.appendChild(d),i.appendChild(g),i.appendChild(u);const f=document.createElement("div");f.className="rte-merge-tag-footer";const x=document.createElement("button");x.type="button",x.className="rte-merge-tag-btn-secondary",x.textContent="Cancel";const p=document.createElement("button");p.type="button",p.className="rte-merge-tag-btn-primary",p.textContent="Insert",f.appendChild(x),f.appendChild(p),n.appendChild(o),n.appendChild(i),n.appendChild(f),r.appendChild(n),document.body.appendChild(r),k=r;const D=()=>{d.querySelectorAll(".rte-merge-tag-tab").forEach(l=>{const m=l.dataset.category===e.category;l.classList.toggle("active",m)})},w=()=>{if(e.filteredTags.length===0){e.selectedIndex=-1;return}e.selectedIndex<0&&(e.selectedIndex=0),e.selectedIndex>=e.filteredTags.length&&(e.selectedIndex=e.filteredTags.length-1)},I=()=>{w();const a=e.selectedIndex>=0?e.filteredTags[e.selectedIndex]:null;if(!a){u.style.display="none",p.disabled=!0;return}u.style.display="block",u.innerHTML=`<strong>Preview:</strong> {{ ${a.label} }}`,p.disabled=!1},K=()=>{if(e.selectedIndex<0)return;g.querySelector(`.rte-merge-tag-item[data-index="${e.selectedIndex}"]`)?.scrollIntoView({block:"nearest"})},h=()=>{if(e.filteredTags=le(e.category,e.searchTerm),e.filteredTags.length>0&&e.selectedIndex<0&&(e.selectedIndex=0),w(),g.innerHTML="",e.filteredTags.length===0){const l=document.createElement("div");l.className="rte-merge-tag-empty",l.textContent="No merge tags found",g.appendChild(l),I();return}const a=document.createDocumentFragment();e.filteredTags.forEach((l,m)=>{const s=document.createElement("div");s.className="rte-merge-tag-item",s.setAttribute("data-index",String(m)),s.classList.toggle("selected",m===e.selectedIndex);const N=document.createElement("div");if(N.className="rte-merge-tag-item-label",N.textContent=l.label,s.appendChild(N),l.preview){const S=document.createElement("div");S.className="rte-merge-tag-item-preview",S.textContent=l.preview,s.appendChild(S)}a.appendChild(s)}),g.appendChild(a),I(),K()},M=()=>{e.searchRaf!==null&&cancelAnimationFrame(e.searchRaf),e.searchRaf=requestAnimationFrame(()=>{e.searchRaf=null,e.searchTerm=c.value,e.selectedIndex=0,h()})},b=()=>{e.searchRaf!==null&&(cancelAnimationFrame(e.searchRaf),e.searchRaf=null),r.remove(),k===r&&(k=null,y=null)},E=()=>{if(w(),e.selectedIndex<0)return;const a=e.filteredTags[e.selectedIndex];ie(t,e.savedRange,a)&&b()},O=a=>{const m=a.target.closest(".rte-merge-tag-tab");if(!m)return;const s=m.dataset.category;!s||!L.includes(s)||(e.category=s,e.searchTerm="",c.value="",e.selectedIndex=0,D(),h())},_=a=>{const m=a.target.closest(".rte-merge-tag-item");if(!m)return;const s=Number(m.dataset.index||"-1");Number.isNaN(s)||s<0||s>=e.filteredTags.length||(e.selectedIndex=s,h())},F=a=>{const m=a.target.closest(".rte-merge-tag-item");if(!m)return;const s=Number(m.dataset.index||"-1");Number.isNaN(s)||s<0||s>=e.filteredTags.length||(e.selectedIndex=s,E())},T=a=>{if(a.key==="Escape"){a.preventDefault(),b();return}if(a.key==="ArrowDown"){if(a.preventDefault(),e.filteredTags.length===0)return;e.selectedIndex=Math.min(e.filteredTags.length-1,e.selectedIndex+1),h();return}if(a.key==="ArrowUp"){if(a.preventDefault(),e.filteredTags.length===0)return;e.selectedIndex=Math.max(0,e.selectedIndex-1),h();return}a.key==="Enter"&&(a.preventDefault(),E())},U=a=>{a.target===r&&b()},z=o.querySelector(".rte-merge-tag-close");d.addEventListener("click",O),g.addEventListener("click",_),g.addEventListener("dblclick",F),c.addEventListener("input",M),c.addEventListener("keydown",T),r.addEventListener("click",U),n.addEventListener("keydown",T),z?.addEventListener("click",b),x.addEventListener("click",b),p.addEventListener("click",E),y=()=>{d.removeEventListener("click",O),g.removeEventListener("click",_),g.removeEventListener("dblclick",F),c.removeEventListener("input",M),c.removeEventListener("keydown",T),r.removeEventListener("click",U),n.removeEventListener("keydown",T),z?.removeEventListener("click",b),x.removeEventListener("click",b),p.removeEventListener("click",E),e.searchRaf!==null&&(cancelAnimationFrame(e.searchRaf),e.searchRaf=null),r.remove()},D(),h(),setTimeout(()=>{c.focus()},0)}const ce=()=>({name:"mergeTag",init:()=>{A(),H(),q()},toolbar:[{label:"Merge Tag",command:"insertMergeTag",icon:"{{ }}"}],commands:{insertMergeTag:()=>{A(),H(),q();const t=J();return t?(se(t),!0):!1}}});exports.MergeTagPlugin=ce;
@@ -1,4 +1,4 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const d='.rte-page-break[data-type="page-break"]',g=".rte-content, .editora-content";let p=null,m=!1;const v=new Set(["DIV","P","BLOCKQUOTE","PRE","H1","H2","H3","H4","H5","H6","LI","TD","TH"]),x=()=>{p||typeof document>"u"||(p=document.createElement("style"),p.textContent=`
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const d='.rte-page-break[data-type="page-break"]',g=".rte-content, .editora-content";let p=null,m=!1;const k=new Set(["DIV","P","BLOCKQUOTE","PRE","H1","H2","H3","H4","H5","H6","LI","TD","TH"]),x=()=>{p||typeof document>"u"||(p=document.createElement("style"),p.textContent=`
2
2
  .rte-page-break {
3
3
  display: block;
4
4
  position: relative;
@@ -69,4 +69,4 @@
69
69
  display: none;
70
70
  }
71
71
  }
72
- `,document.head.appendChild(p))},N=()=>{const e=window.getSelection();if(!e||e.rangeCount===0)return null;const n=e.getRangeAt(0);return(n.startContainer.nodeType===Node.ELEMENT_NODE?n.startContainer:n.startContainer.parentElement)?.closest(g)||null},h=()=>{const e=N();if(e)return e;const t=document.activeElement?.closest(g);return t||document.querySelector(g)},C=(e,n)=>{let t=e;for(;t&&t!==n;){if(t.nodeType===Node.ELEMENT_NODE){const r=t;if(v.has(r.tagName))return r}t=t.parentNode}return null},S=()=>{const e=document.createElement("div");return e.className="rte-page-break",e.setAttribute("data-page-break","true"),e.setAttribute("data-type","page-break"),e.setAttribute("contenteditable","false"),e.setAttribute("tabindex","0"),e.setAttribute("role","separator"),e.setAttribute("aria-label","Page break"),e},w=e=>{let n=e.nextElementSibling;for(;n&&n.matches(d);){const r=n;n=n.nextElementSibling,r.remove()}let t=e.previousElementSibling;for(;t&&t.matches(d);){const r=t;t=t.previousElementSibling,r.remove()}},k=e=>{const n=e.nextElementSibling;if(n&&!n.matches(d))return n;const t=document.createElement("p");return t.innerHTML="<br>",e.parentNode?.insertBefore(t,e.nextSibling),t},u=e=>{const n=window.getSelection();if(!n)return;const t=document.createRange();e.nodeType,Node.TEXT_NODE,t.setStart(e,0),t.collapse(!0),n.removeAllRanges(),n.addRange(t)},b=e=>{const n=window.getSelection();if(!n)return;const t=document.createRange();if(e.nodeType===Node.TEXT_NODE){const r=e;t.setStart(r,r.data.length)}else t.selectNodeContents(e),t.collapse(!1);n.removeAllRanges(),n.addRange(t)},f=(e,n)=>{let t=e;for(;t;){if(!(t instanceof HTMLElement&&t.matches(d)))return t;t=n==="previous"?t.previousSibling:t.nextSibling}return null},A=e=>{const n=window.getSelection();if(!n||!e.parentNode)return;const t=e.parentNode,r=Array.from(t.childNodes).indexOf(e);if(r<0)return;const o=document.createRange();o.setStart(t,r),o.setEnd(t,r+1),n.removeAllRanges(),n.addRange(o),e.focus({preventScroll:!0})},T=e=>{if(e.collapsed||e.startContainer!==e.endContainer||e.endOffset!==e.startOffset+1||!(e.startContainer instanceof Element||e.startContainer instanceof DocumentFragment))return null;const n=e.startContainer.childNodes[e.startOffset];return n instanceof HTMLElement&&n.matches(d)?n:null},L=(e,n,t)=>{if(!e.collapsed)return null;const{startContainer:r,startOffset:o}=e,i=a=>a instanceof HTMLElement&&a.matches(d)?a:null,s=a=>{if(r.nodeType===Node.ELEMENT_NODE){const c=r;if(a==="previous"){if(o>0)return c.childNodes[o-1]||null}else if(o<c.childNodes.length)return c.childNodes[o]||null}if(r.nodeType===Node.TEXT_NODE&&(a==="previous"&&o<r.data.length||a==="next"&&o>0))return null;let l=r;for(;l&&l!==n;){const c=a==="previous"?l.previousSibling:l.nextSibling;if(c)return c;l=l.parentNode}return null};if(r.nodeType===Node.ELEMENT_NODE){const a=r;return t==="Backspace"&&o>0?i(a.childNodes[o-1]||null):t==="Delete"?i(a.childNodes[o]||null):null}if(r.nodeType===Node.TEXT_NODE){const a=r;if(t==="Backspace"&&o===0){const l=i(a.previousSibling);return l||i(s("previous"))}if(t==="Delete"&&o===a.data.length){const l=i(a.nextSibling);return l||i(s("next"))}}return i(s(t==="Backspace"?"previous":"next"))},E=(e,n)=>{const t=e.closest(g),r=e.previousSibling,o=e.nextSibling;e.remove();const i=f(r,"previous"),s=f(o,"next");if(n==="Backspace"){if(i)b(i);else if(s)u(s);else if(t){const a=document.createElement("p");a.innerHTML="<br>",t.appendChild(a),u(a)}}else if(s)u(s);else if(i)b(i);else if(t){const a=document.createElement("p");a.innerHTML="<br>",t.appendChild(a),u(a)}return t&&t.dispatchEvent(new Event("input",{bubbles:!0})),!0},R=()=>{const e=h();if(!e)return!1;const n=window.getSelection();if(!n)return!1;let t;n.rangeCount>0&&e.contains(n.getRangeAt(0).commonAncestorContainer)?t=n.getRangeAt(0):(t=document.createRange(),t.selectNodeContents(e),t.collapse(!1),n.removeAllRanges(),n.addRange(t));const r=C(t.endContainer,e)||C(t.startContainer,e),o=S();r&&r.parentNode?r.parentNode.insertBefore(o,r.nextSibling):e.appendChild(o),w(o);const i=k(o);return u(i),e.dispatchEvent(new Event("input",{bubbles:!0})),!0},B=()=>{m||typeof document>"u"||(m=!0,document.addEventListener("click",e=>{const t=e.target?.closest(d);t&&(e.preventDefault(),e.stopPropagation(),A(t))}),document.addEventListener("keydown",e=>{const n=e.key;if(!["Backspace","Delete","ArrowUp","ArrowDown","ArrowLeft","ArrowRight"].includes(n))return;const t=window.getSelection();if(!t||t.rangeCount===0)return;const r=t.getRangeAt(0),o=h();if(!o||!o.contains(r.commonAncestorContainer))return;const i=T(r);if(i){if(n==="Backspace"||n==="Delete"){e.preventDefault(),e.stopPropagation(),E(i,n);return}if(n==="ArrowRight"||n==="ArrowDown"){e.preventDefault();const s=f(i.nextSibling,"next")||k(i);u(s);return}if(n==="ArrowLeft"||n==="ArrowUp"){e.preventDefault();const s=f(i.previousSibling,"previous");s?b(s):u(o);return}}if(n==="Backspace"||n==="Delete"){const s=L(r,o,n);if(!s)return;e.preventDefault(),e.stopPropagation(),E(s,n)}}))},P=()=>(x(),B(),{name:"pageBreak",toolbar:[{label:"Page Break",command:"insertPageBreak",icon:'<svg fill="#000000" width="24px" height="24px" viewBox="0 0 14 14" xmlns="http://www.w3.org/2000/svg"><g id="SVGRepo_bgCarrier" stroke-width="0"></g><g id="SVGRepo_tracerCarrier" stroke-linecap="round" stroke-linejoin="round"></g><g id="SVGRepo_iconCarrier"><path d="M1,6 L3,6 C3.55228475,6 4,6.44771525 4,7 C4,7.55228475 3.55228475,8 3,8 L1,8 C0.44771525,8 0,7.55228475 0,7 C0,6.44771525 0.44771525,6 1,6 Z M11,6 L13,6 C13.5522847,6 14,6.44771525 14,7 C14,7.55228475 13.5522847,8 13,8 L11,8 C10.4477153,8 10,7.55228475 10,7 C10,6.44771525 10.4477153,6 11,6 Z M6,6 L8,6 C8.55228475,6 9,6.44771525 9,7 C9,7.55228475 8.55228475,8 8,8 L6,8 C5.44771525,8 5,7.55228475 5,7 C5,6.44771525 5.44771525,6 6,6 Z M0,1 C0,0.44771525 0.44771525,-2.26485497e-13 1,-2.26485497e-13 C1.55228475,-2.26485497e-13 2,0.44771525 2,1 L2,3.0142458 L12,3.0142458 L12,1 C12,0.44771525 12.4477153,-2.26485497e-13 13,-2.26485497e-13 C13.5522847,-2.26485497e-13 14,0.44771525 14,1 L14,3.0142458 C14,4.1188153 13.1045695,5.0142458 12,5.0142458 L2,5.0142458 C0.8954305,5.0142458 0,4.1188153 0,3.0142458 L0,1 Z M0,13.0142458 L0,11 C0,9.8954305 0.8954305,9 2,9 L12,9 C13.1045695,9 14,9.8954305 14,11 L14,13.0142458 C14,13.5665305 13.5522847,14.0142458 13,14.0142458 C12.4477153,14.0142458 12,13.5665305 12,13.0142458 L12,11 L2,11 L2,13.0142458 C2,13.5665305 1.55228475,14.0142458 1,14.0142458 C0.44771525,14.0142458 0,13.5665305 0,13.0142458 Z"></path></g></svg>',shortcut:"Mod-Enter"}],commands:{insertPageBreak:R},keymap:{"Mod-Enter":"insertPageBreak"}});exports.PageBreakPlugin=P;
72
+ `,document.head.appendChild(p))},N=()=>{const e=window.getSelection();if(!e||e.rangeCount===0)return null;const n=e.getRangeAt(0);return(n.startContainer.nodeType===Node.ELEMENT_NODE?n.startContainer:n.startContainer.parentElement)?.closest(g)||null},v=()=>{const e=N();if(e)return e;const t=document.activeElement?.closest(g);return t||document.querySelector(g)},C=(e,n)=>{let t=e;for(;t&&t!==n;){if(t.nodeType===Node.ELEMENT_NODE){const r=t;if(k.has(r.tagName))return r}t=t.parentNode}return null},S=()=>{const e=document.createElement("div");return e.className="rte-page-break",e.setAttribute("data-page-break","true"),e.setAttribute("data-type","page-break"),e.setAttribute("contenteditable","false"),e.setAttribute("tabindex","0"),e.setAttribute("role","separator"),e.setAttribute("aria-label","Page break"),e},w=e=>{let n=e.nextElementSibling;for(;n&&n.matches(d);){const r=n;n=n.nextElementSibling,r.remove()}let t=e.previousElementSibling;for(;t&&t.matches(d);){const r=t;t=t.previousElementSibling,r.remove()}},h=e=>{const n=e.nextElementSibling;if(n&&!n.matches(d))return n;const t=document.createElement("p");return t.innerHTML="<br>",e.parentNode?.insertBefore(t,e.nextSibling),t},u=e=>{const n=window.getSelection();if(!n)return;const t=document.createRange();e.nodeType,Node.TEXT_NODE,t.setStart(e,0),t.collapse(!0),n.removeAllRanges(),n.addRange(t)},b=e=>{const n=window.getSelection();if(!n)return;const t=document.createRange();if(e.nodeType===Node.TEXT_NODE){const r=e;t.setStart(r,r.data.length)}else t.selectNodeContents(e),t.collapse(!1);n.removeAllRanges(),n.addRange(t)},f=(e,n)=>{let t=e;for(;t;){if(!(t instanceof HTMLElement&&t.matches(d)))return t;t=n==="previous"?t.previousSibling:t.nextSibling}return null},A=e=>{const n=window.getSelection();if(!n||!e.parentNode)return;const t=e.parentNode,r=Array.from(t.childNodes).indexOf(e);if(r<0)return;const o=document.createRange();o.setStart(t,r),o.setEnd(t,r+1),n.removeAllRanges(),n.addRange(o),e.focus({preventScroll:!0})},T=e=>{if(e.collapsed||e.startContainer!==e.endContainer||e.endOffset!==e.startOffset+1||!(e.startContainer instanceof Element||e.startContainer instanceof DocumentFragment))return null;const n=e.startContainer.childNodes[e.startOffset];return n instanceof HTMLElement&&n.matches(d)?n:null},L=(e,n,t)=>{if(!e.collapsed)return null;const{startContainer:r,startOffset:o}=e,i=a=>a instanceof HTMLElement&&a.matches(d)?a:null,s=a=>{if(r.nodeType===Node.ELEMENT_NODE){const c=r;if(a==="previous"){if(o>0)return c.childNodes[o-1]||null}else if(o<c.childNodes.length)return c.childNodes[o]||null}if(r.nodeType===Node.TEXT_NODE&&(a==="previous"&&o<r.data.length||a==="next"&&o>0))return null;let l=r;for(;l&&l!==n;){const c=a==="previous"?l.previousSibling:l.nextSibling;if(c)return c;l=l.parentNode}return null};if(r.nodeType===Node.ELEMENT_NODE){const a=r;return t==="Backspace"&&o>0?i(a.childNodes[o-1]||null):t==="Delete"?i(a.childNodes[o]||null):null}if(r.nodeType===Node.TEXT_NODE){const a=r;if(t==="Backspace"&&o===0){const l=i(a.previousSibling);return l||i(s("previous"))}if(t==="Delete"&&o===a.data.length){const l=i(a.nextSibling);return l||i(s("next"))}}return i(s(t==="Backspace"?"previous":"next"))},E=(e,n)=>{const t=e.closest(g),r=e.previousSibling,o=e.nextSibling;e.remove();const i=f(r,"previous"),s=f(o,"next");if(n==="Backspace"){if(i)b(i);else if(s)u(s);else if(t){const a=document.createElement("p");a.innerHTML="<br>",t.appendChild(a),u(a)}}else if(s)u(s);else if(i)b(i);else if(t){const a=document.createElement("p");a.innerHTML="<br>",t.appendChild(a),u(a)}return t&&t.dispatchEvent(new Event("input",{bubbles:!0})),!0},R=()=>{const e=v();if(!e)return!1;const n=window.getSelection();if(!n)return!1;let t;n.rangeCount>0&&e.contains(n.getRangeAt(0).commonAncestorContainer)?t=n.getRangeAt(0):(t=document.createRange(),t.selectNodeContents(e),t.collapse(!1),n.removeAllRanges(),n.addRange(t));const r=C(t.endContainer,e)||C(t.startContainer,e),o=S();r&&r.parentNode?r.parentNode.insertBefore(o,r.nextSibling):e.appendChild(o),w(o);const i=h(o);return u(i),e.dispatchEvent(new Event("input",{bubbles:!0})),!0},B=()=>{m||typeof document>"u"||(m=!0,document.addEventListener("click",e=>{const t=e.target?.closest(d);t&&(e.preventDefault(),e.stopPropagation(),A(t))}),document.addEventListener("keydown",e=>{const n=e.key;if(!["Backspace","Delete","ArrowUp","ArrowDown","ArrowLeft","ArrowRight"].includes(n))return;const t=window.getSelection();if(!t||t.rangeCount===0)return;const r=t.getRangeAt(0),o=v();if(!o||!o.contains(r.commonAncestorContainer))return;const i=T(r);if(i){if(n==="Backspace"||n==="Delete"){e.preventDefault(),e.stopPropagation(),E(i,n);return}if(n==="ArrowRight"||n==="ArrowDown"){e.preventDefault();const s=f(i.nextSibling,"next")||h(i);u(s);return}if(n==="ArrowLeft"||n==="ArrowUp"){e.preventDefault();const s=f(i.previousSibling,"previous");s?b(s):u(o);return}}if(n==="Backspace"||n==="Delete"){const s=L(r,o,n);if(!s)return;e.preventDefault(),e.stopPropagation(),E(s,n)}}))},P=()=>(x(),B(),{name:"pageBreak",toolbar:[{label:"Page Break",command:"insertPageBreak",icon:'<svg fill="#000000" width="24px" height="24px" viewBox="0 0 14 14" xmlns="http://www.w3.org/2000/svg"><g id="SVGRepo_bgCarrier" stroke-width="0"></g><g id="SVGRepo_tracerCarrier" stroke-linecap="round" stroke-linejoin="round"></g><g id="SVGRepo_iconCarrier"><path d="M1,6 L3,6 C3.55228475,6 4,6.44771525 4,7 C4,7.55228475 3.55228475,8 3,8 L1,8 C0.44771525,8 0,7.55228475 0,7 C0,6.44771525 0.44771525,6 1,6 Z M11,6 L13,6 C13.5522847,6 14,6.44771525 14,7 C14,7.55228475 13.5522847,8 13,8 L11,8 C10.4477153,8 10,7.55228475 10,7 C10,6.44771525 10.4477153,6 11,6 Z M6,6 L8,6 C8.55228475,6 9,6.44771525 9,7 C9,7.55228475 8.55228475,8 8,8 L6,8 C5.44771525,8 5,7.55228475 5,7 C5,6.44771525 5.44771525,6 6,6 Z M0,1 C0,0.44771525 0.44771525,-2.26485497e-13 1,-2.26485497e-13 C1.55228475,-2.26485497e-13 2,0.44771525 2,1 L2,3.0142458 L12,3.0142458 L12,1 C12,0.44771525 12.4477153,-2.26485497e-13 13,-2.26485497e-13 C13.5522847,-2.26485497e-13 14,0.44771525 14,1 L14,3.0142458 C14,4.1188153 13.1045695,5.0142458 12,5.0142458 L2,5.0142458 C0.8954305,5.0142458 0,4.1188153 0,3.0142458 L0,1 Z M0,13.0142458 L0,11 C0,9.8954305 0.8954305,9 2,9 L12,9 C13.1045695,9 14,9.8954305 14,11 L14,13.0142458 C14,13.5665305 13.5522847,14.0142458 13,14.0142458 C12.4477153,14.0142458 12,13.5665305 12,13.0142458 L12,11 L2,11 L2,13.0142458 C2,13.5665305 1.55228475,14.0142458 1,14.0142458 C0.44771525,14.0142458 0,13.5665305 0,13.0142458 Z"></path></g></svg>',shortcut:"Mod-Enter"}],commands:{insertPageBreak:R},keymap:{"Mod-Enter":"insertPageBreak"}});exports.PageBreakPlugin=P;