@editora/plugins 1.0.8 → 1.0.10
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/README.md +27 -0
- package/dist/_commonjsHelpers-6763f629.js +1 -0
- package/dist/_commonjsHelpers-c5d32002.mjs +30 -0
- package/dist/a11y-checker.cjs.js +12 -12
- package/dist/a11y-checker.esm.js +98 -80
- package/dist/anchor.cjs.js +12 -12
- package/dist/anchor.esm.js +128 -115
- package/dist/anchoredPopover-33f1358d.mjs +109 -0
- package/dist/anchoredPopover-8151d535.js +1 -0
- package/dist/approval-workflow.cjs.js +447 -0
- package/dist/approval-workflow.esm.js +1111 -0
- package/dist/background-color.cjs.js +2 -2
- package/dist/background-color.esm.js +68 -55
- package/dist/blockquote.esm.js +2 -1
- package/dist/blocks-library.cjs.js +442 -0
- package/dist/blocks-library.esm.js +1384 -0
- package/dist/capitalization.esm.js +2 -1
- package/dist/checklist.cjs.js +1 -1
- package/dist/checklist.esm.js +82 -58
- package/dist/citations.cjs.js +548 -0
- package/dist/citations.esm.js +1530 -0
- package/dist/clear-formatting.cjs.js +1 -1
- package/dist/clear-formatting.esm.js +33 -27
- package/dist/code-sample.cjs.js +14 -14
- package/dist/code-sample.esm.js +93 -82
- package/dist/code.cjs.js +32 -32
- package/dist/code.esm.js +653 -594
- package/dist/comments.cjs.js +6 -6
- package/dist/comments.esm.js +158 -116
- package/dist/conditional-content.cjs.js +626 -0
- package/dist/conditional-content.esm.js +1421 -0
- package/dist/content-rules.cjs.js +408 -0
- package/dist/content-rules.esm.js +1147 -0
- package/dist/data-binding.cjs.js +321 -0
- package/dist/data-binding.esm.js +953 -0
- package/dist/direction.esm.js +18 -9
- package/dist/doc-schema.cjs.js +398 -0
- package/dist/doc-schema.esm.js +1378 -0
- package/dist/document-manager.cjs.js +1 -1
- package/dist/document-manager.esm.js +5 -4
- package/dist/documentManager-25b6203c.mjs +9122 -0
- package/dist/documentManager-b69e7054.js +17 -0
- package/dist/{editorContainerHelpers-C7kdWnS0.mjs → editorContainerHelpers-69585c07.mjs} +2 -1
- package/dist/embed-iframe.cjs.js +4 -4
- package/dist/embed-iframe.esm.js +81 -73
- package/dist/emojis.cjs.js +8 -8
- package/dist/emojis.esm.js +77 -65
- package/dist/enterprise.cjs.js +1 -0
- package/dist/enterprise.esm.js +58 -0
- package/dist/font-family.cjs.js +1 -1
- package/dist/font-family.esm.js +47 -39
- package/dist/font-size.cjs.js +1 -1
- package/dist/font-size.esm.js +53 -37
- package/dist/footnote.cjs.js +2 -2
- package/dist/footnote.esm.js +117 -76
- package/dist/history.cjs.js +1 -1
- package/dist/history.esm.js +92 -70
- package/dist/html2canvas.esm-09133e29.js +22 -0
- package/dist/{html2canvas.esm-BWVIUcAF.mjs → html2canvas.esm-1a1724a1.mjs} +225 -141
- package/dist/indent.cjs.js +1 -1
- package/dist/indent.esm.js +24 -12
- package/dist/index-656d224b.js +231 -0
- package/dist/index-6a8c48bb.js +1 -0
- package/dist/index-d027b7e2.mjs +16859 -0
- package/dist/{index-BFsKNTTj.mjs → index-f04538f2.mjs} +71 -70
- package/dist/index.cjs.js +1 -1
- package/dist/index.es-730f2d98.mjs +5775 -0
- package/dist/index.es-dd40173b.js +18 -0
- package/dist/index.esm.js +124 -93
- package/dist/italic.cjs.js +1 -1
- package/dist/italic.esm.js +9 -8
- package/dist/jspdf.es.min-90db2c97.js +243 -0
- package/dist/{jspdf.es.min-DQCoX5yh.mjs → jspdf.es.min-c36a4fd8.mjs} +4682 -3658
- package/dist/line-height.cjs.js +1 -1
- package/dist/line-height.esm.js +24 -11
- package/dist/link.cjs.js +5 -5
- package/dist/link.esm.js +30 -24
- package/dist/list.cjs.js +1 -1
- package/dist/list.esm.js +25 -20
- package/dist/lite.cjs.js +1 -1
- package/dist/lite.esm.js +61 -59
- package/dist/math.cjs.js +21 -21
- package/dist/math.esm.js +146 -139
- package/dist/media-manager.cjs.js +38 -38
- package/dist/media-manager.esm.js +325 -308
- package/dist/mentions.cjs.js +105 -0
- package/dist/mentions.esm.js +774 -0
- package/dist/merge-tag.cjs.js +2 -2
- package/dist/merge-tag.esm.js +216 -177
- package/dist/page-break.cjs.js +2 -2
- package/dist/page-break.esm.js +67 -51
- package/dist/pii-redaction.cjs.js +436 -0
- package/dist/pii-redaction.esm.js +1447 -0
- package/dist/preview.cjs.js +3 -3
- package/dist/preview.esm.js +37 -32
- package/dist/print.cjs.js +4 -4
- package/dist/print.esm.js +20 -17
- package/dist/{purify.es-DHhaBdbu.mjs → purify.es-35a15df8.mjs} +19 -9
- package/dist/{purify.es-T2a3nLiC.js → purify.es-a8d731c6.js} +1 -1
- package/dist/slash-commands.cjs.js +90 -0
- package/dist/slash-commands.esm.js +788 -0
- package/dist/smart-paste.cjs.js +398 -0
- package/dist/smart-paste.esm.js +1444 -0
- package/dist/special-characters.cjs.js +7 -7
- package/dist/special-characters.esm.js +69 -61
- package/dist/spell-check.cjs.js +5 -5
- package/dist/spell-check.esm.js +123 -97
- package/dist/strikethrough.cjs.js +1 -1
- package/dist/strikethrough.esm.js +19 -14
- package/dist/style.css +1 -0
- package/dist/table.cjs.js +4 -4
- package/dist/table.esm.js +225 -191
- package/dist/template.cjs.js +11 -11
- package/dist/template.esm.js +153 -124
- package/dist/text-alignment.cjs.js +1 -1
- package/dist/text-alignment.esm.js +27 -21
- package/dist/text-color.cjs.js +3 -3
- package/dist/text-color.esm.js +87 -70
- package/dist/track-changes.cjs.js +77 -0
- package/dist/track-changes.esm.js +817 -0
- package/dist/translation-workflow.cjs.js +626 -0
- package/dist/translation-workflow.esm.js +1794 -0
- package/dist/version-diff.cjs.js +362 -0
- package/dist/version-diff.esm.js +797 -0
- package/index.d.ts +798 -0
- package/package.json +114 -9
- package/dist/_commonjsHelpers-BH3jXuIh.js +0 -1
- package/dist/_commonjsHelpers-ByX85dGu.mjs +0 -33
- package/dist/anchoredPopover-BzqGPOAE.js +0 -1
- package/dist/anchoredPopover-Dts0IrgU.mjs +0 -106
- package/dist/documentManager-CTqRftU8.mjs +0 -8369
- package/dist/documentManager-Jf0RbSks.js +0 -17
- package/dist/html2canvas.esm-B5qzocYs.js +0 -5
- package/dist/index-CvJk4DKa.js +0 -221
- package/dist/index-D3CycEFU.mjs +0 -16543
- package/dist/index-tqLTHcO6.js +0 -1
- package/dist/index.es-CE_A4QSm.js +0 -5
- package/dist/index.es-DQ78mYYo.mjs +0 -6665
- package/dist/jspdf.es.min-BoS80556.js +0 -77
- package/dist/plugins.css +0 -1
- /package/dist/{editorContainerHelpers-CFbfiOJI.js → editorContainerHelpers-36b8ddf3.js} +0 -0
package/dist/template.cjs.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const V=require("./purify.es-a8d731c6.js");let n=null,c=null,f=null,o=null,h="",v="",w="insert",E=null,d=null,b=null;function P(t,e){if(e===t.innerHTML)return;const r=window.execEditorCommand||window.executeEditorCommand;if(typeof r=="function")try{r("recordDomTransaction",t,e,t.innerHTML)}catch{}}function z(t){if(!t)return null;let e=t.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}return null}const _=[{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
|
|
43
|
+
<p>A: [Answer here]</p>`}];let x=[..._];const C=()=>x,F=t=>x.filter(e=>e.category===t),A=()=>{const t=new Set(x.map(e=>e.category));return Array.from(t)},$=t=>{const e=t.toLowerCase();return x.filter(r=>{var a,p;return r.name.toLowerCase().includes(e)||((a=r.description)==null?void 0:a.toLowerCase().includes(e))||((p=r.tags)==null?void 0:p.some(s=>s.toLowerCase().includes(e)))})},S=t=>V.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"]}),I=t=>x.some(e=>e.id===t.id)?(console.warn(`Template with ID ${t.id} already exists`),!1):(x.push(t),!0),O=t=>!!(t.id&&t.name&&t.category&&t.html&&t.html.trim().length>0);function Q(t){c=document.createElement("div"),c.className="rte-dialog-overlay",G(t)&&c.classList.add("rte-ui-theme-dark"),c.addEventListener("click",()=>u()),n=document.createElement("div"),n.className="rte-dialog rte-template-dialog",n.addEventListener("click",r=>r.stopPropagation());const e=A();e.length>0&&!h&&(h=e[0]),k(),c.appendChild(n),document.body.appendChild(c),W(),X()}function W(){j(),E=t=>{t.key==="Escape"&&(!c||!n||(t.preventDefault(),t.stopPropagation(),u()))},document.addEventListener("keydown",E,!0)}function j(){E&&(document.removeEventListener("keydown",E,!0),E=null)}const Z='[data-theme="dark"], .dark, .editora-theme-dark',M=()=>{const t=window.getSelection();if(!t||t.rangeCount===0)return null;const e=t.anchorNode,r=e instanceof HTMLElement?e:e==null?void 0:e.parentElement;return(r==null?void 0:r.closest(".rte-content, .editora-content"))||null},G=t=>{const e=t||M();return e?!!e.closest(Z):!1};function D(){const t=z(f);if(t)return t;if(b!=null&&b.isConnected)return b;const e=M();return e||document.querySelector(".rte-content, .editora-content")}function k(){if(!n)return;const t=A(),e=H();n.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>
|
|
@@ -51,7 +51,7 @@
|
|
|
51
51
|
<input
|
|
52
52
|
type="text"
|
|
53
53
|
placeholder="Search templates..."
|
|
54
|
-
value="${
|
|
54
|
+
value="${v}"
|
|
55
55
|
class="rte-input rte-template-search"
|
|
56
56
|
aria-label="Search templates"
|
|
57
57
|
/>
|
|
@@ -59,7 +59,7 @@
|
|
|
59
59
|
<!-- Category Tabs -->
|
|
60
60
|
<div class="rte-tabs">
|
|
61
61
|
${t.map(r=>`
|
|
62
|
-
<button class="rte-tab ${
|
|
62
|
+
<button class="rte-tab ${h===r?"active":""}" data-category="${r}">
|
|
63
63
|
${r}
|
|
64
64
|
</button>
|
|
65
65
|
`).join("")}
|
|
@@ -69,7 +69,7 @@
|
|
|
69
69
|
<div class="rte-template-list">
|
|
70
70
|
${e.length>0?e.map(r=>`
|
|
71
71
|
<div
|
|
72
|
-
class="rte-template-item ${o
|
|
72
|
+
class="rte-template-item ${(o==null?void 0:o.id)===r.id?"selected":""}"
|
|
73
73
|
data-template-id="${r.id}"
|
|
74
74
|
>
|
|
75
75
|
<div class="template-name">${r.name}</div>
|
|
@@ -89,11 +89,11 @@
|
|
|
89
89
|
<!-- Insert Mode Toggle -->
|
|
90
90
|
<div class="rte-insert-mode">
|
|
91
91
|
<label>
|
|
92
|
-
<input type="radio" name="insertMode" value="insert" ${
|
|
92
|
+
<input type="radio" name="insertMode" value="insert" ${w==="insert"?"checked":""} />
|
|
93
93
|
Insert at cursor
|
|
94
94
|
</label>
|
|
95
95
|
<label>
|
|
96
|
-
<input type="radio" name="insertMode" value="replace" ${
|
|
96
|
+
<input type="radio" name="insertMode" value="replace" ${w==="replace"?"checked":""} />
|
|
97
97
|
Replace document
|
|
98
98
|
</label>
|
|
99
99
|
</div>
|
|
@@ -102,10 +102,10 @@
|
|
|
102
102
|
<div class="rte-dialog-footer">
|
|
103
103
|
<button class="rte-button-secondary rte-cancel-btn">Cancel</button>
|
|
104
104
|
<button class="rte-button-primary rte-insert-btn" ${o?"":"disabled"}>
|
|
105
|
-
${
|
|
105
|
+
${w==="insert"?"Insert":"Replace"}
|
|
106
106
|
</button>
|
|
107
107
|
</div>
|
|
108
|
-
`,
|
|
108
|
+
`,B()}function K(){if(!n)return;n.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=n.querySelector(".rte-cancel-warning-btn"),e=n.querySelector(".rte-confirm-replace-btn");t
|
|
119
|
+
`;const t=n.querySelector(".rte-cancel-warning-btn"),e=n.querySelector(".rte-confirm-replace-btn");t==null||t.addEventListener("click",()=>k()),e==null||e.addEventListener("click",()=>Y())}function H(){const t=C();return v.trim()?$(v):h?t.filter(e=>e.category===h):t}function B(){if(!n)return;const t=n.querySelector(".rte-dialog-close");t==null||t.addEventListener("click",()=>u());const e=n.querySelector(".rte-cancel-btn");e==null||e.addEventListener("click",()=>u());const r=n.querySelector(".rte-insert-btn");r==null||r.addEventListener("click",()=>L());const a=n.querySelector(".rte-template-search");a==null||a.addEventListener("input",l=>{d!==null&&cancelAnimationFrame(d),v=l.target.value,d=requestAnimationFrame(()=>{d=null,R()})}),a==null||a.addEventListener("keydown",l=>{l.key==="Enter"&&o?L():l.key==="Escape"&&u()});const p=n.querySelector(".rte-tabs");p==null||p.addEventListener("click",l=>{const y=l.target.closest(".rte-tab");if(!y)return;const T=y.getAttribute("data-category");T&&(h=T,v="",d!==null&&(cancelAnimationFrame(d),d=null),R())});const s=n.querySelector(".rte-template-list"),g=l=>{const y=l.target.closest(".rte-template-item");if(!y)return null;const T=y.getAttribute("data-template-id");return T&&C().find(N=>N.id===T)||null};s==null||s.addEventListener("click",l=>{const i=g(l);i&&(o=i,k())}),s==null||s.addEventListener("dblclick",l=>{const i=g(l);i&&(o=i,L())});const m=n.querySelector(".rte-insert-mode");m==null||m.addEventListener("change",l=>{const i=l.target;!i||i.name!=="insertMode"||(w=i.value,k())})}function R(){const t=H();t.length>0?(!o||!t.find(e=>e.id===o.id))&&(o=t[0]):o=null,k()}function L(){var t;if(o)if(w==="replace"){const e=D();if((t=e==null?void 0:e.innerHTML)!=null&&t.trim()){K();return}q(o),u()}else J(o),u()}function Y(){o&&(q(o),u())}function J(t){const e=window.getSelection();if(!e)return;const r=D();if(!r)return;if(f)e.removeAllRanges(),e.addRange(f);else{const m=document.createRange();m.selectNodeContents(r),m.collapse(!1),e.removeAllRanges(),e.addRange(m)}if(e.rangeCount===0)return;const a=e.getRangeAt(0),p=(r==null?void 0:r.innerHTML)??"",s=document.createRange().createContextualFragment(S(t.html));a.deleteContents(),a.insertNode(s);const g=document.createRange();g.setStartAfter(a.endContainer),g.collapse(!0),e.removeAllRanges(),e.addRange(g),r&&(P(r,p),r.dispatchEvent(new Event("input",{bubbles:!0})))}function q(t){const e=D();if(e){const r=e.innerHTML;e.innerHTML=S(t.html),P(e,r),e.dispatchEvent(new Event("input",{bubbles:!0}))}}function u(){j(),d!==null&&(cancelAnimationFrame(d),d=null),c&&(c.remove(),c=null),n=null,f=null,v="",b=null}function U(t){const e=window.getSelection();e&&e.rangeCount>0?f=e.getRangeAt(0).cloneRange():f=null;const r=H();r.length>0&&!o&&(o=r[0]);const a=(t==null?void 0:t.contentElement)instanceof HTMLElement?t.contentElement:M();b=a||null,Q(a)}function X(){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 ee=()=>({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)=>(U(e),!0)},keymap:{}});exports.PREDEFINED_TEMPLATES=
|
|
356
|
+
`,document.head.appendChild(e)}const ee=()=>({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)=>(U(e),!0)},keymap:{}});exports.PREDEFINED_TEMPLATES=_;exports.TemplatePlugin=ee;exports.addCustomTemplate=I;exports.getAllTemplates=C;exports.getTemplateCategories=A;exports.getTemplatesByCategory=F;exports.sanitizeTemplate=S;exports.searchTemplates=$;exports.validateTemplate=O;
|
package/dist/template.esm.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import
|
|
2
|
-
let n = null,
|
|
3
|
-
function
|
|
4
|
-
if (e === t.innerHTML)
|
|
1
|
+
import N from "./purify.es-35a15df8.mjs";
|
|
2
|
+
let n = null, c = null, f = null, o = null, h = "", v = "", T = "insert", k = null, d = null, b = null;
|
|
3
|
+
function H(t, e) {
|
|
4
|
+
if (e === t.innerHTML)
|
|
5
|
+
return;
|
|
5
6
|
const r = window.execEditorCommand || window.executeEditorCommand;
|
|
6
7
|
if (typeof r == "function")
|
|
7
8
|
try {
|
|
@@ -9,8 +10,9 @@ function M(t, e) {
|
|
|
9
10
|
} catch {
|
|
10
11
|
}
|
|
11
12
|
}
|
|
12
|
-
function
|
|
13
|
-
if (!t)
|
|
13
|
+
function z(t) {
|
|
14
|
+
if (!t)
|
|
15
|
+
return null;
|
|
14
16
|
let e = t.startContainer;
|
|
15
17
|
for (; e && e !== document.body; ) {
|
|
16
18
|
if (e.nodeType === Node.ELEMENT_NODE) {
|
|
@@ -22,7 +24,7 @@ function q(t) {
|
|
|
22
24
|
}
|
|
23
25
|
return null;
|
|
24
26
|
}
|
|
25
|
-
const
|
|
27
|
+
const F = [
|
|
26
28
|
{
|
|
27
29
|
id: "formal-letter",
|
|
28
30
|
name: "Formal Letter",
|
|
@@ -94,53 +96,60 @@ const z = [
|
|
|
94
96
|
<p>A: [Answer here]</p>`
|
|
95
97
|
}
|
|
96
98
|
];
|
|
97
|
-
let
|
|
98
|
-
const
|
|
99
|
-
const t = new Set(
|
|
99
|
+
let x = [...F];
|
|
100
|
+
const D = () => x, U = (t) => x.filter((e) => e.category === t), R = () => {
|
|
101
|
+
const t = new Set(x.map((e) => e.category));
|
|
100
102
|
return Array.from(t);
|
|
101
|
-
},
|
|
103
|
+
}, P = (t) => {
|
|
102
104
|
const e = t.toLowerCase();
|
|
103
|
-
return
|
|
104
|
-
(r) =>
|
|
105
|
+
return x.filter(
|
|
106
|
+
(r) => {
|
|
107
|
+
var a, p;
|
|
108
|
+
return r.name.toLowerCase().includes(e) || ((a = r.description) == null ? void 0 : a.toLowerCase().includes(e)) || ((p = r.tags) == null ? void 0 : p.some((s) => s.toLowerCase().includes(e)));
|
|
109
|
+
}
|
|
105
110
|
);
|
|
106
|
-
},
|
|
111
|
+
}, $ = (t) => N.sanitize(t, {
|
|
107
112
|
ALLOWED_TAGS: ["p", "br", "strong", "em", "u", "h1", "h2", "h3", "h4", "ul", "ol", "li", "blockquote", "table", "thead", "tbody", "tr", "th", "td", "a", "span"],
|
|
108
113
|
ALLOWED_ATTR: ["href", "target", "class", "data-key", "data-category"]
|
|
109
|
-
}), X = (t) =>
|
|
110
|
-
function
|
|
111
|
-
|
|
112
|
-
const e =
|
|
113
|
-
e.length > 0 && !
|
|
114
|
+
}), X = (t) => x.some((e) => e.id === t.id) ? (console.warn(`Template with ID ${t.id} already exists`), !1) : (x.push(t), !0), ee = (t) => !!(t.id && t.name && t.category && t.html && t.html.trim().length > 0);
|
|
115
|
+
function _(t) {
|
|
116
|
+
c = document.createElement("div"), c.className = "rte-dialog-overlay", O(t) && c.classList.add("rte-ui-theme-dark"), c.addEventListener("click", () => u()), n = document.createElement("div"), n.className = "rte-dialog rte-template-dialog", n.addEventListener("click", (r) => r.stopPropagation());
|
|
117
|
+
const e = R();
|
|
118
|
+
e.length > 0 && !h && (h = e[0]), E(), c.appendChild(n), document.body.appendChild(c), I(), Y();
|
|
114
119
|
}
|
|
115
|
-
function
|
|
116
|
-
|
|
117
|
-
t.key === "Escape" && (!
|
|
118
|
-
}, document.addEventListener("keydown",
|
|
120
|
+
function I() {
|
|
121
|
+
V(), k = (t) => {
|
|
122
|
+
t.key === "Escape" && (!c || !n || (t.preventDefault(), t.stopPropagation(), u()));
|
|
123
|
+
}, document.addEventListener("keydown", k, !0);
|
|
119
124
|
}
|
|
120
|
-
function
|
|
121
|
-
|
|
125
|
+
function V() {
|
|
126
|
+
k && (document.removeEventListener("keydown", k, !0), k = null);
|
|
122
127
|
}
|
|
123
|
-
const
|
|
128
|
+
const Q = '[data-theme="dark"], .dark, .editora-theme-dark', C = () => {
|
|
124
129
|
const t = window.getSelection();
|
|
125
|
-
if (!t || t.rangeCount === 0)
|
|
126
|
-
|
|
127
|
-
|
|
130
|
+
if (!t || t.rangeCount === 0)
|
|
131
|
+
return null;
|
|
132
|
+
const e = t.anchorNode, r = e instanceof HTMLElement ? e : e == null ? void 0 : e.parentElement;
|
|
133
|
+
return (r == null ? void 0 : r.closest(
|
|
128
134
|
".rte-content, .editora-content"
|
|
129
|
-
) || null;
|
|
130
|
-
},
|
|
131
|
-
const e = t ||
|
|
132
|
-
return e ? !!e.closest(
|
|
135
|
+
)) || null;
|
|
136
|
+
}, O = (t) => {
|
|
137
|
+
const e = t || C();
|
|
138
|
+
return e ? !!e.closest(Q) : !1;
|
|
133
139
|
};
|
|
134
|
-
function
|
|
135
|
-
const t =
|
|
136
|
-
if (t)
|
|
137
|
-
|
|
138
|
-
|
|
140
|
+
function A() {
|
|
141
|
+
const t = z(f);
|
|
142
|
+
if (t)
|
|
143
|
+
return t;
|
|
144
|
+
if (b != null && b.isConnected)
|
|
145
|
+
return b;
|
|
146
|
+
const e = C();
|
|
139
147
|
return e || document.querySelector(".rte-content, .editora-content");
|
|
140
148
|
}
|
|
141
|
-
function
|
|
142
|
-
if (!n)
|
|
143
|
-
|
|
149
|
+
function E() {
|
|
150
|
+
if (!n)
|
|
151
|
+
return;
|
|
152
|
+
const t = R(), e = S();
|
|
144
153
|
n.innerHTML = `
|
|
145
154
|
<div class="rte-dialog-header">
|
|
146
155
|
<h2>Insert Template</h2>
|
|
@@ -152,7 +161,7 @@ function y() {
|
|
|
152
161
|
<input
|
|
153
162
|
type="text"
|
|
154
163
|
placeholder="Search templates..."
|
|
155
|
-
value="${
|
|
164
|
+
value="${v}"
|
|
156
165
|
class="rte-input rte-template-search"
|
|
157
166
|
aria-label="Search templates"
|
|
158
167
|
/>
|
|
@@ -160,7 +169,7 @@ function y() {
|
|
|
160
169
|
<!-- Category Tabs -->
|
|
161
170
|
<div class="rte-tabs">
|
|
162
171
|
${t.map((r) => `
|
|
163
|
-
<button class="rte-tab ${
|
|
172
|
+
<button class="rte-tab ${h === r ? "active" : ""}" data-category="${r}">
|
|
164
173
|
${r}
|
|
165
174
|
</button>
|
|
166
175
|
`).join("")}
|
|
@@ -170,7 +179,7 @@ function y() {
|
|
|
170
179
|
<div class="rte-template-list">
|
|
171
180
|
${e.length > 0 ? e.map((r) => `
|
|
172
181
|
<div
|
|
173
|
-
class="rte-template-item ${o
|
|
182
|
+
class="rte-template-item ${(o == null ? void 0 : o.id) === r.id ? "selected" : ""}"
|
|
174
183
|
data-template-id="${r.id}"
|
|
175
184
|
>
|
|
176
185
|
<div class="template-name">${r.name}</div>
|
|
@@ -190,11 +199,11 @@ function y() {
|
|
|
190
199
|
<!-- Insert Mode Toggle -->
|
|
191
200
|
<div class="rte-insert-mode">
|
|
192
201
|
<label>
|
|
193
|
-
<input type="radio" name="insertMode" value="insert" ${
|
|
202
|
+
<input type="radio" name="insertMode" value="insert" ${T === "insert" ? "checked" : ""} />
|
|
194
203
|
Insert at cursor
|
|
195
204
|
</label>
|
|
196
205
|
<label>
|
|
197
|
-
<input type="radio" name="insertMode" value="replace" ${
|
|
206
|
+
<input type="radio" name="insertMode" value="replace" ${T === "replace" ? "checked" : ""} />
|
|
198
207
|
Replace document
|
|
199
208
|
</label>
|
|
200
209
|
</div>
|
|
@@ -203,13 +212,14 @@ function y() {
|
|
|
203
212
|
<div class="rte-dialog-footer">
|
|
204
213
|
<button class="rte-button-secondary rte-cancel-btn">Cancel</button>
|
|
205
214
|
<button class="rte-button-primary rte-insert-btn" ${o ? "" : "disabled"}>
|
|
206
|
-
${
|
|
215
|
+
${T === "insert" ? "Insert" : "Replace"}
|
|
207
216
|
</button>
|
|
208
217
|
</div>
|
|
209
|
-
`,
|
|
218
|
+
`, Z();
|
|
210
219
|
}
|
|
211
|
-
function
|
|
212
|
-
if (!n)
|
|
220
|
+
function W() {
|
|
221
|
+
if (!n)
|
|
222
|
+
return;
|
|
213
223
|
n.innerHTML = `
|
|
214
224
|
<div class="rte-dialog-header">
|
|
215
225
|
<h2>Replace Document?</h2>
|
|
@@ -223,102 +233,121 @@ function O() {
|
|
|
223
233
|
</div>
|
|
224
234
|
`;
|
|
225
235
|
const t = n.querySelector(".rte-cancel-warning-btn"), e = n.querySelector(".rte-confirm-replace-btn");
|
|
226
|
-
t
|
|
236
|
+
t == null || t.addEventListener("click", () => E()), e == null || e.addEventListener("click", () => G());
|
|
227
237
|
}
|
|
228
|
-
function
|
|
229
|
-
const t =
|
|
230
|
-
return
|
|
238
|
+
function S() {
|
|
239
|
+
const t = D();
|
|
240
|
+
return v.trim() ? P(v) : h ? t.filter((e) => e.category === h) : t;
|
|
231
241
|
}
|
|
232
|
-
function
|
|
233
|
-
if (!n)
|
|
234
|
-
|
|
235
|
-
const
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
242
|
+
function Z() {
|
|
243
|
+
if (!n)
|
|
244
|
+
return;
|
|
245
|
+
const t = n.querySelector(".rte-dialog-close");
|
|
246
|
+
t == null || t.addEventListener("click", () => u());
|
|
247
|
+
const e = n.querySelector(".rte-cancel-btn");
|
|
248
|
+
e == null || e.addEventListener("click", () => u());
|
|
249
|
+
const r = n.querySelector(".rte-insert-btn");
|
|
250
|
+
r == null || r.addEventListener("click", () => L());
|
|
251
|
+
const a = n.querySelector(".rte-template-search");
|
|
252
|
+
a == null || a.addEventListener("input", (l) => {
|
|
253
|
+
d !== null && cancelAnimationFrame(d), v = l.target.value, d = requestAnimationFrame(() => {
|
|
254
|
+
d = null, M();
|
|
239
255
|
});
|
|
240
|
-
}),
|
|
241
|
-
|
|
242
|
-
})
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
const
|
|
246
|
-
|
|
256
|
+
}), a == null || a.addEventListener("keydown", (l) => {
|
|
257
|
+
l.key === "Enter" && o ? L() : l.key === "Escape" && u();
|
|
258
|
+
});
|
|
259
|
+
const p = n.querySelector(".rte-tabs");
|
|
260
|
+
p == null || p.addEventListener("click", (l) => {
|
|
261
|
+
const y = l.target.closest(".rte-tab");
|
|
262
|
+
if (!y)
|
|
263
|
+
return;
|
|
264
|
+
const w = y.getAttribute("data-category");
|
|
265
|
+
w && (h = w, v = "", d !== null && (cancelAnimationFrame(d), d = null), M());
|
|
247
266
|
});
|
|
248
|
-
const
|
|
249
|
-
const
|
|
250
|
-
if (!
|
|
251
|
-
|
|
252
|
-
|
|
267
|
+
const s = n.querySelector(".rte-template-list"), g = (l) => {
|
|
268
|
+
const y = l.target.closest(".rte-template-item");
|
|
269
|
+
if (!y)
|
|
270
|
+
return null;
|
|
271
|
+
const w = y.getAttribute("data-template-id");
|
|
272
|
+
return w && D().find((q) => q.id === w) || null;
|
|
253
273
|
};
|
|
254
|
-
|
|
255
|
-
const i =
|
|
256
|
-
i && (o = i,
|
|
257
|
-
}),
|
|
258
|
-
const i =
|
|
259
|
-
i && (o = i,
|
|
260
|
-
})
|
|
261
|
-
|
|
262
|
-
|
|
274
|
+
s == null || s.addEventListener("click", (l) => {
|
|
275
|
+
const i = g(l);
|
|
276
|
+
i && (o = i, E());
|
|
277
|
+
}), s == null || s.addEventListener("dblclick", (l) => {
|
|
278
|
+
const i = g(l);
|
|
279
|
+
i && (o = i, L());
|
|
280
|
+
});
|
|
281
|
+
const m = n.querySelector(".rte-insert-mode");
|
|
282
|
+
m == null || m.addEventListener("change", (l) => {
|
|
283
|
+
const i = l.target;
|
|
284
|
+
!i || i.name !== "insertMode" || (T = i.value, E());
|
|
263
285
|
});
|
|
264
286
|
}
|
|
265
|
-
function
|
|
266
|
-
const t =
|
|
267
|
-
t.length > 0 ? (!o || !t.find((e) => e.id === o.id)) && (o = t[0]) : o = null,
|
|
287
|
+
function M() {
|
|
288
|
+
const t = S();
|
|
289
|
+
t.length > 0 ? (!o || !t.find((e) => e.id === o.id)) && (o = t[0]) : o = null, E();
|
|
268
290
|
}
|
|
269
|
-
function
|
|
291
|
+
function L() {
|
|
292
|
+
var t;
|
|
270
293
|
if (o)
|
|
271
|
-
if (
|
|
272
|
-
|
|
273
|
-
|
|
294
|
+
if (T === "replace") {
|
|
295
|
+
const e = A();
|
|
296
|
+
if ((t = e == null ? void 0 : e.innerHTML) != null && t.trim()) {
|
|
297
|
+
W();
|
|
274
298
|
return;
|
|
275
299
|
}
|
|
276
|
-
|
|
300
|
+
j(o), u();
|
|
277
301
|
} else
|
|
278
|
-
|
|
302
|
+
K(o), u();
|
|
279
303
|
}
|
|
280
|
-
function
|
|
281
|
-
o && (
|
|
304
|
+
function G() {
|
|
305
|
+
o && (j(o), u());
|
|
282
306
|
}
|
|
283
|
-
function
|
|
307
|
+
function K(t) {
|
|
284
308
|
const e = window.getSelection();
|
|
285
|
-
if (!e)
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
if (
|
|
289
|
-
|
|
309
|
+
if (!e)
|
|
310
|
+
return;
|
|
311
|
+
const r = A();
|
|
312
|
+
if (!r)
|
|
313
|
+
return;
|
|
314
|
+
if (f)
|
|
315
|
+
e.removeAllRanges(), e.addRange(f);
|
|
290
316
|
else {
|
|
291
|
-
const
|
|
292
|
-
|
|
317
|
+
const m = document.createRange();
|
|
318
|
+
m.selectNodeContents(r), m.collapse(!1), e.removeAllRanges(), e.addRange(m);
|
|
293
319
|
}
|
|
294
|
-
if (e.rangeCount === 0)
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
320
|
+
if (e.rangeCount === 0)
|
|
321
|
+
return;
|
|
322
|
+
const a = e.getRangeAt(0), p = (r == null ? void 0 : r.innerHTML) ?? "", s = document.createRange().createContextualFragment($(t.html));
|
|
323
|
+
a.deleteContents(), a.insertNode(s);
|
|
324
|
+
const g = document.createRange();
|
|
325
|
+
g.setStartAfter(a.endContainer), g.collapse(!0), e.removeAllRanges(), e.addRange(g), r && (H(r, p), r.dispatchEvent(new Event("input", { bubbles: !0 })));
|
|
299
326
|
}
|
|
300
|
-
function
|
|
301
|
-
const e =
|
|
327
|
+
function j(t) {
|
|
328
|
+
const e = A();
|
|
302
329
|
if (e) {
|
|
303
330
|
const r = e.innerHTML;
|
|
304
|
-
e.innerHTML =
|
|
331
|
+
e.innerHTML = $(t.html), H(e, r), e.dispatchEvent(new Event("input", { bubbles: !0 }));
|
|
305
332
|
}
|
|
306
333
|
}
|
|
307
|
-
function
|
|
308
|
-
|
|
334
|
+
function u() {
|
|
335
|
+
V(), d !== null && (cancelAnimationFrame(d), d = null), c && (c.remove(), c = null), n = null, f = null, v = "", b = null;
|
|
309
336
|
}
|
|
310
|
-
function
|
|
337
|
+
function B(t) {
|
|
311
338
|
const e = window.getSelection();
|
|
312
|
-
e && e.rangeCount > 0 ?
|
|
313
|
-
const r =
|
|
339
|
+
e && e.rangeCount > 0 ? f = e.getRangeAt(0).cloneRange() : f = null;
|
|
340
|
+
const r = S();
|
|
314
341
|
r.length > 0 && !o && (o = r[0]);
|
|
315
|
-
const
|
|
316
|
-
|
|
342
|
+
const a = (t == null ? void 0 : t.contentElement) instanceof HTMLElement ? t.contentElement : C();
|
|
343
|
+
b = a || null, _(a);
|
|
317
344
|
}
|
|
318
345
|
function Y() {
|
|
319
|
-
if (typeof document > "u")
|
|
346
|
+
if (typeof document > "u")
|
|
347
|
+
return;
|
|
320
348
|
const t = "template-plugin-dialog-styles";
|
|
321
|
-
if (document.getElementById(t))
|
|
349
|
+
if (document.getElementById(t))
|
|
350
|
+
return;
|
|
322
351
|
const e = document.createElement("style");
|
|
323
352
|
e.id = t, e.textContent = `
|
|
324
353
|
.rte-dialog-overlay {
|
|
@@ -569,18 +598,18 @@ const te = () => ({
|
|
|
569
598
|
}
|
|
570
599
|
],
|
|
571
600
|
commands: {
|
|
572
|
-
insertTemplate: (t, e) => (
|
|
601
|
+
insertTemplate: (t, e) => (B(e), !0)
|
|
573
602
|
},
|
|
574
603
|
keymap: {}
|
|
575
604
|
});
|
|
576
605
|
export {
|
|
577
|
-
|
|
606
|
+
F as PREDEFINED_TEMPLATES,
|
|
578
607
|
te as TemplatePlugin,
|
|
579
608
|
X as addCustomTemplate,
|
|
580
|
-
|
|
581
|
-
|
|
609
|
+
D as getAllTemplates,
|
|
610
|
+
R as getTemplateCategories,
|
|
582
611
|
U as getTemplatesByCategory,
|
|
583
|
-
|
|
584
|
-
|
|
612
|
+
$ as sanitizeTemplate,
|
|
613
|
+
P as searchTemplates,
|
|
585
614
|
ee as validateTemplate
|
|
586
615
|
};
|
|
@@ -1 +1 @@
|
|
|
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
|
|
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 f(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 h(n){const t=[],e=f(n.startContainer),i=f(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 E(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 m(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 b=n=>{var u;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=E(i),s=(o==null?void 0:o.innerHTML)||"",r=h(i);if(r.length>0)r.forEach(l=>{l&&(l.style.textAlign=n)}),e.removeAllRanges(),e.addRange(i),m(o,s),o&&o.dispatchEvent(new Event("input",{bubbles:!0}));else try{const l=document.createElement("div");l.style.textAlign=n;const g=i.extractContents();l.appendChild(g),i.insertNode(l);const d=document.createRange();d.selectNodeContents(l),e.removeAllRanges(),e.addRange(d);const c=l.closest(".rte-content, .editora-content")||l.closest('[contenteditable="true"]');m(c||o,s),(c||o)&&((u=c||o)==null||u.dispatchEvent(new Event("input",{bubbles:!0})))}catch(l){return console.error("Failed to wrap content for alignment:",l),!1}return!0},p=()=>({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:b},keymap:{}});exports.TextAlignmentPlugin=p;
|