@editora/plugins 1.0.20 → 1.0.22

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.
@@ -1,4 +1,4 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const $=require("./escapeHtml-D2Zh82pD.js"),j=require("./dialogHelpers-zU6zpMIA.js"),z=require("./purify.es-B6PsRpEV.js");let n=null,s=null,u=null,a=null,m="",g="",y="insert",T=null,d=null,w=null;function B(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 F(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>
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const j=require("./escapeHtml-D2Zh82pD.js"),z=require("./dialogHelpers-zU6zpMIA.js"),F=require("./purify.es-B6PsRpEV.js");let n=null,s=null,u=null,a=null,m="",g="",y="insert",T=null,d=null,w=null;function B(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 V(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 I=[{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>`}],b=[..._],L=()=>b,O=t=>b.filter(e=>e.category===t),C=()=>{const t=new Set(b.map(e=>e.category));return Array.from(t)},I=t=>{const e=t.toLowerCase();return b.filter(r=>r.name.toLowerCase().includes(e)||r.description?.toLowerCase().includes(e)||r.tags?.some(i=>i.toLowerCase().includes(e)))},A=t=>z.purify_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"]}),Q=t=>b.some(e=>e.id===t.id)?(console.warn(`Template with ID ${t.id} already exists`),!1):(b.push(t),!0),W=t=>!!(t.id&&t.name&&t.category&&t.html&&t.html.trim().length>0);function Z(t){s&&c(),s=document.createElement("div"),j.initDialogOverlay(s),s.className="rte-dialog-overlay",Y(t)&&s.classList.add("rte-ui-theme-dark"),s.addEventListener("click",()=>c()),n=document.createElement("div"),n.className="rte-dialog rte-template-dialog",n.addEventListener("click",r=>r.stopPropagation());const e=C();e.length>0&&!m&&(m=e[0]),E(),s.appendChild(n),document.body.appendChild(s),G(),ne()}function G(){P(),T=t=>{t.key==="Escape"&&(!s||!n||(t.preventDefault(),t.stopPropagation(),c()))},document.addEventListener("keydown",T,!0)}function P(){T&&(document.removeEventListener("keydown",T,!0),T=null)}const K='[data-theme="dark"], .dark, .editora-theme-dark',S=()=>{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},Y=t=>{const e=t||S();return e?!!e.closest(K):!1};function H(){const t=F(u);if(t)return t;if(w?.isConnected)return w;const e=S();return e||document.querySelector(".rte-content, .editora-content")}function E(){if(!n)return;const t=C(),e=R();n.innerHTML=`
43
+ <p>A: [Answer here]</p>`}],b=[...I],L=()=>b,O=t=>b.filter(e=>e.category===t),C=()=>{const t=new Set(b.map(e=>e.category));return Array.from(t)},P=t=>{const e=t.toLowerCase();return b.filter(r=>r.name.toLowerCase().includes(e)||r.description?.toLowerCase().includes(e)||r.tags?.some(i=>i.toLowerCase().includes(e)))},A=t=>F.purify_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"]}),Q=t=>b.some(e=>e.id===t.id)?(console.warn(`Template with ID ${t.id} already exists`),!1):(b.push(t),!0),W=t=>!!(t.id&&t.name&&t.category&&t.html&&t.html.trim().length>0);function Z(t){s&&c(),s=document.createElement("div"),z.initDialogOverlay(s),s.className="rte-dialog-overlay",Y(t)&&s.classList.add("rte-ui-theme-dark"),s.addEventListener("click",()=>c()),n=document.createElement("div"),n.className="rte-dialog rte-template-dialog",n.addEventListener("click",r=>r.stopPropagation());const e=C();e.length>0&&!m&&(m=e[0]),E(),s.appendChild(n),document.body.appendChild(s),K(),ne()}function K(){q(),T=t=>{t.key==="Escape"&&(!s||!n||(t.preventDefault(),t.stopPropagation(),c()))},document.addEventListener("keydown",T,!0)}function q(){T&&(document.removeEventListener("keydown",T,!0),T=null)}const G='[data-theme="dark"], .dark, .editora-theme-dark',H=()=>{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},Y=t=>{const e=t||H();return e?!!e.closest(G):!1};function S(){const t=V(u);if(t)return t;if(w?.isConnected)return w;const e=H();return e||document.querySelector(".rte-content, .editora-content")}function E(){if(!n)return;const t=C(),e=R();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="${$.escapeHtml(g)}"
54
+ value="${j.escapeHtml(g)}"
55
55
  class="rte-input rte-template-search"
56
56
  aria-label="Search templates"
57
57
  />
@@ -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?.addEventListener("click",()=>E()),e?.addEventListener("click",()=>X())}function R(){const t=L();return g.trim()?I(g):m?t.filter(e=>e.category===m):t}function J(){if(!n)return;n.querySelector(".rte-dialog-close")?.addEventListener("click",()=>c()),n.querySelector(".rte-cancel-btn")?.addEventListener("click",()=>c()),n.querySelector(".rte-insert-btn")?.addEventListener("click",()=>k());const i=n.querySelector(".rte-template-search");i?.addEventListener("input",o=>{d!==null&&cancelAnimationFrame(d),g=o.target.value,d=requestAnimationFrame(()=>{d=null,M()})}),i?.addEventListener("keydown",o=>{o.key==="Enter"&&a?k():o.key==="Escape"&&c()}),n.querySelector(".rte-tabs")?.addEventListener("click",o=>{const v=o.target.closest(".rte-tab");if(!v)return;const x=v.getAttribute("data-category");x&&(m=x,g="",d!==null&&(cancelAnimationFrame(d),d=null),M())});const p=n.querySelector(".rte-template-list"),f=o=>{const v=o.target.closest(".rte-template-item");if(!v)return null;const x=v.getAttribute("data-template-id");return x&&L().find(V=>V.id===x)||null};p?.addEventListener("click",o=>{const l=f(o);l&&(a=l,E())}),p?.addEventListener("dblclick",o=>{const l=f(o);l&&(a=l,k())}),n.querySelector(".rte-insert-mode")?.addEventListener("change",o=>{const l=o.target;!l||l.name!=="insertMode"||(y=l.value,E())})}function M(){const t=R();t.length>0?(!a||!t.find(e=>e.id===a.id))&&(a=t[0]):a=null,E()}function k(){if(a)if(y==="replace"){if(H()?.innerHTML?.trim()){U();return}q(a),c()}else te(a),c()}function X(){a&&(q(a),c())}const ee=new Set(["DIV","P","BLOCKQUOTE","PRE","H1","H2","H3","H4","H5","H6","LI","TD","TH"]);function N(t,e){let r=t;for(;r&&r!==e;){if(r.nodeType===Node.ELEMENT_NODE&&ee.has(r.tagName))return r;r=r.parentNode}return null}function te(t){const e=window.getSelection();if(!e)return;const r=H();if(!r)return;if(u)e.removeAllRanges(),e.addRange(u);else{const l=document.createRange();l.selectNodeContents(r),l.collapse(!1),e.removeAllRanges(),e.addRange(l)}if(e.rangeCount===0)return;const i=e.getRangeAt(0),D=r?.innerHTML??"",p=document.createRange().createContextualFragment(A(t.html));i.deleteContents();const f=p.lastChild,h=N(i.endContainer,r)||N(i.startContainer,r);h&&h.parentNode?h.parentNode.insertBefore(p,h.nextSibling):i.insertNode(p);const o=document.createRange();f?o.setStartAfter(f):o.setStartAfter(i.endContainer),o.collapse(!0),e.removeAllRanges(),e.addRange(o),r&&(B(r,D),r.dispatchEvent(new Event("input",{bubbles:!0})))}function q(t){const e=H();if(e){const r=e.innerHTML;e.innerHTML=A(t.html),B(e,r),e.dispatchEvent(new Event("input",{bubbles:!0}))}}function c(){P(),d!==null&&(cancelAnimationFrame(d),d=null),s&&(s.remove(),s=null),n=null,u=null,g="",w=null}function re(t){const e=window.getSelection();e&&e.rangeCount>0?u=e.getRangeAt(0).cloneRange():u=null;const r=R();r.length>0&&!a&&(a=r[0]);const i=t?.contentElement instanceof HTMLElement?t.contentElement:S();w=i||null,Z(i)}function ne(){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=`
119
+ `;const t=n.querySelector(".rte-cancel-warning-btn"),e=n.querySelector(".rte-confirm-replace-btn");t?.addEventListener("click",()=>E()),e?.addEventListener("click",()=>X())}function R(){const t=L();return g.trim()?P(g):m?t.filter(e=>e.category===m):t}function J(){if(!n)return;n.querySelector(".rte-dialog-close")?.addEventListener("click",()=>c()),n.querySelector(".rte-cancel-btn")?.addEventListener("click",()=>c()),n.querySelector(".rte-insert-btn")?.addEventListener("click",()=>k());const i=n.querySelector(".rte-template-search");i?.addEventListener("input",o=>{d!==null&&cancelAnimationFrame(d),g=o.target.value,d=requestAnimationFrame(()=>{d=null,M()})}),i?.addEventListener("keydown",o=>{o.key==="Enter"&&a?k():o.key==="Escape"&&c()}),n.querySelector(".rte-tabs")?.addEventListener("click",o=>{const v=o.target.closest(".rte-tab");if(!v)return;const x=v.getAttribute("data-category");x&&(m=x,g="",d!==null&&(cancelAnimationFrame(d),d=null),M())});const p=n.querySelector(".rte-template-list"),f=o=>{const v=o.target.closest(".rte-template-item");if(!v)return null;const x=v.getAttribute("data-template-id");return x&&L().find($=>$.id===x)||null};p?.addEventListener("click",o=>{const l=f(o);l&&(a=l,E())}),p?.addEventListener("dblclick",o=>{const l=f(o);l&&(a=l,k())}),n.querySelector(".rte-insert-mode")?.addEventListener("change",o=>{const l=o.target;!l||l.name!=="insertMode"||(y=l.value,E())})}function M(){const t=R();t.length>0?(!a||!t.find(e=>e.id===a.id))&&(a=t[0]):a=null,E()}function k(){if(a)if(y==="replace"){if(S()?.innerHTML?.trim()){U();return}_(a),c()}else te(a),c()}function X(){a&&(_(a),c())}const ee=new Set(["DIV","P","BLOCKQUOTE","PRE","H1","H2","H3","H4","H5","H6","LI","TD","TH"]);function N(t,e){let r=t;for(;r&&r!==e;){if(r.nodeType===Node.ELEMENT_NODE&&ee.has(r.tagName))return r;r=r.parentNode}return null}function te(t){const e=window.getSelection();if(!e)return;const r=S();if(!r)return;if(u)e.removeAllRanges(),e.addRange(u);else{const l=document.createRange();l.selectNodeContents(r),l.collapse(!1),e.removeAllRanges(),e.addRange(l)}if(e.rangeCount===0)return;const i=e.getRangeAt(0),D=r?.innerHTML??"",p=document.createRange().createContextualFragment(A(t.html));i.deleteContents();const f=p.lastChild,h=N(i.endContainer,r)||N(i.startContainer,r);h&&h.parentNode?h.parentNode.insertBefore(p,h.nextSibling):i.insertNode(p);const o=document.createRange();f?o.setStartAfter(f):o.setStartAfter(i.endContainer),o.collapse(!0),e.removeAllRanges(),e.addRange(o),r&&(B(r,D),r.dispatchEvent(new Event("input",{bubbles:!0})))}function _(t){const e=S();if(e){const r=e.innerHTML;e.innerHTML=A(t.html),B(e,r),e.dispatchEvent(new Event("input",{bubbles:!0}))}}function c(){q(),d!==null&&(cancelAnimationFrame(d),d=null),s&&(s.remove(),s=null),n=null,u=null,g="",w=null}function re(t){const e=window.getSelection();e&&e.rangeCount>0?u=e.getRangeAt(0).cloneRange():u=null;const r=R();r.length>0&&!a&&(a=r[0]);const i=t?.contentElement instanceof HTMLElement?t.contentElement:H();w=i||null,Z(i)}function ne(){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 oe=()=>({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)=>(re(e),!0)},keymap:{}});exports.PREDEFINED_TEMPLATES=_;exports.TemplatePlugin=oe;exports.addCustomTemplate=Q;exports.getAllTemplates=L;exports.getTemplateCategories=C;exports.getTemplatesByCategory=O;exports.sanitizeTemplate=A;exports.searchTemplates=I;exports.validateTemplate=W;
356
+ `,document.head.appendChild(e)}const oe=()=>({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 stroke-width="0"></g><g stroke-linecap="round" stroke-linejoin="round"></g><g> <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)=>(re(e),!0)},keymap:{}});exports.PREDEFINED_TEMPLATES=I;exports.TemplatePlugin=oe;exports.addCustomTemplate=Q;exports.getAllTemplates=L;exports.getTemplateCategories=C;exports.getTemplatesByCategory=O;exports.sanitizeTemplate=A;exports.searchTemplates=P;exports.validateTemplate=W;
@@ -1,6 +1,6 @@
1
- import { e as _ } from "./escapeHtml-DyksyvcZ.mjs";
2
- import { i as j } from "./dialogHelpers-5d5BuOCW.mjs";
3
- import { p as q } from "./purify.es-DmCsrgBd.mjs";
1
+ import { e as q } from "./escapeHtml-DyksyvcZ.mjs";
2
+ import { i as P } from "./dialogHelpers-5d5BuOCW.mjs";
3
+ import { p as z } from "./purify.es-DmCsrgBd.mjs";
4
4
  let n = null, s = null, u = null, a = null, m = "", g = "", y = "insert", T = null, d = null, E = null;
5
5
  function D(t, e) {
6
6
  if (e === t.innerHTML) return;
@@ -11,7 +11,7 @@ function D(t, e) {
11
11
  } catch {
12
12
  }
13
13
  }
14
- function P(t) {
14
+ function F(t) {
15
15
  if (!t) return null;
16
16
  let e = t.startContainer;
17
17
  for (; e && e !== document.body; ) {
@@ -24,7 +24,7 @@ function P(t) {
24
24
  }
25
25
  return null;
26
26
  }
27
- const z = [
27
+ const V = [
28
28
  {
29
29
  id: "formal-letter",
30
30
  name: "Formal Letter",
@@ -95,20 +95,20 @@ const z = [
95
95
  <h3>Q: What are the requirements?</h3>
96
96
  <p>A: [Answer here]</p>`
97
97
  }
98
- ], b = [...z], M = () => b, oe = (t) => b.filter((e) => e.category === t), N = () => {
98
+ ], b = [...V], M = () => b, oe = (t) => b.filter((e) => e.category === t), N = () => {
99
99
  const t = new Set(b.map((e) => e.category));
100
100
  return Array.from(t);
101
- }, F = (t) => {
101
+ }, _ = (t) => {
102
102
  const e = t.toLowerCase();
103
103
  return b.filter(
104
104
  (r) => r.name.toLowerCase().includes(e) || r.description?.toLowerCase().includes(e) || r.tags?.some((i) => i.toLowerCase().includes(e))
105
105
  );
106
- }, B = (t) => q.sanitize(t, {
106
+ }, B = (t) => z.sanitize(t, {
107
107
  ALLOWED_TAGS: ["p", "br", "strong", "em", "u", "h1", "h2", "h3", "h4", "ul", "ol", "li", "blockquote", "table", "thead", "tbody", "tr", "th", "td", "a", "span"],
108
108
  ALLOWED_ATTR: ["href", "target", "class", "data-key", "data-category"]
109
109
  }), ae = (t) => b.some((e) => e.id === t.id) ? (console.warn(`Template with ID ${t.id} already exists`), !1) : (b.push(t), !0), le = (t) => !!(t.id && t.name && t.category && t.html && t.html.trim().length > 0);
110
110
  function O(t) {
111
- s && c(), s = document.createElement("div"), j(s), s.className = "rte-dialog-overlay", Z(t) && s.classList.add("rte-ui-theme-dark"), s.addEventListener("click", () => c()), n = document.createElement("div"), n.className = "rte-dialog rte-template-dialog", n.addEventListener("click", (r) => r.stopPropagation());
111
+ s && c(), s = document.createElement("div"), P(s), s.className = "rte-dialog-overlay", Z(t) && s.classList.add("rte-ui-theme-dark"), s.addEventListener("click", () => c()), n = document.createElement("div"), n.className = "rte-dialog rte-template-dialog", n.addEventListener("click", (r) => r.stopPropagation());
112
112
  const e = N();
113
113
  e.length > 0 && !m && (m = e[0]), w(), s.appendChild(n), document.body.appendChild(s), Q(), ee();
114
114
  }
@@ -132,7 +132,7 @@ const W = '[data-theme="dark"], .dark, .editora-theme-dark', L = () => {
132
132
  return e ? !!e.closest(W) : !1;
133
133
  };
134
134
  function C() {
135
- const t = P(u);
135
+ const t = F(u);
136
136
  if (t) return t;
137
137
  if (E?.isConnected) return E;
138
138
  const e = L();
@@ -152,7 +152,7 @@ function w() {
152
152
  <input
153
153
  type="text"
154
154
  placeholder="Search templates..."
155
- value="${_(g)}"
155
+ value="${q(g)}"
156
156
  class="rte-input rte-template-search"
157
157
  aria-label="Search templates"
158
158
  />
@@ -206,9 +206,9 @@ function w() {
206
206
  ${y === "insert" ? "Insert" : "Replace"}
207
207
  </button>
208
208
  </div>
209
- `, K();
209
+ `, G();
210
210
  }
211
- function G() {
211
+ function K() {
212
212
  if (!n) return;
213
213
  n.innerHTML = `
214
214
  <div class="rte-dialog-header">
@@ -227,9 +227,9 @@ function G() {
227
227
  }
228
228
  function A() {
229
229
  const t = M();
230
- return g.trim() ? F(g) : m ? t.filter((e) => e.category === m) : t;
230
+ return g.trim() ? _(g) : m ? t.filter((e) => e.category === m) : t;
231
231
  }
232
- function K() {
232
+ function G() {
233
233
  if (!n) return;
234
234
  n.querySelector(".rte-dialog-close")?.addEventListener("click", () => c()), n.querySelector(".rte-cancel-btn")?.addEventListener("click", () => c()), n.querySelector(".rte-insert-btn")?.addEventListener("click", () => k());
235
235
  const i = n.querySelector(".rte-template-search");
@@ -249,7 +249,7 @@ function K() {
249
249
  const v = o.target.closest(".rte-template-item");
250
250
  if (!v) return null;
251
251
  const x = v.getAttribute("data-template-id");
252
- return x && M().find(($) => $.id === x) || null;
252
+ return x && M().find((j) => j.id === x) || null;
253
253
  };
254
254
  p?.addEventListener("click", (o) => {
255
255
  const l = f(o);
@@ -270,15 +270,15 @@ function k() {
270
270
  if (a)
271
271
  if (y === "replace") {
272
272
  if (C()?.innerHTML?.trim()) {
273
- G();
273
+ K();
274
274
  return;
275
275
  }
276
- V(a), c();
276
+ $(a), c();
277
277
  } else
278
278
  J(a), c();
279
279
  }
280
280
  function Y() {
281
- a && (V(a), c());
281
+ a && ($(a), c());
282
282
  }
283
283
  const U = /* @__PURE__ */ new Set([
284
284
  "DIV",
@@ -323,7 +323,7 @@ function J(t) {
323
323
  const o = document.createRange();
324
324
  f ? o.setStartAfter(f) : o.setStartAfter(i.endContainer), o.collapse(!0), e.removeAllRanges(), e.addRange(o), r && (D(r, H), r.dispatchEvent(new Event("input", { bubbles: !0 })));
325
325
  }
326
- function V(t) {
326
+ function $(t) {
327
327
  const e = C();
328
328
  if (e) {
329
329
  const r = e.innerHTML;
@@ -591,7 +591,7 @@ const ie = () => ({
591
591
  {
592
592
  label: "Template",
593
593
  command: "insertTemplate",
594
- 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>'
594
+ icon: '<svg width="24px" height="24px" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"><g stroke-width="0"></g><g stroke-linecap="round" stroke-linejoin="round"></g><g> <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>'
595
595
  }
596
596
  ],
597
597
  commands: {
@@ -600,13 +600,13 @@ const ie = () => ({
600
600
  keymap: {}
601
601
  });
602
602
  export {
603
- z as PREDEFINED_TEMPLATES,
603
+ V as PREDEFINED_TEMPLATES,
604
604
  ie as TemplatePlugin,
605
605
  ae as addCustomTemplate,
606
606
  M as getAllTemplates,
607
607
  N as getTemplateCategories,
608
608
  oe as getTemplatesByCategory,
609
609
  B as sanitizeTemplate,
610
- F as searchTemplates,
610
+ _ as searchTemplates,
611
611
  le as validateTemplate
612
612
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@editora/plugins",
3
- "version": "1.0.20",
3
+ "version": "1.0.22",
4
4
  "description": "Enterprise plugin suite for Editora rich text editor in React and web apps, including tables, media, workflow, and compliance tooling.",
5
5
  "author": "Ajay Kumar <ajaykr089@gmail.com>",
6
6
  "license": "MIT",
@@ -429,21 +429,22 @@
429
429
  "test:pii-redaction": "node ../../node_modules/jest/bin/jest.js -c ./jest.config.cjs --watchman=false --runTestsByPath ./pii-redaction/src/PIIRedactionPlugin.native.test.js",
430
430
  "test:smart-paste": "node ../../node_modules/jest/bin/jest.js -c ./jest.config.cjs --watchman=false --runTestsByPath ./smart-paste/src/SmartPastePlugin.native.test.js",
431
431
  "test:blocks-library": "node ../../node_modules/jest/bin/jest.js -c ./jest.config.cjs --watchman=false --runTestsByPath ./blocks-library/src/BlocksLibraryPlugin.native.test.js",
432
+ "test:toolbar-icons": "node ../../node_modules/jest/bin/jest.js -c ./jest.config.cjs --watchman=false --runTestsByPath ./shared/toolbar-icons.test.js",
432
433
  "test:doc-schema": "node ../../node_modules/jest/bin/jest.js -c ./jest.config.cjs --watchman=false --runTestsByPath ./doc-schema/src/DocSchemaPlugin.native.test.js",
433
434
  "test:translation-workflow": "node ../../node_modules/jest/bin/jest.js -c ./jest.config.cjs --watchman=false --runTestsByPath ./translation-workflow/src/TranslationWorkflowPlugin.native.test.js",
434
435
  "test:format-painter": "node -r ../../node_modules/ts-node/register ./format-painter/src/FormatPainterPlugin.native.test.js",
435
- "verify:citations": "npm run typecheck:build && npm run test:citations && npm run test:content-rules && npm run test:approval-workflow && npm run test:pii-redaction && npm run test:smart-paste && npm run test:blocks-library && npm run test:doc-schema && npm run test:translation-workflow && npm run test:format-painter && npm run build"
436
+ "verify:citations": "npm run typecheck:build && npm run test:citations && npm run test:content-rules && npm run test:approval-workflow && npm run test:pii-redaction && npm run test:smart-paste && npm run test:blocks-library && npm run test:doc-schema && npm run test:translation-workflow && npm run test:format-painter && npm run test:toolbar-icons && npm run build"
436
437
  },
437
438
  "peerDependencies": {
438
- "@editora/core": "^1.0.19"
439
+ "@editora/core": "^1.0.23"
439
440
  },
440
441
  "dependencies": {
441
- "@editora/light-code-editor": "^1.0.15",
442
+ "@editora/light-code-editor": "^1.0.18",
442
443
  "katex": "^0.16.27",
443
444
  "mathjax": "^3.2.2"
444
445
  },
445
446
  "devDependencies": {
446
- "@editora/core": "^1.0.19",
447
+ "@editora/core": "^1.0.23",
447
448
  "@types/katex": "^0.16.8",
448
449
  "dompurify": "^3.4.16",
449
450
  "typescript": "^5.0.0",