@editora/plugins 1.0.19 → 1.0.21

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (45) hide show
  1. package/dist/{CodePlugin.native-Bwf25lLX.js → CodePlugin.native-CKJo7IFG.js} +8 -8
  2. package/dist/{CodePlugin.native-Cpp4u3Jl.mjs → CodePlugin.native-D8gGxB8i.mjs} +59 -60
  3. package/dist/a11y-checker.cjs.js +1 -1
  4. package/dist/a11y-checker.esm.js +18 -18
  5. package/dist/anchor.cjs.js +6 -6
  6. package/dist/anchor.esm.js +57 -57
  7. package/dist/blockquote.cjs.js +1 -1
  8. package/dist/blockquote.esm.js +31 -31
  9. package/dist/capitalization.cjs.js +1 -1
  10. package/dist/capitalization.esm.js +25 -25
  11. package/dist/checklist.cjs.js +1 -1
  12. package/dist/checklist.esm.js +30 -30
  13. package/dist/code.cjs.js +1 -1
  14. package/dist/code.esm.js +1 -1
  15. package/dist/collaboration.cjs.js +8 -8
  16. package/dist/collaboration.esm.js +1279 -1169
  17. package/dist/comments.cjs.js +1 -1
  18. package/dist/comments.esm.js +1 -1
  19. package/dist/direction.cjs.js +1 -1
  20. package/dist/direction.esm.js +26 -26
  21. package/dist/document-manager.cjs.js +1 -1
  22. package/dist/document-manager.esm.js +1 -1
  23. package/dist/{documentManager-yjRBab4v.mjs → documentManager-BL98a7YZ.mjs} +402 -404
  24. package/dist/{documentManager-BDz6tovy.js → documentManager-r8t7yZEd.js} +9 -9
  25. package/dist/enterprise.cjs.js +1 -1
  26. package/dist/enterprise.esm.js +1 -1
  27. package/dist/font-family.cjs.js +1 -1
  28. package/dist/font-family.esm.js +26 -26
  29. package/dist/{index-Bm1eqYHh.mjs → index-B-VitI3v.mjs} +23 -22
  30. package/dist/{index-CoflqYuK.js → index-D5xugkYA.js} +2 -2
  31. package/dist/index.cjs.js +1 -1
  32. package/dist/index.esm.js +2 -2
  33. package/dist/preview.cjs.js +3 -3
  34. package/dist/preview.esm.js +48 -51
  35. package/dist/purify.es-B6PsRpEV.js +3 -0
  36. package/dist/purify.es-DmCsrgBd.mjs +1480 -0
  37. package/dist/sanitizeHtml-CDoBlNTk.js +1 -0
  38. package/dist/sanitizeHtml-CtLy8um-.mjs +16 -0
  39. package/dist/spell-check.cjs.js +2 -2
  40. package/dist/spell-check.esm.js +19 -19
  41. package/dist/table.cjs.js +14 -14
  42. package/dist/table.esm.js +158 -150
  43. package/dist/template.cjs.js +20 -21
  44. package/dist/template.esm.js +176 -724
  45. package/package.json +6 -4
@@ -1,7 +1,7 @@
1
1
  import { i as z } from "./dialogHelpers-5d5BuOCW.mjs";
2
2
  import { f as D, g as S } from "./editorContainerHelpers-C7kdWnS0.mjs";
3
3
  const b = /* @__PURE__ */ new Set(), x = '[data-theme="dark"], .dark, .editora-theme-dark';
4
- function R(t, c) {
4
+ function M(t, c) {
5
5
  if (c === t.innerHTML) return;
6
6
  const s = window.execEditorCommand || window.executeEditorCommand;
7
7
  if (typeof s == "function")
@@ -10,19 +10,19 @@ function R(t, c) {
10
10
  } catch {
11
11
  }
12
12
  }
13
- function M() {
13
+ function H() {
14
14
  if (typeof window > "u" || window.__anchorObserverInitialized) return;
15
15
  window.__anchorObserverInitialized = !0, new MutationObserver((c) => {
16
16
  c.forEach((s) => {
17
17
  s.removedNodes.forEach((a) => {
18
18
  if (a.nodeType === Node.ELEMENT_NODE) {
19
- const d = a;
20
- if (d.classList?.contains("rte-anchor")) {
21
- const r = d.id;
22
- r && b.delete(r);
19
+ const l = a;
20
+ if (l.classList?.contains("rte-anchor")) {
21
+ const n = l.id;
22
+ n && b.delete(n);
23
23
  }
24
- d.querySelectorAll?.(".rte-anchor")?.forEach((r) => {
25
- const u = r.id;
24
+ l.querySelectorAll?.(".rte-anchor")?.forEach((n) => {
25
+ const u = n.id;
26
26
  u && b.delete(u);
27
27
  });
28
28
  }
@@ -36,18 +36,18 @@ function M() {
36
36
  function A(t) {
37
37
  return !t || t.trim().length === 0 ? { valid: !1, error: "Anchor ID cannot be empty" } : t.length > 256 ? { valid: !1, error: "Anchor ID must be less than 256 characters" } : /^[A-Za-z_]/.test(t) ? /^[A-Za-z0-9\-_]+$/.test(t) ? { valid: !0, error: "" } : { valid: !1, error: "Anchor ID can only contain letters, numbers, hyphens, and underscores" } : { valid: !1, error: "Anchor ID must start with a letter or underscore" };
38
38
  }
39
- function H() {
39
+ function R() {
40
40
  const t = D();
41
41
  if (!t) return;
42
42
  const c = S(t);
43
43
  if (!c) return;
44
44
  const s = c.querySelectorAll(".rte-anchor"), a = /* @__PURE__ */ new Set();
45
- s.forEach((d) => {
46
- const e = d.id;
45
+ s.forEach((l) => {
46
+ const e = l.id;
47
47
  e && a.add(e);
48
- }), b.clear(), a.forEach((d) => b.add(d));
48
+ }), b.clear(), a.forEach((l) => b.add(l));
49
49
  }
50
- function _(t) {
50
+ function I(t) {
51
51
  if (t) {
52
52
  const a = t.startContainer;
53
53
  if ((a.nodeType === Node.ELEMENT_NODE ? a : a.parentElement)?.closest(x)) return !0;
@@ -59,9 +59,9 @@ function _(t) {
59
59
  }
60
60
  return document.activeElement?.closest(x) ? !0 : document.body.matches(x) || document.documentElement.matches(x);
61
61
  }
62
- function I(t, c, s, a) {
63
- document.querySelectorAll(".rte-anchor-dialog-overlay").forEach((n) => n.remove()), H();
64
- const d = _(a), e = d ? {
62
+ function _(t, c, s, a) {
63
+ document.querySelectorAll(".rte-anchor-dialog-overlay").forEach((r) => r.remove()), R();
64
+ const l = I(a), e = l ? {
65
65
  overlay: "rgba(0, 0, 0, 0.62)",
66
66
  dialogBg: "#1f2937",
67
67
  panelBg: "#222d3a",
@@ -109,8 +109,8 @@ function I(t, c, s, a) {
109
109
  help: "#999999",
110
110
  focusRing: "rgba(0, 102, 204, 0.1)",
111
111
  errorRing: "rgba(211, 47, 47, 0.1)"
112
- }, r = document.createElement("div");
113
- z(r), r.className = "rte-anchor-dialog-overlay", r.style.cssText = `
112
+ }, n = document.createElement("div");
113
+ z(n), n.className = "rte-anchor-dialog-overlay", n.style.cssText = `
114
114
  position: fixed;
115
115
  top: 0;
116
116
  left: 0;
@@ -134,8 +134,8 @@ function I(t, c, s, a) {
134
134
  overflow: hidden;
135
135
  animation: rte-anchor-dialog-appear 0.2s ease;
136
136
  `, !document.getElementById("rte-anchor-dialog-styles")) {
137
- const n = document.createElement("style");
138
- n.id = "rte-anchor-dialog-styles", n.textContent = `
137
+ const r = document.createElement("style");
138
+ r.id = "rte-anchor-dialog-styles", r.textContent = `
139
139
  @keyframes rte-anchor-dialog-appear {
140
140
  from { opacity: 0; transform: scale(0.95); }
141
141
  to { opacity: 1; transform: scale(1); }
@@ -143,9 +143,9 @@ function I(t, c, s, a) {
143
143
  .rte-anchor-dialog input:focus {
144
144
  outline: none !important;
145
145
  }
146
- `, document.head.appendChild(n);
146
+ `, document.head.appendChild(r);
147
147
  }
148
- let l = "";
148
+ let d = "";
149
149
  const h = document.createElement("div");
150
150
  h.style.cssText = `
151
151
  display: flex;
@@ -242,66 +242,66 @@ function I(t, c, s, a) {
242
242
  o.value.trim() ? (i.disabled = !1, i.style.background = e.saveBg, i.style.color = "white", i.style.cursor = "pointer") : (i.disabled = !0, i.style.background = e.saveDisabledBg, i.style.color = e.saveDisabledText, i.style.cursor = "not-allowed");
243
243
  };
244
244
  i.onmouseover = () => {
245
- i.disabled || (i.style.background = e.saveHover, i.style.boxShadow = d ? "0 2px 8px rgba(59, 130, 246, 0.35)" : "0 2px 8px rgba(0, 102, 204, 0.3)");
245
+ i.disabled || (i.style.background = e.saveHover, i.style.boxShadow = l ? "0 2px 8px rgba(59, 130, 246, 0.35)" : "0 2px 8px rgba(0, 102, 204, 0.3)");
246
246
  }, i.onmouseout = () => {
247
247
  i.disabled || (i.style.background = e.saveBg, i.style.boxShadow = "none");
248
248
  }, v.appendChild(g), v.appendChild(i), o.oninput = () => {
249
- const n = o.value;
250
- if ($(), n.trim()) {
251
- const k = A(n);
252
- k.valid ? b.has(n) ? (l = `Anchor ID already exists: ${n}`, p.textContent = "⚠ " + l, p.style.display = "block", o.style.borderColor = e.fieldErrorBorder, o.style.background = e.fieldErrorBg) : (l = "", p.style.display = "none", o.style.borderColor = e.fieldBorder, o.style.background = e.fieldBg) : (l = k.error, p.textContent = "⚠ " + l, p.style.display = "block", o.style.borderColor = e.fieldErrorBorder, o.style.background = e.fieldErrorBg);
249
+ const r = o.value;
250
+ if ($(), r.trim()) {
251
+ const k = A(r);
252
+ k.valid ? b.has(r) ? (d = `Anchor ID already exists: ${r}`, p.textContent = "⚠ " + d, p.style.display = "block", o.style.borderColor = e.fieldErrorBorder, o.style.background = e.fieldErrorBg) : (d = "", p.style.display = "none", o.style.borderColor = e.fieldBorder, o.style.background = e.fieldBg) : (d = k.error, p.textContent = "⚠ " + d, p.style.display = "block", o.style.borderColor = e.fieldErrorBorder, o.style.background = e.fieldErrorBg);
253
253
  } else
254
254
  p.style.display = "none", o.style.borderColor = e.fieldBorder, o.style.background = e.fieldBg;
255
255
  }, o.onfocus = () => {
256
- o.style.borderColor = l ? e.fieldErrorBorder : e.saveBg, o.style.boxShadow = l ? `0 0 0 3px ${e.errorRing}` : `0 0 0 3px ${e.focusRing}`, o.style.background = l ? e.fieldErrorBg : e.fieldFocusBg;
256
+ o.style.borderColor = d ? e.fieldErrorBorder : e.saveBg, o.style.boxShadow = d ? `0 0 0 3px ${e.errorRing}` : `0 0 0 3px ${e.focusRing}`, o.style.background = d ? e.fieldErrorBg : e.fieldFocusBg;
257
257
  }, o.onblur = () => {
258
- o.style.boxShadow = "none", l || (o.style.background = e.fieldBg);
258
+ o.style.boxShadow = "none", d || (o.style.background = e.fieldBg);
259
259
  };
260
260
  const T = () => {
261
- const n = o.value.trim();
262
- !n || !A(n).valid || b.has(n) || (s && s(n), r.remove());
261
+ const r = o.value.trim();
262
+ !r || !A(r).valid || b.has(r) || (s && s(r), n.remove());
263
263
  }, E = () => {
264
- r.remove();
264
+ n.remove();
265
265
  };
266
- i.onclick = T, g.onclick = E, f.onclick = E, o.onkeydown = (n) => {
267
- n.key === "Enter" ? (n.preventDefault(), T()) : n.key === "Escape" && (n.preventDefault(), E());
268
- }, r.onclick = (n) => {
269
- n.target === r && E();
270
- }, u.appendChild(h), u.appendChild(C), u.appendChild(v), r.appendChild(u), document.body.appendChild(r), setTimeout(() => o.focus(), 100);
266
+ i.onclick = T, g.onclick = E, f.onclick = E, o.onkeydown = (r) => {
267
+ r.key === "Enter" ? (r.preventDefault(), T()) : r.key === "Escape" && (r.preventDefault(), E());
268
+ }, n.onclick = (r) => {
269
+ r.target === n && E();
270
+ }, u.appendChild(h), u.appendChild(C), u.appendChild(v), n.appendChild(u), document.body.appendChild(n), setTimeout(() => o.focus(), 100);
271
271
  }
272
272
  function L(t, c) {
273
273
  let s;
274
274
  if (c)
275
275
  s = c;
276
276
  else {
277
- const l = window.getSelection();
278
- if (!l || l.rangeCount === 0) return;
279
- s = l.getRangeAt(0);
277
+ const d = window.getSelection();
278
+ if (!d || d.rangeCount === 0) return;
279
+ s = d.getRangeAt(0);
280
280
  }
281
- let a = null, d = s.startContainer;
282
- for (; d && d !== document.body; ) {
283
- if (d.nodeType === Node.ELEMENT_NODE) {
284
- const l = d;
285
- if (l.getAttribute("contenteditable") === "true") {
286
- a = l;
281
+ let a = null, l = s.startContainer;
282
+ for (; l && l !== document.body; ) {
283
+ if (l.nodeType === Node.ELEMENT_NODE) {
284
+ const d = l;
285
+ if (d.getAttribute("contenteditable") === "true") {
286
+ a = d;
287
287
  break;
288
288
  }
289
289
  }
290
- d = d.parentNode;
290
+ l = l.parentNode;
291
291
  }
292
- const e = a?.innerHTML ?? "", r = document.createElement("span");
293
- r.id = t, r.className = "rte-anchor", r.setAttribute("data-type", "anchor"), r.setAttribute("data-anchor-id", t), r.setAttribute("title", `Anchor: ${t}`), r.style.cssText = `
292
+ const e = a?.innerHTML ?? "", n = document.createElement("span");
293
+ n.id = t, n.className = "rte-anchor", n.setAttribute("data-type", "anchor"), n.setAttribute("data-anchor-id", t), n.setAttribute("title", `Anchor: ${t}`), n.style.cssText = `
294
294
  display: inline;
295
295
  position: relative;
296
296
  cursor: pointer;
297
- `, s.insertNode(r), b.add(t), s.setStart(r.nextSibling || r.parentNode, 0), s.collapse(!0);
297
+ `, s.insertNode(n), b.add(t), s.setStart(n.nextSibling || n.parentNode, 0), s.collapse(!0);
298
298
  const u = window.getSelection();
299
299
  if (u && (u.removeAllRanges(), u.addRange(s)), a)
300
- R(a, e), a.dispatchEvent(new Event("input", { bubbles: !0 }));
300
+ M(a, e), a.dispatchEvent(new Event("input", { bubbles: !0 }));
301
301
  else {
302
- const l = D();
303
- if (l) {
304
- const h = S(l);
302
+ const d = D();
303
+ if (d) {
304
+ const h = S(d);
305
305
  h && h.dispatchEvent(new Event("input", { bubbles: !0 }));
306
306
  }
307
307
  }
@@ -390,13 +390,13 @@ function N() {
390
390
  }
391
391
  `, document.head.appendChild(t);
392
392
  }
393
- const j = () => (typeof window < "u" && (M(), N()), {
393
+ const j = () => (typeof window < "u" && (H(), N()), {
394
394
  name: "anchor",
395
395
  toolbar: [
396
396
  {
397
397
  label: "Anchor",
398
398
  command: "insertAnchor",
399
- icon: '<svg width="24px" height="24px" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"><g id="SVGRepo_bgCarrier" stroke-width="0"></g><g id="SVGRepo_tracerCarrier" stroke-linecap="round" stroke-linejoin="round"></g><g id="SVGRepo_iconCarrier"> <path d="M12 8.4C13.4912 8.4 14.7 7.19117 14.7 5.7C14.7 4.20883 13.4912 3 12 3C10.5088 3 9.3 4.20883 9.3 5.7C9.3 7.19117 10.5088 8.4 12 8.4ZM12 8.4V20.9999M12 20.9999C9.61305 20.9999 7.32387 20.0518 5.63604 18.364C3.94821 16.6761 3 14.3869 3 12H5M12 20.9999C14.3869 20.9999 16.6761 20.0518 18.364 18.364C20.0518 16.6761 21 14.3869 21 12H19" stroke="#000000" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"></path> </g></svg>',
399
+ 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 d="M12 8.4C13.4912 8.4 14.7 7.19117 14.7 5.7C14.7 4.20883 13.4912 3 12 3C10.5088 3 9.3 4.20883 9.3 5.7C9.3 7.19117 10.5088 8.4 12 8.4ZM12 8.4V20.9999M12 20.9999C9.61305 20.9999 7.32387 20.0518 5.63604 18.364C3.94821 16.6761 3 14.3869 3 12H5M12 20.9999C14.3869 20.9999 16.6761 20.0518 18.364 18.364C20.0518 16.6761 21 14.3869 21 12H19" stroke="#000000" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"></path> </g></svg>',
400
400
  shortcut: "Mod-Shift-k"
401
401
  }
402
402
  ],
@@ -407,7 +407,7 @@ const j = () => (typeof window < "u" && (M(), N()), {
407
407
  if (!t || t.rangeCount === 0)
408
408
  return alert("Please place your cursor where you want to insert the anchor."), !1;
409
409
  const c = t.getRangeAt(0).cloneRange();
410
- return I("add", "", (s) => {
410
+ return _("add", "", (s) => {
411
411
  L(s, c);
412
412
  }, c), !0;
413
413
  } catch (t) {
@@ -1 +1 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const d='.rte-content, .editora-content, [contenteditable="true"]',L="[data-editora-editor], .rte-editor, .editora-editor, editora-editor",T=["p","div","h1","h2","h3","h4","h5","h6","ul","ol","blockquote","pre","table"].join(",");function E(e){return e?e.nodeType===Node.ELEMENT_NODE?e:e.parentElement:null}function w(e){const t=e?.contentElement;if(t instanceof HTMLElement)return t;const n=e?.editorElement;if(n instanceof HTMLElement){const c=n.querySelector(d);if(c instanceof HTMLElement)return c;if(n.getAttribute("contenteditable")==="true")return n}const o=window.getSelection();if(o&&o.rangeCount>0){const c=E(o.getRangeAt(0).startContainer),i=c?.closest(d);if(i instanceof HTMLElement)return i;const f=c?.closest(L)?.querySelector(d);if(f instanceof HTMLElement)return f}const s=document.activeElement?.closest(d);return s instanceof HTMLElement?s:document.querySelector(d)}function B(e){const t=window.getSelection();if(!t||t.rangeCount===0)return null;const n=t.getRangeAt(0);return!e.contains(n.startContainer)||!e.contains(n.endContainer)?null:n}function C(e,t){let n=E(t);if(!n||n===e||!e.contains(n))return null;for(;n.parentElement&&n.parentElement!==e;)n=n.parentElement;if(n.parentElement!==e)return null;if(n.matches(T))return n;const o=n.closest(T);return o instanceof HTMLElement&&o.parentElement===e?o:n}function N(e,t){if(typeof e.intersectsNode=="function")try{return e.intersectsNode(t)}catch{return!1}const n=document.createRange();return n.selectNode(t),e.compareBoundaryPoints(Range.END_TO_START,n)<0&&e.compareBoundaryPoints(Range.START_TO_END,n)>0}function b(e,t){const n=C(e,t.startContainer),o=C(e,t.endContainer);if(!n)return[];if(!o||n===o)return[n];const s=Array.from(e.children).filter(c=>c instanceof HTMLElement).filter(c=>N(t,c));return s.length>0?s:[n]}function k(e,t){const o=E(t)?.closest("blockquote");return o instanceof HTMLQuoteElement&&e.contains(o)?o:null}function v(e){return e.tagName!=="P"||e.attributes.length>0||(e.textContent||"").trim()!==""?!1:!e.querySelector("img, video, table, iframe, hr, pre, ul, ol")}function M(e){Array.from(e.children).forEach(t=>{v(t)&&t.remove()})}function p(e){M(e);const t=e.parentNode;if(!t)return;Array.from(e.childNodes).forEach(o=>{t.insertBefore(o,e)}),t.removeChild(e)}function y(e){return e.nodeType===Node.TEXT_NODE&&(e.textContent||"").trim()===""}function S(e){const t=Array.from(e.childNodes).filter(o=>!y(o));if(t.length!==1)return null;const n=t[0];return n instanceof HTMLQuoteElement?n:null}function R(e){const t=document.createElement("blockquote");return Array.from(e.childNodes).filter(o=>!y(o)).forEach(o=>{t.appendChild(o)}),t.childNodes.length||(t.innerHTML="<br>"),e.appendChild(t),t}function q(e,t){const n=Array.from(e.querySelectorAll("li")).filter(r=>r instanceof HTMLLIElement&&N(t,r)),o=new Set(n);return n.filter(r=>{let s=r.parentElement?.closest("li");for(;s;){if(o.has(s))return!1;s=s.parentElement?.closest("li")}return!0})}function m(e){const t=window.getSelection();if(!t)return;const n=document.createRange(),o=e instanceof HTMLElement&&e.querySelector("p,li,h1,h2,h3,h4,h5,h6")||e;n.selectNodeContents(o),n.collapse(!0),t.removeAllRanges(),t.addRange(n)}function O(e){e.dispatchEvent(new Event("input",{bubbles:!0}))}function x(e,t,n){const o=window.execEditorCommand;if(typeof o=="function"){o("recordDomTransaction",e,t,n);return}const r=window.executeEditorCommand;typeof r=="function"&&r("recordDomTransaction",{editor:e,beforeHTML:t,afterHTML:n})}function A(e){const t=w(e);if(!t)return!1;const n=B(t);if(!n)return!1;const o=t.innerHTML,r=k(t,n.startContainer),s=k(t,n.endContainer),c=q(t,n),i=b(t,n),h=i.length>0&&i.every(l=>l.tagName==="BLOCKQUOTE");if(r&&r===s){const l=r.firstChild||r;p(r),m(l)}else if(c.length>0){const l=c.map(S);if(l.every(Boolean)){const u=l[0]?.firstChild||c[0];l.forEach(a=>{a&&p(a)}),m(u)}else{const u=c[0];c.forEach(a=>{S(a)||R(a)}),m(u)}}else if(h){const l=i[0].firstChild||i[0];i.forEach(p),m(l)}else{const l=i.filter(a=>a.tagName!=="BLOCKQUOTE");if(l.length===0)return!1;const g=document.createElement("blockquote"),u=l[0];u.parentNode?.insertBefore(g,u),l.forEach(a=>{g.appendChild(a)}),m(g)}const f=t.innerHTML;return o===f?!1:(x(t,o,f),O(t),!0)}const _=()=>({name:"blockquote",nodes:{blockquote:{content:"block+",group:"block",parseDOM:[{tag:"blockquote"}],toDOM:()=>["blockquote",0]}},toolbar:[{label:"Quote",command:"toggleBlockquote",icon:'<svg fill="#000000" height="24px" width="24px" version="1.1" id="Icons" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 32 32" xml:space="preserve"><g id="SVGRepo_bgCarrier" stroke-width="0"></g><g id="SVGRepo_tracerCarrier" stroke-linecap="round" stroke-linejoin="round"></g><g id="SVGRepo_iconCarrier"> <g> <path d="M13,11c0.6,0,1-0.4,1-1s-0.4-1-1-1c-5,0-9,4-9,9c0,2.8,2.2,5,5,5s5-2.2,5-5s-2.2-5-5-5c-0.3,0-0.7,0-1,0.1 C9.3,11.8,11,11,13,11z"></path> <path d="M23,13c-0.3,0-0.7,0-1,0.1c1.3-1.3,3-2.1,5-2.1c0.6,0,1-0.4,1-1s-0.4-1-1-1c-5,0-9,4-9,9c0,2.8,2.2,5,5,5s5-2.2,5-5 S25.8,13,23,13z"></path> </g> </g></svg>',shortcut:"Mod-Shift-9"}],commands:{toggleBlockquote:(e,t)=>A(t)},keymap:{"Mod-Shift-9":"toggleBlockquote"}});exports.BlockquotePlugin=_;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const d='.rte-content, .editora-content, [contenteditable="true"]',S="[data-editora-editor], .rte-editor, .editora-editor, editora-editor",T=["p","div","h1","h2","h3","h4","h5","h6","ul","ol","blockquote","pre","table"].join(",");function p(e){return e?e.nodeType===Node.ELEMENT_NODE?e:e.parentElement:null}function w(e){const t=e?.contentElement;if(t instanceof HTMLElement)return t;const n=e?.editorElement;if(n instanceof HTMLElement){const c=n.querySelector(d);if(c instanceof HTMLElement)return c;if(n.getAttribute("contenteditable")==="true")return n}const o=window.getSelection();if(o&&o.rangeCount>0){const c=p(o.getRangeAt(0).startContainer),i=c?.closest(d);if(i instanceof HTMLElement)return i;const f=c?.closest(S)?.querySelector(d);if(f instanceof HTMLElement)return f}const s=document.activeElement?.closest(d);return s instanceof HTMLElement?s:document.querySelector(d)}function B(e){const t=window.getSelection();if(!t||t.rangeCount===0)return null;const n=t.getRangeAt(0);return!e.contains(n.startContainer)||!e.contains(n.endContainer)?null:n}function C(e,t){let n=p(t);if(!n||n===e||!e.contains(n))return null;for(;n.parentElement&&n.parentElement!==e;)n=n.parentElement;if(n.parentElement!==e)return null;if(n.matches(T))return n;const o=n.closest(T);return o instanceof HTMLElement&&o.parentElement===e?o:n}function y(e,t){if(typeof e.intersectsNode=="function")try{return e.intersectsNode(t)}catch{return!1}const n=document.createRange();return n.selectNode(t),e.compareBoundaryPoints(Range.END_TO_START,n)<0&&e.compareBoundaryPoints(Range.START_TO_END,n)>0}function v(e,t){const n=C(e,t.startContainer),o=C(e,t.endContainer);if(!n)return[];if(!o||n===o)return[n];const s=Array.from(e.children).filter(c=>c instanceof HTMLElement).filter(c=>y(t,c));return s.length>0?s:[n]}function k(e,t){const o=p(t)?.closest("blockquote");return o instanceof HTMLQuoteElement&&e.contains(o)?o:null}function b(e){return e.tagName!=="P"||e.attributes.length>0||(e.textContent||"").trim()!==""?!1:!e.querySelector("img, video, table, iframe, hr, pre, ul, ol")}function M(e){Array.from(e.children).forEach(t=>{b(t)&&t.remove()})}function E(e){M(e);const t=e.parentNode;if(!t)return;Array.from(e.childNodes).forEach(o=>{t.insertBefore(o,e)}),t.removeChild(e)}function L(e){return e.nodeType===Node.TEXT_NODE&&(e.textContent||"").trim()===""}function N(e){const t=Array.from(e.childNodes).filter(o=>!L(o));if(t.length!==1)return null;const n=t[0];return n instanceof HTMLQuoteElement?n:null}function q(e){const t=document.createElement("blockquote");return Array.from(e.childNodes).filter(o=>!L(o)).forEach(o=>{t.appendChild(o)}),t.childNodes.length||(t.innerHTML="<br>"),e.appendChild(t),t}function O(e,t){const n=Array.from(e.querySelectorAll("li")).filter(r=>r instanceof HTMLLIElement&&y(t,r)),o=new Set(n);return n.filter(r=>{let s=r.parentElement?.closest("li");for(;s;){if(o.has(s))return!1;s=s.parentElement?.closest("li")}return!0})}function m(e){const t=window.getSelection();if(!t)return;const n=document.createRange(),o=e instanceof HTMLElement&&e.querySelector("p,li,h1,h2,h3,h4,h5,h6")||e;n.selectNodeContents(o),n.collapse(!0),t.removeAllRanges(),t.addRange(n)}function x(e){e.dispatchEvent(new Event("input",{bubbles:!0}))}function R(e,t,n){const o=window.execEditorCommand;if(typeof o=="function"){o("recordDomTransaction",e,t,n);return}const r=window.executeEditorCommand;typeof r=="function"&&r("recordDomTransaction",{editor:e,beforeHTML:t,afterHTML:n})}function A(e){const t=w(e);if(!t)return!1;const n=B(t);if(!n)return!1;const o=t.innerHTML,r=k(t,n.startContainer),s=k(t,n.endContainer),c=O(t,n),i=v(t,n),h=i.length>0&&i.every(l=>l.tagName==="BLOCKQUOTE");if(r&&r===s){const l=r.firstChild||r;E(r),m(l)}else if(c.length>0){const l=c.map(N);if(l.every(Boolean)){const u=l[0]?.firstChild||c[0];l.forEach(a=>{a&&E(a)}),m(u)}else{const u=c[0];c.forEach(a=>{N(a)||q(a)}),m(u)}}else if(h){const l=i[0].firstChild||i[0];i.forEach(E),m(l)}else{const l=i.filter(a=>a.tagName!=="BLOCKQUOTE");if(l.length===0)return!1;const g=document.createElement("blockquote"),u=l[0];u.parentNode?.insertBefore(g,u),l.forEach(a=>{g.appendChild(a)}),m(g)}const f=t.innerHTML;return o===f?!1:(R(t,o,f),x(t),!0)}const H=()=>({name:"blockquote",nodes:{blockquote:{content:"block+",group:"block",parseDOM:[{tag:"blockquote"}],toDOM:()=>["blockquote",0]}},toolbar:[{label:"Quote",command:"toggleBlockquote",icon:'<svg fill="#000000" height="24px" width="24px" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 32 32" xml:space="preserve"><g stroke-width="0"></g><g stroke-linecap="round" stroke-linejoin="round"></g><g> <g> <path d="M13,11c0.6,0,1-0.4,1-1s-0.4-1-1-1c-5,0-9,4-9,9c0,2.8,2.2,5,5,5s5-2.2,5-5s-2.2-5-5-5c-0.3,0-0.7,0-1,0.1 C9.3,11.8,11,11,13,11z"></path> <path d="M23,13c-0.3,0-0.7,0-1,0.1c1.3-1.3,3-2.1,5-2.1c0.6,0,1-0.4,1-1s-0.4-1-1-1c-5,0-9,4-9,9c0,2.8,2.2,5,5,5s5-2.2,5-5 S25.8,13,23,13z"></path> </g> </g></svg>',shortcut:"Mod-Shift-9"}],commands:{toggleBlockquote:(e,t)=>A(t)},keymap:{"Mod-Shift-9":"toggleBlockquote"}});exports.BlockquotePlugin=H;
@@ -1,4 +1,4 @@
1
- const d = '.rte-content, .editora-content, [contenteditable="true"]', w = "[data-editora-editor], .rte-editor, .editora-editor, editora-editor", T = [
1
+ const d = '.rte-content, .editora-content, [contenteditable="true"]', y = "[data-editora-editor], .rte-editor, .editora-editor, editora-editor", T = [
2
2
  "p",
3
3
  "div",
4
4
  "h1",
@@ -13,10 +13,10 @@ const d = '.rte-content, .editora-content, [contenteditable="true"]', w = "[data
13
13
  "pre",
14
14
  "table"
15
15
  ].join(",");
16
- function E(e) {
16
+ function p(e) {
17
17
  return e ? e.nodeType === Node.ELEMENT_NODE ? e : e.parentElement : null;
18
18
  }
19
- function y(e) {
19
+ function S(e) {
20
20
  const t = e?.contentElement;
21
21
  if (t instanceof HTMLElement) return t;
22
22
  const n = e?.editorElement;
@@ -27,9 +27,9 @@ function y(e) {
27
27
  }
28
28
  const o = window.getSelection();
29
29
  if (o && o.rangeCount > 0) {
30
- const c = E(o.getRangeAt(0).startContainer), i = c?.closest(d);
30
+ const c = p(o.getRangeAt(0).startContainer), i = c?.closest(d);
31
31
  if (i instanceof HTMLElement) return i;
32
- const f = c?.closest(w)?.querySelector(d);
32
+ const f = c?.closest(y)?.querySelector(d);
33
33
  if (f instanceof HTMLElement) return f;
34
34
  }
35
35
  const s = document.activeElement?.closest(d);
@@ -42,7 +42,7 @@ function B(e) {
42
42
  return !e.contains(n.startContainer) || !e.contains(n.endContainer) ? null : n;
43
43
  }
44
44
  function C(e, t) {
45
- let n = E(t);
45
+ let n = p(t);
46
46
  if (!n || n === e || !e.contains(n)) return null;
47
47
  for (; n.parentElement && n.parentElement !== e; )
48
48
  n = n.parentElement;
@@ -51,7 +51,7 @@ function C(e, t) {
51
51
  const o = n.closest(T);
52
52
  return o instanceof HTMLElement && o.parentElement === e ? o : n;
53
53
  }
54
- function S(e, t) {
54
+ function L(e, t) {
55
55
  if (typeof e.intersectsNode == "function")
56
56
  try {
57
57
  return e.intersectsNode(t);
@@ -61,53 +61,53 @@ function S(e, t) {
61
61
  const n = document.createRange();
62
62
  return n.selectNode(t), e.compareBoundaryPoints(Range.END_TO_START, n) < 0 && e.compareBoundaryPoints(Range.START_TO_END, n) > 0;
63
63
  }
64
- function b(e, t) {
64
+ function v(e, t) {
65
65
  const n = C(e, t.startContainer), o = C(e, t.endContainer);
66
66
  if (!n) return [];
67
67
  if (!o || n === o) return [n];
68
68
  const s = Array.from(e.children).filter(
69
69
  (c) => c instanceof HTMLElement
70
- ).filter((c) => S(t, c));
70
+ ).filter((c) => L(t, c));
71
71
  return s.length > 0 ? s : [n];
72
72
  }
73
73
  function k(e, t) {
74
- const o = E(t)?.closest("blockquote");
74
+ const o = p(t)?.closest("blockquote");
75
75
  return o instanceof HTMLQuoteElement && e.contains(o) ? o : null;
76
76
  }
77
- function v(e) {
77
+ function b(e) {
78
78
  return e.tagName !== "P" || e.attributes.length > 0 || (e.textContent || "").trim() !== "" ? !1 : !e.querySelector("img, video, table, iframe, hr, pre, ul, ol");
79
79
  }
80
- function R(e) {
80
+ function M(e) {
81
81
  Array.from(e.children).forEach((t) => {
82
- v(t) && t.remove();
82
+ b(t) && t.remove();
83
83
  });
84
84
  }
85
- function p(e) {
86
- R(e);
85
+ function E(e) {
86
+ M(e);
87
87
  const t = e.parentNode;
88
88
  if (!t) return;
89
89
  Array.from(e.childNodes).forEach((o) => {
90
90
  t.insertBefore(o, e);
91
91
  }), t.removeChild(e);
92
92
  }
93
- function L(e) {
93
+ function w(e) {
94
94
  return e.nodeType === Node.TEXT_NODE && (e.textContent || "").trim() === "";
95
95
  }
96
96
  function N(e) {
97
- const t = Array.from(e.childNodes).filter((o) => !L(o));
97
+ const t = Array.from(e.childNodes).filter((o) => !w(o));
98
98
  if (t.length !== 1) return null;
99
99
  const n = t[0];
100
100
  return n instanceof HTMLQuoteElement ? n : null;
101
101
  }
102
- function M(e) {
102
+ function x(e) {
103
103
  const t = document.createElement("blockquote");
104
- return Array.from(e.childNodes).filter((o) => !L(o)).forEach((o) => {
104
+ return Array.from(e.childNodes).filter((o) => !w(o)).forEach((o) => {
105
105
  t.appendChild(o);
106
106
  }), t.childNodes.length || (t.innerHTML = "<br>"), e.appendChild(t), t;
107
107
  }
108
- function x(e, t) {
108
+ function q(e, t) {
109
109
  const n = Array.from(e.querySelectorAll("li")).filter(
110
- (r) => r instanceof HTMLLIElement && S(t, r)
110
+ (r) => r instanceof HTMLLIElement && L(t, r)
111
111
  ), o = new Set(n);
112
112
  return n.filter((r) => {
113
113
  let s = r.parentElement?.closest("li");
@@ -124,10 +124,10 @@ function m(e) {
124
124
  const n = document.createRange(), o = e instanceof HTMLElement && e.querySelector("p,li,h1,h2,h3,h4,h5,h6") || e;
125
125
  n.selectNodeContents(o), n.collapse(!0), t.removeAllRanges(), t.addRange(n);
126
126
  }
127
- function q(e) {
127
+ function O(e) {
128
128
  e.dispatchEvent(new Event("input", { bubbles: !0 }));
129
129
  }
130
- function O(e, t, n) {
130
+ function R(e, t, n) {
131
131
  const o = window.execEditorCommand;
132
132
  if (typeof o == "function") {
133
133
  o("recordDomTransaction", e, t, n);
@@ -137,30 +137,30 @@ function O(e, t, n) {
137
137
  typeof r == "function" && r("recordDomTransaction", { editor: e, beforeHTML: t, afterHTML: n });
138
138
  }
139
139
  function A(e) {
140
- const t = y(e);
140
+ const t = S(e);
141
141
  if (!t) return !1;
142
142
  const n = B(t);
143
143
  if (!n) return !1;
144
- const o = t.innerHTML, r = k(t, n.startContainer), s = k(t, n.endContainer), c = x(t, n), i = b(t, n), h = i.length > 0 && i.every((l) => l.tagName === "BLOCKQUOTE");
144
+ const o = t.innerHTML, r = k(t, n.startContainer), s = k(t, n.endContainer), c = q(t, n), i = v(t, n), h = i.length > 0 && i.every((l) => l.tagName === "BLOCKQUOTE");
145
145
  if (r && r === s) {
146
146
  const l = r.firstChild || r;
147
- p(r), m(l);
147
+ E(r), m(l);
148
148
  } else if (c.length > 0) {
149
149
  const l = c.map(N);
150
150
  if (l.every(Boolean)) {
151
151
  const u = l[0]?.firstChild || c[0];
152
152
  l.forEach((a) => {
153
- a && p(a);
153
+ a && E(a);
154
154
  }), m(u);
155
155
  } else {
156
156
  const u = c[0];
157
157
  c.forEach((a) => {
158
- N(a) || M(a);
158
+ N(a) || x(a);
159
159
  }), m(u);
160
160
  }
161
161
  } else if (h) {
162
162
  const l = i[0].firstChild || i[0];
163
- i.forEach(p), m(l);
163
+ i.forEach(E), m(l);
164
164
  } else {
165
165
  const l = i.filter((a) => a.tagName !== "BLOCKQUOTE");
166
166
  if (l.length === 0) return !1;
@@ -170,7 +170,7 @@ function A(e) {
170
170
  }), m(g);
171
171
  }
172
172
  const f = t.innerHTML;
173
- return o === f ? !1 : (O(t, o, f), q(t), !0);
173
+ return o === f ? !1 : (R(t, o, f), O(t), !0);
174
174
  }
175
175
  const H = () => ({
176
176
  name: "blockquote",
@@ -188,7 +188,7 @@ const H = () => ({
188
188
  {
189
189
  label: "Quote",
190
190
  command: "toggleBlockquote",
191
- icon: '<svg fill="#000000" height="24px" width="24px" version="1.1" id="Icons" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 32 32" xml:space="preserve"><g id="SVGRepo_bgCarrier" stroke-width="0"></g><g id="SVGRepo_tracerCarrier" stroke-linecap="round" stroke-linejoin="round"></g><g id="SVGRepo_iconCarrier"> <g> <path d="M13,11c0.6,0,1-0.4,1-1s-0.4-1-1-1c-5,0-9,4-9,9c0,2.8,2.2,5,5,5s5-2.2,5-5s-2.2-5-5-5c-0.3,0-0.7,0-1,0.1 C9.3,11.8,11,11,13,11z"></path> <path d="M23,13c-0.3,0-0.7,0-1,0.1c1.3-1.3,3-2.1,5-2.1c0.6,0,1-0.4,1-1s-0.4-1-1-1c-5,0-9,4-9,9c0,2.8,2.2,5,5,5s5-2.2,5-5 S25.8,13,23,13z"></path> </g> </g></svg>',
191
+ icon: '<svg fill="#000000" height="24px" width="24px" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 32 32" xml:space="preserve"><g stroke-width="0"></g><g stroke-linecap="round" stroke-linejoin="round"></g><g> <g> <path d="M13,11c0.6,0,1-0.4,1-1s-0.4-1-1-1c-5,0-9,4-9,9c0,2.8,2.2,5,5,5s5-2.2,5-5s-2.2-5-5-5c-0.3,0-0.7,0-1,0.1 C9.3,11.8,11,11,13,11z"></path> <path d="M23,13c-0.3,0-0.7,0-1,0.1c1.3-1.3,3-2.1,5-2.1c0.6,0,1-0.4,1-1s-0.4-1-1-1c-5,0-9,4-9,9c0,2.8,2.2,5,5,5s5-2.2,5-5 S25.8,13,23,13z"></path> </g> </g></svg>',
192
192
  shortcut: "Mod-Shift-9"
193
193
  }
194
194
  ],
@@ -1 +1 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const f='.rte-content, .editora-content, [contenteditable="true"]',w="[data-editora-editor], .rte-editor, .editora-editor, editora-editor",h=t=>t?t.nodeType===Node.ELEMENT_NODE?t:t.parentElement:null,v=t=>{const e=t?.contentElement;if(e instanceof HTMLElement)return e;const n=t?.editorElement;if(n instanceof HTMLElement){const s=n.querySelector(f);if(s instanceof HTMLElement)return s;if(n.getAttribute("contenteditable")==="true")return n}const r=window.__editoraCommandEditorRoot;if(r instanceof HTMLElement){const s=r.querySelector(f);if(s instanceof HTMLElement)return s;if(r.getAttribute("contenteditable")==="true")return r}const c=window.getSelection();if(c&&c.rangeCount>0){const s=h(c.getRangeAt(0).startContainer),i=s?.closest(f);if(i instanceof HTMLElement)return i;const a=s?.closest(w)?.querySelector(f);if(a instanceof HTMLElement)return a}const l=document.activeElement,u=l instanceof HTMLElement?l.closest(f):null;return u instanceof HTMLElement?u:document.querySelector(f)},R=t=>{const e=window.getSelection();if(!e||e.rangeCount===0||e.isCollapsed)return null;const n=e.getRangeAt(0);return!t.contains(n.startContainer)||!t.contains(n.endContainer)?null:n},S=(t,e)=>{if(!e.data)return!1;if(typeof t.intersectsNode=="function")try{return t.intersectsNode(e)}catch{return!1}const n=document.createRange();return n.selectNodeContents(e),t.compareBoundaryPoints(Range.END_TO_START,n)<0&&t.compareBoundaryPoints(Range.START_TO_END,n)>0},L=(t,e)=>{const n=[],r=document.createTreeWalker(t,NodeFilter.SHOW_TEXT);let c=r.nextNode();for(;c;){const l=c;if(S(e,l)){const u=l===e.startContainer?e.startOffset:0,s=l===e.endContainer?e.endOffset:l.data.length;u<s&&n.push({node:l,start:u,end:s,text:l.data.slice(u,s)})}c=r.nextNode()}return n},_=t=>new RegExp("\\p{L}","u").test(t),x=t=>/[\p{M}'’-]/u.test(t),y=()=>{let t=!1;return e=>{let n="";return Array.from(e.text).forEach(r=>{if(_(r)){n+=t?r.toLocaleLowerCase():r.toLocaleUpperCase(),t=!0;return}n+=r,x(r)||(t=!1)}),n}},M=t=>{if(t.length===0)return;const e=t[0],n=t[t.length-1],r=window.getSelection();if(!r)return;const c=document.createRange();c.setStart(e.node,e.start),c.setEnd(n.node,n.end),r.removeAllRanges(),r.addRange(c)},b=(t,e,n)=>{if(e!==n){if(typeof window.execEditorCommand=="function"){window.execEditorCommand("recordDomTransaction",t,e,n);return}if(typeof window.executeEditorCommand=="function")try{window.executeEditorCommand("recordDomTransaction",{editor:t,beforeHTML:e,afterHTML:n})}catch{}}},H=()=>{const t=(i,o)=>{try{const a=v(o);if(!a)return!1;const m=R(a);if(!m)return!1;const p=L(a,m);if(p.length===0)return!1;const C=a.innerHTML;p.forEach((d,T)=>{const E=i(d,T);d.node.replaceData(d.start,d.end-d.start,E),d.end=d.start+E.length});const g=a.innerHTML;return C===g?!1:(b(a,C,g),a.dispatchEvent(new window.Event("input",{bubbles:!0})),M(p),!0)}catch(a){return console.error("Failed to transform capitalization:",a),!1}},e=(i,o)=>t(a=>a.text.toLocaleUpperCase(),o),n=(i,o)=>t(a=>a.text.toLocaleLowerCase(),o),r=(i,o)=>t(y(),o),c=(i,o)=>{if(!i)return!1;switch(i){case"uppercase":return e(void 0,o);case"lowercase":return n(void 0,o);case"titlecase":return r(void 0,o);default:return!1}},l=(i,o)=>typeof i=="string"?{value:i,context:o}:typeof o=="string"?{value:o}:{value:void 0,context:o},u=(i,o)=>{if(o&&typeof o=="object"&&!o.doc)return o},s=i=>(o,a)=>i(void 0,u(o,a));return{name:"capitalization",toolbar:[{label:"Capitalization",command:"setCapitalization",type:"inline-menu",options:[{label:"lowercase",value:"lowercase"},{label:"UPPERCASE",value:"uppercase"},{label:"Title Case",value:"titlecase"}],icon:'<svg fill="#000000" width="24" height="24" viewBox="0 0 32.00 32.00" id="icon" xmlns="http://www.w3.org/2000/svg"><g id="SVGRepo_bgCarrier" stroke-width="0"></g><g id="SVGRepo_tracerCarrier" stroke-linecap="round" stroke-linejoin="round" stroke="#CCCCCC" stroke-width="0.192"></g><g id="SVGRepo_iconCarrier"><title>letter--Aa</title><path d="M23,13H18v2h5v2H19a2,2,0,0,0-2,2v2a2,2,0,0,0,2,2h6V15A2,2,0,0,0,23,13Zm0,8H19V19h4Z"></path><path d="M13,9H9a2,2,0,0,0-2,2V23H9V18h4v5h2V11A2,2,0,0,0,13,9ZM9,16V11h4v5Z"></path><rect id="_Transparent_Rectangle_" data-name="&lt;Transparent Rectangle&gt;" fill="none" width="32" height="32"></rect></g></svg>'}],commands:{setCapitalization:(i,o)=>{const{value:a,context:m}=l(i,o);return c(a,m)},toUpperCase:s(e),toLowerCase:s(n),toTitleCase:s(r)},keymap:{"Mod-Shift-u":"toUpperCase","Mod-Shift-k":"toLowerCase","Mod-Shift-t":"toTitleCase"}}};exports.CapitalizationPlugin=H;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const f='.rte-content, .editora-content, [contenteditable="true"]',w="[data-editora-editor], .rte-editor, .editora-editor, editora-editor",h=t=>t?t.nodeType===Node.ELEMENT_NODE?t:t.parentElement:null,v=t=>{const e=t?.contentElement;if(e instanceof HTMLElement)return e;const n=t?.editorElement;if(n instanceof HTMLElement){const s=n.querySelector(f);if(s instanceof HTMLElement)return s;if(n.getAttribute("contenteditable")==="true")return n}const r=window.__editoraCommandEditorRoot;if(r instanceof HTMLElement){const s=r.querySelector(f);if(s instanceof HTMLElement)return s;if(r.getAttribute("contenteditable")==="true")return r}const c=window.getSelection();if(c&&c.rangeCount>0){const s=h(c.getRangeAt(0).startContainer),i=s?.closest(f);if(i instanceof HTMLElement)return i;const a=s?.closest(w)?.querySelector(f);if(a instanceof HTMLElement)return a}const l=document.activeElement,u=l instanceof HTMLElement?l.closest(f):null;return u instanceof HTMLElement?u:document.querySelector(f)},S=t=>{const e=window.getSelection();if(!e||e.rangeCount===0||e.isCollapsed)return null;const n=e.getRangeAt(0);return!t.contains(n.startContainer)||!t.contains(n.endContainer)?null:n},R=(t,e)=>{if(!e.data)return!1;if(typeof t.intersectsNode=="function")try{return t.intersectsNode(e)}catch{return!1}const n=document.createRange();return n.selectNodeContents(e),t.compareBoundaryPoints(Range.END_TO_START,n)<0&&t.compareBoundaryPoints(Range.START_TO_END,n)>0},L=(t,e)=>{const n=[],r=document.createTreeWalker(t,NodeFilter.SHOW_TEXT);let c=r.nextNode();for(;c;){const l=c;if(R(e,l)){const u=l===e.startContainer?e.startOffset:0,s=l===e.endContainer?e.endOffset:l.data.length;u<s&&n.push({node:l,start:u,end:s,text:l.data.slice(u,s)})}c=r.nextNode()}return n},x=t=>new RegExp("\\p{L}","u").test(t),y=t=>/[\p{M}'’-]/u.test(t),M=()=>{let t=!1;return e=>{let n="";return Array.from(e.text).forEach(r=>{if(x(r)){n+=t?r.toLocaleLowerCase():r.toLocaleUpperCase(),t=!0;return}n+=r,y(r)||(t=!1)}),n}},_=t=>{if(t.length===0)return;const e=t[0],n=t[t.length-1],r=window.getSelection();if(!r)return;const c=document.createRange();c.setStart(e.node,e.start),c.setEnd(n.node,n.end),r.removeAllRanges(),r.addRange(c)},H=(t,e,n)=>{if(e!==n){if(typeof window.execEditorCommand=="function"){window.execEditorCommand("recordDomTransaction",t,e,n);return}if(typeof window.executeEditorCommand=="function")try{window.executeEditorCommand("recordDomTransaction",{editor:t,beforeHTML:e,afterHTML:n})}catch{}}},N=()=>{const t=(i,o)=>{try{const a=v(o);if(!a)return!1;const m=S(a);if(!m)return!1;const p=L(a,m);if(p.length===0)return!1;const C=a.innerHTML;p.forEach((d,T)=>{const E=i(d,T);d.node.replaceData(d.start,d.end-d.start,E),d.end=d.start+E.length});const g=a.innerHTML;return C===g?!1:(H(a,C,g),a.dispatchEvent(new window.Event("input",{bubbles:!0})),_(p),!0)}catch(a){return console.error("Failed to transform capitalization:",a),!1}},e=(i,o)=>t(a=>a.text.toLocaleUpperCase(),o),n=(i,o)=>t(a=>a.text.toLocaleLowerCase(),o),r=(i,o)=>t(M(),o),c=(i,o)=>{if(!i)return!1;switch(i){case"uppercase":return e(void 0,o);case"lowercase":return n(void 0,o);case"titlecase":return r(void 0,o);default:return!1}},l=(i,o)=>typeof i=="string"?{value:i,context:o}:typeof o=="string"?{value:o}:{value:void 0,context:o},u=(i,o)=>{if(o&&typeof o=="object"&&!o.doc)return o},s=i=>(o,a)=>i(void 0,u(o,a));return{name:"capitalization",toolbar:[{label:"Capitalization",command:"setCapitalization",type:"inline-menu",options:[{label:"lowercase",value:"lowercase"},{label:"UPPERCASE",value:"uppercase"},{label:"Title Case",value:"titlecase"}],icon:'<svg fill="#000000" width="24" height="24" viewBox="0 0 32.00 32.00" xmlns="http://www.w3.org/2000/svg"><g stroke-width="0"></g><g stroke-linecap="round" stroke-linejoin="round" stroke="#CCCCCC" stroke-width="0.192"></g><g><title>letter--Aa</title><path d="M23,13H18v2h5v2H19a2,2,0,0,0-2,2v2a2,2,0,0,0,2,2h6V15A2,2,0,0,0,23,13Zm0,8H19V19h4Z"></path><path d="M13,9H9a2,2,0,0,0-2,2V23H9V18h4v5h2V11A2,2,0,0,0,13,9ZM9,16V11h4v5Z"></path><rect data-name="&lt;Transparent Rectangle&gt;" fill="none" width="32" height="32"></rect></g></svg>'}],commands:{setCapitalization:(i,o)=>{const{value:a,context:m}=l(i,o);return c(a,m)},toUpperCase:s(e),toLowerCase:s(n),toTitleCase:s(r)},keymap:{"Mod-Shift-u":"toUpperCase","Mod-Shift-k":"toLowerCase","Mod-Shift-t":"toTitleCase"}}};exports.CapitalizationPlugin=N;
@@ -20,14 +20,14 @@ const f = '.rte-content, .editora-content, [contenteditable="true"]', w = "[data
20
20
  const a = s?.closest(w)?.querySelector(f);
21
21
  if (a instanceof HTMLElement) return a;
22
22
  }
23
- const l = document.activeElement, d = l instanceof HTMLElement ? l.closest(f) : null;
24
- return d instanceof HTMLElement ? d : document.querySelector(f);
23
+ const l = document.activeElement, u = l instanceof HTMLElement ? l.closest(f) : null;
24
+ return u instanceof HTMLElement ? u : document.querySelector(f);
25
25
  }, R = (t) => {
26
26
  const e = window.getSelection();
27
27
  if (!e || e.rangeCount === 0 || e.isCollapsed) return null;
28
28
  const n = e.getRangeAt(0);
29
29
  return !t.contains(n.startContainer) || !t.contains(n.endContainer) ? null : n;
30
- }, S = (t, e) => {
30
+ }, L = (t, e) => {
31
31
  if (!e.data) return !1;
32
32
  if (typeof t.intersectsNode == "function")
33
33
  try {
@@ -37,24 +37,24 @@ const f = '.rte-content, .editora-content, [contenteditable="true"]', w = "[data
37
37
  }
38
38
  const n = document.createRange();
39
39
  return n.selectNodeContents(e), t.compareBoundaryPoints(Range.END_TO_START, n) < 0 && t.compareBoundaryPoints(Range.START_TO_END, n) > 0;
40
- }, L = (t, e) => {
40
+ }, S = (t, e) => {
41
41
  const n = [], r = document.createTreeWalker(t, NodeFilter.SHOW_TEXT);
42
42
  let c = r.nextNode();
43
43
  for (; c; ) {
44
44
  const l = c;
45
- if (S(e, l)) {
46
- const d = l === e.startContainer ? e.startOffset : 0, s = l === e.endContainer ? e.endOffset : l.data.length;
47
- d < s && n.push({
45
+ if (L(e, l)) {
46
+ const u = l === e.startContainer ? e.startOffset : 0, s = l === e.endContainer ? e.endOffset : l.data.length;
47
+ u < s && n.push({
48
48
  node: l,
49
- start: d,
49
+ start: u,
50
50
  end: s,
51
- text: l.data.slice(d, s)
51
+ text: l.data.slice(u, s)
52
52
  });
53
53
  }
54
54
  c = r.nextNode();
55
55
  }
56
56
  return n;
57
- }, x = (t) => new RegExp("\\p{L}", "u").test(t), _ = (t) => /[\p{M}'’-]/u.test(t), y = () => {
57
+ }, x = (t) => new RegExp("\\p{L}", "u").test(t), y = (t) => /[\p{M}'’-]/u.test(t), M = () => {
58
58
  let t = !1;
59
59
  return (e) => {
60
60
  let n = "";
@@ -63,16 +63,16 @@ const f = '.rte-content, .editora-content, [contenteditable="true"]', w = "[data
63
63
  n += t ? r.toLocaleLowerCase() : r.toLocaleUpperCase(), t = !0;
64
64
  return;
65
65
  }
66
- n += r, _(r) || (t = !1);
66
+ n += r, y(r) || (t = !1);
67
67
  }), n;
68
68
  };
69
- }, M = (t) => {
69
+ }, H = (t) => {
70
70
  if (t.length === 0) return;
71
71
  const e = t[0], n = t[t.length - 1], r = window.getSelection();
72
72
  if (!r) return;
73
73
  const c = document.createRange();
74
74
  c.setStart(e.node, e.start), c.setEnd(n.node, n.end), r.removeAllRanges(), r.addRange(c);
75
- }, H = (t, e, n) => {
75
+ }, N = (t, e, n) => {
76
76
  if (e !== n) {
77
77
  if (typeof window.execEditorCommand == "function") {
78
78
  window.execEditorCommand("recordDomTransaction", t, e, n);
@@ -84,26 +84,26 @@ const f = '.rte-content, .editora-content, [contenteditable="true"]', w = "[data
84
84
  } catch {
85
85
  }
86
86
  }
87
- }, N = () => {
87
+ }, _ = () => {
88
88
  const t = (i, o) => {
89
89
  try {
90
90
  const a = v(o);
91
91
  if (!a) return !1;
92
92
  const m = R(a);
93
93
  if (!m) return !1;
94
- const p = L(a, m);
94
+ const p = S(a, m);
95
95
  if (p.length === 0) return !1;
96
96
  const C = a.innerHTML;
97
- p.forEach((u, T) => {
98
- const E = i(u, T);
99
- u.node.replaceData(u.start, u.end - u.start, E), u.end = u.start + E.length;
97
+ p.forEach((d, T) => {
98
+ const g = i(d, T);
99
+ d.node.replaceData(d.start, d.end - d.start, g), d.end = d.start + g.length;
100
100
  });
101
- const g = a.innerHTML;
102
- return C === g ? !1 : (H(a, C, g), a.dispatchEvent(new window.Event("input", { bubbles: !0 })), M(p), !0);
101
+ const E = a.innerHTML;
102
+ return C === E ? !1 : (N(a, C, E), a.dispatchEvent(new window.Event("input", { bubbles: !0 })), H(p), !0);
103
103
  } catch (a) {
104
104
  return console.error("Failed to transform capitalization:", a), !1;
105
105
  }
106
- }, e = (i, o) => t((a) => a.text.toLocaleUpperCase(), o), n = (i, o) => t((a) => a.text.toLocaleLowerCase(), o), r = (i, o) => t(y(), o), c = (i, o) => {
106
+ }, e = (i, o) => t((a) => a.text.toLocaleUpperCase(), o), n = (i, o) => t((a) => a.text.toLocaleLowerCase(), o), r = (i, o) => t(M(), o), c = (i, o) => {
107
107
  if (!i) return !1;
108
108
  switch (i) {
109
109
  case "uppercase":
@@ -118,10 +118,10 @@ const f = '.rte-content, .editora-content, [contenteditable="true"]', w = "[data
118
118
  }, l = (i, o) => typeof i == "string" ? { value: i, context: o } : typeof o == "string" ? { value: o } : {
119
119
  value: void 0,
120
120
  context: o
121
- }, d = (i, o) => {
121
+ }, u = (i, o) => {
122
122
  if (o && typeof o == "object" && !o.doc)
123
123
  return o;
124
- }, s = (i) => (o, a) => i(void 0, d(o, a));
124
+ }, s = (i) => (o, a) => i(void 0, u(o, a));
125
125
  return {
126
126
  name: "capitalization",
127
127
  toolbar: [
@@ -139,7 +139,7 @@ const f = '.rte-content, .editora-content, [contenteditable="true"]', w = "[data
139
139
  // block - that style tag applies document-wide once inserted via
140
140
  // raw innerHTML into light-DOM toolbar content, so it can collide
141
141
  // with any other icon reusing the same auto-generated class name.
142
- icon: '<svg fill="#000000" width="24" height="24" viewBox="0 0 32.00 32.00" id="icon" xmlns="http://www.w3.org/2000/svg"><g id="SVGRepo_bgCarrier" stroke-width="0"></g><g id="SVGRepo_tracerCarrier" stroke-linecap="round" stroke-linejoin="round" stroke="#CCCCCC" stroke-width="0.192"></g><g id="SVGRepo_iconCarrier"><title>letter--Aa</title><path d="M23,13H18v2h5v2H19a2,2,0,0,0-2,2v2a2,2,0,0,0,2,2h6V15A2,2,0,0,0,23,13Zm0,8H19V19h4Z"></path><path d="M13,9H9a2,2,0,0,0-2,2V23H9V18h4v5h2V11A2,2,0,0,0,13,9ZM9,16V11h4v5Z"></path><rect id="_Transparent_Rectangle_" data-name="&lt;Transparent Rectangle&gt;" fill="none" width="32" height="32"></rect></g></svg>'
142
+ icon: '<svg fill="#000000" width="24" height="24" viewBox="0 0 32.00 32.00" xmlns="http://www.w3.org/2000/svg"><g stroke-width="0"></g><g stroke-linecap="round" stroke-linejoin="round" stroke="#CCCCCC" stroke-width="0.192"></g><g><title>letter--Aa</title><path d="M23,13H18v2h5v2H19a2,2,0,0,0-2,2v2a2,2,0,0,0,2,2h6V15A2,2,0,0,0,23,13Zm0,8H19V19h4Z"></path><path d="M13,9H9a2,2,0,0,0-2,2V23H9V18h4v5h2V11A2,2,0,0,0,13,9ZM9,16V11h4v5Z"></path><rect data-name="&lt;Transparent Rectangle&gt;" fill="none" width="32" height="32"></rect></g></svg>'
143
143
  }
144
144
  ],
145
145
  commands: {
@@ -159,5 +159,5 @@ const f = '.rte-content, .editora-content, [contenteditable="true"]', w = "[data
159
159
  };
160
160
  };
161
161
  export {
162
- N as CapitalizationPlugin
162
+ _ as CapitalizationPlugin
163
163
  };