@editora/plugins 1.0.16 → 1.0.18

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 (109) hide show
  1. package/dist/CodePlugin.native-Bwf25lLX.js +460 -0
  2. package/dist/CodePlugin.native-Cpp4u3Jl.mjs +648 -0
  3. package/dist/a11y-checker.cjs.js +16 -16
  4. package/dist/a11y-checker.esm.js +79 -75
  5. package/dist/anchor.cjs.js +9 -9
  6. package/dist/anchor.esm.js +61 -60
  7. package/dist/anchoredPopover-Bg-ey7Yo.js +1 -0
  8. package/dist/anchoredPopover-D_JbjvdA.mjs +111 -0
  9. package/dist/approval-workflow.cjs.js +5 -5
  10. package/dist/approval-workflow.esm.js +105 -104
  11. package/dist/background-color.cjs.js +1 -1
  12. package/dist/background-color.esm.js +1 -1
  13. package/dist/blocks-library.cjs.js +6 -6
  14. package/dist/blocks-library.esm.js +226 -202
  15. package/dist/capitalization.cjs.js +1 -1
  16. package/dist/capitalization.esm.js +9 -4
  17. package/dist/checklist.cjs.js +1 -1
  18. package/dist/checklist.esm.js +154 -116
  19. package/dist/citations.cjs.js +43 -18
  20. package/dist/citations.esm.js +465 -446
  21. package/dist/clear-formatting.cjs.js +1 -1
  22. package/dist/clear-formatting.esm.js +21 -20
  23. package/dist/code-sample.cjs.js +85 -66
  24. package/dist/code-sample.esm.js +301 -190
  25. package/dist/code.cjs.js +1 -669
  26. package/dist/code.esm.js +2 -4560
  27. package/dist/collaboration.cjs.js +68 -0
  28. package/dist/collaboration.esm.js +7428 -0
  29. package/dist/comments.cjs.js +11 -11
  30. package/dist/comments.esm.js +284 -237
  31. package/dist/conditional-content.cjs.js +67 -60
  32. package/dist/conditional-content.esm.js +270 -220
  33. package/dist/data-binding.cjs.js +3 -3
  34. package/dist/data-binding.esm.js +28 -27
  35. package/dist/dialogHelpers-5d5BuOCW.mjs +39 -0
  36. package/dist/dialogHelpers-zU6zpMIA.js +12 -0
  37. package/dist/document-manager.cjs.js +1 -1
  38. package/dist/document-manager.esm.js +1 -1
  39. package/dist/{documentManager-Jf0RbSks.js → documentManager-BDz6tovy.js} +2 -2
  40. package/dist/{documentManager-CTqRftU8.mjs → documentManager-yjRBab4v.mjs} +3 -3
  41. package/dist/embed-iframe.cjs.js +37 -17
  42. package/dist/embed-iframe.esm.js +188 -143
  43. package/dist/emojis.cjs.js +13 -10
  44. package/dist/emojis.esm.js +288 -76
  45. package/dist/enterprise.cjs.js +1 -1
  46. package/dist/enterprise.esm.js +9 -7
  47. package/dist/escapeHtml-D2Zh82pD.js +1 -0
  48. package/dist/escapeHtml-DyksyvcZ.mjs +6 -0
  49. package/dist/font-family.cjs.js +1 -1
  50. package/dist/font-family.esm.js +48 -41
  51. package/dist/font-size.cjs.js +1 -1
  52. package/dist/font-size.esm.js +67 -60
  53. package/dist/format-painter.cjs.js +1 -1
  54. package/dist/format-painter.esm.js +2 -1
  55. package/dist/history.cjs.js +1 -1
  56. package/dist/history.esm.js +40 -36
  57. package/dist/historyHelpers-BEKwNOtA.mjs +14 -0
  58. package/dist/historyHelpers-Cu8Pk7m1.js +1 -0
  59. package/dist/index-Bm1eqYHh.mjs +194 -0
  60. package/dist/index-CoflqYuK.js +30 -0
  61. package/dist/index-CxhJLMPS.js +221 -0
  62. package/dist/{index-D3CycEFU.mjs → index-Di1ZqIDs.mjs} +6420 -6232
  63. package/dist/index.cjs.js +1 -1
  64. package/dist/{index.es-DQ78mYYo.mjs → index.es-B7pVaNEV.mjs} +1558 -1542
  65. package/dist/{index.es-CE_A4QSm.js → index.es-I9N4o4Iq.js} +5 -5
  66. package/dist/index.esm.js +17 -15
  67. package/dist/{jspdf.es.min-BoS80556.js → jspdf.es.min-B5Idu0Wl.js} +2 -2
  68. package/dist/{jspdf.es.min-DQCoX5yh.mjs → jspdf.es.min-BCzHIwvz.mjs} +3 -2
  69. package/dist/link.cjs.js +17 -13
  70. package/dist/link.esm.js +138 -69
  71. package/dist/list.cjs.js +1 -1
  72. package/dist/list.esm.js +66 -33
  73. package/dist/math.cjs.js +22 -22
  74. package/dist/math.esm.js +221 -126
  75. package/dist/media-manager.cjs.js +12 -12
  76. package/dist/media-manager.esm.js +55 -50
  77. package/dist/mentions.cjs.js +2 -2
  78. package/dist/mentions.esm.js +17 -12
  79. package/dist/merge-tag.cjs.js +2 -2
  80. package/dist/merge-tag.esm.js +43 -42
  81. package/dist/plugins.css +1 -1
  82. package/dist/preview.cjs.js +3 -3
  83. package/dist/preview.esm.js +30 -27
  84. package/dist/{purify.es-T2a3nLiC.js → purify.es-DWpzYfqy.js} +1 -1
  85. package/dist/{purify.es-DHhaBdbu.mjs → purify.es-Dewe88eZ.mjs} +2 -2
  86. package/dist/slash-commands.cjs.js +13 -7
  87. package/dist/slash-commands.esm.js +90 -79
  88. package/dist/smart-paste.cjs.js +5 -5
  89. package/dist/smart-paste.esm.js +85 -81
  90. package/dist/special-characters.cjs.js +6 -3
  91. package/dist/special-characters.esm.js +72 -25
  92. package/dist/spell-check.cjs.js +8 -8
  93. package/dist/spell-check.esm.js +10189 -295
  94. package/dist/table.cjs.js +166 -13
  95. package/dist/table.esm.js +543 -266
  96. package/dist/template.cjs.js +11 -11
  97. package/dist/template.esm.js +290 -264
  98. package/dist/text-color.cjs.js +1 -1
  99. package/dist/text-color.esm.js +1 -1
  100. package/dist/translation-workflow.cjs.js +4 -4
  101. package/dist/translation-workflow.esm.js +33 -31
  102. package/dist/version-diff.cjs.js +6 -6
  103. package/dist/version-diff.esm.js +40 -40
  104. package/package.json +10 -4
  105. package/dist/anchoredPopover-BzqGPOAE.js +0 -1
  106. package/dist/anchoredPopover-Dts0IrgU.mjs +0 -106
  107. package/dist/index-BFsKNTTj.mjs +0 -145
  108. package/dist/index-CvJk4DKa.js +0 -221
  109. package/dist/index-tqLTHcO6.js +0 -1
package/dist/math.cjs.js CHANGED
@@ -1,51 +1,51 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const O={latex:[{name:"Fraction",formula:"\\frac{a}{b}",description:"Simple fraction"},{name:"Square Root",formula:"\\sqrt{x}",description:"Square root"},{name:"Power",formula:"x^{2}",description:"Exponent/power"},{name:"Subscript",formula:"x_{sub}",description:"Subscript"},{name:"Integral",formula:"\\int_{a}^{b} f(x) \\, dx",description:"Definite integral"},{name:"Summation",formula:"\\sum_{i=1}^{n} x_{i}",description:"Summation"},{name:"Limit",formula:"\\lim_{x \\to 0} f(x)",description:"Limit"},{name:"Derivative",formula:"\\frac{d}{dx} f(x)",description:"Derivative"},{name:"Matrix 2x2",formula:"\\begin{pmatrix} a & b \\\\ c & d \\end{pmatrix}",description:"2x2 matrix"},{name:"System",formula:"\\begin{cases} x + y = 1 \\\\ 2x - y = 0 \\end{cases}",description:"System of equations"}],mathml:[{name:"Fraction",formula:"<mfrac><mi>a</mi><mi>b</mi></mfrac>",description:"Simple fraction"},{name:"Square Root",formula:"<msqrt><mi>x</mi></msqrt>",description:"Square root"},{name:"Power",formula:"<msup><mi>x</mi><mn>2</mn></msup>",description:"Exponent/power"},{name:"Subscript",formula:"<msub><mi>x</mi><mi>sub</mi></msub>",description:"Subscript"},{name:"Parentheses",formula:'<mfenced open="(" close=")"><mi>a</mi><mo>+</mo><mi>b</mi></mfenced>',description:"Grouped expression"}]};let T=null,S=null,H=!1,y=null,m=null;const k='[data-theme="dark"], .dark, .editora-theme-dark',K=()=>new Promise((e,t)=>{if(window.katex){e(window.katex);return}if(H){const s=setInterval(()=>{window.katex&&(clearInterval(s),e(window.katex))},100);return}H=!0;const r=document.createElement("link");r.rel="stylesheet",r.href="https://cdn.jsdelivr.net/npm/katex@0.16.9/dist/katex.min.css",document.head.appendChild(r);const l=document.createElement("script");l.src="https://cdn.jsdelivr.net/npm/katex@0.16.9/dist/katex.min.js",l.onload=()=>e(window.katex),l.onerror=t,document.head.appendChild(l)}),_=()=>{const e=window.getSelection();if(!e||e.rangeCount===0)return null;const t=e.getRangeAt(0).startContainer;return(t.nodeType===Node.ELEMENT_NODE?t:t.parentElement)?.closest(".rte-content, .editora-content")||null},U=e=>e?e.nodeType===Node.ELEMENT_NODE?e:e.parentElement:null,j=e=>U(e)?.closest('.rte-content, .editora-content, [contenteditable="true"]')||null,W=(e,t,r)=>{if(t!==r){if(typeof window.execEditorCommand=="function"){window.execEditorCommand("recordDomTransaction",e,t,r);return}if(typeof window.executeEditorCommand=="function")try{window.executeEditorCommand("recordDomTransaction",{editor:e,beforeHTML:t,afterHTML:r})}catch{}}},G=e=>{if(!(e instanceof Element))return null;const t=e.closest(".math-formula, .math-block");return t instanceof HTMLElement?t:null},h=()=>{m&&(m.classList.remove("math-object-selected"),m.removeAttribute("data-rte-selected-object"),m=null)},X=e=>{if(m===e)return;h(),m=e,e.classList.add("math-object-selected"),e.setAttribute("data-rte-selected-object","true");const t=window.getSelection();if(!t)return;const r=document.createRange();r.selectNode(e),t.removeAllRanges(),t.addRange(r)},Z=(e,t)=>{const r=window.getSelection();if(!r)return;const l=document.createRange();t&&t.parentNode===e?l.setStartBefore(t):(l.selectNodeContents(e),l.collapse(!1)),l.collapse(!0),r.removeAllRanges(),r.addRange(l)},Q=e=>{if(e.childNodes.length>0)return;const t=document.createElement("p");t.appendChild(document.createElement("br")),e.appendChild(t)},J=()=>{if(!m||!m.isConnected)return h(),!1;const e=m,t=j(e);if(!t)return h(),!1;const r=t.innerHTML,l=e.nextSibling;e.remove(),Q(t),h(),Z(t,l);const s=t.innerHTML;return W(t,r,s),t.dispatchEvent(new window.Event("input",{bubbles:!0})),r!==s},V=()=>{if(document.getElementById("math-object-selection-styles"))return;const e=document.createElement("style");e.id="math-object-selection-styles",e.textContent=`
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const K=require("./escapeHtml-D2Zh82pD.js"),U=require("./dialogHelpers-zU6zpMIA.js"),W={latex:[{name:"Fraction",formula:"\\frac{a}{b}",description:"Simple fraction"},{name:"Square Root",formula:"\\sqrt{x}",description:"Square root"},{name:"Power",formula:"x^{2}",description:"Exponent/power"},{name:"Subscript",formula:"x_{sub}",description:"Subscript"},{name:"Integral",formula:"\\int_{a}^{b} f(x) \\, dx",description:"Definite integral"},{name:"Summation",formula:"\\sum_{i=1}^{n} x_{i}",description:"Summation"},{name:"Limit",formula:"\\lim_{x \\to 0} f(x)",description:"Limit"},{name:"Derivative",formula:"\\frac{d}{dx} f(x)",description:"Derivative"},{name:"Matrix 2x2",formula:"\\begin{pmatrix} a & b \\\\ c & d \\end{pmatrix}",description:"2x2 matrix"},{name:"System",formula:"\\begin{cases} x + y = 1 \\\\ 2x - y = 0 \\end{cases}",description:"System of equations"}],mathml:[{name:"Fraction",formula:"<mfrac><mi>a</mi><mi>b</mi></mfrac>",description:"Simple fraction"},{name:"Square Root",formula:"<msqrt><mi>x</mi></msqrt>",description:"Square root"},{name:"Power",formula:"<msup><mi>x</mi><mn>2</mn></msup>",description:"Exponent/power"},{name:"Subscript",formula:"<msub><mi>x</mi><mi>sub</mi></msub>",description:"Subscript"},{name:"Parentheses",formula:'<mfenced open="(" close=")"><mi>a</mi><mo>+</mo><mi>b</mi></mfenced>',description:"Grouped expression"}]};let S=null,L=null,D=!1,y=null,m=null;const k='[data-theme="dark"], .dark, .editora-theme-dark',X=new Set(["math","mrow","mi","mn","mo","ms","mtext","mspace","msup","msub","msubsup","mfrac","msqrt","mroot","mfenced","mstyle","mpadded","mphantom","menclose","mtable","mtr","mtd","mlabeledtr","munder","mover","munderover","mmultiscripts","mprescripts","none","semantics","annotation"]),G=new Set(["display","displaystyle","mathvariant","mathsize","mathcolor","mathbackground","scriptlevel","fence","separator","stretchy","symmetric","lspace","rspace","largeop","movablelimits","accent","accentunder","open","close","separators","linethickness","columnalign","rowalign","columnspacing","rowspacing","columnlines","rowlines","frame","notation","width","height","depth","voffset","minsize","maxsize","form","encoding","xmlns","dir","class","id"]),$=e=>{const t=new DOMParser().parseFromString(`<body>${e}</body>`,"text/html"),r=l=>{Array.from(l.childNodes).forEach(a=>{if(a.nodeType===Node.ELEMENT_NODE){const n=a;if(!X.has(n.localName.toLowerCase())){n.remove();return}Array.from(n.attributes).forEach(c=>{G.has(c.name.toLowerCase())||n.removeAttribute(c.name)}),r(n)}else a.nodeType!==Node.TEXT_NODE&&a.parentNode?.removeChild(a)})};return r(t.body),t.body.innerHTML},Z=()=>new Promise((e,t)=>{if(window.katex){e(window.katex);return}if(D){const a=setInterval(()=>{window.katex&&(clearInterval(a),e(window.katex))},100);return}D=!0;const r=document.createElement("link");r.rel="stylesheet",r.href="https://cdn.jsdelivr.net/npm/katex@0.16.9/dist/katex.min.css",document.head.appendChild(r);const l=document.createElement("script");l.src="https://cdn.jsdelivr.net/npm/katex@0.16.9/dist/katex.min.js",l.onload=()=>e(window.katex),l.onerror=t,document.head.appendChild(l)}),_=()=>{const e=window.getSelection();if(!e||e.rangeCount===0)return null;const t=e.getRangeAt(0).startContainer;return(t.nodeType===Node.ELEMENT_NODE?t:t.parentElement)?.closest(".rte-content, .editora-content")||null},Q=e=>e?e.nodeType===Node.ELEMENT_NODE?e:e.parentElement:null,z=e=>Q(e)?.closest('.rte-content, .editora-content, [contenteditable="true"]')||null,J=(e,t,r)=>{if(t!==r){if(typeof window.execEditorCommand=="function"){window.execEditorCommand("recordDomTransaction",e,t,r);return}if(typeof window.executeEditorCommand=="function")try{window.executeEditorCommand("recordDomTransaction",{editor:e,beforeHTML:t,afterHTML:r})}catch{}}},V=e=>{if(!(e instanceof Element))return null;const t=e.closest(".math-formula, .math-block");return t instanceof HTMLElement?t:null},h=()=>{m&&(m.classList.remove("math-object-selected"),m.removeAttribute("data-rte-selected-object"),m=null)},Y=e=>{if(m===e)return;h(),m=e,e.classList.add("math-object-selected"),e.setAttribute("data-rte-selected-object","true");const t=window.getSelection();if(!t)return;const r=document.createRange();r.selectNode(e),t.removeAllRanges(),t.addRange(r)},ee=(e,t)=>{const r=window.getSelection();if(!r)return;const l=document.createRange();t&&t.parentNode===e?l.setStartBefore(t):(l.selectNodeContents(e),l.collapse(!1)),l.collapse(!0),r.removeAllRanges(),r.addRange(l)},te=e=>{if(e.childNodes.length>0)return;const t=document.createElement("p");t.appendChild(document.createElement("br")),e.appendChild(t)},ne=()=>{if(!m||!m.isConnected)return h(),!1;const e=m,t=z(e);if(!t)return h(),!1;const r=t.innerHTML,l=e.nextSibling;e.remove(),te(t),h(),ee(t,l);const a=t.innerHTML;return J(t,r,a),t.dispatchEvent(new window.Event("input",{bubbles:!0})),r!==a},oe=()=>{if(document.getElementById("math-object-selection-styles"))return;const e=document.createElement("style");e.id="math-object-selection-styles",e.textContent=`
2
2
  .math-object-selected {
3
3
  outline: 2px solid #2563eb !important;
4
4
  outline-offset: 2px;
5
5
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.18);
6
6
  }
7
- `,document.head.appendChild(e)},Y=()=>{typeof window>"u"||window.__mathPluginObjectSelectionInitialized||(window.__mathPluginObjectSelectionInitialized=!0,V(),document.addEventListener("pointerdown",e=>{const t=G(e.target);if(!t){e.target?.closest?.(".math-dialog-overlay")||h();return}e.preventDefault(),j(t)?.focus(),X(t)},!0),document.addEventListener("keydown",e=>{if(m){if(e.key==="Escape"){h();return}e.key!=="Backspace"&&e.key!=="Delete"||(e.preventDefault(),e.stopPropagation(),J())}},!0))},ee=e=>{if((e||_())?.closest(k))return!0;const r=window.getSelection();if(r&&r.rangeCount>0){const s=r.getRangeAt(0).startContainer;if((s.nodeType===Node.ELEMENT_NODE?s:s.parentElement)?.closest(k))return!0}return document.activeElement?.closest(k)?!0:document.body.matches(k)||document.documentElement.matches(k)},N=async(e,t)=>{const r=t||S?.closest(".rte-content, .editora-content")||_()||y;y=r||null;const l=window.getSelection();if(l&&l.rangeCount>0){const n=l.getRangeAt(0);T=r&&r.contains(n.commonAncestorContainer)?n.cloneRange():null}await K();const s=ee(r),o=s?{overlay:"rgba(0, 0, 0, 0.62)",dialogBg:"#1f2937",border:"#3b4657",panelBg:"#222d3a",fieldBg:"#111827",fieldBorder:"#4b5563",text:"#e2e8f0",muted:"#94a3b8",templateBtnBg:"#273244",templateBtnHover:"#334155",templateBtnText:"#dbe7f7",templateSubText:"#9fb0c6",previewBg:"#111827",previewText:"#cbd5e1",cancelBg:"#334155",cancelText:"#e2e8f0",cancelBorder:"#4b5563",insertBg:"#3b82f6",insertHover:"#2563eb",invalid:"#f87171"}:{overlay:"rgba(0, 0, 0, 0.5)",dialogBg:"#ffffff",border:"#e1e5e9",panelBg:"#f8f9fa",fieldBg:"#ffffff",fieldBorder:"#ced4da",text:"#1f2937",muted:"#6c757d",templateBtnBg:"#ffffff",templateBtnHover:"#f8f9fa",templateBtnText:"#1f2937",templateSubText:"#6c757d",previewBg:"#f8f9fa",previewText:"#6c757d",cancelBg:"#ffffff",cancelText:"#1f2937",cancelBorder:"#ced4da",insertBg:"#007bff",insertHover:"#0069d9",invalid:"#cc0000"},d=document.createElement("div");d.className="math-dialog-overlay",d.style.cssText=`position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: ${o.overlay}; display: flex; align-items: center; justify-content: center; z-index: 99999;`;const c=document.createElement("div");c.style.cssText=`background: ${o.dialogBg}; border: 1px solid ${o.border}; border-radius: 8px; width: 90%; max-width: 600px; max-height: 90vh; overflow: hidden; display: flex; flex-direction: column; box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2); color: ${o.text};`;let u=e?.format||"latex",B=e?.formula||"",R=e?.inline!==!1,b=null,L="";c.innerHTML=`
8
- <div style="display: flex; justify-content: space-between; align-items: center; padding: 16px 20px; border-bottom: 1px solid ${o.border}; background: ${o.panelBg};">
9
- <h2 style="margin: 0; font-size: 18px; font-weight: 600; color: ${o.text};">${e?"Edit":"Insert"} Math Formula</h2>
10
- <button class="close-btn" style="background: none; border: none; font-size: 28px; cursor: pointer; color: ${o.muted}; padding: 0; width: 30px; height: 30px; line-height: 1;">×</button>
7
+ `,document.head.appendChild(e)},re=()=>{typeof window>"u"||window.__mathPluginObjectSelectionInitialized||(window.__mathPluginObjectSelectionInitialized=!0,oe(),document.addEventListener("pointerdown",e=>{const t=V(e.target);if(!t){e.target?.closest?.(".math-dialog-overlay")||h();return}e.preventDefault(),z(t)?.focus(),Y(t)},!0),document.addEventListener("keydown",e=>{if(m){if(e.key==="Escape"){h();return}e.key!=="Backspace"&&e.key!=="Delete"||(e.preventDefault(),e.stopPropagation(),ne())}},!0))},ae=e=>{if((e||_())?.closest(k))return!0;const r=window.getSelection();if(r&&r.rangeCount>0){const a=r.getRangeAt(0).startContainer;if((a.nodeType===Node.ELEMENT_NODE?a:a.parentElement)?.closest(k))return!0}return document.activeElement?.closest(k)?!0:document.body.matches(k)||document.documentElement.matches(k)},R=async(e,t)=>{document.querySelectorAll(".math-dialog-overlay").forEach(o=>o.remove());const r=t||L?.closest(".rte-content, .editora-content")||_()||y;y=r||null;const l=window.getSelection();if(l&&l.rangeCount>0){const o=l.getRangeAt(0);S=r&&r.contains(o.commonAncestorContainer)?o.cloneRange():null}await Z();const a=ae(r),n=a?{overlay:"rgba(0, 0, 0, 0.62)",dialogBg:"#1f2937",border:"#3b4657",panelBg:"#222d3a",fieldBg:"#111827",fieldBorder:"#4b5563",text:"#e2e8f0",muted:"#94a3b8",templateBtnBg:"#273244",templateBtnHover:"#334155",templateBtnText:"#dbe7f7",templateSubText:"#9fb0c6",previewBg:"#111827",previewText:"#cbd5e1",cancelBg:"#334155",cancelText:"#e2e8f0",cancelBorder:"#4b5563",insertBg:"#3b82f6",insertHover:"#2563eb",invalid:"#f87171"}:{overlay:"rgba(0, 0, 0, 0.5)",dialogBg:"#ffffff",border:"#e1e5e9",panelBg:"#f8f9fa",fieldBg:"#ffffff",fieldBorder:"#ced4da",text:"#1f2937",muted:"#6c757d",templateBtnBg:"#ffffff",templateBtnHover:"#f8f9fa",templateBtnText:"#1f2937",templateSubText:"#6c757d",previewBg:"#f8f9fa",previewText:"#6c757d",cancelBg:"#ffffff",cancelText:"#1f2937",cancelBorder:"#ced4da",insertBg:"#007bff",insertHover:"#0069d9",invalid:"#cc0000"},c=document.createElement("div");U.initDialogOverlay(c),c.className="math-dialog-overlay",c.style.cssText=`position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: ${n.overlay}; display: flex; align-items: center; justify-content: center; z-index: 99999;`;const d=document.createElement("div");d.style.cssText=`background: ${n.dialogBg}; border: 1px solid ${n.border}; border-radius: 8px; width: 90%; max-width: 600px; max-height: 90vh; overflow: hidden; display: flex; flex-direction: column; box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2); color: ${n.text};`;let u=e?.format||"latex",B=e?.formula||"";const j=e?.inline!==!1;let b=null,C="";d.innerHTML=`
8
+ <div style="display: flex; justify-content: space-between; align-items: center; padding: 16px 20px; border-bottom: 1px solid ${n.border}; background: ${n.panelBg};">
9
+ <h2 style="margin: 0; font-size: 18px; font-weight: 600; color: ${n.text};">${e?"Edit":"Insert"} Math Formula</h2>
10
+ <button class="close-btn" style="background: none; border: none; font-size: 28px; cursor: pointer; color: ${n.muted}; padding: 0; width: 30px; height: 30px; line-height: 1;">×</button>
11
11
  </div>
12
12
 
13
13
  <div style="padding: 20px; overflow-y: auto; flex: 1;">
14
14
  <div style="margin-bottom: 20px;">
15
- <label style="display: block; font-weight: 600; margin-bottom: 8px; font-size: 14px; color: ${o.text};">Format:</label>
15
+ <label style="display: block; font-weight: 600; margin-bottom: 8px; font-size: 14px; color: ${n.text};">Format:</label>
16
16
  <div style="display: flex; gap: 16px;">
17
- <label style="cursor: pointer; color: ${o.text};"><input type="radio" name="format" value="latex" ${u==="latex"?"checked":""} style="margin-right: 6px;"> LaTeX</label>
18
- <label style="cursor: pointer; color: ${o.text};"><input type="radio" name="format" value="mathml" ${u==="mathml"?"checked":""} style="margin-right: 6px;"> MathML</label>
17
+ <label style="cursor: pointer; color: ${n.text};"><input type="radio" name="format" value="latex" ${u==="latex"?"checked":""} style="margin-right: 6px;"> LaTeX</label>
18
+ <label style="cursor: pointer; color: ${n.text};"><input type="radio" name="format" value="mathml" ${u==="mathml"?"checked":""} style="margin-right: 6px;"> MathML</label>
19
19
  </div>
20
20
  </div>
21
21
 
22
22
  <div style="margin-bottom: 20px;">
23
- <label style="display: block; font-weight: 600; margin-bottom: 8px; font-size: 14px; color: ${o.text};">Quick Templates:</label>
23
+ <label style="display: block; font-weight: 600; margin-bottom: 8px; font-size: 14px; color: ${n.text};">Quick Templates:</label>
24
24
  <div id="templates-grid" style="display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; max-height: 200px; overflow-y: auto;"></div>
25
25
  </div>
26
26
 
27
27
  <div style="margin-bottom: 20px;">
28
- <label style="cursor: pointer; color: ${o.text};"><input type="checkbox" id="inline-cb" ${R?"checked":""} style="margin-right: 8px;"> Inline math</label>
28
+ <label style="cursor: pointer; color: ${n.text};"><input type="checkbox" id="inline-cb" ${j?"checked":""} style="margin-right: 8px;"> Inline math</label>
29
29
  </div>
30
30
 
31
31
  <div style="margin-bottom: 20px;">
32
- <label style="display: block; font-weight: 600; margin-bottom: 8px; font-size: 14px; color: ${o.text};">Formula:</label>
33
- <textarea id="formula-input" rows="4" style="width: 100%; min-height: 112px; padding: 10px 12px; border: 1px solid ${o.fieldBorder}; border-radius: 6px; font-family: 'Courier New', monospace; font-size: 14px; line-height: 1.45; background: ${o.fieldBg}; color: ${o.text}; box-sizing: border-box; overflow-x: hidden; overflow-y: auto; resize: vertical;">${B}</textarea>
32
+ <label style="display: block; font-weight: 600; margin-bottom: 8px; font-size: 14px; color: ${n.text};">Formula:</label>
33
+ <textarea id="formula-input" rows="4" style="width: 100%; min-height: 112px; padding: 10px 12px; border: 1px solid ${n.fieldBorder}; border-radius: 6px; font-family: 'Courier New', monospace; font-size: 14px; line-height: 1.45; background: ${n.fieldBg}; color: ${n.text}; box-sizing: border-box; overflow-x: hidden; overflow-y: auto; resize: vertical;">${K.escapeHtml(B)}</textarea>
34
34
  </div>
35
35
 
36
36
  <div style="margin-bottom: 20px;">
37
- <label style="display: block; font-weight: 600; margin-bottom: 8px; font-size: 14px; color: ${o.text};">Preview:</label>
38
- <div id="preview-area" style="min-height: 60px; padding: 15px; border: 1px solid ${o.fieldBorder}; border-radius: 4px; background: ${o.previewBg}; display: flex; align-items: center; justify-content: center; color: ${o.previewText};"></div>
37
+ <label style="display: block; font-weight: 600; margin-bottom: 8px; font-size: 14px; color: ${n.text};">Preview:</label>
38
+ <div id="preview-area" style="min-height: 60px; padding: 15px; border: 1px solid ${n.fieldBorder}; border-radius: 4px; background: ${n.previewBg}; display: flex; align-items: center; justify-content: center; color: ${n.previewText};"></div>
39
39
  </div>
40
40
  </div>
41
41
 
42
- <div style="display: flex; justify-content: flex-end; gap: 10px; padding: 16px 20px; border-top: 1px solid ${o.border}; background: ${o.panelBg};">
43
- <button class="cancel-btn" style="padding: 10px 20px; background: ${o.cancelBg}; color: ${o.cancelText}; border: 1px solid ${o.cancelBorder}; border-radius: 4px; cursor: pointer; font-size: 14px;">Cancel</button>
44
- <button id="insert-btn" style="padding: 10px 20px; background: ${o.insertBg}; color: white; border: none; border-radius: 4px; cursor: pointer; font-size: 14px;" disabled>${e?"Update":"Insert"}</button>
42
+ <div style="display: flex; justify-content: flex-end; gap: 10px; padding: 16px 20px; border-top: 1px solid ${n.border}; background: ${n.panelBg};">
43
+ <button class="cancel-btn" style="padding: 10px 20px; background: ${n.cancelBg}; color: ${n.cancelText}; border: 1px solid ${n.cancelBorder}; border-radius: 4px; cursor: pointer; font-size: 14px;">Cancel</button>
44
+ <button id="insert-btn" style="padding: 10px 20px; background: ${n.insertBg}; color: white; border: none; border-radius: 4px; cursor: pointer; font-size: 14px;" disabled>${e?"Update":"Insert"}</button>
45
45
  </div>
46
- `,d.appendChild(c),document.body.appendChild(d);const p=c.querySelector("#formula-input"),v=c.querySelector("#preview-area"),$=c.querySelector("#templates-grid"),P=c.querySelectorAll('input[name="format"]'),z=c.querySelector("#inline-cb"),f=c.querySelector("#insert-btn"),g=c.querySelector(".close-btn"),w=c.querySelector(".cancel-btn"),I=n=>encodeURIComponent(n),q=n=>{try{return decodeURIComponent(n)}catch{return n}},C=()=>{const n=O[u];$.innerHTML=n.map(i=>`
47
- <button type="button" data-formula="${I(i.formula)}" title="${i.description}" style="padding: 8px; border: 1px solid ${o.fieldBorder}; border-radius: 4px; background: ${o.templateBtnBg}; cursor: pointer; text-align: left; transition: background-color 0.16s ease;">
48
- <div style="font-weight: 600; font-size: 12px; color: ${o.templateBtnText};">${i.name}</div>
49
- <div style="font-size: 10px; color: ${o.templateSubText}; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;">${i.formula.substring(0,20)}...</div>
46
+ `,c.appendChild(d),document.body.appendChild(c);const p=d.querySelector("#formula-input"),v=d.querySelector("#preview-area"),M=d.querySelector("#templates-grid"),q=d.querySelectorAll('input[name="format"]'),P=d.querySelector("#inline-cb"),f=d.querySelector("#insert-btn"),g=d.querySelector(".close-btn"),w=d.querySelector(".cancel-btn"),I=o=>encodeURIComponent(o),F=o=>{try{return decodeURIComponent(o)}catch{return o}},A=()=>{const o=W[u];M.innerHTML=o.map(s=>`
47
+ <button type="button" data-formula="${I(s.formula)}" title="${s.description}" style="padding: 8px; border: 1px solid ${n.fieldBorder}; border-radius: 4px; background: ${n.templateBtnBg}; cursor: pointer; text-align: left; transition: background-color 0.16s ease;">
48
+ <div style="font-weight: 600; font-size: 12px; color: ${n.templateBtnText};">${s.name}</div>
49
+ <div style="font-size: 10px; color: ${n.templateSubText}; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;">${s.formula.substring(0,20)}...</div>
50
50
  </button>
51
- `).join("")},F=()=>{const n=p.value.trim(),i=`${u}:${n}`;if(i!==L){if(L=i,!n){v.innerHTML=`<span style="color: ${o.previewText};">Enter a formula to see preview</span>`,f.disabled=!0;return}f.disabled=!1;try{if(u==="latex"){const a=window.katex;v.innerHTML=a.renderToString(n,{displayMode:!1,throwOnError:!1})}else n.trim().startsWith("<math")?v.innerHTML=n:v.innerHTML=`<math xmlns="http://www.w3.org/1998/Math/MathML" display="inline">${n}</math>`}catch{v.innerHTML=`<span style="color: ${o.invalid};">Invalid formula</span>`}}},M=()=>{b!==null&&cancelAnimationFrame(b),b=requestAnimationFrame(()=>{b=null,F()})},A=n=>{n.key==="Escape"&&(n.preventDefault(),n.stopPropagation(),E())},E=()=>{document.removeEventListener("keydown",A,!0),b!==null&&(cancelAnimationFrame(b),b=null),d.parentNode&&d.parentNode.removeChild(d)};g.onmouseover=()=>{g.style.color="#f8fafc",g.style.background=s?"#334155":"#e5e7eb",g.style.borderRadius="4px"},g.onmouseout=()=>{g.style.color=o.muted,g.style.background="none"},w.onmouseover=()=>{w.style.background=s?"#475569":"#f3f4f6"},w.onmouseout=()=>{w.style.background=o.cancelBg},f.onmouseover=()=>{f.disabled||(f.style.background=o.insertHover)},f.onmouseout=()=>{f.style.background=o.insertBg},$.addEventListener("mouseover",n=>{const a=n.target.closest("button[data-formula]");a&&(a.style.background=o.templateBtnHover)}),$.addEventListener("mouseout",n=>{const a=n.target.closest("button[data-formula]");a&&(a.style.background=o.templateBtnBg)}),$.addEventListener("click",n=>{const a=n.target.closest("button[data-formula]");a&&(p.value=q(a.getAttribute("data-formula")||""),B=p.value,M())});const D=()=>{const n=p.value.trim();if(!n)return;const i={formula:n,format:u,inline:z.checked},a=i.inline?document.createElement("span"):document.createElement("div");if(a.className=i.inline?"math-formula":"math-block",a.setAttribute("data-math-formula",n),a.setAttribute("data-math-format",u),a.contentEditable="false",a.style.cssText=i.inline?"background: #f0f8ff; border: 1px solid #b8daff; border-radius: 4px; padding: 2px 6px; margin: 0 2px; color: #004085; display: inline-block; cursor: pointer;":"background: #f8f9fa; border: 1px solid #dee2e6; border-radius: 4px; padding: 12px; margin: 8px 0; text-align: center; display: block; cursor: pointer;",u==="latex"){const x=window.katex;try{a.innerHTML=x.renderToString(n,{displayMode:!i.inline,throwOnError:!1})}catch{a.textContent=i.inline?`$${n}$`:`$$${n}$$`}}else if(n.trim().startsWith("<math"))a.innerHTML=n;else{const x=`<math xmlns="http://www.w3.org/1998/Math/MathML" display="${i.inline?"inline":"block"}">${n}</math>`;a.innerHTML=x}if(S)S.replaceWith(a);else if(T)T.deleteContents(),T.insertNode(a);else if(y&&y.isConnected){const x=document.createRange();x.selectNodeContents(y),x.collapse(!1),x.insertNode(a)}(a.closest(".rte-content, .editora-content")||y)?.dispatchEvent(new Event("input",{bubbles:!0})),E()};g.addEventListener("click",E),w.addEventListener("click",E),f.addEventListener("click",D),d.addEventListener("click",n=>{n.target===d&&E()}),document.addEventListener("keydown",A,!0),P.forEach(n=>{n.addEventListener("change",i=>{u=i.target.value,L="",C(),M()})}),p.addEventListener("input",()=>{B=p.value,M()}),p.addEventListener("keydown",n=>{(n.ctrlKey||n.metaKey)&&n.key==="Enter"&&(n.preventDefault(),D())}),C(),M(),p.focus()};if(typeof window<"u"&&!window.__mathPluginDoubleClickInitialized){window.__mathPluginDoubleClickInitialized=!0;const e=r=>{const s=r.target.closest(".math-formula, .math-block");if(s){r.preventDefault(),r.stopPropagation(),r.stopImmediatePropagation(),h(),S=s;const o=s.getAttribute("data-math-formula")||"",d=s.getAttribute("data-math-format")||"latex",c=s.classList.contains("math-formula");N({formula:o,format:d,inline:c})}},t=()=>{document.addEventListener("dblclick",e,{capture:!0})};document.readyState==="loading"?document.addEventListener("DOMContentLoaded",t):setTimeout(t,100)}const te=()=>({name:"math",init:Y,toolbar:[{label:"Insert Math",command:"insertMath",icon:'<svg width="24" height="24" focusable="false"><path fill-rule="evenodd" clip-rule="evenodd" d="M9 4.8c.1-.5.5-.8 1-.8h10a1 1 0 1 1 0 2h-9.2L8.3 19.2a1 1 0 0 1-1.7.4l-3.4-4.2a1 1 0 0 1 1.6-1.2l2 2.5L9 4.8Zm9.7 5.5c.4.4.4 1 0 1.4L17 13.5l1.8 1.8a1 1 0 0 1-1.4 1.4L15.5 15l-1.8 1.8a1 1 0 0 1-1.4-1.4l1.8-1.8-1.8-1.8a1 1 0 0 1 1.4-1.4l1.8 1.8 1.8-1.8a1 1 0 0 1 1.4 0Z"></path></svg>'}],commands:{insertMath:(e,t)=>{const r=t?.contentElement instanceof HTMLElement?t.contentElement:null;return N(void 0,r),!0}},keymap:{"Mod-Shift-m":"insertMath"}});exports.MathPlugin=te;
51
+ `).join("")},O=()=>{const o=p.value.trim(),s=`${u}:${o}`;if(s!==C){if(C=s,!o){v.innerHTML=`<span style="color: ${n.previewText};">Enter a formula to see preview</span>`,f.disabled=!0;return}f.disabled=!1;try{if(u==="latex"){const i=window.katex;v.innerHTML=i.renderToString(o,{displayMode:!1,throwOnError:!1})}else o.trim().startsWith("<math")?v.innerHTML=$(o):v.innerHTML=$(`<math xmlns="http://www.w3.org/1998/Math/MathML" display="inline">${o}</math>`)}catch{v.innerHTML=`<span style="color: ${n.invalid};">Invalid formula</span>`}}},T=()=>{b!==null&&cancelAnimationFrame(b),b=requestAnimationFrame(()=>{b=null,O()})},N=o=>{o.key==="Escape"&&(o.preventDefault(),o.stopPropagation(),E())},E=()=>{document.removeEventListener("keydown",N,!0),b!==null&&(cancelAnimationFrame(b),b=null),c.parentNode&&c.parentNode.removeChild(c)};g.onmouseover=()=>{g.style.color="#f8fafc",g.style.background=a?"#334155":"#e5e7eb",g.style.borderRadius="4px"},g.onmouseout=()=>{g.style.color=n.muted,g.style.background="none"},w.onmouseover=()=>{w.style.background=a?"#475569":"#f3f4f6"},w.onmouseout=()=>{w.style.background=n.cancelBg},f.onmouseover=()=>{f.disabled||(f.style.background=n.insertHover)},f.onmouseout=()=>{f.style.background=n.insertBg},M.addEventListener("mouseover",o=>{const i=o.target.closest("button[data-formula]");i&&(i.style.background=n.templateBtnHover)}),M.addEventListener("mouseout",o=>{const i=o.target.closest("button[data-formula]");i&&(i.style.background=n.templateBtnBg)}),M.addEventListener("click",o=>{const i=o.target.closest("button[data-formula]");i&&(p.value=F(i.getAttribute("data-formula")||""),B=p.value,T())});const H=()=>{const o=p.value.trim();if(!o)return;const s={formula:o,format:u,inline:P.checked},i=s.inline?document.createElement("span"):document.createElement("div");if(i.className=s.inline?"math-formula":"math-block",i.setAttribute("data-math-formula",o),i.setAttribute("data-math-format",u),i.contentEditable="false",i.style.cssText=s.inline?"background: #f0f8ff; border: 1px solid #b8daff; border-radius: 4px; padding: 2px 6px; margin: 0 2px; color: #004085; display: inline-block; cursor: pointer;":"background: #f8f9fa; border: 1px solid #dee2e6; border-radius: 4px; padding: 12px; margin: 8px 0; text-align: center; display: block; cursor: pointer;",u==="latex"){const x=window.katex;try{i.innerHTML=x.renderToString(o,{displayMode:!s.inline,throwOnError:!1})}catch{i.textContent=s.inline?`$${o}$`:`$$${o}$$`}}else if(o.trim().startsWith("<math"))i.innerHTML=$(o);else{const x=`<math xmlns="http://www.w3.org/1998/Math/MathML" display="${s.inline?"inline":"block"}">${o}</math>`;i.innerHTML=$(x)}if(L)L.replaceWith(i);else if(S)S.deleteContents(),S.insertNode(i);else if(y&&y.isConnected){const x=document.createRange();x.selectNodeContents(y),x.collapse(!1),x.insertNode(i)}(i.closest(".rte-content, .editora-content")||y)?.dispatchEvent(new Event("input",{bubbles:!0})),E()};g.addEventListener("click",E),w.addEventListener("click",E),f.addEventListener("click",H),c.addEventListener("click",o=>{o.target===c&&E()}),document.addEventListener("keydown",N,!0),q.forEach(o=>{o.addEventListener("change",s=>{u=s.target.value,C="",A(),T()})}),p.addEventListener("input",()=>{B=p.value,T()}),p.addEventListener("keydown",o=>{(o.ctrlKey||o.metaKey)&&o.key==="Enter"&&(o.preventDefault(),H())}),A(),T(),p.focus()};if(typeof window<"u"&&!window.__mathPluginDoubleClickInitialized){window.__mathPluginDoubleClickInitialized=!0;const e=r=>{const a=r.target.closest(".math-formula, .math-block");if(a){r.preventDefault(),r.stopPropagation(),r.stopImmediatePropagation(),h(),L=a;const n=a.getAttribute("data-math-formula")||"",c=a.getAttribute("data-math-format")||"latex",d=a.classList.contains("math-formula");R({formula:n,format:c,inline:d})}},t=()=>{document.addEventListener("dblclick",e,{capture:!0})};document.readyState==="loading"?document.addEventListener("DOMContentLoaded",t):setTimeout(t,100)}const ie=()=>({name:"math",init:re,toolbar:[{label:"Insert Math",command:"insertMath",icon:'<svg width="24" height="24" focusable="false"><path fill-rule="evenodd" clip-rule="evenodd" d="M9 4.8c.1-.5.5-.8 1-.8h10a1 1 0 1 1 0 2h-9.2L8.3 19.2a1 1 0 0 1-1.7.4l-3.4-4.2a1 1 0 0 1 1.6-1.2l2 2.5L9 4.8Zm9.7 5.5c.4.4.4 1 0 1.4L17 13.5l1.8 1.8a1 1 0 0 1-1.4 1.4L15.5 15l-1.8 1.8a1 1 0 0 1-1.4-1.4l1.8-1.8-1.8-1.8a1 1 0 0 1 1.4-1.4l1.8 1.8 1.8-1.8a1 1 0 0 1 1.4 0Z"></path></svg>'}],commands:{insertMath:(e,t)=>{const r=t?.contentElement instanceof HTMLElement?t.contentElement:null;return R(void 0,r),!0}},keymap:{"Mod-Shift-m":"insertMath"}});exports.MathPlugin=ie;