@editora/plugins 1.0.5 → 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.
- package/dist/a11y-checker.cjs.js +1 -1
- package/dist/anchor.cjs.js +3 -3
- package/dist/background-color.cjs.js +2 -2
- package/dist/blockquote.cjs.js +1 -1
- package/dist/bold.cjs.js +1 -1
- package/dist/capitalization.cjs.js +1 -1
- package/dist/checklist.cjs.js +1 -1
- package/dist/clear-formatting.cjs.js +1 -1
- package/dist/code-sample.cjs.js +1 -1
- package/dist/code.cjs.js +1 -1
- package/dist/comments.cjs.js +1 -1
- package/dist/direction.cjs.js +1 -1
- package/dist/document-manager.cjs.js +1 -1
- package/dist/embed-iframe.cjs.js +1 -1
- package/dist/emojis.cjs.js +1 -1
- package/dist/font-family.cjs.js +1 -1
- package/dist/font-size.cjs.js +1 -1
- package/dist/footnote.cjs.js +2 -2
- package/dist/fullscreen.cjs.js +1 -1
- package/dist/heading.cjs.js +1 -1
- package/dist/history.cjs.js +1 -1
- package/dist/indent.cjs.js +1 -1
- package/dist/index.cjs.js +1 -1
- package/dist/italic.cjs.js +1 -1
- package/dist/line-height.cjs.js +1 -1
- package/dist/link.cjs.js +3 -3
- package/dist/list.cjs.js +1 -1
- package/dist/lite.cjs.js +1 -1
- package/dist/math.cjs.js +2 -2
- package/dist/media-manager.cjs.js +4 -4
- package/dist/merge-tag.cjs.js +3 -3
- package/dist/page-break.cjs.js +2 -2
- package/dist/preview.cjs.js +3 -3
- package/dist/print.cjs.js +1 -1
- package/dist/shared-config.cjs.js +1 -1
- package/dist/special-characters.cjs.js +3 -3
- package/dist/spell-check.cjs.js +1 -1
- package/dist/strikethrough.cjs.js +1 -1
- package/dist/table.cjs.js +3 -3
- package/dist/template.cjs.js +5 -5
- package/dist/text-alignment.cjs.js +1 -1
- package/dist/text-color.cjs.js +1 -1
- package/dist/underline.cjs.js +1 -1
- package/package.json +89 -46
package/dist/a11y-checker.cjs.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";Object.
|
|
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;
|
package/dist/anchor.cjs.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";Object.
|
|
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
|
|
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
|
|
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.
|
|
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",
|
|
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;
|
package/dist/blockquote.cjs.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.
|
|
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.
|
|
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.
|
|
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="<Transparent Rectangle>" 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;
|
package/dist/checklist.cjs.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.
|
|
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.
|
|
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;
|
package/dist/code-sample.cjs.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";Object.
|
|
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;
|
package/dist/code.cjs.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";Object.
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});class H{constructor(e=""){this._lines=[],this._version=0,this.setText(e)}getLine(e){return this._lines[e]||""}getLines(){return[...this._lines]}getLineCount(){return this._lines.length}getText(){return this._lines.join(`
|
|
2
2
|
`)}setText(e){this._lines=e.split(`
|
|
3
3
|
`),this._version++}getTextInRange(e){if(e.start.line===e.end.line)return this.getLine(e.start.line).substring(e.start.column,e.end.column);const t=[];t.push(this.getLine(e.start.line).substring(e.start.column));for(let i=e.start.line+1;i<e.end.line;i++)t.push(this.getLine(i));return e.end.line<this.getLineCount()&&t.push(this.getLine(e.end.line).substring(0,e.end.column)),t.join(`
|
|
4
4
|
`)}replaceRange(e,t){const i=this.getTextInRange(e);if(e.start.line===e.end.line){const s=this.getLine(e.start.line),r=s.substring(0,e.start.column)+t+s.substring(e.end.column);this._lines[e.start.line]=r}else{const s=this.getLine(e.start.line),r=this.getLine(e.end.line),o=s.substring(0,e.start.column)+t,n=r.substring(e.end.column),l=t.split(`
|
package/dist/comments.cjs.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";Object.
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const C=new WeakMap;let x=null,S=!1,k=0;const E="User";function h(e){return k+=1,`${e}-${Date.now()}-${k}`}function v(e){if(!e)return null;const t=e instanceof Element?e:e.parentElement;return t?t.closest("[data-editora-editor]")||t.closest(".rte-editor")||t.closest(".editora-editor"):null}function w(e,t){return t.contains(e.commonAncestorContainer)}function I(){if(typeof window<"u"){const o=window.__editoraCommandEditorRoot;if(o instanceof HTMLElement){const a=o.closest("[data-editora-editor], .rte-editor, .editora-editor, editora-editor")||(o.matches("[data-editora-editor], .rte-editor, .editora-editor, editora-editor")?o:null);if(a)return x=a,window.__editoraCommandEditorRoot=null,a}}const e=document.activeElement,t=e?v(e):null;if(t)return t;const r=window.getSelection();if(r&&r.rangeCount>0){const o=v(r.getRangeAt(0).commonAncestorContainer);if(o)return o}return x}function B(e){const t=C.get(e);if(t)return t;const r={root:e,comments:new Map,panelVisible:!1,panelElement:null,expandedComments:new Set,replyTexts:{},savedSelection:null,newCommentText:"",selectionChangeListener:null};return C.set(e,r),r}function f(){const e=I();return e?(x=e,B(e)):null}function T(e){const t=window.getSelection();if(!t||t.rangeCount===0||t.isCollapsed)return null;const r=t.getRangeAt(0);return w(r,e)?r.cloneRange():null}function R(e,t){if(!t.anchorId)return;const r=e.root.querySelector(`#${t.anchorId}`);r&&r.classList.toggle("rte-comment-anchor-resolved",t.resolved)}function b(e,t,r){const o=e.comments.get(t);if(!o||!o.anchorId)return;const a=e.root.querySelector(`#${o.anchorId}`);a&&a.classList.toggle("highlighted",r)}function $(e,t,r){t.onclick=o=>{o.preventDefault(),o.stopPropagation(),x=e.root,e.expandedComments.add(r),y(e,!0),m(e)}}function q(e){const t=e.parentNode;if(t){for(;e.firstChild;)t.insertBefore(e.firstChild,e);e.remove()}}function y(e,t){F(),H(e),e.panelVisible=t,e.root.setAttribute("data-rte-comments-open",t?"true":"false"),e.panelElement&&(e.panelElement.classList.toggle("is-open",t),e.panelElement.setAttribute("aria-hidden",t?"false":"true")),t?N(e):z(e)}function H(e){if(e.panelElement)return;const t=document.createElement("aside");t.className="rte-comments-panel",t.setAttribute("role","complementary"),t.setAttribute("aria-label","Comments"),t.setAttribute("aria-hidden","true"),window.getComputedStyle(e.root).position==="static"&&(e.root.style.position="relative"),e.root.appendChild(t),e.panelElement=t}function N(e){e.selectionChangeListener||(e.selectionChangeListener=()=>{const t=window.getSelection();if(!t||t.rangeCount===0||t.isCollapsed)return;const r=t.getRangeAt(0);w(r,e.root)&&(e.savedSelection=r.cloneRange(),x=e.root)},document.addEventListener("selectionchange",e.selectionChangeListener))}function z(e){e.selectionChangeListener&&(document.removeEventListener("selectionchange",e.selectionChangeListener),e.selectionChangeListener=null)}function V(e){return Array.from(e.comments.values()).sort((t,r)=>r.createdAt.localeCompare(t.createdAt))}function A(e){return new Date(e).toLocaleString()}function M(e,t){const r=e.expandedComments.has(t.id),o=document.createElement("article");o.className=`rte-comment-item${t.resolved?" resolved":""}`,o.innerHTML=`
|
|
2
2
|
<header class="rte-comment-header">
|
|
3
3
|
<div class="rte-comment-meta">
|
|
4
4
|
<strong class="rte-comment-author">${t.author}</strong>
|
package/dist/direction.cjs.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const f=new Set(["P","DIV","H1","H2","H3","H4","H5","H6","LI","BLOCKQUOTE","PRE"]),a=e=>f.has(e.tagName)&&e.getAttribute("contenteditable")!=="true",h=()=>{const e=window.getSelection();if(e&&e.rangeCount>0){let t=e.getRangeAt(0).startContainer;for(;t&&t!==document.body;){if(t.nodeType===Node.ELEMENT_NODE){const r=t;if(r.getAttribute("contenteditable")==="true")return r}t=t.parentNode}}const n=document.activeElement;if(n){if(n.getAttribute("contenteditable")==="true")return n;const t=n.closest('[contenteditable="true"]');if(t)return t}return document.querySelector('[contenteditable="true"]')},u=e=>{let n=e;for(;n&&n!==document.body;){if(n.nodeType===Node.ELEMENT_NODE){const t=n;if(a(t))return t;if(t.getAttribute("contenteditable")==="true")break}n=n.parentNode}return null},C=(e,n)=>{const t=[],r=new Set,i=o=>{!o||r.has(o)||n.contains(o)&&a(o)&&(r.add(o),t.push(o))};if(e.collapsed)return i(u(e.startContainer)),t;const s=document.createTreeWalker(n,NodeFilter.SHOW_ELEMENT,{acceptNode:o=>{const d=o;if(!a(d))return NodeFilter.FILTER_SKIP;if(typeof e.intersectsNode=="function")return e.intersectsNode(d)?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP;const l=document.createRange();return l.selectNodeContents(d),e.compareBoundaryPoints(Range.END_TO_START,l)>0&&e.compareBoundaryPoints(Range.START_TO_END,l)<0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});let c=s.nextNode();for(;c;)i(c),c=s.nextNode();return t.length===0&&i(u(e.commonAncestorContainer)),t},T=(e,n)=>{if(n===e.innerHTML)return;const t=window.execEditorCommand||window.executeEditorCommand;if(typeof t=="function")try{t("recordDomTransaction",e,n,e.innerHTML)}catch{}},g=e=>{const n=h();if(!n)return!1;const t=window.getSelection();if(!t||t.rangeCount===0)return!1;const r=t.getRangeAt(0);if(!n.contains(r.commonAncestorContainer))return!1;const i=C(r,n);if(i.length===0)return!1;const s=n.innerHTML;return i.forEach(c=>{e==="rtl"?c.setAttribute("dir","rtl"):c.removeAttribute("dir")}),T(n,s),n.dispatchEvent(new Event("input",{bubbles:!0})),!0},p=()=>({name:"direction",toolbar:[{label:"Left to Right",command:"setDirectionLTR",icon:'<svg width="24" height="24" 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="M21 18H3M21 18L18 21M21 18L18 15M13 3V12M13 3H7M13 3C13.4596 3 13.9148 3.0776 14.3394 3.22836C14.764 3.37913 15.1499 3.6001 15.4749 3.87868C15.7999 4.15726 16.0577 4.48797 16.2336 4.85195C16.4095 5.21593 16.5 5.60603 16.5 6C16.5 6.39397 16.4095 6.78407 16.2336 7.14805C16.0577 7.51203 15.7999 7.84274 15.4749 8.12132C15.1499 8.3999 14.764 8.62087 14.3394 8.77164C13.9148 8.9224 13.4596 9 13 9V3ZM9 3V12" stroke="#000000" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"></path> </g></svg>',shortcut:"Mod-Shift-l"},{label:"Right to Left",command:"setDirectionRTL",icon:'<svg width="24" height="24" 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="M3 18H21M3 18L6 21M3 18L6 15M11 12V3H17M15 3V12M10.5 3C10.0404 3 9.58525 3.0776 9.16061 3.22836C8.73597 3.37913 8.35013 3.6001 8.02513 3.87868C7.70012 4.15726 7.44231 4.48797 7.26642 4.85195C7.09053 5.21593 7 5.60603 7 6C7 6.39397 7.09053 6.78407 7.26642 7.14805C7.44231 7.51203 7.70012 7.84274 8.02513 8.12132C8.35013 8.3999 8.73597 8.62087 9.16061 8.77164C9.58525 8.9224 10.0404 9 10.5 9L10.5 3Z" stroke="#000000" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"></path> </g></svg>',shortcut:"Mod-Shift-r"}],commands:{setDirectionLTR:()=>{try{return g(null)}catch(e){return console.error("Failed to set LTR direction:",e),!1}},setDirectionRTL:()=>{try{return g("rtl")}catch(e){return console.error("Failed to set RTL direction:",e),!1}}},keymap:{"Mod-Shift-l":"setDirectionLTR","Mod-Shift-r":"setDirectionRTL"}});exports.DirectionPlugin=p;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("./index-D3pJyAsj.js");exports.DocumentManagerPlugin=e.DocumentManagerPlugin;exports.getDocumentManagerConfig=e.getDocumentManagerConfig;exports.setDocumentManagerConfig=e.setDocumentManagerConfig;
|
package/dist/embed-iframe.cjs.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";Object.
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const g=[{label:"Inline Value",value:"inline"},{label:"Responsive - 21x9",value:"21x9"},{label:"Responsive - 16x9",value:"16x9"},{label:"Responsive - 4x3",value:"4x3"},{label:"Responsive - 1x1",value:"1x1"}],m='[data-theme="dark"], .dark, .editora-theme-dark',u=new WeakMap,l=e=>(u.has(e)||u.set(e,{dialogElement:null,activeTab:"general",formData:{src:"",selectedSize:"inline",width:"100%",height:"400px",constrainProportions:!0,name:"",title:"",longDescription:"",descriptionUrl:"",showBorder:!0,enableScrollbar:!0}}),u.get(e));function v(e){return e?.matches(m)||e?.closest(m)||document.activeElement?.closest(m)?!0:document.body.matches(m)||document.documentElement.matches(m)}const x=()=>({name:"embedIframe",toolbar:[{label:"Embed Content",command:"openEmbedIframeDialog",icon:'<svg width="24" height="24" focusable="false"><path d="M19 6V5H5v14h2A13 13 0 0 1 19 6Zm0 1.4c-.8.8-1.6 2.4-2.2 4.6H19V7.4Zm0 5.6h-2.4c-.4 1.8-.6 3.8-.6 6h3v-6Zm-4 6c0-2.2.2-4.2.6-6H13c-.7 1.8-1.1 3.8-1.1 6h3Zm-4 0c0-2.2.4-4.2 1-6H9.6A12 12 0 0 0 8 19h3ZM4 3h16c.6 0 1 .4 1 1v16c0 .6-.4 1-1 1H4a1 1 0 0 1-1-1V4c0-.6.4-1 1-1Zm11.8 9c.4-1.9 1-3.4 1.8-4.5a9.2 9.2 0 0 0-4 4.5h2.2Zm-3.4 0a12 12 0 0 1 2.8-4 12 12 0 0 0-5 4h2.2Z" fill-rule="nonzero"></path></svg>',shortcut:"Mod-Shift-e",type:"button"}],commands:{openEmbedIframeDialog:e=>(y(e),!0)},keymap:{"Mod-Shift-e":"openEmbedIframeDialog"}});function y(e){if(!e){const o=document.activeElement;o&&o.closest("[data-editora-editor]")&&(e=o.closest("[data-editora-editor]"))}if(e||(e=document.querySelector("[data-editora-editor]")),!e){console.warn("Editor element not found");return}const t=l(e);t.formData={src:"",selectedSize:"inline",width:"100%",height:"400px",constrainProportions:!0,name:"",title:"",longDescription:"",descriptionUrl:"",showBorder:!0,enableScrollbar:!0},t.activeTab="general";const a=document.createElement("div");a.className="rte-dialog-overlay rte-embed-iframe-overlay",v(e)&&a.classList.add("rte-theme-dark"),a.onclick=()=>f(e);const r=document.createElement("div");r.className="rte-dialog-content embed-iframe-dialog",r.onclick=o=>o.stopPropagation(),r.innerHTML=`
|
|
2
2
|
<div class="rte-dialog-header">
|
|
3
3
|
<h3>Embed Iframe</h3>
|
|
4
4
|
<button class="rte-dialog-close">×</button>
|
package/dist/emojis.cjs.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";Object.
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const d={all:{name:"All",emojis:["❤️","💔","💙","💚","💛","🖤","🤍","🤎","✔️","❌","☑️","❗","❓","⚠️","💯","➕","➖","✖️","➗","♻️","⚡","🔥","✨","⭐","⭕","🚫","😀","😃","😄","😁","😆","😅","😂","🤣","😊","😇","🙂","🙃","😉","😍","😘","😎","🤓","😐","😑","😬","🙄","😏","😌","🤩","🥳","🤔","😴","😭","😢","😡","🤯","👍","👎","👌","✌️","🤞","🙏","👏","🙌","💪","🐶","🐱","🐭","🐹","🐰","🦊","🐻","🐼","🐨","🐯","🦁","🐮","🐷","🐸","🐵","🐔","🐧","🐦","🦆","🦅","🦄","🐝","🦋","🌲","🌳","🌴","🌵","🌸","🌼","🌻","☀️","🌙","⭐","🌈","🌧️","❄️","🌊","🍎","🍌","🍉","🍇","🍓","🍒","🍍","🥭","🍐","🍊","🍋","🍑","🥝","🥑","🍔","🍟","🍕","🌭","🥪","🌮","🌯","🍣","🍜","🍰","🧁","🍩","🍪","🍫","☕","🍵","🥤","🍺","🍷","🍸","🍹","🥂","⚽","🏀","🏈","⚾","🎾","🏐","🏉","🎮","🎯","🎳","🎲","♟️","🏃","🚴","🏊","🏋️","🧘","🎸","🎹","🥁","🎺","🎤","🏆","🥇","🚗","🚕","🚌","🚎","🚓","🚑","🚒","✈️","🚀","🚁","🚤","🛳️","🚢","🏠","🏢","🏬","🏫","🏥","🏰","🗼","🗽","⛩️","🕌","🌍","🌎","🌏","🏖️","🏝️","📱","💻","🖥️","⌨️","🖱️","📷","📸","🎥","📹","📚","📖","📝","📄","📂","🔒","🔑","🗝️","💡","🔦","🕯️","🧰","🛠️","🔧","⚙️","📦","💳","💰","🔋","🔌","🇮🇳","🇺🇸","🇬🇧","🇨🇦","🇦🇺","🇩🇪","🇫🇷","🇪🇸","🇮🇹","🇯🇵","🇰🇷","🇨🇳","🇧🇷","🇲🇽","🇷🇺","🇿🇦","🇳🇿"]},symbols:{name:"Symbols",emojis:["❤️","💔","💙","💚","💛","🖤","🤍","🤎","✔️","❌","☑️","❗","❓","⚠️","💯","➕","➖","✖️","➗","♻️","⚡","🔥","✨","⭐","⭕","🚫","⬆️","⬇️","⬅️","➡️","🔄","🔁","🔀","🔔","🔕","⏰","⌛","⏳"]},people:{name:"People",emojis:["😀","😃","😄","😁","😆","😅","😂","🤣","😊","😇","🙂","🙃","😉","😍","😘","😎","🤓","😐","😑","😬","🙄","😏","😌","🤩","🥳","🤔","😴","😭","😢","😡","🤯","👍","👎","👌","✌️","🤞","🙏","👏","🙌","💪"]},"animals-nature":{name:"Animals & Nature",emojis:["🐶","🐱","🐭","🐹","🐰","🦊","🐻","🐼","🐨","🐯","🦁","🐮","🐷","🐸","🐵","🐔","🐧","🐦","🦆","🦅","🦄","🐝","🦋","🌲","🌳","🌴","🌵","🌸","🌼","🌻","☀️","🌙","⭐","🌈","🌧️","❄️","🌊"]},"food-drink":{name:"Food & Drink",emojis:["🍎","🍌","🍉","🍇","🍓","🍒","🍍","🥭","🍐","🍊","🍋","🍑","🥝","🥑","🍔","🍟","🍕","🌭","🥪","🌮","🌯","🍣","🍜","🍰","🧁","🍩","🍪","🍫","☕","🍵","🥤","🍺","🍷","🍸","🍹","🥂"]},activity:{name:"Activity",emojis:["⚽","🏀","🏈","⚾","🎾","🏐","🏉","🎮","🎯","🎳","🎲","♟️","🏃","🚴","🏊","🏋️","🧘","🎸","🎹","🥁","🎺","🎤","🏆","🥇","🥈","🥉"]},"travel-places":{name:"Travel & Places",emojis:["🚗","🚕","🚌","🚎","🚓","🚑","🚒","✈️","🚀","🚁","🚤","🛳️","🚢","🏠","🏢","🏬","🏫","🏥","🏰","🗼","🗽","⛩️","🕌","🌍","🌎","🌏","🏖️","🏝️"]},objects:{name:"Objects",emojis:["📱","💻","🖥️","⌨️","🖱️","📷","📸","🎥","📹","📚","📖","📝","📄","📂","🔒","🔑","🗝️","💡","🔦","🕯️","🧰","🛠️","🔧","⚙️","📦","💳","💰","🔋","🔌"]},flags:{name:"Flags",emojis:["🇮🇳","🇺🇸","🇬🇧","🇨🇦","🇦🇺","🇩🇪","🇫🇷","🇪🇸","🇮🇹","🇯🇵","🇰🇷","🇨🇳","🇧🇷","🇲🇽","🇷🇺","🇿🇦","🇳🇿"]}},p={"💙":"blue heart","💚":"green heart","💛":"yellow heart","🖤":"black heart","🤍":"white heart","🤎":"brown heart","☑️":"check box with check","🔴":"red circle","🟢":"green circle","🟡":"yellow circle","🔵":"blue circle","⬆️":"up arrow","⬇️":"down arrow","⬅️":"left arrow","➡️":"right arrow","🔄":"counterclockwise arrows","🔁":"repeat button","🔀":"shuffle tracks","🔔":"bell","🔕":"muted bell","⏰":"alarm clock","⏳":"hourglass not done","⌛":"hourglass done","♠️":"spade suit","♥️":"heart suit","♦️":"diamond suit","♣️":"club suit","🚫":"prohibited","⭕":"hollow red circle","❎":"cross mark button","😐":"neutral face","😑":"expressionless face","😬":"grimacing face","🙄":"face with rolling eyes","😏":"smirking face","😌":"relieved face","🤩":"star struck","😜":"winking face with tongue","😝":"squinting face with tongue","🤪":"zany face","😢":"crying face","😥":"sad but relieved face","😓":"downcast face with sweat","😱":"face screaming in fear","😨":"fearful face","🤗":"hugging face","🤭":"face with hand over mouth","🤫":"shushing face","🤥":"lying face","👌":"ok hand","✌️":"victory hand","🤞":"crossed fingers","🙌":"raising hands","💪":"flexed biceps","🐔":"chicken","🐧":"penguin","🐦":"bird","🐤":"baby chick","🦆":"duck","🦅":"eagle","🐺":"wolf","🦄":"unicorn","🐝":"honeybee","🐞":"lady beetle","🦋":"butterfly","🐢":"turtle","🐍":"snake","🦖":"t-rex","🌿":"herb","🍀":"four leaf clover","🍁":"maple leaf","🍂":"fallen leaf","🌊":"water wave","❄️":"snowflake","☁️":"cloud","⛈️":"cloud with lightning and rain","🌪️":"tornado","🍐":"pear","🍊":"tangerine","🍋":"lemon","🍑":"peach","🥝":"kiwi fruit","🥑":"avocado","🍆":"eggplant","🌽":"ear of corn","🥕":"carrot","🥔":"potato","🍞":"bread","🥐":"croissant","🥖":"baguette bread","🧀":"cheese wedge","🍖":"meat on bone","🍗":"poultry leg","🥩":"cut of meat","🍦":"soft ice cream","🍨":"ice cream","🍫":"chocolate bar","🍬":"candy","🥛":"glass of milk","🧃":"beverage box","🍹":"tropical drink","🥂":"clinking glasses","🏓":"ping pong","🥊":"boxing glove","🥋":"martial arts uniform","⛳":"flag in hole","🏹":"bow and arrow","🎿":"skis","⛷️":"skier","🏂":"snowboarder","🎤":"microphone","🎬":"clapper board","🎨":"artist palette","🧩":"puzzle piece","🪀":"yo-yo","🚇":"metro","🚉":"station","🚊":"tram","🚝":"monorail","🛻":"pickup truck","🚐":"minibus","🗺️":"world map","🧭":"compass","⛰️":"mountain","🏔️":"snow capped mountain","🌋":"volcano","🏜️":"desert","🏕️":"camping","🏙️":"cityscape","🌆":"city at dusk","🌃":"night with stars","📦":"package","📫":"closed mailbox with raised flag","📬":"open mailbox with raised flag","📭":"open mailbox with lowered flag","🧾":"receipt","💳":"credit card","💰":"money bag","🪙":"coin","🔋":"battery","🔌":"electric plug","🧯":"fire extinguisher","🪜":"ladder","🪞":"mirror","🧹":"broom","🧸":"teddy bear"};let c=null,n="all",l="",s=null;const j='[data-theme="dark"], .dark, .editora-theme-dark',h=()=>({name:"emojis",toolbar:[{label:"Insert Emoji",command:"openEmojiDialog",icon:'<svg width="24" height="24" focusable="false"><path d="M9 11c.6 0 1-.4 1-1s-.4-1-1-1a1 1 0 0 0-1 1c0 .6.4 1 1 1Zm6 0c.6 0 1-.4 1-1s-.4-1-1-1a1 1 0 0 0-1 1c0 .6.4 1 1 1Zm-3 5.5c2.1 0 4-1.5 4.4-3.5H7.6c.5 2 2.3 3.5 4.4 3.5ZM12 4a8 8 0 1 0 0 16 8 8 0 0 0 0-16Zm0 14.5a6.5 6.5 0 1 1 0-13 6.5 6.5 0 0 1 0 13Z" fill-rule="nonzero"></path></svg>',shortcut:"Mod-Shift-j",type:"button"}],commands:{openEmojiDialog:(o,t)=>{const e=t?.contentElement||u();return e?(v(e),!0):!1},insertEmoji:(o,t)=>{if(!o)return!1;const e=t?.contentElement||u();if(!e)return!1;try{return f(o,e),!0}catch{return!1}}},keymap:{"Mod-Shift-j":"openEmojiDialog"}});function v(o){n="all",l="";const t=window.getSelection();s=null,t&&t.rangeCount>0&&o.contains(t.anchorNode)&&(s=t.getRangeAt(0).cloneRange());const e=document.createElement("div");e.className="emojis-overlay",y(o)&&e.classList.add("rte-ui-theme-dark"),e.onclick=g;const r=document.createElement("div");r.className="emojis-dialog",r.setAttribute("role","dialog"),r.setAttribute("aria-modal","true"),r.onclick=a=>a.stopPropagation();const i=Object.keys(d);r.innerHTML=`
|
|
2
2
|
<div class="rte-dialog-header emojis-header">
|
|
3
3
|
<h3>Insert Emojis</h3>
|
|
4
4
|
<button class="rte-dialog-close emojis-close">×</button>
|
package/dist/font-family.cjs.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const y=()=>({name:"fontFamily",marks:{fontFamily:{attrs:{family:{default:null}},parseDOM:[{tag:'span[style*="font-family"]',getAttrs:e=>{const t=e.style.fontFamily;return t?{family:t}:!1}},{tag:"font[face]",getAttrs:e=>{const t=e.getAttribute("face");return t?{family:t}:!1}}],toDOM:e=>["span",{style:`font-family: ${e.attrs?.family}`},0]}},toolbar:[{label:"Font Family",command:"setFontFamily",type:"inline-menu",options:[{label:"Arial",value:"Arial, sans-serif"},{label:"Times New Roman",value:"Times New Roman, serif"},{label:"Courier New",value:"Courier New, monospace"},{label:"Georgia",value:"Georgia, serif"},{label:"Verdana",value:"Verdana, sans-serif"},{label:"Helvetica",value:"Helvetica, Arial, sans-serif"},{label:"Trebuchet MS",value:"Trebuchet MS, sans-serif"},{label:"Impact",value:"Impact, sans-serif"}],icon:'<svg fill="#000000" width="24px" height="24px" viewBox="0 0 24 24" 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="M15 4h7v2h-7zm1 4h6v2h-6zm2 4h4v2h-4zM9.307 4l-6 16h2.137l1.875-5h6.363l1.875 5h2.137l-6-16H9.307zm-1.239 9L10.5 6.515 12.932 13H8.068z"></path></g></svg>'}],commands:{setFontFamily:e=>{if(!e)return!1;try{return b(e),!0}catch(n){return console.error("Failed to set font family:",n),!1}}},keymap:{"Mod-Shift-f":"setFontFamily"}}),p="p,div,li,ul,ol,table,thead,tbody,tfoot,tr,td,th,h1,h2,h3,h4,h5,h6,blockquote,pre";function h(e){return!!e.cloneContents().querySelector(p)}function g(e){return(e.nodeType===Node.ELEMENT_NODE?e:e.parentElement)?.closest('[contenteditable="true"]')||document.querySelector('[contenteditable="true"]')}function f(e){e&&e.dispatchEvent(new Event("input",{bubbles:!0}))}function S(e,n){const t=document.createElement("span");for(const a of Array.from(e.attributes))a.name==="face"||a.name==="style"||t.setAttribute(a.name,a.value);const o=e.getAttribute("style");for(o&&t.setAttribute("style",o),t.style.fontFamily=n,t.classList.add("rte-font-family");e.firstChild;)t.appendChild(e.firstChild);e.parentNode?.replaceChild(t,e)}function A(e){e.querySelectorAll("span").forEach(t=>{t.childElementCount>0||(t.textContent||"").trim().length>0||t.remove()})}function C(e,n,t){if(h(e))return!1;const o=document.createElement("span");o.style.fontFamily=t,o.className="rte-font-family";try{e.surroundContents(o)}catch{const l=e.extractContents();o.appendChild(l),e.insertNode(o)}const a=document.createRange();return a.selectNodeContents(o),n.removeAllRanges(),n.addRange(a),!0}function b(e){const n=window.getSelection();if(!n||n.rangeCount===0)return;const t=n.getRangeAt(0),o=t.cloneRange(),a=g(t.commonAncestorContainer);if(t.collapsed)return;const l=t.commonAncestorContainer,i=F(l);if(i&&v(t,i)){i.style.fontFamily=e,i.classList.add("rte-font-family");const r=document.createRange();r.selectNodeContents(i),n.removeAllRanges(),n.addRange(r),f(a);return}if(!a)return;const u=new Set(Array.from(a.querySelectorAll("font[face]"))),m=new Set(Array.from(a.querySelectorAll("span[style*='font-family']")));a.focus({preventScroll:!0});try{document.execCommand("styleWithCSS",!1,"true")}catch{}const d=e.split(",").map(r=>r.trim().replace(/^['"]|['"]$/g,"")).filter(Boolean)[0]||"Arial";let s=document.execCommand("fontName",!1,d),c=!1;Array.from(a.querySelectorAll("font[face]")).forEach(r=>{u.has(r)||(S(r,e),c=!0)}),Array.from(a.querySelectorAll("span[style*='font-family']")).forEach(r=>{m.has(r)||(r.style.fontFamily=e,r.classList.add("rte-font-family"),c=!0)}),s||(s=C(o,n,e)),(s||c)&&(A(a),f(a))}function F(e){let n=e;for(;n;){if(n.nodeType===Node.ELEMENT_NODE){const t=n;if(t.tagName==="SPAN"&&t.style.fontFamily)return t}n=n.parentNode}return null}function v(e,n){const t=e.startContainer,o=e.endContainer,a=n.contains(t)||t.nodeType===Node.TEXT_NODE&&t.parentElement===n,l=n.contains(o)||o.nodeType===Node.TEXT_NODE&&o.parentElement===n;return a&&l}exports.FontFamilyPlugin=y;
|
package/dist/font-size.cjs.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const b=()=>({name:"fontSize",marks:{fontSize:{attrs:{size:{default:null}},parseDOM:[{tag:'span[style*="font-size"]',getAttrs:e=>{const t=e.style.fontSize;return t?{size:t}:!1}},{tag:"font[size]",getAttrs:e=>{const t=e.getAttribute("size");return t?{size:t}:!1}}],toDOM:e=>["span",{style:`font-size: ${e.attrs?.size}`},0]}},toolbar:[{label:"Font Size",command:"fontSize",type:"group",items:[{label:"Decrease Font Size",command:"decreaseFontSize",icon:"−",type:"button"},{label:"Font Size",command:"setFontSize",type:"input",placeholder:"14"},{label:"Increase Font Size",command:"increaseFontSize",icon:"+",type:"button"}]}],commands:{decreaseFontSize:()=>{try{return g(-2),y(),!0}catch(e){return console.error("Failed to decrease font size:",e),!1}},increaseFontSize:()=>{try{return g(2),y(),!0}catch(e){return console.error("Failed to increase font size:",e),!1}},setFontSize:e=>{if(!e)return!1;try{const t=e.trim().match(/^(\d+(?:\.\d+)?)(px|em|rem)?$/i);if(!t)return!1;const n=parseFloat(t[1]),i=t[2]?.toLowerCase()||"px";return i==="px"&&(n<8||n>72)||(i==="em"||i==="rem")&&(n<.5||n>5)?!1:(C(n,i),!0)}catch(o){return console.error("Failed to set font size:",o),!1}}},keymap:{}}),A="p,div,li,ul,ol,table,thead,tbody,tfoot,tr,td,th,h1,h2,h3,h4,h5,h6,blockquote,pre",z={"xx-small":9,"x-small":10,small:13,medium:16,large:18,"x-large":24,"xx-large":32,"xxx-large":48,smaller:13,larger:18};function p(e){const o=e.trim().toLowerCase(),t=o.match(/^(\d+(?:\.\d+)?)(px|em|rem)$/i);if(t)return{value:parseFloat(t[1]),unit:t[2].toLowerCase()};const n=z[o];return n?{value:n,unit:"px"}:null}function N(e){return e.trim().toLowerCase()in z}function x(e){return!!e.cloneContents().querySelector(A)}function w(e){return(e.nodeType===Node.ELEMENT_NODE?e:e.parentElement)?.closest('[contenteditable="true"]')||document.querySelector('[contenteditable="true"]')}function m(e){e&&e.dispatchEvent(new Event("input",{bubbles:!0}))}function E(e,o){const t=document.createElement("span");for(const i of Array.from(e.attributes))i.name==="size"||i.name==="style"||t.setAttribute(i.name,i.value);const n=e.getAttribute("style");for(n&&t.setAttribute("style",n),t.style.fontSize=o;e.firstChild;)t.appendChild(e.firstChild);e.parentNode?.replaceChild(t,e)}function T(e,o,t,n){const i=Array.from(e.querySelectorAll("font[size], [style*='font-size']")),r=s=>{if(!n||!s.isConnected)return!1;try{if(typeof n.intersectsNode=="function")return n.intersectsNode(s)}catch{}const a=document.createRange();return a.selectNodeContents(s),n.compareBoundaryPoints(Range.END_TO_START,a)>0&&n.compareBoundaryPoints(Range.START_TO_END,a)<0};let c=!1;return i.forEach(s=>{const a=!o.has(s),u=s.tagName==="FONT",l=N(s.style.fontSize||""),f=r(s);if(!(!a&&!f)&&!(!a&&!u&&!l)){if(c=!0,s.tagName==="FONT"){E(s,t);return}s.style.fontSize=t}}),c}function S(e){e.querySelectorAll("span").forEach(t=>{t.childElementCount>0||(t.textContent||"").trim().length>0||t.remove()})}function R(e,o,t){if(x(e))return!1;const n=document.createElement("span");n.style.fontSize=t;try{e.surroundContents(n)}catch{const r=e.extractContents();n.appendChild(r),e.insertNode(n)}const i=document.createRange();return i.selectNodeContents(n),o.removeAllRanges(),o.addRange(i),!0}function g(e){const o=window.getSelection();if(!o||o.rangeCount===0)return;const{value:t,unit:n}=h();let i=e;(n==="em"||n==="rem")&&(i=e*.125);let r;n==="px"?r=e<0?Math.max(8,t+e):Math.min(72,t+e):r=e<0?Math.max(.5,t+i):Math.min(5,t+i),C(r,n)}function h(){const e=window.getSelection();if(!e||e.rangeCount===0)return{value:14,unit:"px"};const t=e.getRangeAt(0).startContainer,n=t.nodeType===Node.TEXT_NODE?t.parentElement:t;if(n){const i=n.style?.fontSize;if(i){const a=p(i);if(a)return a}const c=window.getComputedStyle(n).fontSize,s=p(c);if(s)return s}return{value:14,unit:"px"}}function C(e,o="px"){const t=window.getSelection();if(!t||t.rangeCount===0)return;const n=t.getRangeAt(0),i=n.cloneRange(),r=w(n.commonAncestorContainer);if(n.collapsed)return;const c=`${e}${o}`,s=n.commonAncestorContainer,a=v(s);if(a&&O(n,a)){a.style.fontSize=c,m(r);const d=document.createRange();d.selectNodeContents(a),t.removeAllRanges(),t.addRange(d);return}if(!r)return;const u=new Set(Array.from(r.querySelectorAll("font[size], [style*='font-size']")));r.focus({preventScroll:!0});try{document.execCommand("styleWithCSS",!1,"true")}catch{}let l=document.execCommand("fontSize",!1,"7");const f=t.rangeCount>0?t.getRangeAt(0).cloneRange():i,F=T(r,u,c,f);if(l&&F){S(r),m(r);return}l=R(i,t,c),l&&(S(r),m(r))}function v(e){let o=e;for(;o&&o!==document.body;){if(o.nodeType===Node.ELEMENT_NODE){const t=o;if(t.tagName==="SPAN"&&t.style.fontSize)return t}o=o.parentNode}return null}function O(e,o){const t=e.startContainer,n=e.endContainer;return o.contains(t)&&o.contains(n)}function y(){setTimeout(()=>{const{value:e,unit:o}=h(),t=window.getSelection();if(!t||t.rangeCount===0)return;let n=null,r=t.getRangeAt(0).startContainer;for(;r;){if(r instanceof HTMLElement&&(r.classList.contains("rte-editor")||r.classList.contains("editora-editor")||r.hasAttribute("data-editora-editor"))){n=r;break}r=r.parentNode}if(!n)return;const c=n.querySelector(".rte-toolbar-wrapper, .editora-toolbar-container")||n,s=Array.from(c.querySelectorAll('input[data-command="setFontSize"], input.editora-toolbar-input.font-size, input.rte-toolbar-input.font-size, input[title="Font Size"]'));if(s.length===0)return;const u=`${e%1===0?e.toString():e.toFixed(2).replace(/\.?0+$/,"")}${o}`;s.forEach(l=>{l.value=u})},10)}exports.FontSizePlugin=b;
|