@editora/plugins 1.0.4 → 1.0.6

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 (48) hide show
  1. package/dist/a11y-checker.cjs.js +1 -1
  2. package/dist/anchor.cjs.js +3 -3
  3. package/dist/background-color.cjs.js +2 -2
  4. package/dist/blockquote.cjs.js +1 -1
  5. package/dist/bold.cjs.js +1 -1
  6. package/dist/capitalization.cjs.js +1 -1
  7. package/dist/checklist.cjs.js +1 -1
  8. package/dist/clear-formatting.cjs.js +1 -1
  9. package/dist/code-sample.cjs.js +7 -7
  10. package/dist/code-sample.esm.js +51 -51
  11. package/dist/code.cjs.js +39 -31
  12. package/dist/code.esm.js +570 -440
  13. package/dist/comments.cjs.js +1 -1
  14. package/dist/direction.cjs.js +1 -1
  15. package/dist/document-manager.cjs.js +1 -1
  16. package/dist/embed-iframe.cjs.js +1 -1
  17. package/dist/emojis.cjs.js +1 -1
  18. package/dist/font-family.cjs.js +1 -1
  19. package/dist/font-size.cjs.js +1 -1
  20. package/dist/footnote.cjs.js +2 -2
  21. package/dist/fullscreen.cjs.js +1 -1
  22. package/dist/heading.cjs.js +1 -1
  23. package/dist/history.cjs.js +1 -1
  24. package/dist/history.esm.js +8 -8
  25. package/dist/indent.cjs.js +1 -1
  26. package/dist/index.cjs.js +1 -1
  27. package/dist/italic.cjs.js +1 -1
  28. package/dist/line-height.cjs.js +1 -1
  29. package/dist/link.cjs.js +3 -3
  30. package/dist/list.cjs.js +1 -1
  31. package/dist/lite.cjs.js +1 -1
  32. package/dist/math.cjs.js +2 -2
  33. package/dist/media-manager.cjs.js +4 -4
  34. package/dist/merge-tag.cjs.js +3 -3
  35. package/dist/merge-tag.esm.js +1 -1
  36. package/dist/page-break.cjs.js +2 -2
  37. package/dist/preview.cjs.js +3 -3
  38. package/dist/print.cjs.js +1 -1
  39. package/dist/shared-config.cjs.js +1 -1
  40. package/dist/special-characters.cjs.js +3 -3
  41. package/dist/spell-check.cjs.js +1 -1
  42. package/dist/strikethrough.cjs.js +1 -1
  43. package/dist/table.cjs.js +3 -3
  44. package/dist/template.cjs.js +5 -5
  45. package/dist/text-alignment.cjs.js +1 -1
  46. package/dist/text-color.cjs.js +1 -1
  47. package/dist/underline.cjs.js +1 -1
  48. package/package.json +91 -47
@@ -1,4 +1,4 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const B=new Set,v=[],f=t=>{v.push(t)},x='[data-theme="dark"], .dark, .editora-theme-dark';f({id:"image-alt-text",wcag:"1.1.1",description:"Images must have alt text",severity:"error",selector:"img",evaluate(t,n){const e=t;return e.hasAttribute("role")&&e.getAttribute("role")==="presentation"||e.hasAttribute("data-a11y-ignore")&&e.getAttribute("data-a11y-ignore")==="image-alt-text"?null:!e.hasAttribute("alt")||e.getAttribute("alt")?.trim()===""?{id:`img-alt-${n.cache.get("imgIdx")}`,rule:"image-alt-text",wcag:"1.1.1",severity:"error",message:"Image missing alt text",nodePath:n.cache.get("imgPath"),element:e,suggestion:"Add descriptive alt text to all images",fixable:!0,fixLabel:"Add empty alt"}:null},fix(t){t.element&&t.element.setAttribute("alt","")}});f({id:"empty-interactive",wcag:"4.1.2",description:"Interactive elements must have accessible names",severity:"error",selector:'button, a, [role="button"]',evaluate(t,n){const e=t;if(e.hasAttribute("data-a11y-ignore")&&e.getAttribute("data-a11y-ignore")==="empty-interactive")return null;const r=e.textContent?.trim(),a=e.hasAttribute("aria-label"),o=e.hasAttribute("aria-labelledby"),s=e.hasAttribute("title");return!r&&!a&&!o&&!s?{id:`interactive-empty-${n.cache.get("buttonIdx")}`,rule:"empty-interactive",wcag:"4.1.2",severity:"error",message:"Interactive element has no accessible name",nodePath:n.cache.get("buttonPath"),element:e,suggestion:"Add text, aria-label, aria-labelledby, or title",fixable:!0,fixLabel:"Add aria-label"}:null},fix(t){t.element&&t.element.setAttribute("aria-label","Button")}});f({id:"form-label",wcag:"1.3.1",description:"Form controls must have labels",severity:"error",selector:"input, textarea, select",evaluate(t,n){const e=t;if(e.hasAttribute("type")&&e.getAttribute("type")==="hidden"||e.hasAttribute("data-a11y-ignore")&&e.getAttribute("data-a11y-ignore")==="form-label")return null;const r=n.doc.querySelector(`label[for="${e.getAttribute("id")}"]`),a=e.hasAttribute("aria-label"),o=e.hasAttribute("aria-labelledby");return!r&&!a&&!o?{id:`form-label-${n.cache.get("inputIdx")}`,rule:"form-label",wcag:"1.3.1",severity:"error",message:"Form control missing label",nodePath:n.cache.get("inputPath"),element:e,suggestion:"Add <label>, aria-label, or aria-labelledby",fixable:!0,fixLabel:"Add aria-label"}:null},fix(t){t.element&&t.element.setAttribute("aria-label","Input")}});f({id:"table-headers",wcag:"1.3.1",description:"Tables must have header rows",severity:"error",selector:"table",evaluate(t,n){const e=t;if(e.hasAttribute("data-a11y-ignore")&&e.getAttribute("data-a11y-ignore")==="table-headers")return null;const r=e.querySelectorAll("th"),a=e.querySelectorAll("tr");return r.length===0&&a.length>0?{id:`table-no-headers-${n.cache.get("tableIdx")}`,rule:"table-headers",wcag:"1.3.1",severity:"error",message:"Table missing header row (<th> elements)",nodePath:n.cache.get("tablePath"),element:e,suggestion:"Add <th> elements to first row",fixable:!0,fixLabel:"Convert first row to headers"}:null},fix(t){if(t.element){const e=t.element.querySelector("tr");e&&Array.from(e.children).forEach(r=>{if(r.tagName==="TD"){const a=document.createElement("th");a.innerHTML=r.innerHTML,e.replaceChild(a,r)}})}}});f({id:"heading-empty",wcag:"1.3.1",description:"Headings must not be empty",severity:"error",selector:"h1, h2, h3, h4, h5, h6",evaluate(t,n){const e=t;if(e.hasAttribute("data-a11y-ignore")&&e.getAttribute("data-a11y-ignore")==="heading-empty")return null;const r=e.textContent?.replace(/\s+/g,"")||"",a=e.childNodes.length===1&&e.childNodes[0].nodeName==="BR";return!r&&!a?{id:`heading-empty-${n.cache.get("headingIdx")}`,rule:"heading-empty",wcag:"1.3.1",severity:"error",message:`Empty ${e.tagName.toLowerCase()} heading`,nodePath:n.cache.get("headingPath"),element:e,suggestion:"All headings must contain text",fixable:!1}:null}});f({id:"heading-order",wcag:"1.3.1",description:"Headings should not skip levels",severity:"warning",selector:"h1, h2, h3, h4, h5, h6",evaluate(t,n){const e=t,r=parseInt(e.tagName[1]),a=n.cache.get("previousHeadingLevel")||r;return n.cache.set("previousHeadingLevel",r),r-a>1?{id:`heading-order-${n.cache.get("headingIdx")}`,rule:"heading-order",wcag:"1.3.1",severity:"warning",message:`Heading skips level (${a} → ${r})`,nodePath:n.cache.get("headingPath"),element:e,suggestion:`Use heading level ${a+1} instead`,fixable:!1}:null}});f({id:"link-text",wcag:"2.4.4",description:"Links must have descriptive text",severity:"error",selector:"a",evaluate(t,n){const e=t;if(e.hasAttribute("data-a11y-ignore")&&e.getAttribute("data-a11y-ignore")==="link-text")return null;const r=e.textContent?.replace(/\s+/g,"").toLowerCase()||"",a=e.childNodes.length===1&&e.childNodes[0].nodeName==="BR",o=["clickhere","readmore","link","here","this","page"];return!r&&!a?{id:`link-empty-${n.cache.get("aIdx")}`,rule:"link-text",wcag:"2.4.4",severity:"error",message:"Link has no text content",nodePath:n.cache.get("aPath"),element:e,suggestion:"All links must have descriptive text",fixable:!0,fixLabel:"Insert placeholder"}:o.some(s=>r.includes(s))?{id:`link-vague-${n.cache.get("aIdx")}`,rule:"link-text",wcag:"2.4.4",severity:"warning",message:`Vague link text: "${e.textContent?.trim()}"`,nodePath:n.cache.get("aPath"),element:e,suggestion:"Use descriptive link text",fixable:!1}:null},fix(t){t.element&&(t.element.textContent="Link")}});f({id:"list-structure",wcag:"1.3.1",description:"Lists must only contain <li> children",severity:"error",selector:"ul, ol",evaluate(t,n){const e=t;if(e.hasAttribute("data-a11y-ignore")&&e.getAttribute("data-a11y-ignore")==="list-structure")return null;const r=e.querySelectorAll(":scope > li");return Array.from(e.children).filter(o=>o.tagName!=="LI").length>0?{id:`list-structure-${n.cache.get("ulIdx")}`,rule:"list-structure",wcag:"1.3.1",severity:"error",message:"List contains non-li elements",nodePath:n.cache.get("ulPath"),element:e,suggestion:"All direct children of ul/ol must be li elements",fixable:!1}:r.length===0?{id:`list-empty-${n.cache.get("ulIdx")}`,rule:"list-structure",wcag:"1.3.1",severity:"warning",message:"Empty list element",nodePath:n.cache.get("ulPath"),element:e,suggestion:"Remove empty lists or add list items",fixable:!1}:null}});const A=()=>{const t=window.getSelection();if(t&&t.rangeCount>0){let e=t.getRangeAt(0).startContainer;for(;e&&e!==document.body;){if(e.nodeType===Node.ELEMENT_NODE){const r=e;if(r.getAttribute("contenteditable")==="true")return r}e=e.parentNode}}const n=document.activeElement;if(n){if(n.getAttribute("contenteditable")==="true")return n;const e=n.closest('[contenteditable="true"]');if(e)return e}return document.querySelector('[contenteditable="true"]')},T=()=>{if(A()?.closest(x))return!0;const n=window.getSelection();if(n&&n.rangeCount>0){const r=n.getRangeAt(0).startContainer;if((r.nodeType===Node.ELEMENT_NODE?r:r.parentElement)?.closest(x))return!0}return document.activeElement?.closest(x)?!0:document.body.matches(x)||document.documentElement.matches(x)},w=()=>{const t=A();if(!t)return[];const n=[],e={doc:t.ownerDocument||document,cache:new Map},r=e.doc.createTreeWalker(t,NodeFilter.SHOW_ELEMENT,null);let a=r.currentNode,o={},s={},p=0;for(;a&&p<5e3;){const h=a,i=h.tagName?.toLowerCase?.()||"";if(h.hidden||h.style.display==="none"||h.style.visibility==="hidden"){a=r.nextNode(),p++;continue}o[i]=(o[i]||0)+1,s[i]=`${i}[${o[i]-1}]`;for(const u of v){if(B.has(u.id)||u.selector&&!a.matches?.(u.selector))continue;e.cache.set(`${i}Idx`,o[i]-1),e.cache.set(`${i}Path`,s[i]),/^h[1-6]$/.test(i)&&(e.cache.set("headingIdx",o[i]-1),e.cache.set("headingPath",s[i])),i==="a"&&(e.cache.set("aIdx",o[i]-1),e.cache.set("aPath",s[i])),i==="table"&&(e.cache.set("tableIdx",o[i]-1),e.cache.set("tablePath",s[i])),i==="button"&&(e.cache.set("buttonIdx",o[i]-1),e.cache.set("buttonPath",s[i])),i==="input"&&(e.cache.set("inputIdx",o[i]-1),e.cache.set("inputPath",s[i])),(i==="ul"||i==="ol")&&(e.cache.set("ulIdx",o[i]-1),e.cache.set("ulPath",s[i]));const m=u.evaluate(a,e);m&&n.push(m)}a=r.nextNode(),p++}return n},b=(t,n=!0)=>{t.element&&(n?(t.element.classList.add("a11y-highlighted"),t.element.style.outline="2px solid #ff9800",t.element.style.backgroundColor="#fff3cd"):(t.element.classList.remove("a11y-highlighted"),t.element.style.outline="",t.element.style.backgroundColor=""))},I=t=>{t||(t=w());const n=t.filter(a=>a.severity==="error").length,e=t.filter(a=>a.severity==="warning").length;let r=100-n*20-e*5;return Math.max(0,r)},P=t=>{const n=v.find(e=>e.id===t.rule);n&&n.fix&&n.fix(t)},k=()=>{const t=w(),n=I(t),r=T()?{overlay:"rgba(0, 0, 0, 0.62)",dialogBg:"#1f2937",panelBg:"#222d3a",border:"#3b4657",text:"#e2e8f0",muted:"#9fb0c6",closeHover:"#334155",summaryBg:"#111827",issueBg:"#1f2937",issueHoverBg:"#273244",issueBorder:"#4b5563",issueHoverBorder:"#58a6ff",fixBtn:"#3b82f6",fixBtnHover:"#2563eb"}:{overlay:"rgba(0, 0, 0, 0.5)",dialogBg:"#ffffff",panelBg:"#ffffff",border:"#e0e0e0",text:"#1f2937",muted:"#666666",closeHover:"#f0f0f0",summaryBg:"#f5f5f5",issueBg:"#ffffff",issueHoverBg:"#f5f9ff",issueBorder:"#e0e0e0",issueHoverBorder:"#2196f3",fixBtn:"#2196f3",fixBtnHover:"#1976d2"},a=document.createElement("div");a.className="a11y-dialog-overlay",a.style.cssText=`
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const B=new Set,v=[],f=t=>{v.push(t)},x='[data-theme="dark"], .dark, .editora-theme-dark';f({id:"image-alt-text",wcag:"1.1.1",description:"Images must have alt text",severity:"error",selector:"img",evaluate(t,n){const e=t;return e.hasAttribute("role")&&e.getAttribute("role")==="presentation"||e.hasAttribute("data-a11y-ignore")&&e.getAttribute("data-a11y-ignore")==="image-alt-text"?null:!e.hasAttribute("alt")||e.getAttribute("alt")?.trim()===""?{id:`img-alt-${n.cache.get("imgIdx")}`,rule:"image-alt-text",wcag:"1.1.1",severity:"error",message:"Image missing alt text",nodePath:n.cache.get("imgPath"),element:e,suggestion:"Add descriptive alt text to all images",fixable:!0,fixLabel:"Add empty alt"}:null},fix(t){t.element&&t.element.setAttribute("alt","")}});f({id:"empty-interactive",wcag:"4.1.2",description:"Interactive elements must have accessible names",severity:"error",selector:'button, a, [role="button"]',evaluate(t,n){const e=t;if(e.hasAttribute("data-a11y-ignore")&&e.getAttribute("data-a11y-ignore")==="empty-interactive")return null;const r=e.textContent?.trim(),a=e.hasAttribute("aria-label"),o=e.hasAttribute("aria-labelledby"),s=e.hasAttribute("title");return!r&&!a&&!o&&!s?{id:`interactive-empty-${n.cache.get("buttonIdx")}`,rule:"empty-interactive",wcag:"4.1.2",severity:"error",message:"Interactive element has no accessible name",nodePath:n.cache.get("buttonPath"),element:e,suggestion:"Add text, aria-label, aria-labelledby, or title",fixable:!0,fixLabel:"Add aria-label"}:null},fix(t){t.element&&t.element.setAttribute("aria-label","Button")}});f({id:"form-label",wcag:"1.3.1",description:"Form controls must have labels",severity:"error",selector:"input, textarea, select",evaluate(t,n){const e=t;if(e.hasAttribute("type")&&e.getAttribute("type")==="hidden"||e.hasAttribute("data-a11y-ignore")&&e.getAttribute("data-a11y-ignore")==="form-label")return null;const r=n.doc.querySelector(`label[for="${e.getAttribute("id")}"]`),a=e.hasAttribute("aria-label"),o=e.hasAttribute("aria-labelledby");return!r&&!a&&!o?{id:`form-label-${n.cache.get("inputIdx")}`,rule:"form-label",wcag:"1.3.1",severity:"error",message:"Form control missing label",nodePath:n.cache.get("inputPath"),element:e,suggestion:"Add <label>, aria-label, or aria-labelledby",fixable:!0,fixLabel:"Add aria-label"}:null},fix(t){t.element&&t.element.setAttribute("aria-label","Input")}});f({id:"table-headers",wcag:"1.3.1",description:"Tables must have header rows",severity:"error",selector:"table",evaluate(t,n){const e=t;if(e.hasAttribute("data-a11y-ignore")&&e.getAttribute("data-a11y-ignore")==="table-headers")return null;const r=e.querySelectorAll("th"),a=e.querySelectorAll("tr");return r.length===0&&a.length>0?{id:`table-no-headers-${n.cache.get("tableIdx")}`,rule:"table-headers",wcag:"1.3.1",severity:"error",message:"Table missing header row (<th> elements)",nodePath:n.cache.get("tablePath"),element:e,suggestion:"Add <th> elements to first row",fixable:!0,fixLabel:"Convert first row to headers"}:null},fix(t){if(t.element){const e=t.element.querySelector("tr");e&&Array.from(e.children).forEach(r=>{if(r.tagName==="TD"){const a=document.createElement("th");a.innerHTML=r.innerHTML,e.replaceChild(a,r)}})}}});f({id:"heading-empty",wcag:"1.3.1",description:"Headings must not be empty",severity:"error",selector:"h1, h2, h3, h4, h5, h6",evaluate(t,n){const e=t;if(e.hasAttribute("data-a11y-ignore")&&e.getAttribute("data-a11y-ignore")==="heading-empty")return null;const r=e.textContent?.replace(/\s+/g,"")||"",a=e.childNodes.length===1&&e.childNodes[0].nodeName==="BR";return!r&&!a?{id:`heading-empty-${n.cache.get("headingIdx")}`,rule:"heading-empty",wcag:"1.3.1",severity:"error",message:`Empty ${e.tagName.toLowerCase()} heading`,nodePath:n.cache.get("headingPath"),element:e,suggestion:"All headings must contain text",fixable:!1}:null}});f({id:"heading-order",wcag:"1.3.1",description:"Headings should not skip levels",severity:"warning",selector:"h1, h2, h3, h4, h5, h6",evaluate(t,n){const e=t,r=parseInt(e.tagName[1]),a=n.cache.get("previousHeadingLevel")||r;return n.cache.set("previousHeadingLevel",r),r-a>1?{id:`heading-order-${n.cache.get("headingIdx")}`,rule:"heading-order",wcag:"1.3.1",severity:"warning",message:`Heading skips level (${a} → ${r})`,nodePath:n.cache.get("headingPath"),element:e,suggestion:`Use heading level ${a+1} instead`,fixable:!1}:null}});f({id:"link-text",wcag:"2.4.4",description:"Links must have descriptive text",severity:"error",selector:"a",evaluate(t,n){const e=t;if(e.hasAttribute("data-a11y-ignore")&&e.getAttribute("data-a11y-ignore")==="link-text")return null;const r=e.textContent?.replace(/\s+/g,"").toLowerCase()||"",a=e.childNodes.length===1&&e.childNodes[0].nodeName==="BR",o=["clickhere","readmore","link","here","this","page"];return!r&&!a?{id:`link-empty-${n.cache.get("aIdx")}`,rule:"link-text",wcag:"2.4.4",severity:"error",message:"Link has no text content",nodePath:n.cache.get("aPath"),element:e,suggestion:"All links must have descriptive text",fixable:!0,fixLabel:"Insert placeholder"}:o.some(s=>r.includes(s))?{id:`link-vague-${n.cache.get("aIdx")}`,rule:"link-text",wcag:"2.4.4",severity:"warning",message:`Vague link text: "${e.textContent?.trim()}"`,nodePath:n.cache.get("aPath"),element:e,suggestion:"Use descriptive link text",fixable:!1}:null},fix(t){t.element&&(t.element.textContent="Link")}});f({id:"list-structure",wcag:"1.3.1",description:"Lists must only contain <li> children",severity:"error",selector:"ul, ol",evaluate(t,n){const e=t;if(e.hasAttribute("data-a11y-ignore")&&e.getAttribute("data-a11y-ignore")==="list-structure")return null;const r=e.querySelectorAll(":scope > li");return Array.from(e.children).filter(o=>o.tagName!=="LI").length>0?{id:`list-structure-${n.cache.get("ulIdx")}`,rule:"list-structure",wcag:"1.3.1",severity:"error",message:"List contains non-li elements",nodePath:n.cache.get("ulPath"),element:e,suggestion:"All direct children of ul/ol must be li elements",fixable:!1}:r.length===0?{id:`list-empty-${n.cache.get("ulIdx")}`,rule:"list-structure",wcag:"1.3.1",severity:"warning",message:"Empty list element",nodePath:n.cache.get("ulPath"),element:e,suggestion:"Remove empty lists or add list items",fixable:!1}:null}});const A=()=>{const t=window.getSelection();if(t&&t.rangeCount>0){let e=t.getRangeAt(0).startContainer;for(;e&&e!==document.body;){if(e.nodeType===Node.ELEMENT_NODE){const r=e;if(r.getAttribute("contenteditable")==="true")return r}e=e.parentNode}}const n=document.activeElement;if(n){if(n.getAttribute("contenteditable")==="true")return n;const e=n.closest('[contenteditable="true"]');if(e)return e}return document.querySelector('[contenteditable="true"]')},T=()=>{if(A()?.closest(x))return!0;const n=window.getSelection();if(n&&n.rangeCount>0){const r=n.getRangeAt(0).startContainer;if((r.nodeType===Node.ELEMENT_NODE?r:r.parentElement)?.closest(x))return!0}return document.activeElement?.closest(x)?!0:document.body.matches(x)||document.documentElement.matches(x)},w=()=>{const t=A();if(!t)return[];const n=[],e={doc:t.ownerDocument||document,cache:new Map},r=e.doc.createTreeWalker(t,NodeFilter.SHOW_ELEMENT,null);let a=r.currentNode,o={},s={},p=0;for(;a&&p<5e3;){const h=a,i=h.tagName?.toLowerCase?.()||"";if(h.hidden||h.style.display==="none"||h.style.visibility==="hidden"){a=r.nextNode(),p++;continue}o[i]=(o[i]||0)+1,s[i]=`${i}[${o[i]-1}]`;for(const u of v){if(B.has(u.id)||u.selector&&!a.matches?.(u.selector))continue;e.cache.set(`${i}Idx`,o[i]-1),e.cache.set(`${i}Path`,s[i]),/^h[1-6]$/.test(i)&&(e.cache.set("headingIdx",o[i]-1),e.cache.set("headingPath",s[i])),i==="a"&&(e.cache.set("aIdx",o[i]-1),e.cache.set("aPath",s[i])),i==="table"&&(e.cache.set("tableIdx",o[i]-1),e.cache.set("tablePath",s[i])),i==="button"&&(e.cache.set("buttonIdx",o[i]-1),e.cache.set("buttonPath",s[i])),i==="input"&&(e.cache.set("inputIdx",o[i]-1),e.cache.set("inputPath",s[i])),(i==="ul"||i==="ol")&&(e.cache.set("ulIdx",o[i]-1),e.cache.set("ulPath",s[i]));const m=u.evaluate(a,e);m&&n.push(m)}a=r.nextNode(),p++}return n},b=(t,n=!0)=>{t.element&&(n?(t.element.classList.add("a11y-highlighted"),t.element.style.outline="2px solid #ff9800",t.element.style.backgroundColor="#fff3cd"):(t.element.classList.remove("a11y-highlighted"),t.element.style.outline="",t.element.style.backgroundColor=""))},I=t=>{t||(t=w());const n=t.filter(a=>a.severity==="error").length,e=t.filter(a=>a.severity==="warning").length;let r=100-n*20-e*5;return Math.max(0,r)},P=t=>{const n=v.find(e=>e.id===t.rule);n&&n.fix&&n.fix(t)},k=()=>{const t=w(),n=I(t),r=T()?{overlay:"rgba(0, 0, 0, 0.62)",dialogBg:"#1f2937",panelBg:"#222d3a",border:"#3b4657",text:"#e2e8f0",muted:"#9fb0c6",closeHover:"#334155",summaryBg:"#111827",issueBg:"#1f2937",issueHoverBg:"#273244",issueBorder:"#4b5563",issueHoverBorder:"#58a6ff",fixBtn:"#3b82f6",fixBtnHover:"#2563eb"}:{overlay:"rgba(0, 0, 0, 0.5)",dialogBg:"#ffffff",panelBg:"#ffffff",border:"#e0e0e0",text:"#1f2937",muted:"#666666",closeHover:"#f0f0f0",summaryBg:"#f5f5f5",issueBg:"#ffffff",issueHoverBg:"#f5f9ff",issueBorder:"#e0e0e0",issueHoverBorder:"#2196f3",fixBtn:"#2196f3",fixBtnHover:"#1976d2"},a=document.createElement("div");a.className="a11y-dialog-overlay",a.style.cssText=`
2
2
  position: fixed;
3
3
  top: 0;
4
4
  left: 0;
@@ -1,4 +1,4 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const w=require("./editorContainerHelpers-CFbfiOJI.js"),h=new Set,m='[data-theme="dark"], .dark, .editora-theme-dark';function z(){if(typeof window>"u"||window.__anchorObserverInitialized)return;window.__anchorObserverInitialized=!0,new MutationObserver(d=>{d.forEach(s=>{s.removedNodes.forEach(r=>{if(r.nodeType===Node.ELEMENT_NODE){const l=r;if(l.classList?.contains("rte-anchor")){const a=l.id;a&&h.delete(a)}l.querySelectorAll?.(".rte-anchor")?.forEach(a=>{const u=a.id;u&&h.delete(u)})}})})}).observe(document.body,{childList:!0,subtree:!0})}function S(o){return!o||o.trim().length===0?{valid:!1,error:"Anchor ID cannot be empty"}:o.length>256?{valid:!1,error:"Anchor ID must be less than 256 characters"}:/^[a-z_]/.test(o)?/^[a-z0-9\-_]+$/.test(o)?{valid:!0,error:""}:{valid:!1,error:"Anchor ID can only contain letters, numbers, hyphens, and underscores"}:{valid:!1,error:"Anchor ID must start with a letter or underscore"}}function R(){const o=w.findEditorContainerFromSelection();if(!o)return;const d=w.getContentElement(o);if(!d)return;const s=d.querySelectorAll(".rte-anchor"),r=new Set;s.forEach(l=>{const e=l.id;e&&r.add(e)}),h.clear(),r.forEach(l=>h.add(l))}function N(o){if(o){const r=o.startContainer;if((r.nodeType===Node.ELEMENT_NODE?r:r.parentElement)?.closest(m))return!0}const d=window.getSelection();if(d&&d.rangeCount>0){const r=d.getRangeAt(0).startContainer;if((r.nodeType===Node.ELEMENT_NODE?r:r.parentElement)?.closest(m))return!0}return document.activeElement?.closest(m)?!0:document.body.matches(m)||document.documentElement.matches(m)}function M(o,d,s,r){R();const l=N(r),e=l?{overlay:"rgba(0, 0, 0, 0.62)",dialogBg:"#1f2937",panelBg:"#222d3a",border:"#3b4657",text:"#e2e8f0",muted:"#94a3b8",closeHoverBg:"#334155",fieldBg:"#111827",fieldFocusBg:"#111827",fieldBorder:"#4b5563",fieldText:"#e2e8f0",fieldErrorBg:"#3f2124",fieldErrorBorder:"#ef4444",cancelBg:"#334155",cancelHover:"#475569",cancelText:"#e2e8f0",saveBg:"#3b82f6",saveHover:"#2563eb",saveDisabledBg:"#374151",saveDisabledText:"#7f8ca1",help:"#9fb0c6",focusRing:"rgba(88, 166, 255, 0.25)",errorRing:"rgba(239, 68, 68, 0.25)"}:{overlay:"rgba(0, 0, 0, 0.5)",dialogBg:"#ffffff",panelBg:"#f9f9f9",border:"#e0e0e0",text:"#333333",muted:"#999999",closeHoverBg:"#e0e0e0",fieldBg:"#ffffff",fieldFocusBg:"#f9f9ff",fieldBorder:"#d0d0d0",fieldText:"#333333",fieldErrorBg:"#ffebee",fieldErrorBorder:"#d32f2f",cancelBg:"#f0f0f0",cancelHover:"#e0e0e0",cancelText:"#333333",saveBg:"#0066cc",saveHover:"#0052a3",saveDisabledBg:"#d0d0d0",saveDisabledText:"#999999",help:"#999999",focusRing:"rgba(0, 102, 204, 0.1)",errorRing:"rgba(211, 47, 47, 0.1)"},a=document.createElement("div");a.className="rte-anchor-dialog-overlay",a.style.cssText=`
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const w=require("./editorContainerHelpers-CFbfiOJI.js"),h=new Set,m='[data-theme="dark"], .dark, .editora-theme-dark';function z(){if(typeof window>"u"||window.__anchorObserverInitialized)return;window.__anchorObserverInitialized=!0,new MutationObserver(d=>{d.forEach(s=>{s.removedNodes.forEach(r=>{if(r.nodeType===Node.ELEMENT_NODE){const l=r;if(l.classList?.contains("rte-anchor")){const a=l.id;a&&h.delete(a)}l.querySelectorAll?.(".rte-anchor")?.forEach(a=>{const u=a.id;u&&h.delete(u)})}})})}).observe(document.body,{childList:!0,subtree:!0})}function S(o){return!o||o.trim().length===0?{valid:!1,error:"Anchor ID cannot be empty"}:o.length>256?{valid:!1,error:"Anchor ID must be less than 256 characters"}:/^[a-z_]/.test(o)?/^[a-z0-9\-_]+$/.test(o)?{valid:!0,error:""}:{valid:!1,error:"Anchor ID can only contain letters, numbers, hyphens, and underscores"}:{valid:!1,error:"Anchor ID must start with a letter or underscore"}}function R(){const o=w.findEditorContainerFromSelection();if(!o)return;const d=w.getContentElement(o);if(!d)return;const s=d.querySelectorAll(".rte-anchor"),r=new Set;s.forEach(l=>{const e=l.id;e&&r.add(e)}),h.clear(),r.forEach(l=>h.add(l))}function N(o){if(o){const r=o.startContainer;if((r.nodeType===Node.ELEMENT_NODE?r:r.parentElement)?.closest(m))return!0}const d=window.getSelection();if(d&&d.rangeCount>0){const r=d.getRangeAt(0).startContainer;if((r.nodeType===Node.ELEMENT_NODE?r:r.parentElement)?.closest(m))return!0}return document.activeElement?.closest(m)?!0:document.body.matches(m)||document.documentElement.matches(m)}function M(o,d,s,r){R();const l=N(r),e=l?{overlay:"rgba(0, 0, 0, 0.62)",dialogBg:"#1f2937",panelBg:"#222d3a",border:"#3b4657",text:"#e2e8f0",muted:"#94a3b8",closeHoverBg:"#334155",fieldBg:"#111827",fieldFocusBg:"#111827",fieldBorder:"#4b5563",fieldText:"#e2e8f0",fieldErrorBg:"#3f2124",fieldErrorBorder:"#ef4444",cancelBg:"#334155",cancelHover:"#475569",cancelText:"#e2e8f0",saveBg:"#3b82f6",saveHover:"#2563eb",saveDisabledBg:"#374151",saveDisabledText:"#7f8ca1",help:"#9fb0c6",focusRing:"rgba(88, 166, 255, 0.25)",errorRing:"rgba(239, 68, 68, 0.25)"}:{overlay:"rgba(0, 0, 0, 0.5)",dialogBg:"#ffffff",panelBg:"#f9f9f9",border:"#e0e0e0",text:"#333333",muted:"#999999",closeHoverBg:"#e0e0e0",fieldBg:"#ffffff",fieldFocusBg:"#f9f9ff",fieldBorder:"#d0d0d0",fieldText:"#333333",fieldErrorBg:"#ffebee",fieldErrorBorder:"#d32f2f",cancelBg:"#f0f0f0",cancelHover:"#e0e0e0",cancelText:"#333333",saveBg:"#0066cc",saveHover:"#0052a3",saveDisabledBg:"#d0d0d0",saveDisabledText:"#999999",help:"#999999",focusRing:"rgba(0, 102, 204, 0.1)",errorRing:"rgba(211, 47, 47, 0.1)"},a=document.createElement("div");a.className="rte-anchor-dialog-overlay",a.style.cssText=`
2
2
  position: fixed;
3
3
  top: 0;
4
4
  left: 0;
@@ -91,7 +91,7 @@
91
91
  transition: all 0.2s ease;
92
92
  background: ${e.saveBg};
93
93
  color: white;
94
- `,n.disabled=!t.value.trim();const $=()=>{t.value.trim()?(n.disabled=!1,n.style.background=e.saveBg,n.style.color="white",n.style.cursor="pointer"):(n.disabled=!0,n.style.background=e.saveDisabledBg,n.style.color=e.saveDisabledText,n.style.cursor="not-allowed")};n.onmouseover=()=>{n.disabled||(n.style.background=e.saveHover,n.style.boxShadow=l?"0 2px 8px rgba(59, 130, 246, 0.35)":"0 2px 8px rgba(0, 102, 204, 0.3)")},n.onmouseout=()=>{n.disabled||(n.style.background=e.saveBg,n.style.boxShadow="none")},v.appendChild(g),v.appendChild(n),t.oninput=()=>{const i=t.value;if($(),i.trim()){const T=S(i);T.valid?h.has(i)?(p=`Anchor ID already exists: ${i}`,f.textContent="⚠ "+p,f.style.display="block",t.style.borderColor=e.fieldErrorBorder,t.style.background=e.fieldErrorBg):(p="",f.style.display="none",t.style.borderColor=e.fieldBorder,t.style.background=e.fieldBg):(p=T.error,f.textContent="⚠ "+p,f.style.display="block",t.style.borderColor=e.fieldErrorBorder,t.style.background=e.fieldErrorBg)}else f.style.display="none",t.style.borderColor=e.fieldBorder,t.style.background=e.fieldBg},t.onfocus=()=>{t.style.borderColor=p?e.fieldErrorBorder:e.saveBg,t.style.boxShadow=p?`0 0 0 3px ${e.errorRing}`:`0 0 0 3px ${e.focusRing}`,t.style.background=p?e.fieldErrorBg:e.fieldFocusBg},t.onblur=()=>{t.style.boxShadow="none",p||(t.style.background=e.fieldBg)};const A=()=>{const i=t.value.trim();!i||!S(i).valid||h.has(i)||(s&&s(i),a.remove())},E=()=>{a.remove()};n.onclick=A,g.onclick=E,c.onclick=E,t.onkeydown=i=>{i.key==="Enter"?(i.preventDefault(),A()):i.key==="Escape"&&(i.preventDefault(),E())},a.onclick=i=>{i.target===a&&E()},u.appendChild(x),u.appendChild(B),u.appendChild(v),a.appendChild(u),document.body.appendChild(a),setTimeout(()=>t.focus(),100)}function H(o,d){let s;if(d)s=d;else{const a=window.getSelection();if(!a||a.rangeCount===0)return;s=a.getRangeAt(0)}const r=document.createElement("span");r.id=o,r.className="rte-anchor",r.setAttribute("data-type","anchor"),r.setAttribute("data-anchor-id",o),r.setAttribute("title",`Anchor: ${o}`),r.style.cssText=`
94
+ `,n.disabled=!t.value.trim();const $=()=>{t.value.trim()?(n.disabled=!1,n.style.background=e.saveBg,n.style.color="white",n.style.cursor="pointer"):(n.disabled=!0,n.style.background=e.saveDisabledBg,n.style.color=e.saveDisabledText,n.style.cursor="not-allowed")};n.onmouseover=()=>{n.disabled||(n.style.background=e.saveHover,n.style.boxShadow=l?"0 2px 8px rgba(59, 130, 246, 0.35)":"0 2px 8px rgba(0, 102, 204, 0.3)")},n.onmouseout=()=>{n.disabled||(n.style.background=e.saveBg,n.style.boxShadow="none")},v.appendChild(g),v.appendChild(n),t.oninput=()=>{const i=t.value;if($(),i.trim()){const T=S(i);T.valid?h.has(i)?(p=`Anchor ID already exists: ${i}`,f.textContent="⚠ "+p,f.style.display="block",t.style.borderColor=e.fieldErrorBorder,t.style.background=e.fieldErrorBg):(p="",f.style.display="none",t.style.borderColor=e.fieldBorder,t.style.background=e.fieldBg):(p=T.error,f.textContent="⚠ "+p,f.style.display="block",t.style.borderColor=e.fieldErrorBorder,t.style.background=e.fieldErrorBg)}else f.style.display="none",t.style.borderColor=e.fieldBorder,t.style.background=e.fieldBg},t.onfocus=()=>{t.style.borderColor=p?e.fieldErrorBorder:e.saveBg,t.style.boxShadow=p?`0 0 0 3px ${e.errorRing}`:`0 0 0 3px ${e.focusRing}`,t.style.background=p?e.fieldErrorBg:e.fieldFocusBg},t.onblur=()=>{t.style.boxShadow="none",p||(t.style.background=e.fieldBg)};const A=()=>{const i=t.value.trim();!i||!S(i).valid||h.has(i)||(s&&s(i),a.remove())},E=()=>{a.remove()};n.onclick=A,g.onclick=E,c.onclick=E,t.onkeydown=i=>{i.key==="Enter"?(i.preventDefault(),A()):i.key==="Escape"&&(i.preventDefault(),E())},a.onclick=i=>{i.target===a&&E()},u.appendChild(x),u.appendChild(B),u.appendChild(v),a.appendChild(u),document.body.appendChild(a),setTimeout(()=>t.focus(),100)}function _(o,d){let s;if(d)s=d;else{const a=window.getSelection();if(!a||a.rangeCount===0)return;s=a.getRangeAt(0)}const r=document.createElement("span");r.id=o,r.className="rte-anchor",r.setAttribute("data-type","anchor"),r.setAttribute("data-anchor-id",o),r.setAttribute("title",`Anchor: ${o}`),r.style.cssText=`
95
95
  display: inline;
96
96
  position: relative;
97
97
  cursor: pointer;
@@ -173,4 +173,4 @@
173
173
  outline: 2px solid #0066cc;
174
174
  outline-offset: 2px;
175
175
  }
176
- `,document.head.appendChild(o)}const _=()=>(typeof window<"u"&&(z(),D()),{name:"anchor",toolbar:[{label:"Anchor",command:"insertAnchor",icon:'<svg width="24px" height="24px" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"><g id="SVGRepo_bgCarrier" stroke-width="0"></g><g id="SVGRepo_tracerCarrier" stroke-linecap="round" stroke-linejoin="round"></g><g id="SVGRepo_iconCarrier"> <path d="M12 8.4C13.4912 8.4 14.7 7.19117 14.7 5.7C14.7 4.20883 13.4912 3 12 3C10.5088 3 9.3 4.20883 9.3 5.7C9.3 7.19117 10.5088 8.4 12 8.4ZM12 8.4V20.9999M12 20.9999C9.61305 20.9999 7.32387 20.0518 5.63604 18.364C3.94821 16.6761 3 14.3869 3 12H5M12 20.9999C14.3869 20.9999 16.6761 20.0518 18.364 18.364C20.0518 16.6761 21 14.3869 21 12H19" stroke="#000000" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"></path> </g></svg>',shortcut:"Mod-Shift-k"}],commands:{insertAnchor:()=>{try{const o=window.getSelection();if(!o||o.rangeCount===0)return alert("Please place your cursor where you want to insert the anchor."),!1;const d=o.getRangeAt(0).cloneRange();return M("add","",s=>{H(s,d)},d),!0}catch(o){return console.error("Failed to insert anchor:",o),!1}}},keymap:{"Mod-Shift-k":"insertAnchor"}});exports.AnchorPlugin=_;
176
+ `,document.head.appendChild(o)}const H=()=>(typeof window<"u"&&(z(),D()),{name:"anchor",toolbar:[{label:"Anchor",command:"insertAnchor",icon:'<svg width="24px" height="24px" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"><g id="SVGRepo_bgCarrier" stroke-width="0"></g><g id="SVGRepo_tracerCarrier" stroke-linecap="round" stroke-linejoin="round"></g><g id="SVGRepo_iconCarrier"> <path d="M12 8.4C13.4912 8.4 14.7 7.19117 14.7 5.7C14.7 4.20883 13.4912 3 12 3C10.5088 3 9.3 4.20883 9.3 5.7C9.3 7.19117 10.5088 8.4 12 8.4ZM12 8.4V20.9999M12 20.9999C9.61305 20.9999 7.32387 20.0518 5.63604 18.364C3.94821 16.6761 3 14.3869 3 12H5M12 20.9999C14.3869 20.9999 16.6761 20.0518 18.364 18.364C20.0518 16.6761 21 14.3869 21 12H19" stroke="#000000" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"></path> </g></svg>',shortcut:"Mod-Shift-k"}],commands:{insertAnchor:()=>{try{const o=window.getSelection();if(!o||o.rangeCount===0)return alert("Please place your cursor where you want to insert the anchor."),!1;const d=o.getRangeAt(0).cloneRange();return M("add","",s=>{_(s,d)},d),!0}catch(o){return console.error("Failed to insert anchor:",o),!1}}},keymap:{"Mod-Shift-k":"insertAnchor"}});exports.AnchorPlugin=H;
@@ -1,4 +1,4 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const A=require("./colorSelectionApply-C0iOfMWb.js");let l=null,k=null,L=null,s="#ffff00";const h='[data-theme="dark"], .dark, .editora-theme-dark',M=["#000000","#ffffff","#808080","#ff0000","#00ff00","#0000ff","#ffff00","#ff00ff","#00ffff","#ffa500","#800080","#ffc0cb"];function P(){const e=window.getSelection();if(e&&e.rangeCount>0){const r=e.getRangeAt(0).startContainer,a=r.nodeType===Node.ELEMENT_NODE?r:r.parentElement;if(a){const n=a.closest('[data-editora-editor="true"], .rte-editor, .editora-editor');if(n)return n}}const t=document.activeElement;return t?t.closest('[data-editora-editor="true"], .rte-editor, .editora-editor'):null}function R(e){const t=P();if(t){const c=t.querySelector(`[data-command="${e}"]`);if(c)return c}return document.querySelector(`[data-command="${e}"]`)}function T(e){if(e?.closest(h))return!0;const t=window.getSelection();if(t&&t.rangeCount>0){const r=t.getRangeAt(0).startContainer;if((r.nodeType===Node.ELEMENT_NODE?r:r.parentElement)?.closest(h))return!0}return document.activeElement?.closest(h)?!0:document.body.matches(h)||document.documentElement.matches(h)}function q(){if(document.getElementById("rte-bg-color-picker-styles"))return;const e=document.createElement("style");e.id="rte-bg-color-picker-styles",e.textContent=`
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const P=require("./colorSelectionApply-C0iOfMWb.js");let l=null,k=null,L=null,s="#ffff00";const h='[data-theme="dark"], .dark, .editora-theme-dark',A=["#000000","#ffffff","#808080","#ff0000","#00ff00","#0000ff","#ffff00","#ff00ff","#00ffff","#ffa500","#800080","#ffc0cb"];function M(){const e=window.getSelection();if(e&&e.rangeCount>0){const r=e.getRangeAt(0).startContainer,a=r.nodeType===Node.ELEMENT_NODE?r:r.parentElement;if(a){const n=a.closest('[data-editora-editor="true"], .rte-editor, .editora-editor');if(n)return n}}const t=document.activeElement;return t?t.closest('[data-editora-editor="true"], .rte-editor, .editora-editor'):null}function R(e){const t=M();if(t){const c=t.querySelector(`[data-command="${e}"]`);if(c)return c}return document.querySelector(`[data-command="${e}"]`)}function T(e){if(e?.closest(h))return!0;const t=window.getSelection();if(t&&t.rangeCount>0){const r=t.getRangeAt(0).startContainer;if((r.nodeType===Node.ELEMENT_NODE?r:r.parentElement)?.closest(h))return!0}return document.activeElement?.closest(h)?!0:document.body.matches(h)||document.documentElement.matches(h)}function q(){if(document.getElementById("rte-bg-color-picker-styles"))return;const e=document.createElement("style");e.id="rte-bg-color-picker-styles",e.textContent=`
2
2
  .rte-bg-color-picker {
3
3
  position: absolute;
4
4
  background: white;
@@ -215,4 +215,4 @@
215
215
  .rte-bg-color-picker.rte-theme-dark .rte-bg-color-text-input:focus {
216
216
  border-color: #58a6ff;
217
217
  }
218
- `,document.head.appendChild(e)}function H(){const e=document.createElement("div");e.className="rte-bg-color-picker",T(k)&&e.classList.add("rte-theme-dark"),e.addEventListener("click",m=>m.stopPropagation());const t=document.createElement("div");t.className="rte-bg-color-picker-header";const c=document.createElement("span");c.className="rte-bg-color-picker-title",c.textContent="Background Color";const r=document.createElement("button");r.type="button",r.className="rte-bg-color-picker-close",r.id="rte-bg-color-close",r.setAttribute("aria-label","Close"),r.textContent="×",t.appendChild(c),t.appendChild(r);const a=document.createElement("div");a.className="rte-bg-color-picker-body";const n=document.createElement("div");n.className="rte-bg-color-section";const o=document.createElement("div");o.className="rte-bg-color-section-label",o.textContent="Current Color";const i=document.createElement("div");i.className="rte-bg-color-preview";const d=document.createElement("div");d.className="rte-bg-color-preview-swatch",d.id="rte-bg-color-preview-swatch";const u=document.createElement("span");u.className="rte-bg-color-preview-hex",u.id="rte-bg-color-preview-hex",i.appendChild(d),i.appendChild(u),n.appendChild(o),n.appendChild(i);const x=document.createElement("div");x.className="rte-bg-color-section";const E=document.createElement("div");E.className="rte-bg-color-section-label",E.textContent="Colors";const C=document.createElement("div");C.className="rte-bg-color-grid",C.id="rte-bg-color-grid",M.forEach(m=>{const g=document.createElement("button");g.type="button",g.className="rte-bg-color-swatch",g.style.backgroundColor=m,g.dataset.color=m,g.title=m,C.appendChild(g)}),x.appendChild(E),x.appendChild(C);const w=document.createElement("div");w.className="rte-bg-color-section";const S=document.createElement("div");S.className="rte-bg-color-section-label",S.textContent="Custom";const v=document.createElement("div");v.className="rte-bg-color-custom";const f=document.createElement("input");f.type="color",f.className="rte-bg-color-input",f.id="rte-bg-color-input",f.value=s;const p=document.createElement("input");return p.type="text",p.className="rte-bg-color-text-input",p.id="rte-bg-color-text-input",p.placeholder="#FFFF00",p.value=s.toUpperCase(),p.maxLength=7,v.appendChild(f),v.appendChild(p),w.appendChild(S),w.appendChild(v),a.appendChild(n),a.appendChild(x),a.appendChild(w),e.appendChild(t),e.appendChild(a),e}function U(){if(!l)return;l.querySelector("#rte-bg-color-close")?.addEventListener("click",()=>b());const t=l.querySelector("#rte-bg-color-grid");t&&t.addEventListener("click",n=>{const o=n.target;if(o.classList.contains("rte-bg-color-swatch")){const i=o.dataset.color;i&&(s=i,y(i),b())}});const c=l.querySelector("#rte-bg-color-input");c&&(c.addEventListener("change",n=>{const o=n.target.value.toUpperCase();s=o,y(o),b()}),c.addEventListener("input",n=>{s=n.target.value.toUpperCase(),N(),B()}));const r=l.querySelector("#rte-bg-color-text-input");r&&(r.addEventListener("change",n=>{let o=n.target.value.trim();o&&!o.startsWith("#")&&(o="#"+o),/^#[0-9A-F]{6}$/i.test(o)&&(s=o.toUpperCase(),y(s),b())}),r.addEventListener("input",n=>{let o=n.target.value.trim();o&&!o.startsWith("#")&&(o="#"+o,r.value=o),/^#[0-9A-F]{6}$/i.test(o)&&(s=o.toUpperCase(),N(),B())}));const a=n=>{if(l&&k){const o=n.target;!l.contains(o)&&!k.contains(o)&&b()}};setTimeout(()=>{document.addEventListener("click",a)},100),l._clickOutsideHandler=a}function N(){if(!l)return;const e=l.querySelector("#rte-bg-color-preview-swatch"),t=l.querySelector("#rte-bg-color-preview-hex"),c=l.querySelector("#rte-bg-color-input"),r=l.querySelector("#rte-bg-color-text-input");e&&(e.style.backgroundColor=s),t&&(t.textContent=s.toUpperCase()),c&&(c.value=s),r&&(r.value=s.toUpperCase())}function B(){if(!l)return;l.querySelectorAll(".rte-bg-color-swatch").forEach(t=>{t.dataset.color?.toUpperCase()===s.toUpperCase()?t.classList.add("selected"):t.classList.remove("selected")})}function I(){try{const e=window.getSelection();if(!e||e.rangeCount===0)return"#ffff00";const c=e.getRangeAt(0).commonAncestorContainer,r=c.nodeType===1?c:c.parentElement;if(r){const a=r.closest('[style*="background-color"]');if(a){const n=a.style.backgroundColor;if(n)return O(n)}}return"#ffff00"}catch{return"#ffff00"}}function O(e){if(e.startsWith("#"))return e.toUpperCase();const t=e.match(/rgba?\((\d+),\s*(\d+),\s*(\d+)/);if(t){const c=parseInt(t[1]),r=parseInt(t[2]),a=parseInt(t[3]);return"#"+[c,r,a].map(n=>{const o=n.toString(16);return o.length===1?"0"+o:o}).join("").toUpperCase()}return"#ffff00"}function y(e){const t=A.applyColorToSelection({color:e,className:"rte-bg-color",styleProperty:"backgroundColor",commands:["hiliteColor","backColor"],savedRange:L,getActiveEditorRoot:P,warnMessage:"[BackgroundColor] Could not apply highlight for current selection"});return t&&console.log("[BackgroundColor] Applied color:",e),t}function b(){if(l){const e=l._clickOutsideHandler;e&&document.removeEventListener("click",e),l.remove(),l=null}k=null,L=null}function z(e,t){const c=e.getBoundingClientRect(),r=t.getBoundingClientRect(),a=r.width||220,n=r.height||320,o=8;let i=c.left;i+a>window.innerWidth-o&&(i=window.innerWidth-a-o),i=Math.max(o,i);let d=c.bottom+o;if(d+n>window.innerHeight-o){const u=c.top-n-o;u>=o?d=u:d=Math.max(o,window.innerHeight-n-o)}t.style.top=`${Math.round(d+window.scrollY)}px`,t.style.left=`${Math.round(i+window.scrollX)}px`}function _(){if(q(),l)return b(),!0;const e=R("openBackgroundColorPicker");if(!e)return!1;const t=window.getSelection();return!t||t.isCollapsed?(alert("Please select text to apply background color"),!1):(t.rangeCount>0&&(L=t.getRangeAt(0).cloneRange()),s=I(),l=H(),document.body.appendChild(l),k=e,z(e,l),N(),B(),U(),!0)}const D=()=>({name:"backgroundColor",marks:{backgroundColor:{attrs:{color:{default:"#ffffff"}},parseDOM:[{tag:'span[style*="background-color"]',getAttrs:e=>{const r=(e.getAttribute("style")||"").match(/background-color:\s*([^;]+)/);return r?{color:r[1]}:null}},{tag:"mark",getAttrs:e=>({color:e.style.backgroundColor||"#ffff00"})}],toDOM:e=>["span",{style:`background-color: ${e.attrs?.color||"#ffffff"}`,class:"rte-bg-color"},0]}},toolbar:[{label:"Background Color",command:"openBackgroundColorPicker",icon:'<svg width="24" height="24" focusable="false"><g fill-rule="evenodd"><path class="tox-icon-highlight-bg-color__color" d="M3 18h18v3H3z" fill="#000000"></path><path fill-rule="nonzero" d="M7.7 16.7H3l3.3-3.3-.7-.8L10.2 8l4 4.1-4 4.2c-.2.2-.6.2-.8 0l-.6-.7-1.1 1.1zm5-7.5L11 7.4l3-2.9a2 2 0 0 1 2.6 0L18 6c.7.7.7 2 0 2.7l-2.9 2.9-1.8-1.8-.5-.6"></path></g></svg>',shortcut:"Mod-Shift-h"}],commands:{openBackgroundColorPicker:()=>_(),setBackgroundColor:e=>e?y(e):!1},keymap:{"Mod-Shift-h":"openBackgroundColorPicker"}});exports.BackgroundColorPlugin=D;
218
+ `,document.head.appendChild(e)}function H(){const e=document.createElement("div");e.className="rte-bg-color-picker",T(k)&&e.classList.add("rte-theme-dark"),e.addEventListener("click",m=>m.stopPropagation());const t=document.createElement("div");t.className="rte-bg-color-picker-header";const c=document.createElement("span");c.className="rte-bg-color-picker-title",c.textContent="Background Color";const r=document.createElement("button");r.type="button",r.className="rte-bg-color-picker-close",r.id="rte-bg-color-close",r.setAttribute("aria-label","Close"),r.textContent="×",t.appendChild(c),t.appendChild(r);const a=document.createElement("div");a.className="rte-bg-color-picker-body";const n=document.createElement("div");n.className="rte-bg-color-section";const o=document.createElement("div");o.className="rte-bg-color-section-label",o.textContent="Current Color";const i=document.createElement("div");i.className="rte-bg-color-preview";const d=document.createElement("div");d.className="rte-bg-color-preview-swatch",d.id="rte-bg-color-preview-swatch";const u=document.createElement("span");u.className="rte-bg-color-preview-hex",u.id="rte-bg-color-preview-hex",i.appendChild(d),i.appendChild(u),n.appendChild(o),n.appendChild(i);const x=document.createElement("div");x.className="rte-bg-color-section";const E=document.createElement("div");E.className="rte-bg-color-section-label",E.textContent="Colors";const C=document.createElement("div");C.className="rte-bg-color-grid",C.id="rte-bg-color-grid",A.forEach(m=>{const g=document.createElement("button");g.type="button",g.className="rte-bg-color-swatch",g.style.backgroundColor=m,g.dataset.color=m,g.title=m,C.appendChild(g)}),x.appendChild(E),x.appendChild(C);const w=document.createElement("div");w.className="rte-bg-color-section";const S=document.createElement("div");S.className="rte-bg-color-section-label",S.textContent="Custom";const v=document.createElement("div");v.className="rte-bg-color-custom";const f=document.createElement("input");f.type="color",f.className="rte-bg-color-input",f.id="rte-bg-color-input",f.value=s;const p=document.createElement("input");return p.type="text",p.className="rte-bg-color-text-input",p.id="rte-bg-color-text-input",p.placeholder="#FFFF00",p.value=s.toUpperCase(),p.maxLength=7,v.appendChild(f),v.appendChild(p),w.appendChild(S),w.appendChild(v),a.appendChild(n),a.appendChild(x),a.appendChild(w),e.appendChild(t),e.appendChild(a),e}function U(){if(!l)return;l.querySelector("#rte-bg-color-close")?.addEventListener("click",()=>b());const t=l.querySelector("#rte-bg-color-grid");t&&t.addEventListener("click",n=>{const o=n.target;if(o.classList.contains("rte-bg-color-swatch")){const i=o.dataset.color;i&&(s=i,y(i),b())}});const c=l.querySelector("#rte-bg-color-input");c&&(c.addEventListener("change",n=>{const o=n.target.value.toUpperCase();s=o,y(o),b()}),c.addEventListener("input",n=>{s=n.target.value.toUpperCase(),N(),B()}));const r=l.querySelector("#rte-bg-color-text-input");r&&(r.addEventListener("change",n=>{let o=n.target.value.trim();o&&!o.startsWith("#")&&(o="#"+o),/^#[0-9A-F]{6}$/i.test(o)&&(s=o.toUpperCase(),y(s),b())}),r.addEventListener("input",n=>{let o=n.target.value.trim();o&&!o.startsWith("#")&&(o="#"+o,r.value=o),/^#[0-9A-F]{6}$/i.test(o)&&(s=o.toUpperCase(),N(),B())}));const a=n=>{if(l&&k){const o=n.target;!l.contains(o)&&!k.contains(o)&&b()}};setTimeout(()=>{document.addEventListener("click",a)},100),l._clickOutsideHandler=a}function N(){if(!l)return;const e=l.querySelector("#rte-bg-color-preview-swatch"),t=l.querySelector("#rte-bg-color-preview-hex"),c=l.querySelector("#rte-bg-color-input"),r=l.querySelector("#rte-bg-color-text-input");e&&(e.style.backgroundColor=s),t&&(t.textContent=s.toUpperCase()),c&&(c.value=s),r&&(r.value=s.toUpperCase())}function B(){if(!l)return;l.querySelectorAll(".rte-bg-color-swatch").forEach(t=>{t.dataset.color?.toUpperCase()===s.toUpperCase()?t.classList.add("selected"):t.classList.remove("selected")})}function I(){try{const e=window.getSelection();if(!e||e.rangeCount===0)return"#ffff00";const c=e.getRangeAt(0).commonAncestorContainer,r=c.nodeType===1?c:c.parentElement;if(r){const a=r.closest('[style*="background-color"]');if(a){const n=a.style.backgroundColor;if(n)return O(n)}}return"#ffff00"}catch{return"#ffff00"}}function O(e){if(e.startsWith("#"))return e.toUpperCase();const t=e.match(/rgba?\((\d+),\s*(\d+),\s*(\d+)/);if(t){const c=parseInt(t[1]),r=parseInt(t[2]),a=parseInt(t[3]);return"#"+[c,r,a].map(n=>{const o=n.toString(16);return o.length===1?"0"+o:o}).join("").toUpperCase()}return"#ffff00"}function y(e){const t=P.applyColorToSelection({color:e,className:"rte-bg-color",styleProperty:"backgroundColor",commands:["hiliteColor","backColor"],savedRange:L,getActiveEditorRoot:M,warnMessage:"[BackgroundColor] Could not apply highlight for current selection"});return t&&console.log("[BackgroundColor] Applied color:",e),t}function b(){if(l){const e=l._clickOutsideHandler;e&&document.removeEventListener("click",e),l.remove(),l=null}k=null,L=null}function _(e,t){const c=e.getBoundingClientRect(),r=t.getBoundingClientRect(),a=r.width||220,n=r.height||320,o=8;let i=c.left;i+a>window.innerWidth-o&&(i=window.innerWidth-a-o),i=Math.max(o,i);let d=c.bottom+o;if(d+n>window.innerHeight-o){const u=c.top-n-o;u>=o?d=u:d=Math.max(o,window.innerHeight-n-o)}t.style.top=`${Math.round(d+window.scrollY)}px`,t.style.left=`${Math.round(i+window.scrollX)}px`}function z(){if(q(),l)return b(),!0;const e=R("openBackgroundColorPicker");if(!e)return!1;const t=window.getSelection();return!t||t.isCollapsed?(alert("Please select text to apply background color"),!1):(t.rangeCount>0&&(L=t.getRangeAt(0).cloneRange()),s=I(),l=H(),document.body.appendChild(l),k=e,_(e,l),N(),B(),U(),!0)}const D=()=>({name:"backgroundColor",marks:{backgroundColor:{attrs:{color:{default:"#ffffff"}},parseDOM:[{tag:'span[style*="background-color"]',getAttrs:e=>{const r=(e.getAttribute("style")||"").match(/background-color:\s*([^;]+)/);return r?{color:r[1]}:null}},{tag:"mark",getAttrs:e=>({color:e.style.backgroundColor||"#ffff00"})}],toDOM:e=>["span",{style:`background-color: ${e.attrs?.color||"#ffffff"}`,class:"rte-bg-color"},0]}},toolbar:[{label:"Background Color",command:"openBackgroundColorPicker",icon:'<svg width="24" height="24" focusable="false"><g fill-rule="evenodd"><path class="tox-icon-highlight-bg-color__color" d="M3 18h18v3H3z" fill="#000000"></path><path fill-rule="nonzero" d="M7.7 16.7H3l3.3-3.3-.7-.8L10.2 8l4 4.1-4 4.2c-.2.2-.6.2-.8 0l-.6-.7-1.1 1.1zm5-7.5L11 7.4l3-2.9a2 2 0 0 1 2.6 0L18 6c.7.7.7 2 0 2.7l-2.9 2.9-1.8-1.8-.5-.6"></path></g></svg>',shortcut:"Mod-Shift-h"}],commands:{openBackgroundColorPicker:()=>z(),setBackgroundColor:e=>e?y(e):!1},keymap:{"Mod-Shift-h":"openBackgroundColorPicker"}});exports.BackgroundColorPlugin=D;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=()=>({name:"blockquote",nodes:{blockquote:{content:"block+",group:"block",parseDOM:[{tag:"blockquote"}],toDOM:()=>["blockquote",0]}},toolbar:[{label:"Quote",command:"toggleBlockquote",icon:'<svg fill="#000000" height="24px" width="24px" version="1.1" id="Icons" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 32 32" xml:space="preserve"><g id="SVGRepo_bgCarrier" stroke-width="0"></g><g id="SVGRepo_tracerCarrier" stroke-linecap="round" stroke-linejoin="round"></g><g id="SVGRepo_iconCarrier"> <g> <path d="M13,11c0.6,0,1-0.4,1-1s-0.4-1-1-1c-5,0-9,4-9,9c0,2.8,2.2,5,5,5s5-2.2,5-5s-2.2-5-5-5c-0.3,0-0.7,0-1,0.1 C9.3,11.8,11,11,13,11z"></path> <path d="M23,13c-0.3,0-0.7,0-1,0.1c1.3-1.3,3-2.1,5-2.1c0.6,0,1-0.4,1-1s-0.4-1-1-1c-5,0-9,4-9,9c0,2.8,2.2,5,5,5s5-2.2,5-5 S25.8,13,23,13z"></path> </g> </g></svg>',shortcut:"Mod-Shift-9"}],commands:{toggleBlockquote:()=>{const o=window.getSelection();if(!o||o.rangeCount===0)return!1;let e=o.anchorNode,t=!1;for(;e&&e!==document.body;){if(e.nodeName==="BLOCKQUOTE"){t=!0;break}e=e.parentNode}return t?document.execCommand("formatBlock",!1,"p"):document.execCommand("formatBlock",!1,"blockquote"),!0}},keymap:{"Mod-Shift-9":"toggleBlockquote"}});exports.BlockquotePlugin=c;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const l=()=>({name:"blockquote",nodes:{blockquote:{content:"block+",group:"block",parseDOM:[{tag:"blockquote"}],toDOM:()=>["blockquote",0]}},toolbar:[{label:"Quote",command:"toggleBlockquote",icon:'<svg fill="#000000" height="24px" width="24px" version="1.1" id="Icons" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 32 32" xml:space="preserve"><g id="SVGRepo_bgCarrier" stroke-width="0"></g><g id="SVGRepo_tracerCarrier" stroke-linecap="round" stroke-linejoin="round"></g><g id="SVGRepo_iconCarrier"> <g> <path d="M13,11c0.6,0,1-0.4,1-1s-0.4-1-1-1c-5,0-9,4-9,9c0,2.8,2.2,5,5,5s5-2.2,5-5s-2.2-5-5-5c-0.3,0-0.7,0-1,0.1 C9.3,11.8,11,11,13,11z"></path> <path d="M23,13c-0.3,0-0.7,0-1,0.1c1.3-1.3,3-2.1,5-2.1c0.6,0,1-0.4,1-1s-0.4-1-1-1c-5,0-9,4-9,9c0,2.8,2.2,5,5,5s5-2.2,5-5 S25.8,13,23,13z"></path> </g> </g></svg>',shortcut:"Mod-Shift-9"}],commands:{toggleBlockquote:()=>{const o=window.getSelection();if(!o||o.rangeCount===0)return!1;let e=o.anchorNode,t=!1;for(;e&&e!==document.body;){if(e.nodeName==="BLOCKQUOTE"){t=!0;break}e=e.parentNode}return t?document.execCommand("formatBlock",!1,"p"):document.execCommand("formatBlock",!1,"blockquote"),!0}},keymap:{"Mod-Shift-9":"toggleBlockquote"}});exports.BlockquotePlugin=l;
package/dist/bold.cjs.js CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=()=>({name:"bold",marks:{bold:{parseDOM:[{tag:"strong"},{tag:"b"},{style:"font-weight",getAttrs:t=>{const o=typeof t=="string"?t:t.style.fontWeight;return/^(bold(er)?|[5-9]\d{2,})$/.test(o)&&null}}],toDOM:()=>["strong",0]}},toolbar:[{label:"Bold",command:"toggleBold",icon:'<svg width="24" height="24" focusable="false"><path d="M7.8 19c-.3 0-.5 0-.6-.2l-.2-.5V5.7c0-.2 0-.4.2-.5l.6-.2h5c1.5 0 2.7.3 3.5 1 .7.6 1.1 1.4 1.1 2.5a3 3 0 0 1-.6 1.9c-.4.6-1 1-1.6 1.2.4.1.9.3 1.3.6s.8.7 1 1.2c.4.4.5 1 .5 1.6 0 1.3-.4 2.3-1.3 3-.8.7-2.1 1-3.8 1H7.8Zm5-8.3c.6 0 1.2-.1 1.6-.5.4-.3.6-.7.6-1.3 0-1.1-.8-1.7-2.3-1.7H9.3v3.5h3.4Zm.5 6c.7 0 1.3-.1 1.7-.4.4-.4.6-.9.6-1.5s-.2-1-.7-1.4c-.4-.3-1-.4-2-.4H9.4v3.8h4Z" fill-rule="evenodd"></path></svg>',shortcut:"Mod-b"}],commands:{toggleBold:()=>(document.execCommand("bold",!1),!0)},keymap:{"Mod-b":"toggleBold","Mod-B":"toggleBold"}});exports.BoldPlugin=e;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=()=>({name:"bold",marks:{bold:{parseDOM:[{tag:"strong"},{tag:"b"},{style:"font-weight",getAttrs:t=>{const o=typeof t=="string"?t:t.style.fontWeight;return/^(bold(er)?|[5-9]\d{2,})$/.test(o)&&null}}],toDOM:()=>["strong",0]}},toolbar:[{label:"Bold",command:"toggleBold",icon:'<svg width="24" height="24" focusable="false"><path d="M7.8 19c-.3 0-.5 0-.6-.2l-.2-.5V5.7c0-.2 0-.4.2-.5l.6-.2h5c1.5 0 2.7.3 3.5 1 .7.6 1.1 1.4 1.1 2.5a3 3 0 0 1-.6 1.9c-.4.6-1 1-1.6 1.2.4.1.9.3 1.3.6s.8.7 1 1.2c.4.4.5 1 .5 1.6 0 1.3-.4 2.3-1.3 3-.8.7-2.1 1-3.8 1H7.8Zm5-8.3c.6 0 1.2-.1 1.6-.5.4-.3.6-.7.6-1.3 0-1.1-.8-1.7-2.3-1.7H9.3v3.5h3.4Zm.5 6c.7 0 1.3-.1 1.7-.4.4-.4.6-.9.6-1.5s-.2-1-.7-1.4c-.4-.3-1-.4-2-.4H9.4v3.8h4Z" fill-rule="evenodd"></path></svg>',shortcut:"Mod-b"}],commands:{toggleBold:()=>(document.execCommand("bold",!1),!0)},keymap:{"Mod-b":"toggleBold","Mod-B":"toggleBold"}});exports.BoldPlugin=e;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const l=()=>{const o=()=>{try{const e=window.getSelection();if(e&&e.rangeCount>0&&!e.isCollapsed){const t=e.getRangeAt(0),r=t.toString().toUpperCase();return t.deleteContents(),t.insertNode(document.createTextNode(r)),!0}return!1}catch(e){return console.error("Failed to convert to uppercase:",e),!1}},a=()=>{try{const e=window.getSelection();if(e&&e.rangeCount>0&&!e.isCollapsed){const t=e.getRangeAt(0),r=t.toString().toLowerCase();return t.deleteContents(),t.insertNode(document.createTextNode(r)),!0}return!1}catch(e){return console.error("Failed to convert to lowercase:",e),!1}},n=()=>{try{const e=window.getSelection();if(e&&e.rangeCount>0&&!e.isCollapsed){const t=e.getRangeAt(0),r=t.toString().replace(/\w\S*/g,i=>i.charAt(0).toUpperCase()+i.substr(1).toLowerCase());return t.deleteContents(),t.insertNode(document.createTextNode(r)),!0}return!1}catch(e){return console.error("Failed to convert to title case:",e),!1}};return{name:"capitalization",toolbar:[{label:"Capitalization",command:"setCapitalization",type:"inline-menu",options:[{label:"lowercase",value:"lowercase"},{label:"UPPERCASE",value:"uppercase"},{label:"Title Case",value:"titlecase"}],icon:'<svg fill="#000000" width="24" height="24" viewBox="0 0 32.00 32.00" id="icon" 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" stroke="#CCCCCC" stroke-width="0.192"></g><g id="SVGRepo_iconCarrier"><defs><style>.cls-1{fill:none;}</style></defs><title>letter--Aa</title><path d="M23,13H18v2h5v2H19a2,2,0,0,0-2,2v2a2,2,0,0,0,2,2h6V15A2,2,0,0,0,23,13Zm0,8H19V19h4Z"></path><path d="M13,9H9a2,2,0,0,0-2,2V23H9V18h4v5h2V11A2,2,0,0,0,13,9ZM9,16V11h4v5Z"></path><rect id="_Transparent_Rectangle_" data-name="&lt;Transparent Rectangle&gt;" class="cls-1" width="32" height="32"></rect></g></svg>'}],commands:{setCapitalization:e=>{if(!e)return!1;switch(e){case"uppercase":return o();case"lowercase":return a();case"titlecase":return n();default:return!1}},toUpperCase:o,toLowerCase:a,toTitleCase:n},keymap:{"Mod-Shift-u":"toUpperCase","Mod-Shift-k":"toLowerCase","Mod-Shift-t":"toTitleCase"}}};exports.CapitalizationPlugin=l;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const i=()=>{const o=()=>{try{const e=window.getSelection();if(e&&e.rangeCount>0&&!e.isCollapsed){const t=e.getRangeAt(0),r=t.toString().toUpperCase();return t.deleteContents(),t.insertNode(document.createTextNode(r)),!0}return!1}catch(e){return console.error("Failed to convert to uppercase:",e),!1}},a=()=>{try{const e=window.getSelection();if(e&&e.rangeCount>0&&!e.isCollapsed){const t=e.getRangeAt(0),r=t.toString().toLowerCase();return t.deleteContents(),t.insertNode(document.createTextNode(r)),!0}return!1}catch(e){return console.error("Failed to convert to lowercase:",e),!1}},n=()=>{try{const e=window.getSelection();if(e&&e.rangeCount>0&&!e.isCollapsed){const t=e.getRangeAt(0),r=t.toString().replace(/\w\S*/g,l=>l.charAt(0).toUpperCase()+l.substr(1).toLowerCase());return t.deleteContents(),t.insertNode(document.createTextNode(r)),!0}return!1}catch(e){return console.error("Failed to convert to title case:",e),!1}};return{name:"capitalization",toolbar:[{label:"Capitalization",command:"setCapitalization",type:"inline-menu",options:[{label:"lowercase",value:"lowercase"},{label:"UPPERCASE",value:"uppercase"},{label:"Title Case",value:"titlecase"}],icon:'<svg fill="#000000" width="24" height="24" viewBox="0 0 32.00 32.00" id="icon" 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" stroke="#CCCCCC" stroke-width="0.192"></g><g id="SVGRepo_iconCarrier"><defs><style>.cls-1{fill:none;}</style></defs><title>letter--Aa</title><path d="M23,13H18v2h5v2H19a2,2,0,0,0-2,2v2a2,2,0,0,0,2,2h6V15A2,2,0,0,0,23,13Zm0,8H19V19h4Z"></path><path d="M13,9H9a2,2,0,0,0-2,2V23H9V18h4v5h2V11A2,2,0,0,0,13,9ZM9,16V11h4v5Z"></path><rect id="_Transparent_Rectangle_" data-name="&lt;Transparent Rectangle&gt;" class="cls-1" width="32" height="32"></rect></g></svg>'}],commands:{setCapitalization:e=>{if(!e)return!1;switch(e){case"uppercase":return o();case"lowercase":return a();case"titlecase":return n();default:return!1}},toUpperCase:o,toLowerCase:a,toTitleCase:n},keymap:{"Mod-Shift-u":"toUpperCase","Mod-Shift-k":"toLowerCase","Mod-Shift-t":"toTitleCase"}}};exports.CapitalizationPlugin=i;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const N="__editoraCommandEditorRoot",w=t=>{if(!t)return null;const e=t.querySelector('[contenteditable="true"]');return e instanceof HTMLElement?e:null},A=()=>{if(typeof window>"u")return null;const t=window[N];if(!(t instanceof HTMLElement))return null;window[N]=null;const e=t.closest("[data-editora-editor], .rte-editor, .editora-editor, editora-editor")||(t.matches("[data-editora-editor], .rte-editor, .editora-editor, editora-editor")?t:null);if(e){const r=w(e);if(r)return r;if(e.getAttribute("contenteditable")==="true")return e}if(t.getAttribute("contenteditable")==="true")return t;const n=t.closest('[contenteditable="true"]');return n instanceof HTMLElement?n:null},S=()=>{const t=A();if(t&&document.contains(t))return t;const e=window.getSelection();if(e&&e.rangeCount>0){let r=e.getRangeAt(0).startContainer;for(;r&&r!==document.body;){if(r.nodeType===Node.ELEMENT_NODE){const o=r;if(o.getAttribute("contenteditable")==="true")return o}r=r.parentNode}}const n=document.activeElement;if(n){if(n.getAttribute("contenteditable")==="true")return n;const r=n.closest('[contenteditable="true"]');if(r)return r}return document.querySelector('[contenteditable="true"]')},_=t=>t?t.nodeType===Node.ELEMENT_NODE?t:t.parentElement:null,H=t=>{const e=window.getSelection();if(!e||e.rangeCount===0)return null;const n=e.getRangeAt(0);return t.contains(n.commonAncestorContainer)?n:null},y=t=>{t.dispatchEvent(new Event("input",{bubbles:!0}))},M=(t,e)=>{if(e===t.innerHTML)return;const n=window.execEditorCommand||window.executeEditorCommand;if(typeof n=="function")try{n("recordDomTransaction",t,e,t.innerHTML)}catch{}},k=(t,e)=>{if(!t.isConnected){e.focus({preventScroll:!0});return}const n=window.getSelection();if(!n)return;const r=document.createRange();r.selectNodeContents(t),r.collapse(!1),n.removeAllRanges();try{n.addRange(r)}catch{e.focus({preventScroll:!0});return}e.focus({preventScroll:!0})},I=t=>{let e=t.querySelector(":scope > p");if(!e){e=document.createElement("p");const n=[];t.childNodes.forEach(r=>{r.nodeType===Node.ELEMENT_NODE&&["UL","OL"].includes(r.tagName)||n.push(r)}),n.forEach(r=>e.appendChild(r)),t.insertBefore(e,t.firstChild)}return e.innerHTML.trim()||(e.innerHTML="<br>"),e},C=t=>{const e=document.createElement("li");e.setAttribute("data-type","checklist-item"),e.setAttribute("data-checked","false");const n=document.createElement("p");return n.innerHTML=t.trim()||"<br>",e.appendChild(n),e},T=t=>Array.from(t.children).filter(e=>e instanceof HTMLLIElement),R=new Set(["P","DIV","H1","H2","H3","H4","H5","H6","BLOCKQUOTE","PRE","LI"]),b=t=>R.has(t.tagName)&&t.getAttribute("contenteditable")!=="true",v=(t,e)=>{const n=[],r=new Set,o=i=>{!i||r.has(i)||e.contains(i)&&b(i)&&(i.closest("ul, ol")||(r.add(i),n.push(i)))},u=i=>{let a=i;for(;a&&a!==document.body;){if(a.nodeType===Node.ELEMENT_NODE){const h=a;if(b(h))return h;if(h.getAttribute("contenteditable")==="true")break}a=a.parentNode}return null};if(t.collapsed)return o(u(t.startContainer)),n;const d=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:i=>{const a=i;if(!b(a)||a.closest("ul, ol"))return NodeFilter.FILTER_SKIP;if(typeof t.intersectsNode=="function")return t.intersectsNode(a)?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP;const h=document.createRange();return h.selectNodeContents(a),t.compareBoundaryPoints(Range.END_TO_START,h)>0&&t.compareBoundaryPoints(Range.START_TO_END,h)<0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});let l=d.nextNode();for(;l;)o(l),l=d.nextNode();if(n.length===0&&o(u(t.commonAncestorContainer)),n.length<=1)return n;const m=n.filter(i=>!n.some(a=>a!==i&&i.contains(a)));return m.length>0?m:n},O=t=>{const e=[],n=document.createElement("div"),r=()=>{const o=n.innerHTML.trim();if(!o)return;const u=document.createElement("p");u.innerHTML=o,e.push(u),n.innerHTML=""};if(t.childNodes.forEach(o=>{if(o.nodeType===Node.ELEMENT_NODE&&["UL","OL"].includes(o.tagName)){r();return}if(o.nodeType===Node.ELEMENT_NODE&&o.tagName==="P"){r();const u=o.innerHTML.trim(),d=document.createElement("p");d.innerHTML=u||"<br>",e.push(d);return}o.nodeType===Node.TEXT_NODE&&!(o.textContent||"").trim()||n.appendChild(o.cloneNode(!0))}),r(),e.length===0){const o=document.createElement("p");o.innerHTML="<br>",e.push(o)}return e},P=()=>({name:"checklist",init:()=>{if(typeof document>"u"||typeof window>"u"||window.__checklistPluginClickInitialized)return;window.__checklistPluginClickInitialized=!0;const t=e=>{const r=e.target.closest('li[data-type="checklist-item"]');if(!r)return;const o=r.getBoundingClientRect();if(!(e.clientX-o.left<32))return;e.preventDefault(),e.stopPropagation();const l=r.closest("[contenteditable], .rte-content, .editora-content");if(l?.getAttribute("contenteditable")==="false"||!!l?.closest('[data-readonly="true"], .editora-editor[readonly], editora-editor[readonly]'))return;const i=l?.innerHTML||"",a=r.getAttribute("data-checked")==="true";r.setAttribute("data-checked",(!a).toString()),l&&(M(l,i),y(l))};document.addEventListener("click",t)},nodes:{checklist:{content:"checklistItem+",group:"block",parseDOM:[{tag:'ul[data-type="checklist"]'}],toDOM:()=>["ul",{"data-type":"checklist"},0]},checklistItem:{content:"paragraph",attrs:{checked:{default:!1}},parseDOM:[{tag:'li[data-type="checklist-item"]',getAttrs:t=>({checked:t.getAttribute("data-checked")==="true"})}],toDOM:t=>["li",{"data-type":"checklist-item","data-checked":t?.attrs?.checked?"true":"false"},0]}},toolbar:[{label:"Checklist",command:"toggleChecklist",icon:'<svg width="24px" height="24px" viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg" fill="#000000"><g id="SVGRepo_bgCarrier" stroke-width="0"></g><g id="SVGRepo_tracerCarrier" stroke-linecap="round" stroke-linejoin="round"></g><g id="SVGRepo_iconCarrier"><path fill-rule="evenodd" clip-rule="evenodd" d="M3.75 4.48h-.71L2 3.43l.71-.7.69.68L4.81 2l.71.71-1.77 1.77zM6.99 3h8v1h-8V3zm0 3h8v1h-8V6zm8 3h-8v1h8V9zm-8 3h8v1h-8v-1zM3.04 7.48h.71l1.77-1.77-.71-.7L3.4 6.42l-.69-.69-.71.71 1.04 1.04zm.71 3.01h-.71L2 9.45l.71-.71.69.69 1.41-1.42.71.71-1.77 1.77zm-.71 3.01h.71l1.77-1.77-.71-.71-1.41 1.42-.69-.69-.71.7 1.04 1.05z"></path></g></svg>',shortcut:"Mod-Shift-9"}],commands:{toggleChecklist:()=>{try{const t=S();if(!t)return!1;const e=t.innerHTML,n=()=>(M(t,e),y(t),!0),r=H(t);if(!r)return!1;const o=_(r.startContainer);if(!o)return!1;const u=o.closest('ul[data-type="checklist"]');if(u&&t.contains(u)){const c=T(u);if(c.length===0)return!1;const p=document.createDocumentFragment();let s=null;return c.forEach((f,g)=>{const E=O(f);E.forEach(L=>{p.appendChild(L),!s&&(f.contains(r.startContainer)||g===0)&&(s=L)}),!s&&g===0&&E[0]&&(s=E[0])}),u.replaceWith(p),s&&k(s,t),n()}const d=o.closest("ul, ol");if(d&&t.contains(d)){let c;if(d.tagName.toLowerCase()==="ul")c=d;else{for(c=document.createElement("ul");d.firstChild;)c.appendChild(d.firstChild);d.replaceWith(c)}c.setAttribute("data-type","checklist");let p=T(c);p.length===0&&(c.appendChild(C("")),p=T(c));let s=null;p.forEach(g=>{g.setAttribute("data-type","checklist-item"),g.hasAttribute("data-checked")||g.setAttribute("data-checked","false");const E=I(g);g.contains(r.startContainer)&&(s=E)});const f=c.querySelector(':scope > li[data-type="checklist-item"] > p');return k(s||f||c,t),n()}const l=v(r,t);if(l.length>1){const c=document.createElement("ul");c.setAttribute("data-type","checklist"),l.forEach(f=>{c.appendChild(C(f.innerHTML))}),l[0].replaceWith(c),l.slice(1).forEach(f=>{f.isConnected&&f.remove()});const s=c.querySelector(':scope > li[data-type="checklist-item"] > p');return s&&k(s,t),n()}const m=l[0]||o.closest("p, h1, h2, h3, h4, h5, h6, blockquote, pre");if(m&&m!==t){const c=document.createElement("ul");c.setAttribute("data-type","checklist");const p=C(m.innerHTML);c.appendChild(p),m.replaceWith(c);const s=p.querySelector(":scope > p");return s&&k(s,t),n()}const i=document.createElement("ul");i.setAttribute("data-type","checklist");const a=C("");i.appendChild(a),r.deleteContents(),r.insertNode(i);const h=a.querySelector(":scope > p");return h&&k(h,t),n()}catch(t){return console.error("Failed to toggle checklist:",t),!1}}},keymap:{"Mod-Shift-9":"toggleChecklist"}});exports.ChecklistPlugin=P;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const N="__editoraCommandEditorRoot",w=e=>{if(!e)return null;const t=e.querySelector('[contenteditable="true"]');return t instanceof HTMLElement?t:null},A=()=>{if(typeof window>"u")return null;const e=window[N];if(!(e instanceof HTMLElement))return null;window[N]=null;const t=e.closest("[data-editora-editor], .rte-editor, .editora-editor, editora-editor")||(e.matches("[data-editora-editor], .rte-editor, .editora-editor, editora-editor")?e:null);if(t){const r=w(t);if(r)return r;if(t.getAttribute("contenteditable")==="true")return t}if(e.getAttribute("contenteditable")==="true")return e;const n=e.closest('[contenteditable="true"]');return n instanceof HTMLElement?n:null},_=()=>{const e=A();if(e&&document.contains(e))return e;const t=window.getSelection();if(t&&t.rangeCount>0){let r=t.getRangeAt(0).startContainer;for(;r&&r!==document.body;){if(r.nodeType===Node.ELEMENT_NODE){const o=r;if(o.getAttribute("contenteditable")==="true")return o}r=r.parentNode}}const n=document.activeElement;if(n){if(n.getAttribute("contenteditable")==="true")return n;const r=n.closest('[contenteditable="true"]');if(r)return r}return document.querySelector('[contenteditable="true"]')},S=e=>e?e.nodeType===Node.ELEMENT_NODE?e:e.parentElement:null,H=e=>{const t=window.getSelection();if(!t||t.rangeCount===0)return null;const n=t.getRangeAt(0);return e.contains(n.commonAncestorContainer)?n:null},y=e=>{e.dispatchEvent(new Event("input",{bubbles:!0}))},M=(e,t)=>{if(t===e.innerHTML)return;const n=window.execEditorCommand||window.executeEditorCommand;if(typeof n=="function")try{n("recordDomTransaction",e,t,e.innerHTML)}catch{}},k=(e,t)=>{if(!e.isConnected){t.focus({preventScroll:!0});return}const n=window.getSelection();if(!n)return;const r=document.createRange();r.selectNodeContents(e),r.collapse(!1),n.removeAllRanges();try{n.addRange(r)}catch{t.focus({preventScroll:!0});return}t.focus({preventScroll:!0})},v=e=>{let t=e.querySelector(":scope > p");if(!t){t=document.createElement("p");const n=[];e.childNodes.forEach(r=>{r.nodeType===Node.ELEMENT_NODE&&["UL","OL"].includes(r.tagName)||n.push(r)}),n.forEach(r=>t.appendChild(r)),e.insertBefore(t,e.firstChild)}return t.innerHTML.trim()||(t.innerHTML="<br>"),t},C=e=>{const t=document.createElement("li");t.setAttribute("data-type","checklist-item"),t.setAttribute("data-checked","false");const n=document.createElement("p");return n.innerHTML=e.trim()||"<br>",t.appendChild(n),t},T=e=>Array.from(e.children).filter(t=>t instanceof HTMLLIElement),I=new Set(["P","DIV","H1","H2","H3","H4","H5","H6","BLOCKQUOTE","PRE","LI"]),b=e=>I.has(e.tagName)&&e.getAttribute("contenteditable")!=="true",R=(e,t)=>{const n=[],r=new Set,o=i=>{!i||r.has(i)||t.contains(i)&&b(i)&&(i.closest("ul, ol")||(r.add(i),n.push(i)))},u=i=>{let a=i;for(;a&&a!==document.body;){if(a.nodeType===Node.ELEMENT_NODE){const h=a;if(b(h))return h;if(h.getAttribute("contenteditable")==="true")break}a=a.parentNode}return null};if(e.collapsed)return o(u(e.startContainer)),n;const d=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT,{acceptNode:i=>{const a=i;if(!b(a)||a.closest("ul, ol"))return NodeFilter.FILTER_SKIP;if(typeof e.intersectsNode=="function")return e.intersectsNode(a)?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP;const h=document.createRange();return h.selectNodeContents(a),e.compareBoundaryPoints(Range.END_TO_START,h)>0&&e.compareBoundaryPoints(Range.START_TO_END,h)<0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});let l=d.nextNode();for(;l;)o(l),l=d.nextNode();if(n.length===0&&o(u(e.commonAncestorContainer)),n.length<=1)return n;const m=n.filter(i=>!n.some(a=>a!==i&&i.contains(a)));return m.length>0?m:n},O=e=>{const t=[],n=document.createElement("div"),r=()=>{const o=n.innerHTML.trim();if(!o)return;const u=document.createElement("p");u.innerHTML=o,t.push(u),n.innerHTML=""};if(e.childNodes.forEach(o=>{if(o.nodeType===Node.ELEMENT_NODE&&["UL","OL"].includes(o.tagName)){r();return}if(o.nodeType===Node.ELEMENT_NODE&&o.tagName==="P"){r();const u=o.innerHTML.trim(),d=document.createElement("p");d.innerHTML=u||"<br>",t.push(d);return}o.nodeType===Node.TEXT_NODE&&!(o.textContent||"").trim()||n.appendChild(o.cloneNode(!0))}),r(),t.length===0){const o=document.createElement("p");o.innerHTML="<br>",t.push(o)}return t},P=()=>({name:"checklist",init:()=>{if(typeof document>"u"||typeof window>"u"||window.__checklistPluginClickInitialized)return;window.__checklistPluginClickInitialized=!0;const e=t=>{const r=t.target.closest('li[data-type="checklist-item"]');if(!r)return;const o=r.getBoundingClientRect();if(!(t.clientX-o.left<32))return;t.preventDefault(),t.stopPropagation();const l=r.closest("[contenteditable], .rte-content, .editora-content");if(l?.getAttribute("contenteditable")==="false"||!!l?.closest('[data-readonly="true"], .editora-editor[readonly], editora-editor[readonly]'))return;const i=l?.innerHTML||"",a=r.getAttribute("data-checked")==="true";r.setAttribute("data-checked",(!a).toString()),l&&(M(l,i),y(l))};document.addEventListener("click",e)},nodes:{checklist:{content:"checklistItem+",group:"block",parseDOM:[{tag:'ul[data-type="checklist"]'}],toDOM:()=>["ul",{"data-type":"checklist"},0]},checklistItem:{content:"paragraph",attrs:{checked:{default:!1}},parseDOM:[{tag:'li[data-type="checklist-item"]',getAttrs:e=>({checked:e.getAttribute("data-checked")==="true"})}],toDOM:e=>["li",{"data-type":"checklist-item","data-checked":e?.attrs?.checked?"true":"false"},0]}},toolbar:[{label:"Checklist",command:"toggleChecklist",icon:'<svg width="24px" height="24px" viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg" fill="#000000"><g id="SVGRepo_bgCarrier" stroke-width="0"></g><g id="SVGRepo_tracerCarrier" stroke-linecap="round" stroke-linejoin="round"></g><g id="SVGRepo_iconCarrier"><path fill-rule="evenodd" clip-rule="evenodd" d="M3.75 4.48h-.71L2 3.43l.71-.7.69.68L4.81 2l.71.71-1.77 1.77zM6.99 3h8v1h-8V3zm0 3h8v1h-8V6zm8 3h-8v1h8V9zm-8 3h8v1h-8v-1zM3.04 7.48h.71l1.77-1.77-.71-.7L3.4 6.42l-.69-.69-.71.71 1.04 1.04zm.71 3.01h-.71L2 9.45l.71-.71.69.69 1.41-1.42.71.71-1.77 1.77zm-.71 3.01h.71l1.77-1.77-.71-.71-1.41 1.42-.69-.69-.71.7 1.04 1.05z"></path></g></svg>',shortcut:"Mod-Shift-9"}],commands:{toggleChecklist:()=>{try{const e=_();if(!e)return!1;const t=e.innerHTML,n=()=>(M(e,t),y(e),!0),r=H(e);if(!r)return!1;const o=S(r.startContainer);if(!o)return!1;const u=o.closest('ul[data-type="checklist"]');if(u&&e.contains(u)){const c=T(u);if(c.length===0)return!1;const p=document.createDocumentFragment();let s=null;return c.forEach((f,g)=>{const E=O(f);E.forEach(L=>{p.appendChild(L),!s&&(f.contains(r.startContainer)||g===0)&&(s=L)}),!s&&g===0&&E[0]&&(s=E[0])}),u.replaceWith(p),s&&k(s,e),n()}const d=o.closest("ul, ol");if(d&&e.contains(d)){let c;if(d.tagName.toLowerCase()==="ul")c=d;else{for(c=document.createElement("ul");d.firstChild;)c.appendChild(d.firstChild);d.replaceWith(c)}c.setAttribute("data-type","checklist");let p=T(c);p.length===0&&(c.appendChild(C("")),p=T(c));let s=null;p.forEach(g=>{g.setAttribute("data-type","checklist-item"),g.hasAttribute("data-checked")||g.setAttribute("data-checked","false");const E=v(g);g.contains(r.startContainer)&&(s=E)});const f=c.querySelector(':scope > li[data-type="checklist-item"] > p');return k(s||f||c,e),n()}const l=R(r,e);if(l.length>1){const c=document.createElement("ul");c.setAttribute("data-type","checklist"),l.forEach(f=>{c.appendChild(C(f.innerHTML))}),l[0].replaceWith(c),l.slice(1).forEach(f=>{f.isConnected&&f.remove()});const s=c.querySelector(':scope > li[data-type="checklist-item"] > p');return s&&k(s,e),n()}const m=l[0]||o.closest("p, h1, h2, h3, h4, h5, h6, blockquote, pre");if(m&&m!==e){const c=document.createElement("ul");c.setAttribute("data-type","checklist");const p=C(m.innerHTML);c.appendChild(p),m.replaceWith(c);const s=p.querySelector(":scope > p");return s&&k(s,e),n()}const i=document.createElement("ul");i.setAttribute("data-type","checklist");const a=C("");i.appendChild(a),r.deleteContents(),r.insertNode(i);const h=a.querySelector(":scope > p");return h&&k(h,e),n()}catch(e){return console.error("Failed to toggle checklist:",e),!1}}},keymap:{"Mod-Shift-9":"toggleChecklist"}});exports.ChecklistPlugin=P;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=()=>({name:"clearFormatting",toolbar:[{label:"Clear Formatting",command:"clearFormatting",icon:'<svg width="24" height="24" focusable="false"><path d="M13.2 6a1 1 0 0 1 0 .2l-2.6 10a1 1 0 0 1-1 .8h-.2a.8.8 0 0 1-.8-1l2.6-10H8a1 1 0 1 1 0-2h9a1 1 0 0 1 0 2h-3.8ZM5 18h7a1 1 0 0 1 0 2H5a1 1 0 0 1 0-2Zm13 1.5L16.5 18 15 19.5a.7.7 0 0 1-1-1l1.5-1.5-1.5-1.5a.7.7 0 0 1 1-1l1.5 1.5 1.5-1.5a.7.7 0 0 1 1 1L17.5 17l1.5 1.5a.7.7 0 0 1-1 1Z" fill-rule="evenodd"></path></svg>',shortcut:"Mod-\\"}],commands:{clearFormatting:()=>{const t=f();if(!t)return!1;const e=window.getSelection();if(!e||e.rangeCount===0)return!1;const o=e.getRangeAt(0);if(!t.contains(o.commonAncestorContainer))return!1;const n=o.cloneRange();return t.focus({preventScroll:!0}),document.execCommand("unlink",!1),document.execCommand("removeFormat",!1),h(t,n),m(t,n),t.dispatchEvent(new Event("input",{bubbles:!0})),!0}},keymap:{"Mod-\\":"clearFormatting"}}),l=new Set(["A","B","STRONG","I","EM","U","S","STRIKE","DEL","FONT","MARK","CODE","SUB","SUP"]),u=new Set(["H1","H2","H3","H4","H5","H6","BLOCKQUOTE","PRE"]),d=["color","background-color","font-size","font-family","font-weight","font-style","text-decoration","text-transform","line-height","letter-spacing","word-spacing","vertical-align","text-align","padding-left"];function f(){const t=window.getSelection();if(t&&t.rangeCount>0){const o=t.getRangeAt(0).startContainer,r=(o.nodeType===Node.ELEMENT_NODE?o:o.parentElement)?.closest('[contenteditable="true"], .rte-content, .editora-content');if(r)return r}const e=document.activeElement;return e?e.getAttribute("contenteditable")==="true"?e:e.closest('[contenteditable="true"], .rte-content, .editora-content'):null}function c(t,e){try{if(typeof t.intersectsNode=="function")return t.intersectsNode(e)}catch{}const o=document.createRange();return e.nodeType===Node.ELEMENT_NODE?o.selectNodeContents(e):o.selectNode(e),t.compareBoundaryPoints(Range.END_TO_START,o)>0&&t.compareBoundaryPoints(Range.START_TO_END,o)<0}function a(t){let e=0,o=t;for(;o&&o.parentNode;)e+=1,o=o.parentNode;return e}function g(t){d.forEach(e=>{t.style.removeProperty(e)}),(!t.getAttribute("style")||t.style.length===0)&&t.removeAttribute("style"),t.classList.contains("rte-text-color")&&t.classList.remove("rte-text-color"),t.classList.contains("rte-bg-color")&&t.classList.remove("rte-bg-color"),t.classList.length===0&&t.removeAttribute("class")}function i(t){const e=t.parentNode;if(e){for(;t.firstChild;)e.insertBefore(t.firstChild,t);e.removeChild(t)}}function h(t,e){Array.from(t.querySelectorAll("h1,h2,h3,h4,h5,h6,blockquote,pre")).forEach(n=>{if(!c(e,n)||!u.has(n.tagName))return;const r=document.createElement("p");for(;n.firstChild;)r.appendChild(n.firstChild);n.parentNode?.replaceChild(r,n)})}function m(t,e){const o=Array.from(t.querySelectorAll("a,b,strong,i,em,u,s,strike,del,font,mark,code,sub,sup,span,[style],[class]"));o.sort((n,r)=>a(r)-a(n)),o.forEach(n=>{if(n.isConnected&&c(e,n)&&!(n.getAttribute("contenteditable")==="false"||n.closest('[contenteditable="false"]'))){if(g(n),l.has(n.tagName)){i(n);return}n.tagName==="SPAN"&&n.attributes.length===0&&i(n)}})}exports.ClearFormattingPlugin=s;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const s=()=>({name:"clearFormatting",toolbar:[{label:"Clear Formatting",command:"clearFormatting",icon:'<svg width="24" height="24" focusable="false"><path d="M13.2 6a1 1 0 0 1 0 .2l-2.6 10a1 1 0 0 1-1 .8h-.2a.8.8 0 0 1-.8-1l2.6-10H8a1 1 0 1 1 0-2h9a1 1 0 0 1 0 2h-3.8ZM5 18h7a1 1 0 0 1 0 2H5a1 1 0 0 1 0-2Zm13 1.5L16.5 18 15 19.5a.7.7 0 0 1-1-1l1.5-1.5-1.5-1.5a.7.7 0 0 1 1-1l1.5 1.5 1.5-1.5a.7.7 0 0 1 1 1L17.5 17l1.5 1.5a.7.7 0 0 1-1 1Z" fill-rule="evenodd"></path></svg>',shortcut:"Mod-\\"}],commands:{clearFormatting:()=>{const t=f();if(!t)return!1;const e=window.getSelection();if(!e||e.rangeCount===0)return!1;const o=e.getRangeAt(0);if(!t.contains(o.commonAncestorContainer))return!1;const n=o.cloneRange();return t.focus({preventScroll:!0}),document.execCommand("unlink",!1),document.execCommand("removeFormat",!1),h(t,n),m(t,n),t.dispatchEvent(new Event("input",{bubbles:!0})),!0}},keymap:{"Mod-\\":"clearFormatting"}}),l=new Set(["A","B","STRONG","I","EM","U","S","STRIKE","DEL","FONT","MARK","CODE","SUB","SUP"]),u=new Set(["H1","H2","H3","H4","H5","H6","BLOCKQUOTE","PRE"]),d=["color","background-color","font-size","font-family","font-weight","font-style","text-decoration","text-transform","line-height","letter-spacing","word-spacing","vertical-align","text-align","padding-left"];function f(){const t=window.getSelection();if(t&&t.rangeCount>0){const o=t.getRangeAt(0).startContainer,r=(o.nodeType===Node.ELEMENT_NODE?o:o.parentElement)?.closest('[contenteditable="true"], .rte-content, .editora-content');if(r)return r}const e=document.activeElement;return e?e.getAttribute("contenteditable")==="true"?e:e.closest('[contenteditable="true"], .rte-content, .editora-content'):null}function c(t,e){try{if(typeof t.intersectsNode=="function")return t.intersectsNode(e)}catch{}const o=document.createRange();return e.nodeType===Node.ELEMENT_NODE?o.selectNodeContents(e):o.selectNode(e),t.compareBoundaryPoints(Range.END_TO_START,o)>0&&t.compareBoundaryPoints(Range.START_TO_END,o)<0}function a(t){let e=0,o=t;for(;o&&o.parentNode;)e+=1,o=o.parentNode;return e}function g(t){d.forEach(e=>{t.style.removeProperty(e)}),(!t.getAttribute("style")||t.style.length===0)&&t.removeAttribute("style"),t.classList.contains("rte-text-color")&&t.classList.remove("rte-text-color"),t.classList.contains("rte-bg-color")&&t.classList.remove("rte-bg-color"),t.classList.length===0&&t.removeAttribute("class")}function i(t){const e=t.parentNode;if(e){for(;t.firstChild;)e.insertBefore(t.firstChild,t);e.removeChild(t)}}function h(t,e){Array.from(t.querySelectorAll("h1,h2,h3,h4,h5,h6,blockquote,pre")).forEach(n=>{if(!c(e,n)||!u.has(n.tagName))return;const r=document.createElement("p");for(;n.firstChild;)r.appendChild(n.firstChild);n.parentNode?.replaceChild(r,n)})}function m(t,e){const o=Array.from(t.querySelectorAll("a,b,strong,i,em,u,s,strike,del,font,mark,code,sub,sup,span,[style],[class]"));o.sort((n,r)=>a(r)-a(n)),o.forEach(n=>{if(n.isConnected&&c(e,n)&&!(n.getAttribute("contenteditable")==="false"||n.closest('[contenteditable="false"]'))){if(g(n),l.has(n.tagName)){i(n);return}n.tagName==="SPAN"&&n.attributes.length===0&&i(n)}})}exports.ClearFormattingPlugin=s;
@@ -1,4 +1,4 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const w=()=>{const d=window.getSelection();if(d&&d.rangeCount>0){let t=d.getRangeAt(0).startContainer;for(;t&&t!==document.body;){if(t.nodeType===Node.ELEMENT_NODE){const n=t;if(n.getAttribute("contenteditable")==="true")return n}t=t.parentNode}}const a=document.activeElement;if(a){if(a.getAttribute("contenteditable")==="true")return a;const t=a.closest('[contenteditable="true"]');if(t)return t}return document.querySelector('[contenteditable="true"]')},k='[data-theme="dark"], .dark, .editora-theme-dark',N=()=>{if(w()?.closest(k))return!0;const a=window.getSelection();if(a&&a.rangeCount>0){const n=a.getRangeAt(0).startContainer;if((n.nodeType===Node.ELEMENT_NODE?n:n.parentElement)?.closest(k))return!0}return document.activeElement?.closest(k)?!0:document.body.matches(k)||document.documentElement.matches(k)},A=[{value:"javascript",label:"JavaScript"},{value:"typescript",label:"TypeScript"},{value:"python",label:"Python"},{value:"java",label:"Java"},{value:"csharp",label:"C#"},{value:"cpp",label:"C++"},{value:"c",label:"C"},{value:"php",label:"PHP"},{value:"ruby",label:"Ruby"},{value:"go",label:"Go"},{value:"rust",label:"Rust"},{value:"swift",label:"Swift"},{value:"kotlin",label:"Kotlin"},{value:"html",label:"HTML"},{value:"css",label:"CSS"},{value:"scss",label:"SCSS"},{value:"json",label:"JSON"},{value:"xml",label:"XML"},{value:"yaml",label:"YAML"},{value:"markdown",label:"Markdown"},{value:"sql",label:"SQL"},{value:"bash",label:"Bash"},{value:"shell",label:"Shell"},{value:"plaintext",label:"Plain Text"}],T=new Map;function $(d,a,t,n){const s=!!a,c=n||"javascript",g=t||"",p=N(),e=p?{overlay:"rgba(0, 0, 0, 0.62)",dialogBg:"#1f2937",dialogBorder:"#4b5563",text:"#e2e8f0",mutedText:"#a8b5c8",headerFooterBg:"#222d3a",border:"#3b4657",fieldBg:"#111827",fieldBorder:"#4b5563",cancelBg:"#334155",cancelHover:"#475569",cancelText:"#e2e8f0",primaryBg:"#3b82f6",primaryHover:"#2563eb"}:{overlay:"rgba(0, 0, 0, 0.5)",dialogBg:"#ffffff",dialogBorder:"#e0e0e0",text:"#333333",mutedText:"#666666",headerFooterBg:"#ffffff",border:"#e0e0e0",fieldBg:"#ffffff",fieldBorder:"#dddddd",cancelBg:"#e5e7eb",cancelHover:"#d1d5db",cancelText:"#333333",primaryBg:"#2563eb",primaryHover:"#1d4ed8"},l=document.createElement("div");l.className="rte-code-sample-overlay",p&&l.classList.add("rte-theme-dark"),l.style.cssText=`
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const S=()=>{const d=window.getSelection();if(d&&d.rangeCount>0){let t=d.getRangeAt(0).startContainer;for(;t&&t!==document.body;){if(t.nodeType===Node.ELEMENT_NODE){const n=t;if(n.getAttribute("contenteditable")==="true")return n}t=t.parentNode}}const r=document.activeElement;if(r){if(r.getAttribute("contenteditable")==="true")return r;const t=r.closest('[contenteditable="true"]');if(t)return t}return document.querySelector('[contenteditable="true"]')},k='[data-theme="dark"], .dark, .editora-theme-dark',N=()=>{if(S()?.closest(k))return!0;const r=window.getSelection();if(r&&r.rangeCount>0){const n=r.getRangeAt(0).startContainer;if((n.nodeType===Node.ELEMENT_NODE?n:n.parentElement)?.closest(k))return!0}return document.activeElement?.closest(k)?!0:document.body.matches(k)||document.documentElement.matches(k)},A=[{value:"javascript",label:"JavaScript"},{value:"typescript",label:"TypeScript"},{value:"python",label:"Python"},{value:"java",label:"Java"},{value:"csharp",label:"C#"},{value:"cpp",label:"C++"},{value:"c",label:"C"},{value:"php",label:"PHP"},{value:"ruby",label:"Ruby"},{value:"go",label:"Go"},{value:"rust",label:"Rust"},{value:"swift",label:"Swift"},{value:"kotlin",label:"Kotlin"},{value:"html",label:"HTML"},{value:"css",label:"CSS"},{value:"scss",label:"SCSS"},{value:"json",label:"JSON"},{value:"xml",label:"XML"},{value:"yaml",label:"YAML"},{value:"markdown",label:"Markdown"},{value:"sql",label:"SQL"},{value:"bash",label:"Bash"},{value:"shell",label:"Shell"},{value:"plaintext",label:"Plain Text"}],B=new Map;function $(d,r,t,n){const s=!!r,c=n||"javascript",g=t||"",p=N(),e=p?{overlay:"rgba(0, 0, 0, 0.62)",dialogBg:"#1f2937",dialogBorder:"#4b5563",text:"#e2e8f0",mutedText:"#a8b5c8",headerFooterBg:"#222d3a",border:"#3b4657",fieldBg:"#111827",fieldBorder:"#4b5563",cancelBg:"#334155",cancelHover:"#475569",cancelText:"#e2e8f0",primaryBg:"#3b82f6",primaryHover:"#2563eb"}:{overlay:"rgba(0, 0, 0, 0.5)",dialogBg:"#ffffff",dialogBorder:"#e0e0e0",text:"#333333",mutedText:"#666666",headerFooterBg:"#ffffff",border:"#e0e0e0",fieldBg:"#ffffff",fieldBorder:"#dddddd",cancelBg:"#e5e7eb",cancelHover:"#d1d5db",cancelText:"#333333",primaryBg:"#2563eb",primaryHover:"#1d4ed8"},l=document.createElement("div");l.className="rte-code-sample-overlay",p&&l.classList.add("rte-theme-dark"),l.style.cssText=`
2
2
  position: fixed;
3
3
  top: 0;
4
4
  left: 0;
@@ -49,9 +49,9 @@
49
49
  color: ${e.text};
50
50
  cursor: pointer;
51
51
  ">
52
- ${A.map(r=>`
53
- <option value="${r.value}" ${r.value===c?"selected":""}>
54
- ${r.label}
52
+ ${A.map(a=>`
53
+ <option value="${a.value}" ${a.value===c?"selected":""}>
54
+ ${a.label}
55
55
  </option>
56
56
  `).join("")}
57
57
  </select>
@@ -101,7 +101,7 @@
101
101
  background: ${e.primaryBg};
102
102
  color: #fff;
103
103
  ">${s?"Update Code Sample":"Insert Code Sample"}</button>
104
- `,o.appendChild(u),o.appendChild(m),o.appendChild(y),l.appendChild(o);const L=i.querySelector(".rte-code-language"),E=b.querySelector(".rte-code-textarea"),S=b.querySelector(".rte-code-error"),f=u.querySelector(".rte-code-close-btn"),v=y.querySelector(".rte-code-cancel-btn"),h=y.querySelector(".rte-code-save-btn");f.onmouseover=()=>{f.style.color="#f8fafc",f.style.background=p?"#334155":"#f0f0f0",f.style.borderRadius="4px"},f.onmouseout=()=>{f.style.color=e.mutedText,f.style.background="none"},v.onmouseover=()=>{v.style.background=e.cancelHover},v.onmouseout=()=>{v.style.background=e.cancelBg},h.onmouseover=()=>{h.style.background=e.primaryHover},h.onmouseout=()=>{h.style.background=e.primaryBg};const C=()=>{l.remove()},B=()=>{const r=E.value.trim();if(!r){S.textContent="⚠ Code cannot be empty",S.style.display="block";return}const M=L.value;d(r,M),C()};if(f.onclick=C,v.onclick=C,h.onclick=B,E.addEventListener("keydown",r=>{(r.ctrlKey||r.metaKey)&&r.key==="Enter"&&(r.preventDefault(),B()),r.key==="Escape"&&C()}),E.addEventListener("input",()=>{S.style.display="none"}),l.addEventListener("click",r=>{r.target===l&&C()}),!document.getElementById("rte-code-sample-animations")){const r=document.createElement("style");r.id="rte-code-sample-animations",r.textContent=`
104
+ `,o.appendChild(u),o.appendChild(m),o.appendChild(y),l.appendChild(o);const L=i.querySelector(".rte-code-language"),E=b.querySelector(".rte-code-textarea"),T=b.querySelector(".rte-code-error"),f=u.querySelector(".rte-code-close-btn"),v=y.querySelector(".rte-code-cancel-btn"),h=y.querySelector(".rte-code-save-btn");f.onmouseover=()=>{f.style.color="#f8fafc",f.style.background=p?"#334155":"#f0f0f0",f.style.borderRadius="4px"},f.onmouseout=()=>{f.style.color=e.mutedText,f.style.background="none"},v.onmouseover=()=>{v.style.background=e.cancelHover},v.onmouseout=()=>{v.style.background=e.cancelBg},h.onmouseover=()=>{h.style.background=e.primaryHover},h.onmouseout=()=>{h.style.background=e.primaryBg};const C=()=>{l.remove()},w=()=>{const a=E.value.trim();if(!a){T.textContent="⚠ Code cannot be empty",T.style.display="block";return}const M=L.value;d(a,M),C()};if(f.onclick=C,v.onclick=C,h.onclick=w,E.addEventListener("keydown",a=>{(a.ctrlKey||a.metaKey)&&a.key==="Enter"&&(a.preventDefault(),w()),a.key==="Escape"&&C()}),E.addEventListener("input",()=>{T.style.display="none"}),l.addEventListener("click",a=>{a.target===l&&C()}),!document.getElementById("rte-code-sample-animations")){const a=document.createElement("style");a.id="rte-code-sample-animations",a.textContent=`
105
105
  @keyframes fadeIn {
106
106
  from { opacity: 0; }
107
107
  to { opacity: 1; }
@@ -110,7 +110,7 @@
110
110
  from { transform: translateY(20px); opacity: 0; }
111
111
  to { transform: translateY(0); opacity: 1; }
112
112
  }
113
- `,document.head.appendChild(r)}return document.body.appendChild(l),setTimeout(()=>E.focus(),100),l}function R(){if(!w())return;let a=null;const t=window.getSelection();t&&t.rangeCount>0&&(a=t.getRangeAt(0).cloneRange()),$((n,s)=>{const c=window.getSelection();if(a&&(c?.removeAllRanges(),c?.addRange(a)),!c||c.rangeCount===0)return;const g=w();if(!g)return;const p=c.anchorNode;if(!p||!g.contains(p))return;const e=c.getRangeAt(0),l=`code-block-${Date.now()}`,o=document.createElement("pre");o.className="rte-code-block",o.id=l,o.setAttribute("data-type","code-block"),o.setAttribute("data-lang",s),o.setAttribute("data-code-id",l),o.setAttribute("contenteditable","false"),o.style.cssText=`
113
+ `,document.head.appendChild(a)}return document.body.appendChild(l),setTimeout(()=>E.focus(),100),l}function R(){if(!S())return;let r=null;const t=window.getSelection();t&&t.rangeCount>0&&(r=t.getRangeAt(0).cloneRange()),$((n,s)=>{const c=window.getSelection();if(r&&(c?.removeAllRanges(),c?.addRange(r)),!c||c.rangeCount===0)return;const g=S();if(!g)return;const p=c.anchorNode;if(!p||!g.contains(p))return;const e=c.getRangeAt(0),l=`code-block-${Date.now()}`,o=document.createElement("pre");o.className="rte-code-block",o.id=l,o.setAttribute("data-type","code-block"),o.setAttribute("data-lang",s),o.setAttribute("data-code-id",l),o.setAttribute("contenteditable","false"),o.style.cssText=`
114
114
  display: block;
115
115
  position: relative;
116
116
  background: #f5f5f5;
@@ -158,4 +158,4 @@
158
158
  cursor: pointer;
159
159
  opacity: 0;
160
160
  transition: opacity 0.2s ease;
161
- `,i.onclick=x=>{x.stopPropagation(),navigator.clipboard.writeText(n).then(()=>{i.textContent="✓ Copied!",setTimeout(()=>{i.textContent="Copy"},2e3)})},o.appendChild(m),o.appendChild(i),o.appendChild(u),o.addEventListener("mouseenter",()=>{i.style.opacity="1"}),o.addEventListener("mouseleave",()=>{i.style.opacity="0"}),o.addEventListener("dblclick",()=>{z(l)}),T.set(l,{id:l,language:s,code:n}),e.insertNode(o);const b=document.createRange();b.setStartAfter(o),b.collapse(!0),c.removeAllRanges(),c.addRange(b)})}function z(d){const a=w();if(!a)return;const t=a.querySelector(`#${d}`);if(!t)return;const n=T.get(d);n&&$((s,c)=>{const g=t.querySelector("code");g&&(g.textContent=s,g.className=`language-${c}`);const p=t.querySelector("span");p&&(p.textContent=c),t.setAttribute("data-lang",c),n.language=c,n.code=s;const e=t.querySelector(".rte-code-copy");e&&(e.onclick=l=>{l.stopPropagation(),navigator.clipboard.writeText(s).then(()=>{e.textContent="✓ Copied!",setTimeout(()=>{e.textContent="Copy"},2e3)})})},d,n.code,n.language)}const H=()=>({name:"codeSample",toolbar:[{label:"Code Block",command:"insertCodeBlock",icon:'<svg width="18px" height="18px" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M7 8L3 11.6923L7 16M17 8L21 11.6923L17 16M14 4L10 20" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/></svg>',shortcut:"Mod-Shift-C"}],commands:{insertCodeBlock:(...d)=>(R(),!0)}});exports.CodeSamplePlugin=H;
161
+ `,i.onclick=x=>{x.stopPropagation(),navigator.clipboard.writeText(n).then(()=>{i.textContent="✓ Copied!",setTimeout(()=>{i.textContent="Copy"},2e3)})},o.appendChild(m),o.appendChild(i),o.appendChild(u),o.addEventListener("mouseenter",()=>{i.style.opacity="1"}),o.addEventListener("mouseleave",()=>{i.style.opacity="0"}),o.addEventListener("dblclick",()=>{z(l)}),B.set(l,{id:l,language:s,code:n}),e.insertNode(o);const b=document.createRange();b.setStartAfter(o),b.collapse(!0),c.removeAllRanges(),c.addRange(b)})}function z(d){const r=S();if(!r)return;const t=r.querySelector(`#${d}`);if(!t)return;const n=B.get(d);n&&$((s,c)=>{const g=t.querySelector("code");g&&(g.textContent=s,g.className=`language-${c}`);const p=t.querySelector("span");p&&(p.textContent=c),t.setAttribute("data-lang",c),n.language=c,n.code=s;const e=t.querySelector(".rte-code-copy");e&&(e.onclick=l=>{l.stopPropagation(),navigator.clipboard.writeText(s).then(()=>{e.textContent="✓ Copied!",setTimeout(()=>{e.textContent="Copy"},2e3)})})},d,n.code,n.language)}const H=()=>({name:"codeSample",toolbar:[{label:"Insert Code",command:"insertCodeBlock",icon:'<svg width="24" height="26" focusable="false"><path d="M7.1 11a2.8 2.8 0 0 1-.8 2 2.8 2.8 0 0 1 .8 2v1.7c0 .3.1.6.4.8.2.3.5.4.8.4.3 0 .4.2.4.4v.8c0 .2-.1.4-.4.4-.7 0-1.4-.3-2-.8-.5-.6-.8-1.3-.8-2V15c0-.3-.1-.6-.4-.8-.2-.3-.5-.4-.8-.4a.4.4 0 0 1-.4-.4v-.8c0-.2.2-.4.4-.4.3 0 .6-.1.8-.4.3-.2.4-.5.4-.8V9.3c0-.7.3-1.4.8-2 .6-.5 1.3-.8 2-.8.3 0 .4.2.4.4v.8c0 .2-.1.4-.4.4-.3 0-.6.1-.8.4-.3.2-.4.5-.4.8V11Zm9.8 0V9.3c0-.3-.1-.6-.4-.8-.2-.3-.5-.4-.8-.4a.4.4 0 0 1-.4-.4V7c0-.2.1-.4.4-.4.7 0 1.4.3 2 .8.5.6.8 1.3.8 2V11c0 .3.1.6.4.8.2.3.5.4.8.4.2 0 .4.2.4.4v.8c0 .2-.2.4-.4.4-.3 0-.6.1-.8.4-.3.2-.4.5-.4.8v1.7c0 .7-.3 1.4-.8 2-.6.5-1.3.8-2 .8a.4.4 0 0 1-.4-.4v-.8c0-.2.1-.4.4-.4.3 0 .6-.1.8-.4.3-.2.4-.5.4-.8V15a2.8 2.8 0 0 1 .8-2 2.8 2.8 0 0 1-.8-2Zm-3.3-.4c0 .4-.1.8-.5 1.1-.3.3-.7.5-1.1.5-.4 0-.8-.2-1.1-.5-.4-.3-.5-.7-.5-1.1 0-.5.1-.9.5-1.2.3-.3.7-.4 1.1-.4.4 0 .8.1 1.1.4.4.3.5.7.5 1.2ZM12 13c.4 0 .8.1 1.1.5.4.3.5.7.5 1.1 0 1-.1 1.6-.5 2a3 3 0 0 1-1.1 1c-.4.3-.8.4-1.1.4a.5.5 0 0 1-.5-.5V17a3 3 0 0 0 1-.2l.6-.6c-.6 0-1-.2-1.3-.5-.2-.3-.3-.7-.3-1 0-.5.1-1 .5-1.2.3-.4.7-.5 1.1-.5Z" fill-rule="evenodd"></path></svg>',shortcut:"Mod-Shift-C"}],commands:{insertCodeBlock:(...d)=>(R(),!0)}});exports.CodeSamplePlugin=H;
@@ -1,4 +1,4 @@
1
- const w = () => {
1
+ const T = () => {
2
2
  const d = window.getSelection();
3
3
  if (d && d.rangeCount > 0) {
4
4
  let t = d.getRangeAt(0).startContainer;
@@ -11,23 +11,23 @@ const w = () => {
11
11
  t = t.parentNode;
12
12
  }
13
13
  }
14
- const a = document.activeElement;
15
- if (a) {
16
- if (a.getAttribute("contenteditable") === "true")
17
- return a;
18
- const t = a.closest('[contenteditable="true"]');
14
+ const r = document.activeElement;
15
+ if (r) {
16
+ if (r.getAttribute("contenteditable") === "true")
17
+ return r;
18
+ const t = r.closest('[contenteditable="true"]');
19
19
  if (t) return t;
20
20
  }
21
21
  return document.querySelector('[contenteditable="true"]');
22
- }, k = '[data-theme="dark"], .dark, .editora-theme-dark', N = () => {
23
- if (w()?.closest(k)) return !0;
24
- const a = window.getSelection();
25
- if (a && a.rangeCount > 0) {
26
- const n = a.getRangeAt(0).startContainer;
22
+ }, k = '[data-theme="dark"], .dark, .editora-theme-dark', A = () => {
23
+ if (T()?.closest(k)) return !0;
24
+ const r = window.getSelection();
25
+ if (r && r.rangeCount > 0) {
26
+ const n = r.getRangeAt(0).startContainer;
27
27
  if ((n.nodeType === Node.ELEMENT_NODE ? n : n.parentElement)?.closest(k)) return !0;
28
28
  }
29
29
  return document.activeElement?.closest(k) ? !0 : document.body.matches(k) || document.documentElement.matches(k);
30
- }, A = [
30
+ }, M = [
31
31
  { value: "javascript", label: "JavaScript" },
32
32
  { value: "typescript", label: "TypeScript" },
33
33
  { value: "python", label: "Python" },
@@ -53,8 +53,8 @@ const w = () => {
53
53
  { value: "shell", label: "Shell" },
54
54
  { value: "plaintext", label: "Plain Text" }
55
55
  ], S = /* @__PURE__ */ new Map();
56
- function $(d, a, t, n) {
57
- const s = !!a, c = n || "javascript", g = t || "", p = N(), e = p ? {
56
+ function $(d, r, t, n) {
57
+ const s = !!r, c = n || "javascript", f = t || "", p = A(), e = p ? {
58
58
  overlay: "rgba(0, 0, 0, 0.62)",
59
59
  dialogBg: "#1f2937",
60
60
  dialogBorder: "#4b5563",
@@ -144,9 +144,9 @@ function $(d, a, t, n) {
144
144
  color: ${e.text};
145
145
  cursor: pointer;
146
146
  ">
147
- ${A.map((r) => `
148
- <option value="${r.value}" ${r.value === c ? "selected" : ""}>
149
- ${r.label}
147
+ ${M.map((a) => `
148
+ <option value="${a.value}" ${a.value === c ? "selected" : ""}>
149
+ ${a.label}
150
150
  </option>
151
151
  `).join("")}
152
152
  </select>
@@ -168,7 +168,7 @@ function $(d, a, t, n) {
168
168
  background-color: ${e.fieldBg};
169
169
  color: ${e.text};
170
170
  box-sizing: border-box;
171
- ">${g}</textarea>
171
+ ">${f}</textarea>
172
172
  <div class="rte-code-error" style="color: #dc2626; font-size: 12px; margin-top: 6px; display: none;"></div>
173
173
  `;
174
174
  const x = document.createElement("div");
@@ -203,11 +203,11 @@ function $(d, a, t, n) {
203
203
  color: #fff;
204
204
  ">${s ? "Update Code Sample" : "Insert Code Sample"}</button>
205
205
  `, o.appendChild(u), o.appendChild(m), o.appendChild(y), l.appendChild(o);
206
- const L = i.querySelector(".rte-code-language"), E = b.querySelector(".rte-code-textarea"), B = b.querySelector(".rte-code-error"), f = u.querySelector(".rte-code-close-btn"), v = y.querySelector(".rte-code-cancel-btn"), h = y.querySelector(".rte-code-save-btn");
207
- f.onmouseover = () => {
208
- f.style.color = "#f8fafc", f.style.background = p ? "#334155" : "#f0f0f0", f.style.borderRadius = "4px";
209
- }, f.onmouseout = () => {
210
- f.style.color = e.mutedText, f.style.background = "none";
206
+ const L = i.querySelector(".rte-code-language"), E = b.querySelector(".rte-code-textarea"), w = b.querySelector(".rte-code-error"), g = u.querySelector(".rte-code-close-btn"), v = y.querySelector(".rte-code-cancel-btn"), h = y.querySelector(".rte-code-save-btn");
207
+ g.onmouseover = () => {
208
+ g.style.color = "#f8fafc", g.style.background = p ? "#334155" : "#f0f0f0", g.style.borderRadius = "4px";
209
+ }, g.onmouseout = () => {
210
+ g.style.color = e.mutedText, g.style.background = "none";
211
211
  }, v.onmouseover = () => {
212
212
  v.style.background = e.cancelHover;
213
213
  }, v.onmouseout = () => {
@@ -219,24 +219,24 @@ function $(d, a, t, n) {
219
219
  };
220
220
  const C = () => {
221
221
  l.remove();
222
- }, T = () => {
223
- const r = E.value.trim();
224
- if (!r) {
225
- B.textContent = "⚠ Code cannot be empty", B.style.display = "block";
222
+ }, B = () => {
223
+ const a = E.value.trim();
224
+ if (!a) {
225
+ w.textContent = "⚠ Code cannot be empty", w.style.display = "block";
226
226
  return;
227
227
  }
228
- const M = L.value;
229
- d(r, M), C();
228
+ const N = L.value;
229
+ d(a, N), C();
230
230
  };
231
- if (f.onclick = C, v.onclick = C, h.onclick = T, E.addEventListener("keydown", (r) => {
232
- (r.ctrlKey || r.metaKey) && r.key === "Enter" && (r.preventDefault(), T()), r.key === "Escape" && C();
231
+ if (g.onclick = C, v.onclick = C, h.onclick = B, E.addEventListener("keydown", (a) => {
232
+ (a.ctrlKey || a.metaKey) && a.key === "Enter" && (a.preventDefault(), B()), a.key === "Escape" && C();
233
233
  }), E.addEventListener("input", () => {
234
- B.style.display = "none";
235
- }), l.addEventListener("click", (r) => {
236
- r.target === l && C();
234
+ w.style.display = "none";
235
+ }), l.addEventListener("click", (a) => {
236
+ a.target === l && C();
237
237
  }), !document.getElementById("rte-code-sample-animations")) {
238
- const r = document.createElement("style");
239
- r.id = "rte-code-sample-animations", r.textContent = `
238
+ const a = document.createElement("style");
239
+ a.id = "rte-code-sample-animations", a.textContent = `
240
240
  @keyframes fadeIn {
241
241
  from { opacity: 0; }
242
242
  to { opacity: 1; }
@@ -245,21 +245,21 @@ function $(d, a, t, n) {
245
245
  from { transform: translateY(20px); opacity: 0; }
246
246
  to { transform: translateY(0); opacity: 1; }
247
247
  }
248
- `, document.head.appendChild(r);
248
+ `, document.head.appendChild(a);
249
249
  }
250
250
  return document.body.appendChild(l), setTimeout(() => E.focus(), 100), l;
251
251
  }
252
252
  function R() {
253
- if (!w()) return;
254
- let a = null;
253
+ if (!T()) return;
254
+ let r = null;
255
255
  const t = window.getSelection();
256
- t && t.rangeCount > 0 && (a = t.getRangeAt(0).cloneRange()), $((n, s) => {
256
+ t && t.rangeCount > 0 && (r = t.getRangeAt(0).cloneRange()), $((n, s) => {
257
257
  const c = window.getSelection();
258
- if (a && (c?.removeAllRanges(), c?.addRange(a)), !c || c.rangeCount === 0) return;
259
- const g = w();
260
- if (!g) return;
258
+ if (r && (c?.removeAllRanges(), c?.addRange(r)), !c || c.rangeCount === 0) return;
259
+ const f = T();
260
+ if (!f) return;
261
261
  const p = c.anchorNode;
262
- if (!p || !g.contains(p)) return;
262
+ if (!p || !f.contains(p)) return;
263
263
  const e = c.getRangeAt(0), l = `code-block-${Date.now()}`, o = document.createElement("pre");
264
264
  o.className = "rte-code-block", o.id = l, o.setAttribute("data-type", "code-block"), o.setAttribute("data-lang", s), o.setAttribute("data-code-id", l), o.setAttribute("contenteditable", "false"), o.style.cssText = `
265
265
  display: block;
@@ -337,15 +337,15 @@ function R() {
337
337
  });
338
338
  }
339
339
  function z(d) {
340
- const a = w();
341
- if (!a) return;
342
- const t = a.querySelector(`#${d}`);
340
+ const r = T();
341
+ if (!r) return;
342
+ const t = r.querySelector(`#${d}`);
343
343
  if (!t) return;
344
344
  const n = S.get(d);
345
345
  n && $(
346
346
  (s, c) => {
347
- const g = t.querySelector("code");
348
- g && (g.textContent = s, g.className = `language-${c}`);
347
+ const f = t.querySelector("code");
348
+ f && (f.textContent = s, f.className = `language-${c}`);
349
349
  const p = t.querySelector("span");
350
350
  p && (p.textContent = c), t.setAttribute("data-lang", c), n.language = c, n.code = s;
351
351
  const e = t.querySelector(".rte-code-copy");
@@ -366,9 +366,9 @@ const H = () => ({
366
366
  name: "codeSample",
367
367
  toolbar: [
368
368
  {
369
- label: "Code Block",
369
+ label: "Insert Code",
370
370
  command: "insertCodeBlock",
371
- icon: '<svg width="18px" height="18px" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M7 8L3 11.6923L7 16M17 8L21 11.6923L17 16M14 4L10 20" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/></svg>',
371
+ icon: '<svg width="24" height="26" focusable="false"><path d="M7.1 11a2.8 2.8 0 0 1-.8 2 2.8 2.8 0 0 1 .8 2v1.7c0 .3.1.6.4.8.2.3.5.4.8.4.3 0 .4.2.4.4v.8c0 .2-.1.4-.4.4-.7 0-1.4-.3-2-.8-.5-.6-.8-1.3-.8-2V15c0-.3-.1-.6-.4-.8-.2-.3-.5-.4-.8-.4a.4.4 0 0 1-.4-.4v-.8c0-.2.2-.4.4-.4.3 0 .6-.1.8-.4.3-.2.4-.5.4-.8V9.3c0-.7.3-1.4.8-2 .6-.5 1.3-.8 2-.8.3 0 .4.2.4.4v.8c0 .2-.1.4-.4.4-.3 0-.6.1-.8.4-.3.2-.4.5-.4.8V11Zm9.8 0V9.3c0-.3-.1-.6-.4-.8-.2-.3-.5-.4-.8-.4a.4.4 0 0 1-.4-.4V7c0-.2.1-.4.4-.4.7 0 1.4.3 2 .8.5.6.8 1.3.8 2V11c0 .3.1.6.4.8.2.3.5.4.8.4.2 0 .4.2.4.4v.8c0 .2-.2.4-.4.4-.3 0-.6.1-.8.4-.3.2-.4.5-.4.8v1.7c0 .7-.3 1.4-.8 2-.6.5-1.3.8-2 .8a.4.4 0 0 1-.4-.4v-.8c0-.2.1-.4.4-.4.3 0 .6-.1.8-.4.3-.2.4-.5.4-.8V15a2.8 2.8 0 0 1 .8-2 2.8 2.8 0 0 1-.8-2Zm-3.3-.4c0 .4-.1.8-.5 1.1-.3.3-.7.5-1.1.5-.4 0-.8-.2-1.1-.5-.4-.3-.5-.7-.5-1.1 0-.5.1-.9.5-1.2.3-.3.7-.4 1.1-.4.4 0 .8.1 1.1.4.4.3.5.7.5 1.2ZM12 13c.4 0 .8.1 1.1.5.4.3.5.7.5 1.1 0 1-.1 1.6-.5 2a3 3 0 0 1-1.1 1c-.4.3-.8.4-1.1.4a.5.5 0 0 1-.5-.5V17a3 3 0 0 0 1-.2l.6-.6c-.6 0-1-.2-1.3-.5-.2-.3-.3-.7-.3-1 0-.5.1-1 .5-1.2.3-.4.7-.5 1.1-.5Z" fill-rule="evenodd"></path></svg>',
372
372
  shortcut: "Mod-Shift-C"
373
373
  }
374
374
  ],