@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/preview.cjs.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";Object.
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});let c=!1;const g=()=>{if(typeof document>"u")return;const r="rte-preview-plugin-styles";if(document.getElementById(r))return;const t=document.createElement("style");t.id=r,t.textContent=`
|
|
2
2
|
/* Preview Editor Dialog Styles */
|
|
3
3
|
.rte-preview-editor-overlay {
|
|
4
4
|
position: fixed !important;
|
|
@@ -217,7 +217,7 @@
|
|
|
217
217
|
font-size: 14px;
|
|
218
218
|
}
|
|
219
219
|
}
|
|
220
|
-
`,document.head.appendChild(t)},v=()=>{const r=window.getSelection();if(r&&r.rangeCount>0){let e=r.getRangeAt(0).startContainer;for(;e&&e!==document.body;){if(e.nodeType===Node.ELEMENT_NODE){const o=e;if(o.getAttribute("contenteditable")==="true")return o}e=e.parentNode}}const t=document.activeElement;if(t){if(t.getAttribute("contenteditable")==="true")return t;const e=t.closest('[contenteditable="true"]');if(e)return e}return document.querySelector('[contenteditable="true"]')},h=()=>{const r=v();if(!r)return"";const t=r.cloneNode(!0);return[".rte-floating-toolbar",".rte-selection-marker",".rte-toolbar",".rte-resize-handle","[data-rte-internal]"].forEach(o=>{t.querySelectorAll(o).forEach(i=>i.remove())}),t.innerHTML},
|
|
220
|
+
`,document.head.appendChild(t)},v=()=>{const r=window.getSelection();if(r&&r.rangeCount>0){let e=r.getRangeAt(0).startContainer;for(;e&&e!==document.body;){if(e.nodeType===Node.ELEMENT_NODE){const o=e;if(o.getAttribute("contenteditable")==="true")return o}e=e.parentNode}}const t=document.activeElement;if(t){if(t.getAttribute("contenteditable")==="true")return t;const e=t.closest('[contenteditable="true"]');if(e)return e}return document.querySelector('[contenteditable="true"]')},h=()=>{const r=v();if(!r)return"";const t=r.cloneNode(!0);return[".rte-floating-toolbar",".rte-selection-marker",".rte-toolbar",".rte-resize-handle","[data-rte-internal]"].forEach(o=>{t.querySelectorAll(o).forEach(i=>i.remove())}),t.innerHTML},u=r=>{const t=document.createElement("div");return t.innerHTML=r,t.querySelectorAll('script, iframe[src^="javascript:"], object, embed, form[action^="javascript:"]').forEach(i=>i.remove()),t.querySelectorAll("*").forEach(i=>{Array.from(i.attributes).forEach(n=>{n.name.startsWith("on")&&i.removeAttribute(n.name),(n.name==="href"||n.name==="src")&&n.value.startsWith("javascript:")&&i.removeAttribute(n.name)})}),t.innerHTML},w=()=>{if(typeof window>"u"||c)return;c=!0,g();const r=h(),t=u(r),e=document.createElement("div");e.className="rte-preview-editor-overlay",e.setAttribute("role","dialog"),e.setAttribute("aria-modal","true"),e.setAttribute("aria-labelledby","preview-editor-title");const o=document.createElement("div");o.className="rte-preview-editor-modal";const i=document.createElement("div");i.className="rte-preview-editor-header",i.innerHTML=`
|
|
221
221
|
<h2 id="preview-editor-title">Preview Editor</h2>
|
|
222
222
|
<div class="rte-preview-editor-header-actions">
|
|
223
223
|
<button class="rte-preview-editor-close-btn" aria-label="Close preview editor">
|
|
@@ -227,4 +227,4 @@
|
|
|
227
227
|
</svg>
|
|
228
228
|
</button>
|
|
229
229
|
</div>
|
|
230
|
-
`;const n=document.createElement("div");n.className="rte-preview-editor-body";const a=document.createElement("div");a.className="rte-preview-editor-content";const l=document.createElement("div");l.className="rte-preview-editor-light-editor",l.innerHTML=t,a.appendChild(l),n.appendChild(a),o.appendChild(i),o.appendChild(n),e.appendChild(o);const p=()=>{e.parentNode&&e.parentNode.removeChild(e),c=!1,document.removeEventListener("keydown",s)},s=d=>{d.key==="Escape"&&(d.preventDefault(),d.stopPropagation(),p())},m=i.querySelector(".rte-preview-editor-close-btn");m&&m.addEventListener("click",d=>{d.preventDefault(),d.stopPropagation(),p()}),e.addEventListener("click",d=>{d.target===e&&p()}),document.addEventListener("keydown",s),document.body.appendChild(e)},f=()=>({name:"preview",toolbar:[{label:"Preview",command:"togglePreview",icon:'<svg fill="#000000" version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="24px" height="24px" viewBox="0 0 92 92" enable-background="new 0 0 92 92" 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"> <path id="XMLID_1239_" d="M91.3,43.8C90.6,42.8,74.4,19,46,19C17.6,19,1.4,42.8,0.7,43.8c-0.9,1.3-0.9,3.1,0,4.5 C1.4,49.2,17.6,73,46,73c28.4,0,44.6-23.8,45.3-24.8C92.2,46.9,92.2,45.1,91.3,43.8z M46,65C26.7,65,13.5,51.4,9,46 c4.5-5.5,17.6-19,37-19c19.3,0,32.5,13.6,37,19C78.4,51.5,65.3,65,46,65z M48.3,29.6c-4.4-0.6-8.7,0.5-12.3,3.2c0,0,0,0,0,0 c-7.3,5.5-8.8,15.9-3.3,23.2c2.7,3.6,6.5,5.8,10.9,6.5c0.8,0.1,1.6,0.2,2.3,0.2c3.6,0,7-1.2,9.9-3.3c7.3-5.5,8.8-15.9,3.3-23.2 C56.6,32.5,52.7,30.2,48.3,29.6z M52.3,54.5c-2.2,1.7-5,2.4-7.8,2c-2.8-0.4-5.3-1.9-7-4.1C34.1,47.7,35,41,39.7,37.5 c2.2-1.7,5-2.4,7.8-2c2.8,0.4,5.3,1.9,7,4.1C57.9,44.3,57,51,52.3,54.5z M51.9,40c0.8,0.7,1.2,1.8,1.2,2.8c0,1-0.4,2.1-1.2,2.8 c-0.7,0.7-1.8,1.2-2.8,1.2c-1.1,0-2.1-0.4-2.8-1.2c-0.8-0.8-1.2-1.8-1.2-2.8c0-1.1,0.4-2.1,1.2-2.8c0.7-0.8,1.8-1.2,2.8-1.2 C50.2,38.9,51.2,39.3,51.9,40z"></path> </g></svg>'}],commands:{togglePreview:()=>(
|
|
230
|
+
`;const n=document.createElement("div");n.className="rte-preview-editor-body";const a=document.createElement("div");a.className="rte-preview-editor-content";const l=document.createElement("div");l.className="rte-preview-editor-light-editor",l.innerHTML=t,a.appendChild(l),n.appendChild(a),o.appendChild(i),o.appendChild(n),e.appendChild(o);const p=()=>{e.parentNode&&e.parentNode.removeChild(e),c=!1,document.removeEventListener("keydown",s)},s=d=>{d.key==="Escape"&&(d.preventDefault(),d.stopPropagation(),p())},m=i.querySelector(".rte-preview-editor-close-btn");m&&m.addEventListener("click",d=>{d.preventDefault(),d.stopPropagation(),p()}),e.addEventListener("click",d=>{d.target===e&&p()}),document.addEventListener("keydown",s),document.body.appendChild(e)},f=()=>({name:"preview",toolbar:[{label:"Preview",command:"togglePreview",icon:'<svg fill="#000000" version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="24px" height="24px" viewBox="0 0 92 92" enable-background="new 0 0 92 92" 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"> <path id="XMLID_1239_" d="M91.3,43.8C90.6,42.8,74.4,19,46,19C17.6,19,1.4,42.8,0.7,43.8c-0.9,1.3-0.9,3.1,0,4.5 C1.4,49.2,17.6,73,46,73c28.4,0,44.6-23.8,45.3-24.8C92.2,46.9,92.2,45.1,91.3,43.8z M46,65C26.7,65,13.5,51.4,9,46 c4.5-5.5,17.6-19,37-19c19.3,0,32.5,13.6,37,19C78.4,51.5,65.3,65,46,65z M48.3,29.6c-4.4-0.6-8.7,0.5-12.3,3.2c0,0,0,0,0,0 c-7.3,5.5-8.8,15.9-3.3,23.2c2.7,3.6,6.5,5.8,10.9,6.5c0.8,0.1,1.6,0.2,2.3,0.2c3.6,0,7-1.2,9.9-3.3c7.3-5.5,8.8-15.9,3.3-23.2 C56.6,32.5,52.7,30.2,48.3,29.6z M52.3,54.5c-2.2,1.7-5,2.4-7.8,2c-2.8-0.4-5.3-1.9-7-4.1C34.1,47.7,35,41,39.7,37.5 c2.2-1.7,5-2.4,7.8-2c2.8,0.4,5.3,1.9,7,4.1C57.9,44.3,57,51,52.3,54.5z M51.9,40c0.8,0.7,1.2,1.8,1.2,2.8c0,1-0.4,2.1-1.2,2.8 c-0.7,0.7-1.8,1.2-2.8,1.2c-1.1,0-2.1-0.4-2.8-1.2c-0.8-0.8-1.2-1.8-1.2-2.8c0-1.1,0.4-2.1,1.2-2.8c0.7-0.8,1.8-1.2,2.8-1.2 C50.2,38.9,51.2,39.3,51.9,40z"></path> </g></svg>'}],commands:{togglePreview:()=>(w(),!0)},keymap:{}});exports.PreviewPlugin=f;
|
package/dist/print.cjs.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const o={apiUrl:"http://localhost:3001/api/",headers:{}};let l={...o};function r(e){l={...l,...e}}function t(){return{...l}}function c(){return t().headers||{}}function s(e,i){const n=e.replace(/\/$/,""),a=i.replace(/^\//,"");return`${n}/${a}`}exports.DEFAULT_API_CONFIG=o;exports.buildApiUrl=s;exports.getGlobalApiConfig=t;exports.getGlobalApiHeaders=c;exports.setGlobalApiConfig=r;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";Object.
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const p={all:{name:"All",characters:["€","£","¥","¢","₹","₽","₩","₿","₺","₴","₦","₨","₪","₫","₭","₮","₯","₰","₱","₲","₳","₴","₵","₶","₷","₹","₺","₼","₽","₾","₿",'"',"'","«","»","„","‟","‹","›","‚","‛","〝","〞","〟","‟","„","©","®","™","°","§","¶","†","‡","•","‣","⁃","‰","‱","′","″","‴","‵","‶","‷","※","‼","‽","‾","‿","⁀","⁁","⁂","⁃","⁇","⁈","⁉","+","-","×","÷","=","≠","≈","≡","≤","≥","<",">","±","∓","∴","∵","∶","∷","∸","∹","∺","∻","∼","∽","∾","∿","≀","≁","≂","≃","≄","≅","≆","≇","≈","≉","≊","≋","≌","≍","≎","≏","≐","≑","≒","≓","≔","≕","≖","≗","≘","≙","≚","≛","≜","≝","≞","≟","≠","≡","≢","≣","≤","≥","≦","≧","≨","≩","≪","≫","≬","≭","≮","≯","≰","≱","≲","≳","≴","≵","≶","≷","≸","≹","≺","≻","≼","≽","≾","≿","À","Á","Â","Ã","Ä","Å","Æ","Ç","È","É","Ê","Ë","Ì","Í","Î","Ï","Ð","Ñ","Ò","Ó","Ô","Õ","Ö","×","Ø","Ù","Ú","Û","Ü","Ý","Þ","ß","à","á","â","ã","ä","å","æ","ç","è","é","ê","ë","ì","í","î","ï","ð","ñ","ò","ó","ô","õ","ö","÷","ø","ù","ú","û","ü","ý","þ","ÿ","¡","¿","‽","‼","⁇","⁈","⁉","※","‾","‿","⁀","⁁","⁂","⁃","←","↑","→","↓","↔","↕","↖","↗","↘","↙","↚","↛","↜","↝","↞","↟","↠","↡","↢","↣","↤","↥","↦","↧","↨","↩","↪","↫","↬","↭","↮","↯","↰","↱","↲","↳","↴","↵","↶","↷","↸","↹","↺","↻","↼","↽","↾","↿","⇀","⇁","⇂","⇃","⇄","⇅","⇆","⇇","⇈","⇉","⇊","⇋","⇌","⇍","⇎","⇏","⇐","⇑","⇒","⇓","⇔","⇕","⇖","⇗","⇘","⇙","⇚","⇛","⇜","⇝","⇞","⇟","⇠","⇡","⇢","⇣","⇤","⇥","⇦","⇧","⇨","⇩","⇪","⇫","⇬","⇭","⇮","⇯","⇰","⇱","⇲","⇳","⇴","⇵","⇶","⇷","⇸","⇹","⇺","⇻","⇼","⇽","⇾","⇿"]},currency:{name:"Currency",characters:["€","£","¥","¢","₹","₽","₩","₿","₺","₴","₦","₨","₪","₫","₭","₮","₯","₰","₱","₲","₳","₵","₶","₷","₼","₾","₿"]},text:{name:"Text",characters:["©","®","™","°","§","¶","†","‡","•","‣","⁃","‰","‱","′","″","‴","‵","‶","‷","※","‼","‽","‾","‿","⁀","⁁","⁂"]},quotation:{name:"Quotation",characters:['"',"'","«","»","„","‟","‹","›","‚","‛","〝","〞","〟"]},mathematical:{name:"Mathematical",characters:["+","-","×","÷","=","≠","≈","≡","≤","≥","<",">","±","∓","∴","∵","∶","∷","∸","∹","∺","∻","∼","∽","∾","∿","≀","≁","≂","≃","≄","≅","≆","≇","≉","≊","≋","≌","≍","≎","≏","≐","≑","≒","≓","≔","≕","≖","≗","≘","≙","≚","≛","≜","≝","≞","≟","≢","≣","≦","≧","≨","≩","≪","≫","≬","≭","≮","≯","≰","≱","≲","≳","≴","≵","≶","≷","≸","≹","≺","≻","≼","≽","≾","≿"]},"extended-latin":{name:"Extended Latin",characters:["À","Á","Â","Ã","Ä","Å","Æ","Ç","È","É","Ê","Ë","Ì","Í","Î","Ï","Ð","Ñ","Ò","Ó","Ô","Õ","Ö","×","Ø","Ù","Ú","Û","Ü","Ý","Þ","ß","à","á","â","ã","ä","å","æ","ç","è","é","ê","ë","ì","í","î","ï","ð","ñ","ò","ó","ô","õ","ö","÷","ø","ù","ú","û","ü","ý","þ","ÿ"]},symbols:{name:"Symbols",characters:["¡","¿","‽","‼","⁇","⁈","⁉","※","‾","‿","⁀","⁁","⁂","⁃"]},arrows:{name:"Arrows",characters:["←","↑","→","↓","↔","↕","↖","↗","↘","↙","↚","↛","↜","↝","↞","↟","↠","↡","↢","↣","↤","↥","↦","↧","↨","↩","↪","↫","↬","↭","↮","↯","↰","↱","↲","↳","↴","↵","↶","↷","↸","↹","↺","↻","↼","↽","↾","↿","⇀","⇁","⇂","⇃","⇄","⇅","⇆","⇇","⇈","⇉","⇊","⇋","⇌","⇍","⇎","⇏","⇐","⇑","⇒","⇓","⇔","⇕","⇖","⇗","⇘","⇙","⇚","⇛","⇜","⇝","⇞","⇟","⇠","⇡","⇢","⇣","⇤","⇥","⇦","⇧","⇨","⇩","⇪","⇫","⇬","⇭","⇮","⇯","⇰","⇱","⇲","⇳","⇴","⇵","⇶","⇷","⇸","⇹","⇺","⇻","⇼","⇽","⇾","⇿"]}},g={"€":"euro","£":"pound","¥":"yen","¢":"cent","₹":"rupee","₽":"ruble","₩":"won","₿":"bitcoin",'"':"quote","'":"apostrophe","«":"left angle quote","»":"right angle quote","„":"low quote","©":"copyright","®":"registered","™":"trademark","°":"degree","§":"section","¶":"paragraph","†":"dagger","‡":"double dagger","•":"bullet","‰":"per mille","′":"prime","″":"double prime","+":"plus","-":"minus","×":"multiplication","÷":"division","=":"equals","≠":"not equal","≈":"approximately","≡":"identical","≤":"less or equal","≥":"greater or equal","±":"plus minus",À:"a grave",Á:"a acute",Â:"a circumflex",Ã:"a tilde",Ä:"a diaeresis",Ç:"c cedilla","←":"left arrow","↑":"up arrow","→":"right arrow","↓":"down arrow","↔":"left right arrow"};let u=!1;const f='[data-theme="dark"], .dark, .editora-theme-dark',b=()=>{const a=window.getSelection();if(!a||a.rangeCount===0)return null;const e=a.anchorNode;return(e instanceof HTMLElement?e:e?.parentElement)?.closest(".rte-content, .editora-content")||null},m=a=>{const e=a||b();return e?!!e.closest(f):!1},x=()=>{if(typeof document>"u")return;const a="special-characters-plugin-styles";if(document.getElementById(a))return;const e=document.createElement("style");e.id=a,e.textContent=`
|
|
2
2
|
.special-characters-overlay {
|
|
3
3
|
--rte-sc-overlay-bg: rgba(15, 23, 36, 0.56);
|
|
4
4
|
--rte-sc-dialog-bg: #ffffff;
|
|
@@ -228,7 +228,7 @@
|
|
|
228
228
|
white-space: nowrap;
|
|
229
229
|
}
|
|
230
230
|
}
|
|
231
|
-
`,document.head.appendChild(e)},v=a=>{const e=window.getSelection();if(e&&e.rangeCount>0){const r=e.getRangeAt(0);r.deleteContents();const c=document.createTextNode(a);r.insertNode(c),r.setStartAfter(c),r.setEndAfter(c),e.removeAllRanges(),e.addRange(r)}},y=a=>{if(typeof window>"u"||
|
|
231
|
+
`,document.head.appendChild(e)},v=a=>{const e=window.getSelection();if(e&&e.rangeCount>0){const r=e.getRangeAt(0);r.deleteContents();const c=document.createTextNode(a);r.insertNode(c),r.setStartAfter(c),r.setEndAfter(c),e.removeAllRanges(),e.addRange(r)}},y=a=>{if(typeof window>"u"||u)return;u=!0,x();let e="all",r="";const c=document.createElement("div");c.className="special-characters-overlay",m(a)&&c.classList.add("rte-ui-theme-dark");const o=document.createElement("div");o.className="special-characters-dialog",o.setAttribute("role","dialog"),o.setAttribute("aria-modal","true");const d=()=>{const s=p[e].characters.filter(t=>{if(!r.trim())return!0;const n=r.toLowerCase();return t.toLowerCase().includes(n)||(g[t]||"").toLowerCase().includes(n)});o.innerHTML=`
|
|
232
232
|
<div class="special-characters-header">
|
|
233
233
|
<h2>Insert Special Characters</h2>
|
|
234
234
|
<button class="special-characters-close">×</button>
|
|
@@ -254,4 +254,4 @@
|
|
|
254
254
|
</div>
|
|
255
255
|
</div>
|
|
256
256
|
</div>
|
|
257
|
-
`,o.querySelector(".special-characters-close")?.addEventListener("click",l),o.querySelectorAll(".special-characters-tab").forEach(t=>{t.addEventListener("click",n=>{const i=n.target.getAttribute("data-category");i&&(e=i,d())})}),o.querySelector(".special-characters-search-input")?.addEventListener("input",t=>{r=t.target.value,d()}),o.querySelectorAll(".special-characters-item").forEach(t=>{t.addEventListener("click",n=>{const i=n.target.getAttribute("data-char");i&&(v(i),l())})})},l=()=>{c.parentNode&&c.parentNode.removeChild(c),
|
|
257
|
+
`,o.querySelector(".special-characters-close")?.addEventListener("click",l),o.querySelectorAll(".special-characters-tab").forEach(t=>{t.addEventListener("click",n=>{const i=n.target.getAttribute("data-category");i&&(e=i,d())})}),o.querySelector(".special-characters-search-input")?.addEventListener("input",t=>{r=t.target.value,d()}),o.querySelectorAll(".special-characters-item").forEach(t=>{t.addEventListener("click",n=>{const i=n.target.getAttribute("data-char");i&&(v(i),l())})})},l=()=>{c.parentNode&&c.parentNode.removeChild(c),u=!1,document.removeEventListener("keydown",h)},h=s=>{s.key==="Escape"&&(s.preventDefault(),s.stopPropagation(),l())};c.addEventListener("click",s=>{s.target===c&&l()}),document.addEventListener("keydown",h),d(),c.appendChild(o),document.body.appendChild(c)},w=()=>({name:"specialCharacters",toolbar:[{label:"Special Characters",command:"insertSpecialCharacter",icon:'<svg width="24" height="24" focusable="false"><path d="M15 18h4l1-2v4h-6v-3.3l1.4-1a6 6 0 0 0 1.8-2.9 6.3 6.3 0 0 0-.1-4.1 5.8 5.8 0 0 0-3-3.2c-.6-.3-1.3-.5-2.1-.5a5.1 5.1 0 0 0-3.9 1.8 6.3 6.3 0 0 0-1.3 6 6.2 6.2 0 0 0 1.8 3l1.4.9V20H4v-4l1 2h4v-.5l-2-1L5.4 15A6.5 6.5 0 0 1 4 11c0-1 .2-1.9.6-2.7A7 7 0 0 1 6.3 6C7.1 5.4 8 5 9 4.5c1-.3 2-.5 3.1-.5a8.8 8.8 0 0 1 5.7 2 7 7 0 0 1 1.7 2.3 6 6 0 0 1 .2 4.8c-.2.7-.6 1.3-1 1.9a7.6 7.6 0 0 1-3.6 2.5v.5Z" fill-rule="evenodd"></path></svg>'}],commands:{insertSpecialCharacter:(a,e)=>{const r=e?.contentElement instanceof HTMLElement?e.contentElement:b();return y(r),!0}},keymap:{}});exports.SpecialCharactersPlugin=w;
|
package/dist/spell-check.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 H=new Set(["the","a","an","and","or","but","in","on","at","to","for","of","with","by","from","is","are","be","was","were","have","has","had","do","does","did","will","would","could","should","may","might","must","can","this","that","these","those","what","which","who","whom","where","when","why","how","all","each","every","both","few","more","most","other","same","such","no","nor","not","only","own","so","than","too","very","just","as","if","because","while","although","though","it","its","their","them","they","you","he","she","we","me","him","her","us","our","i","my","your","his","hers","ours","yours","theirs","editor","document","text","word","paragraph","line","page","content","hello","world","test","example","sample","demo","lorem","ipsum"]),E=new Set,C=new Set;let u=!1,d=null,f=null,a=null,s=null,g=null,v=!1,h=null,O=!1,b=0;const $={characterData:!0,childList:!0,subtree:!0},D="rte-spellcheck-styles",F="__editoraCommandEditorRoot";function q(){if(typeof window>"u")return null;const e=window[F];if(!(e instanceof HTMLElement))return null;window[F]=null;const r=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(r){const l=j(r);if(l)return l;if(r.getAttribute("contenteditable")==="true")return r}if(e.getAttribute("contenteditable")==="true")return e;const t=e.closest('[contenteditable="true"]');return t instanceof HTMLElement?t:null}function T(){let e=document.getElementById(D);e||(e=document.createElement("style"),e.id=D,document.head.appendChild(e)),e.textContent=`
|
|
2
2
|
.rte-spell-check-panel {
|
|
3
3
|
position: absolute;
|
|
4
4
|
top: 12px;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const i=()=>({name:"strikethrough",marks:{strikethrough:{parseDOM:[{tag:"s"},{tag:"strike"},{tag:"del"},{style:"text-decoration",getAttrs:t=>(typeof t=="string"?t:t.style.textDecoration)==="line-through"&&null}],toDOM:()=>["s",0]}},toolbar:[{label:"Strikethrough",command:"toggleStrikethrough",icon:'<svg width="24" height="24" focusable="false"><g fill-rule="evenodd"><path d="M15.6 8.5c-.5-.7-1-1.1-1.3-1.3-.6-.4-1.3-.6-2-.6-2.7 0-2.8 1.7-2.8 2.1 0 1.6 1.8 2 3.2 2.3 4.4.9 4.6 2.8 4.6 3.9 0 1.4-.7 4.1-5 4.1A6.2 6.2 0 0 1 7 16.4l1.5-1.1c.4.6 1.6 2 3.7 2 1.6 0 2.5-.4 3-1.2.4-.8.3-2-.8-2.6-.7-.4-1.6-.7-2.9-1-1-.2-3.9-.8-3.9-3.6C7.6 6 10.3 5 12.4 5c2.9 0 4.2 1.6 4.7 2.4l-1.5 1.1Z"></path><path d="M5 11h14a1 1 0 0 1 0 2H5a1 1 0 0 1 0-2Z" fill-rule="nonzero"></path></g></svg>',shortcut:"Mod-Shift-x"}],commands:{toggleStrikethrough:()=>{const t=l();if(!t)return!1;const n=window.getSelection();if(!n||n.rangeCount===0)return!1;const e=n.getRangeAt(0);if(!t.contains(e.commonAncestorContainer))return!1;t.focus({preventScroll:!0});const o=document.execCommand("strikeThrough",!1);return c(t),t.dispatchEvent(new Event("input",{bubbles:!0})),o!==!1}},keymap:{"Mod-Shift-x":"toggleStrikethrough","Mod-Shift-X":"toggleStrikethrough"}});function l(){const t=window.getSelection();if(t&&t.rangeCount>0){const e=t.getRangeAt(0).startContainer,r=(e.nodeType===Node.ELEMENT_NODE?e:e.parentElement)?.closest('[contenteditable="true"], .rte-content, .editora-content');if(r)return r}const n=document.activeElement;return n?n.getAttribute("contenteditable")==="true"?n:n.closest('[contenteditable="true"], .rte-content, .editora-content'):null}function c(t){t.querySelectorAll("strike, del").forEach(e=>{const o=document.createElement("s");for(const r of Array.from(e.attributes))r.name!=="style"&&o.setAttribute(r.name,r.value);for(;e.firstChild;)o.appendChild(e.firstChild);e.parentNode?.replaceChild(o,e)})}exports.StrikethroughPlugin=i;
|
package/dist/table.cjs.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
"use strict";Object.
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const R=require("./editorContainerHelpers-CFbfiOJI.js");let h=null,m=null,x=null,I=null,M=null,S=null,V=null;const w='[data-theme="dark"], .dark, .editora-theme-dark';let g=!1,p=null,L=0,k=0,C=!1,A=0,B=0,D=0,N=0;const _=()=>{const e=R.findEditorContainerFromSelection(),t=R.getContentElement(e);if(!t)return alert("Please place your cursor in the editor before inserting a table"),!1;const n=window.getSelection();if(!n||n.rangeCount===0)return;const r=n.getRangeAt(0),o=document.createElement("table");o.className="rte-table";const l=document.createElement("thead"),a=document.createElement("tr");for(let c=0;c<3;c++){const s=document.createElement("th"),u=document.createElement("p");u.appendChild(document.createElement("br")),s.appendChild(u),a.appendChild(s)}l.appendChild(a);const i=document.createElement("tbody");for(let c=0;c<2;c++){const s=document.createElement("tr");for(let u=0;u<3;u++){const v=document.createElement("td"),T=document.createElement("p");T.appendChild(document.createElement("br")),v.appendChild(T),s.appendChild(v)}i.appendChild(s)}o.appendChild(l),o.appendChild(i),r.deleteContents(),r.insertNode(o);const d=o.querySelector("th p");if(d){const c=document.createRange();c.setStart(d,0),c.collapse(!0),n.removeAllRanges(),n.addRange(c)}t.focus()},X=()=>{const e=f();if(!e)return;const{table:t,rowIndex:n}=e,r=document.createElement("tr"),o=t.rows[0]?.cells.length||0;for(let a=0;a<o;a++){const i=document.createElement("td"),d=document.createElement("p");d.innerHTML="<br>",i.appendChild(d),r.appendChild(i)}const l=t.rows[n];l&&l.parentElement?l.parentElement.insertBefore(r,l):t.appendChild(r),b()},H=()=>{const e=f();if(!e)return;const{table:t,rowIndex:n}=e,r=document.createElement("tr"),o=t.rows[0]?.cells.length||0;for(let l=0;l<o;l++){const a=document.createElement("td"),i=document.createElement("p");i.innerHTML="<br>",a.appendChild(i),r.appendChild(a)}n>=t.rows.length-1?t.appendChild(r):t.insertBefore(r,t.rows[n+1]),b()},P=()=>{const e=f();if(!e)return;const{table:t,colIndex:n}=e;for(let r=0;r<t.rows.length;r++){const o=t.rows[r],l=document.createElement("td"),a=document.createElement("p");a.innerHTML="<br>",l.appendChild(a),n===0?o.insertBefore(l,o.cells[0]):o.insertBefore(l,o.cells[n])}b()},z=()=>{const e=f();if(!e)return;const{table:t,colIndex:n}=e;for(let r=0;r<t.rows.length;r++){const o=t.rows[r],l=document.createElement("td"),a=document.createElement("p");a.innerHTML="<br>",l.appendChild(a),n>=o.cells.length-1?o.appendChild(l):o.insertBefore(l,o.cells[n+1])}b()},O=()=>{const e=f();if(!e||e.rowCount<=1)return;const{table:t,rowIndex:n}=e;t.deleteRow(n),b()},W=()=>{const e=f();if(!e||e.cellCount<=1)return;const{table:t,colIndex:n}=e;for(let r=0;r<t.rows.length;r++){const o=t.rows[r];o.cells[n]&&o.deleteCell(n)}b()},K=()=>{const e=f();if(!e)return;const{table:t,rowIndex:n}=e,r=t.rows[n];if(r.parentElement?.tagName.toLowerCase()==="thead"){const l=t.querySelector("tbody")||t.appendChild(document.createElement("tbody")),a=t.querySelector("thead");a&&(l.insertBefore(r,l.firstChild),a.rows.length===0&&a.remove())}else{let l=t.querySelector("thead");l||(l=document.createElement("thead"),t.insertBefore(l,t.firstChild)),l.appendChild(r)}b()},Y=()=>{const e=f();if(!e)return;const{table:t,colIndex:n}=e;for(let r=0;r<t.rows.length;r++){const o=t.rows[r].cells[n];if(o){const l=o.tagName.toLowerCase()==="th"?"td":"th",a=document.createElement(l);a.innerHTML=o.innerHTML;for(let i=0;i<o.attributes.length;i++){const d=o.attributes[i];a.setAttribute(d.name,d.value)}o.parentNode?.replaceChild(a,o)}}b()},F=()=>{const e=f();if(!e)return;e.table.remove(),document.dispatchEvent(new CustomEvent("tableDeleted"))},U=()=>{const e=window.getSelection();if(!e||e.rangeCount===0)return;const n=e.getRangeAt(0).startContainer;if(!(n.nodeType===Node.TEXT_NODE?n.parentElement?.closest("table"):n.closest("table")))return;let o=null;if(n.nodeType===Node.TEXT_NODE?o=n.parentElement?.closest("td, th"):n.nodeType===Node.ELEMENT_NODE&&(o=n.closest("td, th")),!o)return;const l=o.parentElement;if(!l)return;let a=-1;for(let u=0;u<l.cells.length;u++)if(l.cells[u]===o){a=u;break}if(a===-1||a===l.cells.length-1)return;const i=l.cells[a+1];if(!i)return;const d=parseInt(o.getAttribute("colspan")||"1"),c=parseInt(i.getAttribute("colspan")||"1");o.setAttribute("colspan",String(d+c)),Array.from(i.childNodes).forEach(u=>{o.appendChild(u)}),i.remove(),b()};function f(){const e=window.getSelection();if(!e||e.rangeCount===0)return null;const n=e.getRangeAt(0).startContainer;let r=n.nodeType===Node.TEXT_NODE?n.parentElement?.closest("table"):n.closest("table");if(!r)return null;const o=r;let l=0,a=0;const i=n.nodeType===Node.TEXT_NODE?n.parentElement?.closest("td, th"):n.closest("td, th");if(i){let d=i.parentElement;for(;d&&d!==o.rows[l]&&(l++,!(l>=o.rows.length)););const c=d;if(c){for(let s=0;s<c.cells.length;s++)if(c.cells[s]===i){a=s;break}}}return{table:o,rowIndex:l,colIndex:a,rowCount:o.rows.length,cellCount:o.rows[0]?.cells.length||0}}function b(){if(!h||!m)return;const e=f();if(!e)return;const t=e.rowCount>1,n=e.cellCount>1;q(t,n)}function j(){x=()=>{const e=f();e?G(e.table):E()},I=e=>{const t=e.target,n=t.closest("table"),r=t.closest(".table-toolbar");!n&&!r&&E()},M=()=>{E()},S=()=>{m&&h&&h.style.display!=="none"&&y(m)},V=()=>{m&&h&&h.style.display!=="none"&&y(m)},document.addEventListener("selectionchange",x),document.addEventListener("mousedown",I),document.addEventListener("tableDeleted",M),window.addEventListener("scroll",S,!0),window.addEventListener("resize",V)}function y(e){if(!h)return;const t=e.getBoundingClientRect(),n=h.getBoundingClientRect(),r=n.height||40,o=n.width||280,l=10;let a=t.top-r-l,i=t.left+t.width/2-o/2;a<l&&(a=t.bottom+l),i<l&&(i=l);const d=window.innerWidth;i+o>d-l&&(i=d-o-l);const c=window.innerHeight;a+r>c-l&&(a=c-r-l),h.style.top=a+"px",h.style.left=i+"px"}function G(e){m=e,h||(h=J(),document.body.appendChild(h));const t=!!e.closest(w)||document.body.matches(w)||document.documentElement.matches(w);h.classList.toggle("rte-theme-dark",t),h.style.display="flex",h.style.visibility="hidden",requestAnimationFrame(()=>{y(e),h&&(h.style.visibility="visible")});const n=f();n&&q(n.rowCount>1,n.cellCount>1),Z(e)}function E(){if(h&&(h.style.display="none"),m){m.querySelectorAll(".resize-handle").forEach(n=>n.remove());const t=m.querySelector(".table-resize-handle");t&&t.remove()}m=null}function q(e,t){if(!h)return;const n=h.querySelector('[data-action="deleteRow"]'),r=h.querySelector('[data-action="deleteColumn"]');n&&(n.disabled=!e),r&&(r.disabled=!t)}function J(){const e=document.createElement("div");e.className="table-toolbar",e.style.cssText=`
|
|
2
2
|
position: fixed;
|
|
3
3
|
z-index: 1000;
|
|
4
4
|
display: none;
|
|
5
|
-
`,e.setAttribute("role","toolbar"),e.setAttribute("aria-label","Table editing toolbar");const t=s=>{const u=document.createElement("button");return u.className="toolbar-icon-btn",s.danger&&u.classList.add("toolbar-icon-btn-danger"),s.delete&&u.classList.add("toolbar-icon-btn-delete"),u.innerHTML=s.icon,u.title=s.title,u.setAttribute("aria-label",s.title),u.setAttribute("type","button"),u.setAttribute("data-action",s.action),u.onclick=()=>Q(s.action),u},n=()=>{const s=document.createElement("div");return s.className="toolbar-divider",s},r=(...s)=>{const u=document.createElement("div");return u.className="toolbar-section",s.forEach(v=>u.appendChild(v)),u},o=r(t({icon:te(),title:"Add row above (Ctrl+Shift+R)",action:"addRowAbove"}),t({icon:ne(),title:"Add row below",action:"addRowBelow"}),t({icon:oe(),title:"Delete row",action:"deleteRow",danger:!0})),l=r(t({icon:le(),title:"Add column left",action:"addColumnLeft"}),t({icon:re(),title:"Add column right (Ctrl+Shift+C)",action:"addColumnRight"}),t({icon:ae(),title:"Delete column",action:"deleteColumn",danger:!0})),a=r(t({icon:ie(),title:"Toggle header row",action:"toggleHeaderRow"}),t({icon:se(),title:"Toggle header column",action:"toggleHeaderColumn"})),i=r(t({icon:ce(),title:"Merge cells (horizontally)",action:"mergeCells"})),d=r(t({icon:de(),title:"Delete table",action:"deleteTable",delete:!0}));e.appendChild(o),e.appendChild(n()),e.appendChild(l),e.appendChild(n()),e.appendChild(a),e.appendChild(n()),e.appendChild(i),e.appendChild(n()),e.appendChild(d);const c=s=>{!h||h.style.display==="none"||(s.ctrlKey||s.metaKey)&&s.shiftKey&&(s.key==="r"||s.key==="R"?(s.preventDefault(),H()):(s.key==="c"||s.key==="C")&&(s.preventDefault(),z()))};return window.addEventListener("keydown",c),e}function Q(e){switch(e){case"addRowAbove":
|
|
5
|
+
`,e.setAttribute("role","toolbar"),e.setAttribute("aria-label","Table editing toolbar");const t=s=>{const u=document.createElement("button");return u.className="toolbar-icon-btn",s.danger&&u.classList.add("toolbar-icon-btn-danger"),s.delete&&u.classList.add("toolbar-icon-btn-delete"),u.innerHTML=s.icon,u.title=s.title,u.setAttribute("aria-label",s.title),u.setAttribute("type","button"),u.setAttribute("data-action",s.action),u.onclick=()=>Q(s.action),u},n=()=>{const s=document.createElement("div");return s.className="toolbar-divider",s},r=(...s)=>{const u=document.createElement("div");return u.className="toolbar-section",s.forEach(v=>u.appendChild(v)),u},o=r(t({icon:te(),title:"Add row above (Ctrl+Shift+R)",action:"addRowAbove"}),t({icon:ne(),title:"Add row below",action:"addRowBelow"}),t({icon:oe(),title:"Delete row",action:"deleteRow",danger:!0})),l=r(t({icon:le(),title:"Add column left",action:"addColumnLeft"}),t({icon:re(),title:"Add column right (Ctrl+Shift+C)",action:"addColumnRight"}),t({icon:ae(),title:"Delete column",action:"deleteColumn",danger:!0})),a=r(t({icon:ie(),title:"Toggle header row",action:"toggleHeaderRow"}),t({icon:se(),title:"Toggle header column",action:"toggleHeaderColumn"})),i=r(t({icon:ce(),title:"Merge cells (horizontally)",action:"mergeCells"})),d=r(t({icon:de(),title:"Delete table",action:"deleteTable",delete:!0}));e.appendChild(o),e.appendChild(n()),e.appendChild(l),e.appendChild(n()),e.appendChild(a),e.appendChild(n()),e.appendChild(i),e.appendChild(n()),e.appendChild(d);const c=s=>{!h||h.style.display==="none"||(s.ctrlKey||s.metaKey)&&s.shiftKey&&(s.key==="r"||s.key==="R"?(s.preventDefault(),H()):(s.key==="c"||s.key==="C")&&(s.preventDefault(),z()))};return window.addEventListener("keydown",c),e}function Q(e){switch(e){case"addRowAbove":X();break;case"addRowBelow":H();break;case"addColumnLeft":P();break;case"addColumnRight":z();break;case"deleteRow":O();break;case"deleteColumn":W();break;case"toggleHeaderRow":K();break;case"toggleHeaderColumn":Y();break;case"deleteTable":F();break;case"mergeCells":U();break}}function Z(e){e.querySelectorAll(".resize-handle").forEach(a=>a.remove());const n=e.querySelector(".table-resize-handle");n&&n.remove();const r=e.querySelector("thead tr, tbody tr:first-child");if(!r)return;const o=r.querySelectorAll("td, th");o.forEach((a,i)=>{if(i===o.length-1)return;const d=document.createElement("div");d.className="resize-handle",d.style.cssText=`
|
|
6
6
|
position: absolute;
|
|
7
7
|
right: -4px;
|
|
8
8
|
top: 0;
|
|
@@ -32,4 +32,4 @@
|
|
|
32
32
|
<path d="M3 1h10v1H3V1zm1 2v11h8V3H4zM6 5h1v6H6V5zm3 0h1v6H9V5z"/>
|
|
33
33
|
</svg>`}function ce(){return`<svg width="16" height="16" viewBox="0 0 16 16" fill="currentColor">
|
|
34
34
|
<path d="M2 2h4v3H2V2zm5 0h4v3H7V2zm5 0h2v3h-2V2zm-10 4h4v3H2V6zm5 0h4v3H7V6zm5 0h2v3h-2V6zm-10 4h4v3H2v-3zm5 0h4v3H7v-3zm5 0h2v3h-2v-3z"/>
|
|
35
|
-
</svg>`}if(typeof window<"u"&&!window.__tablePluginInitialized){window.__tablePluginInitialized=!0;const e=()=>{j()};document.readyState==="loading"?document.addEventListener("DOMContentLoaded",e):setTimeout(e,100)}const ue=()=>({name:"table",toolbar:[{label:"Insert Table",command:"insertTable",icon:'<svg width="24" height="24" viewBox="0 0 24 24" fill="none" focusable="false" aria-hidden="true"><rect x="3" y="4" width="18" height="16" rx="2" fill="none" stroke="currentColor" stroke-width="1.8"/><path d="M3 10h18M3 15h18M9 4v16M15 4v16" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round"/></svg>'}],commands:{insertTable:()=>(
|
|
35
|
+
</svg>`}if(typeof window<"u"&&!window.__tablePluginInitialized){window.__tablePluginInitialized=!0;const e=()=>{j()};document.readyState==="loading"?document.addEventListener("DOMContentLoaded",e):setTimeout(e,100)}const ue=()=>({name:"table",toolbar:[{label:"Insert Table",command:"insertTable",icon:'<svg width="24" height="24" viewBox="0 0 24 24" fill="none" focusable="false" aria-hidden="true"><rect x="3" y="4" width="18" height="16" rx="2" fill="none" stroke="currentColor" stroke-width="1.8"/><path d="M3 10h18M3 15h18M9 4v16M15 4v16" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round"/></svg>'}],commands:{insertTable:()=>(_(),!0)},keymap:{"Mod-Shift-r":()=>(H(),!0),"Mod-Shift-c":()=>(z(),!0)}});exports.TablePlugin=ue;
|
package/dist/template.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=require("./purify.es-T2a3nLiC.js");let o=null,d=null,s=null,n=null,p="",m="",g="insert";const M=[{id:"formal-letter",name:"Formal Letter",category:"Letters",description:"Professional business letter template",html:`<p><strong>{{ Company Name }}</strong></p>
|
|
2
2
|
<p>{{ Today }}</p>
|
|
3
3
|
<p>Dear {{ first_name }} {{ last_name }},</p>
|
|
4
4
|
<p>I hope this letter finds you well. [Your letter content here]</p>
|
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
<h3>Q: How do I get started?</h3>
|
|
41
41
|
<p>A: [Answer here]</p>
|
|
42
42
|
<h3>Q: What are the requirements?</h3>
|
|
43
|
-
<p>A: [Answer here]</p>`}];let w=[...M];const y=()=>w,k=()=>{const t=new Set(w.map(e=>e.category));return Array.from(t)},R=t=>{const e=t.toLowerCase();return w.filter(r=>r.name.toLowerCase().includes(e)||r.description?.toLowerCase().includes(e)||r.tags?.some(l=>l.toLowerCase().includes(e)))},L=t=>S.default.sanitize(t,{ALLOWED_TAGS:["p","br","strong","em","u","h1","h2","h3","h4","ul","ol","li","blockquote","table","thead","tbody","tr","th","td","a","span"],ALLOWED_ATTR:["href","target","class","data-key","data-category"]});function D(t){d=document.createElement("div"),d.className="rte-dialog-overlay",N(t)&&d.classList.add("rte-ui-theme-dark"),d.addEventListener("click",()=>c()),o=document.createElement("div"),o.className="rte-dialog rte-template-dialog",o.addEventListener("click",r=>r.stopPropagation());const e=k();e.length>0&&!p&&(p=e[0]),b(),d.appendChild(o),document.body.appendChild(d)
|
|
43
|
+
<p>A: [Answer here]</p>`}];let w=[...M];const y=()=>w,k=()=>{const t=new Set(w.map(e=>e.category));return Array.from(t)},R=t=>{const e=t.toLowerCase();return w.filter(r=>r.name.toLowerCase().includes(e)||r.description?.toLowerCase().includes(e)||r.tags?.some(l=>l.toLowerCase().includes(e)))},L=t=>S.default.sanitize(t,{ALLOWED_TAGS:["p","br","strong","em","u","h1","h2","h3","h4","ul","ol","li","blockquote","table","thead","tbody","tr","th","td","a","span"],ALLOWED_ATTR:["href","target","class","data-key","data-category"]});function D(t){d=document.createElement("div"),d.className="rte-dialog-overlay",N(t)&&d.classList.add("rte-ui-theme-dark"),d.addEventListener("click",()=>c()),o=document.createElement("div"),o.className="rte-dialog rte-template-dialog",o.addEventListener("click",r=>r.stopPropagation());const e=k();e.length>0&&!p&&(p=e[0]),b(),d.appendChild(o),document.body.appendChild(d),$()}const H='[data-theme="dark"], .dark, .editora-theme-dark',A=()=>{const t=window.getSelection();if(!t||t.rangeCount===0)return null;const e=t.anchorNode;return(e instanceof HTMLElement?e:e?.parentElement)?.closest(".rte-content, .editora-content")||null},N=t=>{const e=t||A();return e?!!e.closest(H):!1};function b(){if(!o)return;const t=k(),e=T();o.innerHTML=`
|
|
44
44
|
<div class="rte-dialog-header">
|
|
45
45
|
<h2>Insert Template</h2>
|
|
46
46
|
<button class="rte-dialog-close" aria-label="Close">✕</button>
|
|
@@ -105,7 +105,7 @@
|
|
|
105
105
|
${g==="insert"?"Insert":"Replace"}
|
|
106
106
|
</button>
|
|
107
107
|
</div>
|
|
108
|
-
`,
|
|
108
|
+
`,_()}function I(){if(!o)return;o.innerHTML=`
|
|
109
109
|
<div class="rte-dialog-header">
|
|
110
110
|
<h2>Replace Document?</h2>
|
|
111
111
|
</div>
|
|
@@ -116,7 +116,7 @@
|
|
|
116
116
|
<button class="rte-button-secondary rte-cancel-warning-btn">Cancel</button>
|
|
117
117
|
<button class="rte-button-primary rte-confirm-replace-btn">Replace</button>
|
|
118
118
|
</div>
|
|
119
|
-
`;const t=o.querySelector(".rte-cancel-warning-btn"),e=o.querySelector(".rte-confirm-replace-btn");t?.addEventListener("click",()=>b()),e?.addEventListener("click",()=>
|
|
119
|
+
`;const t=o.querySelector(".rte-cancel-warning-btn"),e=o.querySelector(".rte-confirm-replace-btn");t?.addEventListener("click",()=>b()),e?.addEventListener("click",()=>j())}function T(){const t=y();return m.trim()?R(m):p?t.filter(e=>e.category===p):t}function _(){if(!o)return;o.querySelector(".rte-dialog-close")?.addEventListener("click",()=>c()),o.querySelector(".rte-cancel-btn")?.addEventListener("click",()=>c()),o.querySelector(".rte-insert-btn")?.addEventListener("click",()=>x());const l=o.querySelector(".rte-template-search");l?.addEventListener("input",a=>{m=a.target.value,E()}),l?.addEventListener("keydown",a=>{a.key==="Enter"&&n?x():a.key==="Escape"&&c()}),o.querySelectorAll(".rte-tab").forEach(a=>{a.addEventListener("click",()=>{const i=a.getAttribute("data-category");i&&(p=i,m="",E())})}),o.querySelectorAll(".rte-template-item").forEach(a=>{a.addEventListener("click",()=>{const i=a.getAttribute("data-template-id");if(i){const u=y().find(v=>v.id===i);u&&(n=u,b())}}),a.addEventListener("dblclick",()=>{const i=a.getAttribute("data-template-id");if(i){const u=y().find(v=>v.id===i);u&&(n=u,x())}})}),o.querySelectorAll('input[name="insertMode"]').forEach(a=>{a.addEventListener("change",i=>{g=i.target.value,b()})})}function E(){const t=T();t.length>0?(!n||!t.find(e=>e.id===n.id))&&(n=t[0]):n=null,b()}function x(){if(n)if(g==="replace"){let t=null;if(s){let e=s.startContainer;for(;e&&e!==document.body;){if(e.nodeType===Node.ELEMENT_NODE){const r=e;if(r.getAttribute("contenteditable")==="true"){t=r;break}}e=e.parentNode}}if(t||(t=document.querySelector('[contenteditable="true"]')),t?.innerHTML?.trim()){I();return}C(n),c()}else q(n),c()}function j(){n&&(C(n),c())}function q(t){if(s){const f=window.getSelection();f&&(f.removeAllRanges(),f.addRange(s))}const e=window.getSelection();if(!e||e.rangeCount===0)return;const r=e.getRangeAt(0),l=document.createRange().createContextualFragment(L(t.html));r.deleteContents(),r.insertNode(l);const h=document.createRange();h.setStartAfter(r.endContainer),h.collapse(!0),e.removeAllRanges(),e.addRange(h)}function C(t){let e=null;if(s){let r=s.startContainer;for(;r&&r!==document.body;){if(r.nodeType===Node.ELEMENT_NODE){const l=r;if(l.getAttribute("contenteditable")==="true"){e=l;break}}r=r.parentNode}}e||(e=document.querySelector('[contenteditable="true"]')),e&&(e.innerHTML=L(t.html),e.dispatchEvent(new Event("input",{bubbles:!0})))}function c(){d&&(d.remove(),d=null),o=null,s=null,m=""}function V(t){const e=window.getSelection();e&&e.rangeCount>0?s=e.getRangeAt(0).cloneRange():s=null;const r=T();r.length>0&&!n&&(n=r[0]);const l=t?.contentElement instanceof HTMLElement?t.contentElement:A();D(l)}function $(){if(typeof document>"u")return;const t="template-plugin-dialog-styles";if(document.getElementById(t))return;const e=document.createElement("style");e.id=t,e.textContent=`
|
|
120
120
|
.rte-dialog-overlay {
|
|
121
121
|
--rte-tmpl-overlay-bg: rgba(15, 23, 36, 0.56);
|
|
122
122
|
--rte-tmpl-dialog-bg: #fff;
|
|
@@ -353,4 +353,4 @@
|
|
|
353
353
|
.rte-button-secondary:hover {
|
|
354
354
|
background-color: var(--rte-tmpl-subtle-hover);
|
|
355
355
|
}
|
|
356
|
-
`,document.head.appendChild(e)}const z=()=>({name:"template",toolbar:[{label:"Template",command:"insertTemplate",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 fill-rule="evenodd" clip-rule="evenodd" d="M3 3V9H21V3H3ZM19 5H5V7H19V5Z" fill="#000000"></path> <path fill-rule="evenodd" clip-rule="evenodd" d="M3 11V21H11V11H3ZM9 13H5V19H9V13Z" fill="#000000"></path> <path d="M21 11H13V13H21V11Z" fill="#000000"></path> <path d="M13 15H21V17H13V15Z" fill="#000000"></path> <path d="M21 19H13V21H21V19Z" fill="#000000"></path> </g></svg>'}],commands:{insertTemplate:(t,e)=>(
|
|
356
|
+
`,document.head.appendChild(e)}const z=()=>({name:"template",toolbar:[{label:"Template",command:"insertTemplate",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 fill-rule="evenodd" clip-rule="evenodd" d="M3 3V9H21V3H3ZM19 5H5V7H19V5Z" fill="#000000"></path> <path fill-rule="evenodd" clip-rule="evenodd" d="M3 11V21H11V11H3ZM9 13H5V19H9V13Z" fill="#000000"></path> <path d="M21 11H13V13H21V11Z" fill="#000000"></path> <path d="M13 15H21V17H13V15Z" fill="#000000"></path> <path d="M21 19H13V21H21V19Z" fill="#000000"></path> </g></svg>'}],commands:{insertTemplate:(t,e)=>(V(e),!0)},keymap:{}});exports.TemplatePlugin=z;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const a=["P","DIV","H1","H2","H3","H4","H5","H6","LI","BLOCKQUOTE","PRE","TD","TH"];function d(n){let t=n;if(t.nodeType===Node.ELEMENT_NODE){const e=t;if(a.includes(e.tagName))return e}for(;t;){if(t.nodeType===Node.ELEMENT_NODE){const e=t;if(a.includes(e.tagName))return e;if(e.hasAttribute("contenteditable"))return null}t=t.parentNode}return null}function g(n){const t=[],e=d(n.startContainer),i=d(n.endContainer);if(!e&&!i)return t;if(n.collapsed)return e&&t.push(e),t;if(e===i)e&&t.push(e);else{let o=e;const s=new Set;for(e&&(t.push(e),s.add(e));o&&o!==i&&!s.has(i);){let r=o.nextElementSibling;for(;r;){if(a.includes(r.tagName)){o=r,s.has(o)||(t.push(o),s.add(o));break}r=r.nextElementSibling}if(!r)break}i&&!t.includes(i)&&t.push(i)}return t}function h(n){const t=n.commonAncestorContainer.nodeType===Node.ELEMENT_NODE?n.commonAncestorContainer:n.commonAncestorContainer.parentElement;return t?t.closest(".rte-content, .editora-content")||t.closest('[contenteditable="true"]'):null}function f(n,t){if(!n||t===n.innerHTML)return;const e=window.execEditorCommand||window.executeEditorCommand;if(typeof e=="function")try{e("recordDomTransaction",n,t,n.innerHTML)}catch{}}const E=n=>{if(!n||!["left","center","right","justify"].includes(n))return!1;const e=window.getSelection();if(!e||e.rangeCount===0)return!1;const i=e.getRangeAt(0).cloneRange(),o=h(i),s=o?.innerHTML||"",r=g(i);if(r.length>0)r.forEach(l=>{l&&(l.style.textAlign=n)}),e.removeAllRanges(),e.addRange(i),f(o,s),o&&o.dispatchEvent(new Event("input",{bubbles:!0}));else try{const l=document.createElement("div");l.style.textAlign=n;const m=i.extractContents();l.appendChild(m),i.insertNode(l);const u=document.createRange();u.selectNodeContents(l),e.removeAllRanges(),e.addRange(u);const c=l.closest(".rte-content, .editora-content")||l.closest('[contenteditable="true"]');f(c||o,s),(c||o)&&(c||o)?.dispatchEvent(new Event("input",{bubbles:!0}))}catch(l){return console.error("Failed to wrap content for alignment:",l),!1}return!0},b=()=>({name:"textAlignment",toolbar:[{label:"Text Alignment",command:"setTextAlignment",type:"inline-menu",options:[{label:"Left",value:"left"},{label:"Center",value:"center"},{label:"Right",value:"right"},{label:"Justify",value:"justify"}],icon:'<svg width="24" height="24" focusable="false"><path d="M5 5h14c.6 0 1 .4 1 1s-.4 1-1 1H5a1 1 0 1 1 0-2Zm0 4h8c.6 0 1 .4 1 1s-.4 1-1 1H5a1 1 0 1 1 0-2Zm0 8h8c.6 0 1 .4 1 1s-.4 1-1 1H5a1 1 0 0 1 0-2Zm0-4h14c.6 0 1 .4 1 1s-.4 1-1 1H5a1 1 0 0 1 0-2Z" fill-rule="evenodd"></path></svg>'}],commands:{setTextAlignment:E},keymap:{}});exports.TextAlignmentPlugin=b;
|
package/dist/text-color.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 h=require("./colorSelectionApply-C0iOfMWb.js");let o=null,p=null,f=null,i="#000000";const s='[data-theme="dark"], .dark, .editora-theme-dark',k=["#000000","#ffffff","#808080","#ff0000","#00ff00","#0000ff","#ffff00","#ff00ff","#00ffff","#ffa500","#800080","#ffc0cb"];function m(){const e=window.getSelection();if(e&&e.rangeCount>0){const l=e.getRangeAt(0).startContainer,c=l.nodeType===Node.ELEMENT_NODE?l:l.parentElement;if(c){const n=c.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 v(e){const t=m();if(t){const r=t.querySelector(`[data-command="${e}"]`);if(r)return r}return document.querySelector(`[data-command="${e}"]`)}function y(e){if(e?.closest(s))return!0;const t=window.getSelection();if(t&&t.rangeCount>0){const l=t.getRangeAt(0).startContainer;if((l.nodeType===Node.ELEMENT_NODE?l:l.parentElement)?.closest(s))return!0}return document.activeElement?.closest(s)?!0:document.body.matches(s)||document.documentElement.matches(s)}function d(e){return h.applyColorToSelection({color:e,className:"rte-text-color",styleProperty:"color",commands:["foreColor"],savedRange:f,getActiveEditorRoot:m,warnMessage:"[TextColor] Could not apply color for current selection"})}function w(){const e=window.getSelection();if(!e||e.rangeCount===0)return"#000000";let r=e.getRangeAt(0).startContainer;for(;r&&r!==document.body;){if(r.nodeType===Node.ELEMENT_NODE){const l=r,c=l.style.color||window.getComputedStyle(l).color;if(c&&c!=="rgb(0, 0, 0)")return C(c)}r=r.parentNode}return"#000000"}function C(e){if(e.startsWith("#"))return e;const t=e.match(/^rgb\((\d+),\s*(\d+),\s*(\d+)\)$/);if(!t)return"#000000";const r=parseInt(t[1]),l=parseInt(t[2]),c=parseInt(t[3]);return"#"+[r,l,c].map(n=>{const u=n.toString(16);return u.length===1?"0"+u:u}).join("")}function E(e){const t=window.getSelection();t&&t.rangeCount>0&&(f=t.getRangeAt(0).cloneRange()),i=w(),o=document.createElement("div"),o.className="rte-inline-color-picker",y(e)&&o.classList.add("rte-theme-dark"),o.addEventListener("click",l=>l.stopPropagation()),o.innerHTML=`
|
|
2
2
|
<div class="rte-color-picker-header">
|
|
3
3
|
<span class="rte-color-picker-title">Text Color</span>
|
|
4
4
|
<button class="rte-color-picker-close" aria-label="Close">×</button>
|
package/dist/underline.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:"underline",marks:{underline:{parseDOM:[{tag:"u"}],toDOM:()=>["u",{},0]}},toolbar:[{label:"Underline",command:"toggleUnderline",icon:'<svg width="24" height="24" focusable="false"><path d="M16 5c.6 0 1 .4 1 1v7c0 2.8-2.2 5-5 5s-5-2.2-5-5V6c0-.6.4-1 1-1s1 .4 1 1v7c0 1.7 1.3 3 3 3s3-1.3 3-3V6c0-.6.4-1 1-1ZM4 17h16c.6 0 1 .4 1 1s-.4 1-1 1H4a1 1 0 1 1 0-2Z" fill-rule="evenodd"></path></svg>',shortcut:"Mod-u"}],commands:{toggleUnderline:()=>(document.execCommand("underline",!1),!0)},keymap:{"Mod-u":"toggleUnderline","Mod-U":"toggleUnderline"}});exports.UnderlinePlugin=e;
|