@editora/plugins 1.0.12 → 1.0.13

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 (51) hide show
  1. package/dist/approval-workflow.cjs.js +14 -14
  2. package/dist/approval-workflow.esm.js +265 -262
  3. package/dist/blockquote.cjs.js +1 -1
  4. package/dist/blockquote.esm.js +177 -15
  5. package/dist/blocks-library.cjs.js +6 -6
  6. package/dist/blocks-library.esm.js +95 -92
  7. package/dist/bold.cjs.js +1 -1
  8. package/dist/bold.esm.js +10 -6
  9. package/dist/capitalization.cjs.js +1 -1
  10. package/dist/capitalization.esm.js +124 -44
  11. package/dist/checklist.cjs.js +1 -1
  12. package/dist/checklist.esm.js +251 -191
  13. package/dist/citations.cjs.js +4 -4
  14. package/dist/citations.esm.js +131 -128
  15. package/dist/clear-formatting.cjs.js +1 -1
  16. package/dist/clear-formatting.esm.js +68 -36
  17. package/dist/content-rules.cjs.js +5 -5
  18. package/dist/content-rules.esm.js +104 -101
  19. package/dist/data-binding.cjs.js +3 -3
  20. package/dist/data-binding.esm.js +51 -48
  21. package/dist/direction.cjs.js +1 -1
  22. package/dist/direction.esm.js +97 -74
  23. package/dist/doc-schema.cjs.js +4 -4
  24. package/dist/doc-schema.esm.js +104 -101
  25. package/dist/embed-iframe.cjs.js +21 -4
  26. package/dist/embed-iframe.esm.js +279 -116
  27. package/dist/heading.cjs.js +1 -1
  28. package/dist/heading.esm.js +239 -56
  29. package/dist/history.cjs.js +1 -1
  30. package/dist/history.esm.js +74 -89
  31. package/dist/inlineFormatting-DOYOJdnD.js +1 -0
  32. package/dist/inlineFormatting-DuVTGXYG.mjs +95 -0
  33. package/dist/italic.cjs.js +1 -1
  34. package/dist/italic.esm.js +12 -8
  35. package/dist/math.cjs.js +27 -21
  36. package/dist/math.esm.js +218 -146
  37. package/dist/merge-tag.cjs.js +8 -2
  38. package/dist/merge-tag.esm.js +130 -111
  39. package/dist/pii-redaction.cjs.js +6 -6
  40. package/dist/pii-redaction.esm.js +169 -166
  41. package/dist/smart-paste.cjs.js +5 -5
  42. package/dist/smart-paste.esm.js +120 -117
  43. package/dist/special-characters.cjs.js +6 -10
  44. package/dist/special-characters.esm.js +97 -75
  45. package/dist/strikethrough.cjs.js +1 -1
  46. package/dist/strikethrough.esm.js +11 -25
  47. package/dist/translation-workflow.cjs.js +7 -7
  48. package/dist/translation-workflow.esm.js +103 -100
  49. package/dist/underline.cjs.js +1 -1
  50. package/dist/underline.esm.js +7 -3
  51. package/package.json +3 -3
@@ -1,5 +1,5 @@
1
- const v = ".rte-content, .editora-content", fe = "[data-editora-editor], .rte-editor, .editora-editor, editora-editor", ye = "__editoraCommandEditorRoot", he = "rte-blocks-library-styles", u = "rte-blocks-library-panel", E = "blocks-library", B = "blocksLibrary", $ = ':is([data-theme="dark"], .dark, .editora-theme-dark, .rte-theme-dark)';
2
- const Ce = /* @__PURE__ */ new Set(["script", "style", "meta", "link", "object", "embed", "iframe"]), Pe = /^(https?:|mailto:|tel:|#|\/)/i, De = /^data:image\/(?:png|gif|jpeg|jpg|webp);base64,/i, Oe = {
1
+ const v = ".rte-content, .editora-content", fe = "[data-editora-editor], .rte-editor, .editora-editor, editora-editor", ye = "__editoraCommandEditorRoot", he = "rte-blocks-library-styles", u = "rte-blocks-library-panel", E = "blocks-library", C = "blocksLibrary", $ = ':is([data-theme="dark"], .dark, .editora-theme-dark, .rte-theme-dark)';
2
+ const Be = /* @__PURE__ */ new Set(["script", "style", "meta", "link", "object", "embed", "iframe"]), De = /^(https?:|mailto:|tel:|#|\/)/i, Oe = /^data:image\/(?:png|gif|jpeg|jpg|webp);base64,/i, Ke = {
3
3
  panelTitle: "Blocks Library",
4
4
  panelAriaLabel: "Blocks library panel",
5
5
  searchLabel: "Search blocks",
@@ -23,19 +23,19 @@ let X = 0, Ne = 0, ke = 0, M = null, y = null, _ = null, P = null, A = null, D =
23
23
  function m(e) {
24
24
  return e.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&#39;");
25
25
  }
26
- function Ke(e) {
26
+ function je(e) {
27
27
  return e.replace(/\u00A0/g, " ").replace(/\s+/g, " ").trim();
28
28
  }
29
- function je(e) {
29
+ function We(e) {
30
30
  return e.toLowerCase().replace(/[^a-z0-9_-]+/g, "-").replace(/^-+|-+$/g, "").slice(0, 80);
31
31
  }
32
32
  function ce(e) {
33
33
  const t = e.trim();
34
- return t && (Pe.test(t) || De.test(t)) ? t : "";
34
+ return t && (De.test(t) || Oe.test(t)) ? t : "";
35
35
  }
36
36
  function xe(e) {
37
37
  let t = e;
38
- return Ce.forEach((r) => {
38
+ return Be.forEach((r) => {
39
39
  const o = new RegExp(`<${r}[\\s\\S]*?>[\\s\\S]*?<\\/${r}>`, "gi"), l = new RegExp(`<${r}\\b[^>]*\\/?>`, "gi");
40
40
  t = t.replace(o, "").replace(l, "");
41
41
  }), t = t.replace(/\son\w+=(\"[^\"]*\"|'[^']*'|[^\s>]+)/gi, "").replace(/\s(xmlns|xml:[^=\s>]+)\s*=\s*(\"[^\"]*\"|'[^']*'|[^\s>]+)/gi, "").replace(
@@ -60,7 +60,7 @@ function xe(e) {
60
60
  return ` style=${s}${a}${s}`;
61
61
  }).trim(), t;
62
62
  }
63
- function We(e) {
63
+ function Fe(e) {
64
64
  if (!e) return "";
65
65
  if (typeof document > "u")
66
66
  return xe(e);
@@ -69,7 +69,7 @@ function We(e) {
69
69
  const r = t.content;
70
70
  return !r || typeof r.querySelectorAll != "function" ? xe(e) : (Array.from(r.querySelectorAll("*")).forEach((l) => {
71
71
  const n = l.tagName.toLowerCase();
72
- if (Ce.has(n)) {
72
+ if (Be.has(n)) {
73
73
  l.remove();
74
74
  return;
75
75
  }
@@ -97,7 +97,7 @@ function We(e) {
97
97
  function ne(e) {
98
98
  return e.trim().toLowerCase();
99
99
  }
100
- function Fe(e) {
100
+ function Ge(e) {
101
101
  if (!e) return "";
102
102
  if (typeof document > "u")
103
103
  return e.replace(/<[^>]*>/g, " ").replace(/\s+/g, " ").trim();
@@ -106,18 +106,18 @@ function Fe(e) {
106
106
  const r = t.content;
107
107
  return !r || typeof r.textContent != "string" ? e.replace(/<[^>]*>/g, " ").replace(/\s+/g, " ").trim() : r.textContent.replace(/\s+/g, " ").trim();
108
108
  }
109
- function Be(e, t) {
109
+ function Ce(e, t) {
110
110
  if (!Array.isArray(e) || e.length === 0) return [];
111
111
  const r = /* @__PURE__ */ new Set(), o = [];
112
112
  return e.forEach((l) => {
113
113
  const n = t.normalizeText(l.label || ""), a = t.sanitizeBlockHtml(l.html || "", l).trim();
114
114
  if (!n || !a) return;
115
115
  const s = t.normalizeText(l.category || "General") || "General", i = ne(s);
116
- let d = je(t.normalizeText(l.id || n)) || `block-${ke++}`;
116
+ let d = We(t.normalizeText(l.id || n)) || `block-${ke++}`;
117
117
  for (; r.has(d); )
118
118
  d = `${d}-${ke++}`;
119
119
  r.add(d);
120
- const f = (l.tags || []).map((H) => t.normalizeText(H)).filter(Boolean), g = (l.keywords || []).map((H) => t.normalizeText(H)).filter(Boolean), h = t.normalizeText(l.description || ""), R = Fe(a), V = [n, h, s, ...f, ...g, R].join(" ").toLowerCase();
120
+ const f = (l.tags || []).map((H) => t.normalizeText(H)).filter(Boolean), g = (l.keywords || []).map((H) => t.normalizeText(H)).filter(Boolean), h = t.normalizeText(l.description || ""), R = Ge(a), V = [n, h, s, ...f, ...g, R].join(" ").toLowerCase();
121
121
  o.push({
122
122
  id: d,
123
123
  label: n,
@@ -133,7 +133,7 @@ function Be(e, t) {
133
133
  }), o;
134
134
  }
135
135
  function Q(e = {}) {
136
- const t = e.normalizeText || Ke, r = e.sanitizeBlockHtml || We, o = {
136
+ const t = e.normalizeText || je, r = e.sanitizeBlockHtml || Fe, o = {
137
137
  blocks: [],
138
138
  defaultCategory: t(e.defaultCategory || ""),
139
139
  maxResults: Math.max(4, Math.min(300, Number(e.maxResults ?? 80))),
@@ -141,16 +141,16 @@ function Q(e = {}) {
141
141
  debounceMs: Math.max(0, Math.min(700, Number(e.debounceMs ?? 90))),
142
142
  cacheTtlMs: Math.max(0, Number(e.cacheTtlMs ?? 6e4)),
143
143
  labels: {
144
- ...Oe,
144
+ ...Ke,
145
145
  ...e.labels || {}
146
146
  },
147
147
  normalizeText: t,
148
148
  sanitizeBlockHtml: r,
149
149
  getBlocks: typeof e.getBlocks == "function" ? e.getBlocks : void 0
150
150
  };
151
- return o.blocks = Be(e.blocks, o), o;
151
+ return o.blocks = Ce(e.blocks, o), o;
152
152
  }
153
- function Ge(e) {
153
+ function Ue(e) {
154
154
  return {
155
155
  blocks: e.blocks.map((t) => ({
156
156
  id: t.id,
@@ -181,7 +181,7 @@ function G(e) {
181
181
  const t = e.querySelector(v);
182
182
  return t instanceof HTMLElement ? t : null;
183
183
  }
184
- function Ue() {
184
+ function Ve() {
185
185
  if (typeof window > "u") return null;
186
186
  const e = window[ye];
187
187
  if (!(e instanceof HTMLElement)) return null;
@@ -196,7 +196,7 @@ function Ue() {
196
196
  const o = e.closest(v);
197
197
  return o instanceof HTMLElement ? o : null;
198
198
  }
199
- function Ve(e) {
199
+ function Ye(e) {
200
200
  const t = e.closest("[data-editora-editor]");
201
201
  if (t && G(t) === e)
202
202
  return t;
@@ -222,7 +222,7 @@ function T(e, t = !0, r = !0) {
222
222
  const a = G(e.editorElement);
223
223
  if (a) return a;
224
224
  }
225
- const o = Ue();
225
+ const o = Ve();
226
226
  if (o) return o;
227
227
  const l = window.getSelection();
228
228
  if (l && l.rangeCount > 0) {
@@ -241,7 +241,7 @@ function T(e, t = !0, r = !0) {
241
241
  }
242
242
  return t ? document.querySelector(v) : null;
243
243
  }
244
- function Ye(e) {
244
+ function Xe(e) {
245
245
  const t = e.target;
246
246
  if (t) {
247
247
  const o = t.closest(v);
@@ -257,20 +257,20 @@ function Ye(e) {
257
257
  function Z(e) {
258
258
  return e ? (e.getAttribute("data-theme") || e.getAttribute("theme") || "").toLowerCase() === "dark" ? !0 : e.classList.contains("dark") || e.classList.contains("editora-theme-dark") || e.classList.contains("rte-theme-dark") : !1;
259
259
  }
260
- function Xe(e) {
260
+ function Ze(e) {
261
261
  const t = le(e);
262
262
  if (Z(t)) return !0;
263
263
  const r = t.closest("[data-theme], [theme], .dark, .editora-theme-dark, .rte-theme-dark");
264
264
  return Z(r) ? !0 : Z(document.documentElement) || Z(document.body);
265
265
  }
266
266
  function re(e, t) {
267
- e.classList.remove("rte-blocks-library-theme-dark"), Xe(t) && e.classList.add("rte-blocks-library-theme-dark");
267
+ e.classList.remove("rte-blocks-library-theme-dark"), Ze(t) && e.classList.add("rte-blocks-library-theme-dark");
268
268
  }
269
269
  function Te(e) {
270
270
  return e.getAttribute("contenteditable") === "false" || e.getAttribute("data-readonly") === "true";
271
271
  }
272
272
  function we(e, t, r) {
273
- const o = Ve(e);
273
+ const o = Ye(e);
274
274
  Array.from(
275
275
  o.querySelectorAll(
276
276
  `.rte-toolbar-button[data-command="${t}"], .editora-toolbar-button[data-command="${t}"]`
@@ -303,11 +303,11 @@ function Se(e) {
303
303
  return q.delete(e), null;
304
304
  }
305
305
  }
306
- function Ze(e) {
306
+ function Je(e) {
307
307
  const t = Se(e);
308
308
  return t ? (He(e, t), !0) : !1;
309
309
  }
310
- function Je(e) {
310
+ function Qe(e) {
311
311
  if (te.has(e)) return;
312
312
  const t = () => {
313
313
  const r = window.getSelection();
@@ -317,7 +317,7 @@ function Je(e) {
317
317
  };
318
318
  e.addEventListener("keyup", t), e.addEventListener("mouseup", t), e.addEventListener("touchend", t), te.set(e, t);
319
319
  }
320
- function Qe(e) {
320
+ function et(e) {
321
321
  const t = te.get(e);
322
322
  t && (e.removeEventListener("keyup", t), e.removeEventListener("mouseup", t), e.removeEventListener("touchend", t), te.delete(e));
323
323
  }
@@ -336,18 +336,18 @@ function k(e, t) {
336
336
  visibleMatches: 0,
337
337
  filterCache: /* @__PURE__ */ new Map(),
338
338
  debounceTimer: null
339
- }, w.set(e, r)), oe.add(e), Je(e), r;
339
+ }, w.set(e, r)), oe.add(e), Qe(e), r;
340
340
  }
341
341
  function Me(e) {
342
342
  const t = w.get(e);
343
343
  !t || t.debounceTimer === null || (window.clearTimeout(t.debounceTimer), t.debounceTimer = null);
344
344
  }
345
345
  function ge(e) {
346
- Me(e), Qe(e), q.delete(e);
346
+ Me(e), et(e), q.delete(e);
347
347
  const t = W.get(e);
348
348
  t && (t.abort(), W.delete(e)), j.delete(e), z.delete(e), x.get(e)?.remove(), x.delete(e), U.delete(e), b.delete(e), J.delete(e), w.delete(e), I.delete(e), O.delete(e), oe.delete(e), y === e && (y = null);
349
349
  }
350
- function et(e) {
350
+ function tt(e) {
351
351
  for (let t = 0; t < e.length; t += 1) {
352
352
  const r = e[t];
353
353
  if (!(r.type !== "childList" || r.removedNodes.length === 0))
@@ -372,7 +372,7 @@ function de(e, t) {
372
372
  function ae(e) {
373
373
  return I.get(e) || b.get(e)?.blocks || [];
374
374
  }
375
- function tt(e, t) {
375
+ function rt(e, t) {
376
376
  const r = /* @__PURE__ */ new Map();
377
377
  ae(e).forEach((l) => {
378
378
  r.has(l.categoryKey) || r.set(l.categoryKey, l.category);
@@ -401,7 +401,7 @@ function Ae(e, t) {
401
401
  }
402
402
  return i;
403
403
  }
404
- function rt(e, t) {
404
+ function ot(e, t) {
405
405
  const r = w.get(e);
406
406
  if (!r) return;
407
407
  if (t.length === 0) {
@@ -410,7 +410,7 @@ function rt(e, t) {
410
410
  }
411
411
  t.some((l) => l.id === r.selectedBlockId) || (r.selectedBlockId = t[0].id);
412
412
  }
413
- function N(e) {
413
+ function K(e) {
414
414
  const t = w.get(e);
415
415
  we(e, "toggleBlocksLibraryPanel", pe(e)), we(e, "insertLastBlockSnippet", !!t?.lastInsertedBlockId);
416
416
  }
@@ -430,8 +430,8 @@ function L(e) {
430
430
  i && (i.textContent = r.labels.categoryLabel);
431
431
  const c = t.querySelector('[data-field="category"]');
432
432
  if (c) {
433
- const C = tt(e, r);
434
- c.innerHTML = C.map((p) => `<option value="${m(p.value)}">${m(p.label)}</option>`).join(""), C.some((p) => p.value === o.category) || (o.category = "all"), c.value = o.category;
433
+ const B = rt(e, r);
434
+ c.innerHTML = B.map((p) => `<option value="${m(p.value)}">${m(p.label)}</option>`).join(""), B.some((p) => p.value === o.category) || (o.category = "all"), c.value = o.category;
435
435
  }
436
436
  const d = t.querySelector(".rte-blocks-library-helper");
437
437
  d && (d.textContent = r.labels.helperText);
@@ -442,16 +442,16 @@ function L(e) {
442
442
  const h = t.querySelector('[data-action="insert-selected"]');
443
443
  if (h) {
444
444
  h.textContent = r.labels.insertText;
445
- const C = !Te(e) && !!o.selectedBlockId;
446
- h.disabled = !C, h.setAttribute("aria-disabled", C ? "false" : "true");
445
+ const B = !Te(e) && !!o.selectedBlockId;
446
+ h.disabled = !B, h.setAttribute("aria-disabled", B ? "false" : "true");
447
447
  }
448
448
  const R = t.querySelector(".rte-blocks-library-empty"), V = t.querySelector(".rte-blocks-library-list"), H = Ae(e, r);
449
- rt(e, H);
449
+ ot(e, H);
450
450
  const Y = t.querySelector(".rte-blocks-library-status");
451
451
  if (Y && (o.loading ? Y.textContent = r.labels.loadingText : o.loadError ? Y.textContent = o.loadError : Y.textContent = `${r.labels.summaryPrefix}: ${o.visibleMatches}/${o.totalMatches}`), V) {
452
- const C = new Set(o.recentBlockIds);
452
+ const B = new Set(o.recentBlockIds);
453
453
  V.innerHTML = H.map((p) => {
454
- const ie = o.selectedBlockId === p.id, qe = p.tags.length ? ` • ${p.tags.join(", ")}` : "", _e = C.has(p.id), me = p.previewText.slice(0, 180);
454
+ const ie = o.selectedBlockId === p.id, _e = p.tags.length ? ` • ${p.tags.join(", ")}` : "", Pe = B.has(p.id), me = p.previewText.slice(0, 180);
455
455
  return `
456
456
  <li class="rte-blocks-library-item-wrapper" role="presentation">
457
457
  <button
@@ -465,9 +465,9 @@ function L(e) {
465
465
  >
466
466
  <span class="rte-blocks-library-item-head">
467
467
  <span class="rte-blocks-library-item-label">${m(p.label)}</span>
468
- ${_e ? `<span class="rte-blocks-library-recent-pill">${m(r.labels.recentHeading)}</span>` : ""}
468
+ ${Pe ? `<span class="rte-blocks-library-recent-pill">${m(r.labels.recentHeading)}</span>` : ""}
469
469
  </span>
470
- <span class="rte-blocks-library-item-meta">${m(p.category)}${m(qe)}</span>
470
+ <span class="rte-blocks-library-item-meta">${m(p.category)}${m(_e)}</span>
471
471
  ${p.description ? `<span class="rte-blocks-library-item-description">${m(p.description)}</span>` : ""}
472
472
  ${me ? `<span class="rte-blocks-library-item-preview">${m(me)}</span>` : ""}
473
473
  </button>
@@ -476,20 +476,20 @@ function L(e) {
476
476
  }).join("");
477
477
  }
478
478
  R && (R.hidden = H.length > 0, R.textContent = r.labels.noResultsText);
479
- const K = t.querySelector(".rte-blocks-library-last-inserted");
480
- if (K)
479
+ const N = t.querySelector(".rte-blocks-library-last-inserted");
480
+ if (N)
481
481
  if (o.lastInsertedBlockId) {
482
- const C = ae(e).find((p) => p.id === o.lastInsertedBlockId);
483
- C ? (K.hidden = !1, K.textContent = `${r.labels.lastInsertedPrefix}: ${C.label}`) : K.hidden = !0;
482
+ const B = ae(e).find((p) => p.id === o.lastInsertedBlockId);
483
+ B ? (N.hidden = !1, N.textContent = `${r.labels.lastInsertedPrefix}: ${B.label}`) : N.hidden = !0;
484
484
  } else
485
- K.hidden = !0;
485
+ N.hidden = !0;
486
486
  t.setAttribute("aria-label", r.labels.panelAriaLabel);
487
487
  }
488
488
  function S(e, t = !1) {
489
489
  const r = x.get(e);
490
- r && (r.classList.remove("show"), U.set(e, !1), N(e), t && (e.focus({ preventScroll: !0 }), Ze(e)));
490
+ r && (r.classList.remove("show"), U.set(e, !1), K(e), t && (e.focus({ preventScroll: !0 }), Je(e)));
491
491
  }
492
- function ot(e) {
492
+ function nt(e) {
493
493
  e.querySelector(".rte-blocks-library-item.active")?.focus();
494
494
  }
495
495
  function ve(e, t) {
@@ -505,13 +505,13 @@ function ve(e, t) {
505
505
  ) + t + l.length) % l.length;
506
506
  o.selectedBlockId = l[a].id, L(e);
507
507
  const s = x.get(e);
508
- s && ot(s);
508
+ s && nt(s);
509
509
  }
510
510
  function ue(e) {
511
- const t = it(e);
511
+ const t = ct(e);
512
512
  se(e), x.forEach((o, l) => {
513
513
  l !== e && S(l, !1);
514
- }), t.classList.add("show"), U.set(e, !0), L(e), de(e, t), N(e), t.querySelector('[data-field="query"]')?.focus(), be(e, !1);
514
+ }), t.classList.add("show"), U.set(e, !0), L(e), de(e, t), K(e), t.querySelector('[data-field="query"]')?.focus(), be(e, !1);
515
515
  }
516
516
  function Ie(e, t) {
517
517
  const r = pe(e);
@@ -543,7 +543,7 @@ function Le(e, t, r) {
543
543
  }
544
544
  return se(e), !0;
545
545
  }
546
- function nt(e, t) {
546
+ function lt(e, t) {
547
547
  e.focus({ preventScroll: !0 });
548
548
  const r = Se(e);
549
549
  if (r && Le(e, r, t))
@@ -556,7 +556,7 @@ function nt(e, t) {
556
556
  const o = Re(e);
557
557
  return o ? Le(e, o, t) : !1;
558
558
  }
559
- function lt(e, t) {
559
+ function st(e, t) {
560
560
  if (t === e.innerHTML) return;
561
561
  const r = window.execEditorCommand || window.executeEditorCommand;
562
562
  if (typeof r == "function")
@@ -565,7 +565,7 @@ function lt(e, t) {
565
565
  } catch {
566
566
  }
567
567
  }
568
- function st(e) {
568
+ function at(e) {
569
569
  e.dispatchEvent(new Event("input", { bubbles: !0 }));
570
570
  }
571
571
  function F(e, t) {
@@ -577,10 +577,10 @@ function F(e, t) {
577
577
  const n = ae(e).find((i) => i.id === t);
578
578
  if (!n) return !1;
579
579
  const a = e.innerHTML;
580
- return nt(e, n.html) ? (o.lastInsertedBlockId = n.id, o.selectedBlockId = n.id, o.recentBlockIds = [n.id, ...o.recentBlockIds.filter((i) => i !== n.id)].slice(
580
+ return lt(e, n.html) ? (o.lastInsertedBlockId = n.id, o.selectedBlockId = n.id, o.recentBlockIds = [n.id, ...o.recentBlockIds.filter((i) => i !== n.id)].slice(
581
581
  0,
582
582
  r.maxRecentBlocks
583
- ), lt(e, a), st(e), N(e), e.dispatchEvent(
583
+ ), st(e, a), at(e), K(e), e.dispatchEvent(
584
584
  new CustomEvent("editora:blocks-library-insert", {
585
585
  bubbles: !0,
586
586
  detail: {
@@ -595,7 +595,7 @@ function ze(e) {
595
595
  const t = w.get(e);
596
596
  return t?.lastInsertedBlockId ? F(e, t.lastInsertedBlockId) : !1;
597
597
  }
598
- function at(e) {
598
+ function it(e) {
599
599
  const t = b.get(e) || M;
600
600
  if (!t) return;
601
601
  const r = w.get(e);
@@ -610,7 +610,7 @@ function at(e) {
610
610
  }
611
611
  r.debounceTimer = window.setTimeout(o, t.debounceMs);
612
612
  }
613
- function it(e) {
613
+ function ct(e) {
614
614
  const t = x.get(e);
615
615
  if (t) return t;
616
616
  const r = b.get(e) || M || Q(), o = k(e, r), l = `rte-blocks-library-panel-${Ne++}`, n = `${l}-query`, a = `${l}-category`, s = document.createElement("section");
@@ -657,7 +657,7 @@ function it(e) {
657
657
  g && (o.selectedBlockId = g, L(e), i.detail >= 2 && F(e, g) && S(e, !0));
658
658
  }), s.addEventListener("input", (i) => {
659
659
  const c = i.target;
660
- !(c instanceof HTMLInputElement) || c.getAttribute("data-field") !== "query" || (o.query = r.normalizeText(c.value).toLowerCase(), o.filterCache.clear(), at(e));
660
+ !(c instanceof HTMLInputElement) || c.getAttribute("data-field") !== "query" || (o.query = r.normalizeText(c.value).toLowerCase(), o.filterCache.clear(), it(e));
661
661
  }), s.addEventListener("change", (i) => {
662
662
  const c = i.target;
663
663
  !(c instanceof HTMLSelectElement) || c.getAttribute("data-field") !== "category" || (o.category = ne(c.value || "all") || "all", o.filterCache.clear(), L(e));
@@ -680,7 +680,7 @@ function it(e) {
680
680
  }
681
681
  }), re(s, e), document.body.appendChild(s), x.set(e, s), U.set(e, !1), L(e), s;
682
682
  }
683
- function ct(e) {
683
+ function dt(e) {
684
684
  const t = w.get(e);
685
685
  return {
686
686
  query: t?.query || "",
@@ -716,7 +716,7 @@ async function be(e, t) {
716
716
  signal: s.signal
717
717
  }, f = await r.getBlocks?.(d);
718
718
  if (s.signal.aborted || z.get(e) !== i) return;
719
- const g = Be(f || [], r);
719
+ const g = Ce(f || [], r);
720
720
  I.set(e, g), O.set(e, Date.now());
721
721
  const h = w.get(e);
722
722
  h && (h.loading = !1, h.loadError = null, h.filterCache.clear());
@@ -729,21 +729,24 @@ async function be(e, t) {
729
729
  });
730
730
  return j.set(e, c), c;
731
731
  }
732
- function dt(e) {
733
- const t = e.key.toLowerCase();
734
- return (e.metaKey || e.ctrlKey) && e.altKey && e.shiftKey && t === "b";
732
+ function qe(e) {
733
+ return typeof e.key == "string" ? e.key.toLowerCase() : "";
735
734
  }
736
735
  function ut(e) {
737
- const t = e.key.toLowerCase();
738
- return (e.metaKey || e.ctrlKey) && e.altKey && e.shiftKey && t === "l";
736
+ const t = qe(e);
737
+ return (e.metaKey || e.ctrlKey) && e.altKey && e.shiftKey && t === "b";
739
738
  }
740
739
  function bt(e) {
740
+ const t = qe(e);
741
+ return (e.metaKey || e.ctrlKey) && e.altKey && e.shiftKey && t === "l";
742
+ }
743
+ function ft(e) {
741
744
  M = e, _ || (_ = (t) => {
742
745
  ee();
743
746
  const o = t.target?.closest(v);
744
747
  if (!o) return;
745
748
  const l = b.get(o) || e;
746
- k(o, l), b.set(o, l), y = o, N(o);
749
+ k(o, l), b.set(o, l), y = o, K(o);
747
750
  const n = x.get(o);
748
751
  n && (re(n, o), de(o, n), L(o));
749
752
  }, document.addEventListener("focusin", _, !0)), P || (P = (t) => {
@@ -756,40 +759,40 @@ function bt(e) {
756
759
  }
757
760
  return;
758
761
  }
759
- const l = Ye(t);
762
+ const l = Xe(t);
760
763
  if (!l) return;
761
764
  const n = b.get(l) || M || e;
762
765
  if (k(l, n), b.set(l, n), y = l, t.key === "Escape" && pe(l)) {
763
766
  t.preventDefault(), S(l, !0);
764
767
  return;
765
768
  }
766
- if (dt(t)) {
769
+ if (ut(t)) {
767
770
  t.preventDefault(), t.stopPropagation(), Ie(l);
768
771
  return;
769
772
  }
770
- ut(t) && (t.preventDefault(), t.stopPropagation(), ze(l));
773
+ bt(t) && (t.preventDefault(), t.stopPropagation(), ze(l));
771
774
  }, document.addEventListener("keydown", P, !0)), A || (A = () => {
772
775
  ee(), x.forEach((t, r) => {
773
776
  !r.isConnected || !t.isConnected || (re(t, r), de(r, t));
774
777
  });
775
778
  }, window.addEventListener("scroll", A, !0), window.addEventListener("resize", A)), !D && typeof MutationObserver < "u" && document.body && (D = new MutationObserver((t) => {
776
- et(t) && ee();
779
+ tt(t) && ee();
777
780
  }), D.observe(document.body, {
778
781
  childList: !0,
779
782
  subtree: !0
780
783
  }));
781
784
  }
782
- function ft() {
785
+ function gt() {
783
786
  _ && (document.removeEventListener("focusin", _, !0), _ = null), P && (document.removeEventListener("keydown", P, !0), P = null), A && (window.removeEventListener("scroll", A, !0), window.removeEventListener("resize", A), A = null), D && (D.disconnect(), D = null), x.forEach((t) => t.remove()), x.clear(), Array.from(oe).forEach((t) => ge(t)), M = null, y = null;
784
787
  }
785
- function gt() {
788
+ function pt() {
786
789
  if (typeof document > "u" || document.getElementById(he)) return;
787
790
  const e = document.createElement("style");
788
791
  e.id = he, e.textContent = `
789
792
  .rte-toolbar-group-items.${E},
790
793
  .editora-toolbar-group-items.${E},
791
- .rte-toolbar-group-items.${B},
792
- .editora-toolbar-group-items.${B} {
794
+ .rte-toolbar-group-items.${C},
795
+ .editora-toolbar-group-items.${C} {
793
796
  display: flex;
794
797
  border: 1px solid #cbd5e1;
795
798
  border-radius: 4px;
@@ -798,8 +801,8 @@ function gt() {
798
801
 
799
802
  .rte-toolbar-group-items.${E} .rte-toolbar-button,
800
803
  .editora-toolbar-group-items.${E} .editora-toolbar-button,
801
- .rte-toolbar-group-items.${B} .rte-toolbar-button,
802
- .editora-toolbar-group-items.${B} .editora-toolbar-button {
804
+ .rte-toolbar-group-items.${C} .rte-toolbar-button,
805
+ .editora-toolbar-group-items.${C} .editora-toolbar-button {
803
806
  border: none;
804
807
  border-right: 1px solid #cbd5e1;
805
808
  border-radius: 0;
@@ -807,8 +810,8 @@ function gt() {
807
810
 
808
811
  .rte-toolbar-group-items.${E} .rte-toolbar-item:last-child .rte-toolbar-button,
809
812
  .editora-toolbar-group-items.${E} .editora-toolbar-item:last-child .editora-toolbar-button,
810
- .rte-toolbar-group-items.${B} .rte-toolbar-item:last-child .rte-toolbar-button,
811
- .editora-toolbar-group-items.${B} .editora-toolbar-item:last-child .editora-toolbar-button {
813
+ .rte-toolbar-group-items.${C} .rte-toolbar-item:last-child .rte-toolbar-button,
814
+ .editora-toolbar-group-items.${C} .editora-toolbar-item:last-child .editora-toolbar-button {
812
815
  border-right: none;
813
816
  }
814
817
 
@@ -819,14 +822,14 @@ function gt() {
819
822
 
820
823
  ${$} .rte-toolbar-group-items.${E},
821
824
  ${$} .editora-toolbar-group-items.${E},
822
- ${$} .rte-toolbar-group-items.${B},
823
- ${$} .editora-toolbar-group-items.${B} {
825
+ ${$} .rte-toolbar-group-items.${C},
826
+ ${$} .editora-toolbar-group-items.${C} {
824
827
  border-color: #566275;
825
828
  }
826
829
  ${$} .rte-toolbar-group-items.${E} .rte-toolbar-button svg,
827
830
  ${$} .editora-toolbar-group-items.${E} .editora-toolbar-button svg,
828
- ${$} .rte-toolbar-group-items.${B} .rte-toolbar-button svg,
829
- ${$} .editora-toolbar-group-items.${B} .editora-toolbar-button svg
831
+ ${$} .rte-toolbar-group-items.${C} .rte-toolbar-button svg,
832
+ ${$} .editora-toolbar-group-items.${C} .editora-toolbar-button svg
830
833
  {
831
834
  fill: none;
832
835
  }
@@ -1185,9 +1188,9 @@ function gt() {
1185
1188
  }
1186
1189
  `, document.head.appendChild(e);
1187
1190
  }
1188
- const pt = (e = {}) => {
1191
+ const mt = (e = {}) => {
1189
1192
  const t = Q(e), r = /* @__PURE__ */ new Set();
1190
- return gt(), {
1193
+ return pt(), {
1191
1194
  name: "blocksLibrary",
1192
1195
  toolbar: [
1193
1196
  {
@@ -1255,7 +1258,7 @@ const pt = (e = {}) => {
1255
1258
  setBlocksLibraryOptions: (o, l) => {
1256
1259
  const n = T(l, !1, !1);
1257
1260
  if (!n || !o || typeof o != "object") return !1;
1258
- const a = b.get(n) || t, s = J.get(n) || Ge(a), i = {
1261
+ const a = b.get(n) || t, s = J.get(n) || Ue(a), i = {
1259
1262
  ...s,
1260
1263
  ...o,
1261
1264
  labels: {
@@ -1269,14 +1272,14 @@ const pt = (e = {}) => {
1269
1272
  }, c = Q(i), d = Array.isArray(o.blocks), f = o.getBlocks !== void 0;
1270
1273
  b.set(n, c), J.set(n, i), (d || f || !I.has(n)) && (I.set(n, c.blocks), O.set(n, f ? 0 : Date.now()));
1271
1274
  const g = k(n, c);
1272
- return g.filterCache.clear(), typeof o.defaultCategory == "string" && (g.category = ne(c.defaultCategory) || "all"), L(n), N(n), f && be(n, !0), !0;
1275
+ return g.filterCache.clear(), typeof o.defaultCategory == "string" && (g.category = ne(c.defaultCategory) || "all"), L(n), K(n), f && be(n, !0), !0;
1273
1276
  },
1274
1277
  getBlocksLibraryState: (o, l) => {
1275
1278
  const n = T(l, !1, !1);
1276
1279
  if (!n) return !1;
1277
1280
  const a = b.get(n) || t;
1278
1281
  k(n, a);
1279
- const s = ct(n);
1282
+ const s = dt(n);
1280
1283
  if (typeof o == "function")
1281
1284
  try {
1282
1285
  o(s);
@@ -1299,19 +1302,19 @@ const pt = (e = {}) => {
1299
1302
  init: function(l) {
1300
1303
  X += 1;
1301
1304
  const n = this && typeof this.__pluginConfig == "object" ? { ...e, ...this.__pluginConfig } : e, a = Q(n);
1302
- bt(a);
1305
+ ft(a);
1303
1306
  const s = T(
1304
1307
  l?.editorElement ? { editorElement: l.editorElement } : void 0,
1305
1308
  !1,
1306
1309
  !1
1307
1310
  );
1308
- s && (y = s, r.add(s), k(s, a), b.set(s, a), J.set(s, n), I.set(s, a.blocks), O.set(s, Date.now()), N(s));
1311
+ s && (y = s, r.add(s), k(s, a), b.set(s, a), J.set(s, n), I.set(s, a.blocks), O.set(s, Date.now()), K(s));
1309
1312
  },
1310
1313
  destroy: () => {
1311
- r.forEach((o) => ge(o)), r.clear(), X = Math.max(0, X - 1), !(X > 0) && ft();
1314
+ r.forEach((o) => ge(o)), r.clear(), X = Math.max(0, X - 1), !(X > 0) && gt();
1312
1315
  }
1313
1316
  };
1314
1317
  };
1315
1318
  export {
1316
- pt as BlocksLibraryPlugin
1319
+ mt as BlocksLibraryPlugin
1317
1320
  };
package/dist/bold.cjs.js CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=()=>({name:"bold",marks:{bold:{parseDOM:[{tag:"strong"},{tag:"b"},{style:"font-weight",getAttrs:t=>{const o=typeof t=="string"?t:t.style.fontWeight;return/^(bold(er)?|[5-9]\d{2,})$/.test(o)&&null}}],toDOM:()=>["strong",0]}},toolbar:[{label:"Bold",command:"toggleBold",icon:'<svg width="24" height="24" focusable="false"><path d="M7.8 19c-.3 0-.5 0-.6-.2l-.2-.5V5.7c0-.2 0-.4.2-.5l.6-.2h5c1.5 0 2.7.3 3.5 1 .7.6 1.1 1.4 1.1 2.5a3 3 0 0 1-.6 1.9c-.4.6-1 1-1.6 1.2.4.1.9.3 1.3.6s.8.7 1 1.2c.4.4.5 1 .5 1.6 0 1.3-.4 2.3-1.3 3-.8.7-2.1 1-3.8 1H7.8Zm5-8.3c.6 0 1.2-.1 1.6-.5.4-.3.6-.7.6-1.3 0-1.1-.8-1.7-2.3-1.7H9.3v3.5h3.4Zm.5 6c.7 0 1.3-.1 1.7-.4.4-.4.6-.9.6-1.5s-.2-1-.7-1.4c-.4-.3-1-.4-2-.4H9.4v3.8h4Z" fill-rule="evenodd"></path></svg>',shortcut:"Mod-b"}],commands:{toggleBold:()=>(document.execCommand("bold",!1),!0)},keymap:{"Mod-b":"toggleBold","Mod-B":"toggleBold"}});exports.BoldPlugin=e;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("./inlineFormatting-DOYOJdnD.js"),l=()=>({name:"bold",marks:{bold:{parseDOM:[{tag:"strong"},{tag:"b"},{style:"font-weight",getAttrs:t=>{const o=typeof t=="string"?t:t.style.fontWeight;return/^(bold(er)?|[5-9]\d{2,})$/.test(o)&&null}}],toDOM:()=>["strong",0]}},toolbar:[{label:"Bold",command:"toggleBold",icon:'<svg width="24" height="24" focusable="false"><path d="M7.8 19c-.3 0-.5 0-.6-.2l-.2-.5V5.7c0-.2 0-.4.2-.5l.6-.2h5c1.5 0 2.7.3 3.5 1 .7.6 1.1 1.4 1.1 2.5a3 3 0 0 1-.6 1.9c-.4.6-1 1-1.6 1.2.4.1.9.3 1.3.6s.8.7 1 1.2c.4.4.5 1 .5 1.6 0 1.3-.4 2.3-1.3 3-.8.7-2.1 1-3.8 1H7.8Zm5-8.3c.6 0 1.2-.1 1.6-.5.4-.3.6-.7.6-1.3 0-1.1-.8-1.7-2.3-1.7H9.3v3.5h3.4Zm.5 6c.7 0 1.3-.1 1.7-.4.4-.4.6-.9.6-1.5s-.2-1-.7-1.4c-.4-.3-1-.4-2-.4H9.4v3.8h4Z" fill-rule="evenodd"></path></svg>',shortcut:"Mod-b"}],commands:{toggleBold:(t,o)=>e.applyInlineFormatting({command:"bold",context:o})},keymap:{"Mod-b":"toggleBold","Mod-B":"toggleBold"}});exports.BoldPlugin=l;
package/dist/bold.esm.js CHANGED
@@ -1,4 +1,5 @@
1
- const e = () => ({
1
+ import { a as l } from "./inlineFormatting-DuVTGXYG.mjs";
2
+ const g = () => ({
2
3
  name: "bold",
3
4
  // Schema definition for bold mark
4
5
  marks: {
@@ -8,9 +9,9 @@ const e = () => ({
8
9
  { tag: "b" },
9
10
  {
10
11
  style: "font-weight",
11
- getAttrs: (t) => {
12
- const o = typeof t == "string" ? t : t.style.fontWeight;
13
- return /^(bold(er)?|[5-9]\d{2,})$/.test(o) && null;
12
+ getAttrs: (o) => {
13
+ const t = typeof o == "string" ? o : o.style.fontWeight;
14
+ return /^(bold(er)?|[5-9]\d{2,})$/.test(t) && null;
14
15
  }
15
16
  }
16
17
  ],
@@ -31,7 +32,10 @@ const e = () => ({
31
32
  /**
32
33
  * Toggle bold formatting on current selection
33
34
  */
34
- toggleBold: () => (document.execCommand("bold", !1), !0)
35
+ toggleBold: (o, t) => l({
36
+ command: "bold",
37
+ context: t
38
+ })
35
39
  },
36
40
  // Keyboard shortcuts
37
41
  keymap: {
@@ -40,5 +44,5 @@ const e = () => ({
40
44
  }
41
45
  });
42
46
  export {
43
- e as BoldPlugin
47
+ g as BoldPlugin
44
48
  };
@@ -1 +1 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const i=()=>{const o=()=>{try{const e=window.getSelection();if(e&&e.rangeCount>0&&!e.isCollapsed){const t=e.getRangeAt(0),r=t.toString().toUpperCase();return t.deleteContents(),t.insertNode(document.createTextNode(r)),!0}return!1}catch(e){return console.error("Failed to convert to uppercase:",e),!1}},a=()=>{try{const e=window.getSelection();if(e&&e.rangeCount>0&&!e.isCollapsed){const t=e.getRangeAt(0),r=t.toString().toLowerCase();return t.deleteContents(),t.insertNode(document.createTextNode(r)),!0}return!1}catch(e){return console.error("Failed to convert to lowercase:",e),!1}},n=()=>{try{const e=window.getSelection();if(e&&e.rangeCount>0&&!e.isCollapsed){const t=e.getRangeAt(0),r=t.toString().replace(/\w\S*/g,l=>l.charAt(0).toUpperCase()+l.substr(1).toLowerCase());return t.deleteContents(),t.insertNode(document.createTextNode(r)),!0}return!1}catch(e){return console.error("Failed to convert to title case:",e),!1}};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"><defs><style>.cls-1{fill:none;}</style></defs><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;" class="cls-1" width="32" height="32"></rect></g></svg>'}],commands:{setCapitalization:e=>{if(!e)return!1;switch(e){case"uppercase":return o();case"lowercase":return a();case"titlecase":return n();default:return!1}},toUpperCase:o,toLowerCase:a,toTitleCase:n},keymap:{"Mod-Shift-u":"toUpperCase","Mod-Shift-k":"toLowerCase","Mod-Shift-t":"toTitleCase"}}};exports.CapitalizationPlugin=i;
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},y=(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},L=t=>new RegExp("\\p{L}","u").test(t),_=t=>/[\p{M}'’-]/u.test(t),x=()=>{let t=!1;return e=>{let n="";return Array.from(e.text).forEach(r=>{if(L(r)){n+=t?r.toLocaleLowerCase():r.toLocaleUpperCase(),t=!0;return}n+=r,_(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=y(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(x(),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"><defs><style>.cls-1{fill:none;}</style></defs><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;" class="cls-1" 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;