@editora/core 1.0.1 → 1.0.2

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 (121) hide show
  1. package/README.md +9 -0
  2. package/dist/A11yCheckerPlugin.native-CZKpi3uF.mjs +475 -0
  3. package/dist/A11yCheckerPlugin.native-CZKpi3uF.mjs.map +1 -0
  4. package/dist/AnchorPlugin.native-7es9PVZ9.mjs +340 -0
  5. package/dist/AnchorPlugin.native-7es9PVZ9.mjs.map +1 -0
  6. package/dist/BackgroundColorPlugin.native-Dip5uqTg.mjs +449 -0
  7. package/dist/BackgroundColorPlugin.native-Dip5uqTg.mjs.map +1 -0
  8. package/dist/BlockquotePlugin.native-JFmOLsxN.mjs +48 -0
  9. package/dist/BlockquotePlugin.native-JFmOLsxN.mjs.map +1 -0
  10. package/dist/BoldPlugin.native-BAzzoqU5.mjs +45 -0
  11. package/dist/BoldPlugin.native-BAzzoqU5.mjs.map +1 -0
  12. package/dist/CapitalizationPlugin.native-DOMsh5R7.mjs +79 -0
  13. package/dist/CapitalizationPlugin.native-DOMsh5R7.mjs.map +1 -0
  14. package/dist/ChecklistPlugin.native-Dccs3nLe.mjs +153 -0
  15. package/dist/ChecklistPlugin.native-Dccs3nLe.mjs.map +1 -0
  16. package/dist/ClearFormattingPlugin.native-BZPDHswo.mjs +27 -0
  17. package/dist/ClearFormattingPlugin.native-BZPDHswo.mjs.map +1 -0
  18. package/dist/CodePlugin.native-DD9xFIid.mjs +1679 -0
  19. package/dist/CodePlugin.native-DD9xFIid.mjs.map +1 -0
  20. package/dist/CodeSamplePlugin.native-DMbEdO9j.mjs +326 -0
  21. package/dist/CodeSamplePlugin.native-DMbEdO9j.mjs.map +1 -0
  22. package/dist/CommentsPlugin.native-2zQV8Ia4.mjs +473 -0
  23. package/dist/CommentsPlugin.native-2zQV8Ia4.mjs.map +1 -0
  24. package/dist/DirectionPlugin.native-Be7wCzkI.mjs +59 -0
  25. package/dist/DirectionPlugin.native-Be7wCzkI.mjs.map +1 -0
  26. package/dist/DocumentManagerPlugin.native-BvZL5CSG.mjs +116 -0
  27. package/dist/DocumentManagerPlugin.native-BvZL5CSG.mjs.map +1 -0
  28. package/dist/EmbedIframePlugin.native-ifr9KLdN.mjs +461 -0
  29. package/dist/EmbedIframePlugin.native-ifr9KLdN.mjs.map +1 -0
  30. package/dist/EmojisPlugin.native-D6mJSnSR.mjs +1033 -0
  31. package/dist/EmojisPlugin.native-D6mJSnSR.mjs.map +1 -0
  32. package/dist/FontFamilyPlugin.native-BzS_9qbM.mjs +106 -0
  33. package/dist/FontFamilyPlugin.native-BzS_9qbM.mjs.map +1 -0
  34. package/dist/FontSizePlugin.native-DkLMLPue.mjs +186 -0
  35. package/dist/FontSizePlugin.native-DkLMLPue.mjs.map +1 -0
  36. package/dist/FootnotePlugin.native-BciVc9W6.mjs +128 -0
  37. package/dist/FootnotePlugin.native-BciVc9W6.mjs.map +1 -0
  38. package/dist/FullscreenPlugin.native-ChXyxeNw.mjs +77 -0
  39. package/dist/FullscreenPlugin.native-ChXyxeNw.mjs.map +1 -0
  40. package/dist/HeadingPlugin.native-DrLYwQnQ.mjs +64 -0
  41. package/dist/HeadingPlugin.native-DrLYwQnQ.mjs.map +1 -0
  42. package/dist/HistoryPlugin.native-DoDRifCf.mjs +89 -0
  43. package/dist/HistoryPlugin.native-DoDRifCf.mjs.map +1 -0
  44. package/dist/IndentPlugin.native-CbFugPoi.mjs +133 -0
  45. package/dist/IndentPlugin.native-CbFugPoi.mjs.map +1 -0
  46. package/dist/ItalicPlugin.native-CQjjDyUL.mjs +43 -0
  47. package/dist/ItalicPlugin.native-CQjjDyUL.mjs.map +1 -0
  48. package/dist/LineHeightPlugin.native-CWQT2FIa.mjs +73 -0
  49. package/dist/LineHeightPlugin.native-CWQT2FIa.mjs.map +1 -0
  50. package/dist/LinkPlugin.native-BdAOV-iu.mjs +206 -0
  51. package/dist/LinkPlugin.native-BdAOV-iu.mjs.map +1 -0
  52. package/dist/ListPlugin.native-CLFU5AUQ.mjs +59 -0
  53. package/dist/ListPlugin.native-CLFU5AUQ.mjs.map +1 -0
  54. package/dist/MathPlugin.native-DE_ii-LA.mjs +182 -0
  55. package/dist/MathPlugin.native-DE_ii-LA.mjs.map +1 -0
  56. package/dist/MediaManagerPlugin.native-DaYFDzNM.mjs +533 -0
  57. package/dist/MediaManagerPlugin.native-DaYFDzNM.mjs.map +1 -0
  58. package/dist/MergeTagPlugin.native-CrxyThyn.mjs +178 -0
  59. package/dist/MergeTagPlugin.native-CrxyThyn.mjs.map +1 -0
  60. package/dist/PageBreakPlugin.native-DDjcDyRW.mjs +172 -0
  61. package/dist/PageBreakPlugin.native-DDjcDyRW.mjs.map +1 -0
  62. package/dist/PreviewPlugin.native-DBvfpmIv.mjs +322 -0
  63. package/dist/PreviewPlugin.native-DBvfpmIv.mjs.map +1 -0
  64. package/dist/PrintPlugin.native-BUpm52VJ.mjs +311 -0
  65. package/dist/PrintPlugin.native-BUpm52VJ.mjs.map +1 -0
  66. package/dist/SpecialCharactersPlugin.native-x7a2SWXc.mjs +731 -0
  67. package/dist/SpecialCharactersPlugin.native-x7a2SWXc.mjs.map +1 -0
  68. package/dist/SpellCheckPlugin.native-B7yTh0iE.mjs +465 -0
  69. package/dist/SpellCheckPlugin.native-B7yTh0iE.mjs.map +1 -0
  70. package/dist/StrikethroughPlugin.native-ChaZLaXw.mjs +43 -0
  71. package/dist/StrikethroughPlugin.native-ChaZLaXw.mjs.map +1 -0
  72. package/dist/TablePlugin.native-EEWXn1-s.mjs +491 -0
  73. package/dist/TablePlugin.native-EEWXn1-s.mjs.map +1 -0
  74. package/dist/TemplatePlugin.native-BlSn1c9h.mjs +564 -0
  75. package/dist/TemplatePlugin.native-BlSn1c9h.mjs.map +1 -0
  76. package/dist/TextAlignmentPlugin.native-CQIs1m7R.mjs +97 -0
  77. package/dist/TextAlignmentPlugin.native-CQIs1m7R.mjs.map +1 -0
  78. package/dist/TextColorPlugin.native-D6SmTglm.mjs +432 -0
  79. package/dist/TextColorPlugin.native-D6SmTglm.mjs.map +1 -0
  80. package/dist/UnderlinePlugin.native-QpIcK4L2.mjs +35 -0
  81. package/dist/UnderlinePlugin.native-QpIcK4L2.mjs.map +1 -0
  82. package/dist/documentManager-irzj9n3V.mjs +37627 -0
  83. package/dist/documentManager-irzj9n3V.mjs.map +1 -0
  84. package/dist/editorContainerHelpers-C7kdWnS0.mjs +27 -0
  85. package/dist/editorContainerHelpers-C7kdWnS0.mjs.map +1 -0
  86. package/dist/editora.min.js +14 -12
  87. package/dist/editora.min.js.map +1 -1
  88. package/dist/editora.umd.js +14 -12
  89. package/dist/editora.umd.js.map +1 -1
  90. package/dist/index-BF5RBhL9.js +4 -0
  91. package/dist/index-BF5RBhL9.js.map +1 -0
  92. package/dist/{index-BS4zT-KN.mjs → index-BPsf460l.mjs} +286 -162
  93. package/dist/index-BPsf460l.mjs.map +1 -0
  94. package/dist/index.cjs.js +3 -3
  95. package/dist/index.cjs.js.map +1 -1
  96. package/dist/index.es-CuicffkQ.mjs +6665 -0
  97. package/dist/index.es-CuicffkQ.mjs.map +1 -0
  98. package/dist/index.esm.js +117 -112
  99. package/dist/index.esm.js.map +1 -1
  100. package/dist/plugin-loader.js +55 -0
  101. package/dist/plugin-loader.js.map +1 -0
  102. package/dist/purify.es-CKpwg8Tk.mjs +471 -0
  103. package/dist/purify.es-CKpwg8Tk.mjs.map +1 -0
  104. package/dist/webcomponent-core.js +1243 -0
  105. package/dist/webcomponent-core.js.map +1 -0
  106. package/dist/webcomponent-core.min.css +1 -0
  107. package/dist/webcomponent-core.min.js +597 -0
  108. package/dist/webcomponent-core.min.js.map +1 -0
  109. package/dist/webcomponent.cjs.js +1 -1
  110. package/dist/webcomponent.esm.js +3 -3
  111. package/dist/webcomponent.js +1286 -0
  112. package/dist/webcomponent.js.map +1 -0
  113. package/dist/webcomponent.min.css +1 -0
  114. package/dist/webcomponent.min.js +337 -334
  115. package/dist/webcomponent.min.js.map +1 -1
  116. package/package.json +16 -4
  117. package/dist/index-BK2lHfHK.js +0 -2
  118. package/dist/index-BK2lHfHK.js.map +0 -1
  119. package/dist/index-BS4zT-KN.mjs.map +0 -1
  120. package/dist/webcomponent.umd.js +0 -4073
  121. package/dist/webcomponent.umd.js.map +0 -1
package/dist/index.esm.js CHANGED
@@ -1,13 +1,13 @@
1
- import { P as g, E as y, a as f, T as b, R as v } from "./index-BS4zT-KN.mjs";
2
- import { C as B, c as G, F as K, d as V, S as W, b as X } from "./index-BS4zT-KN.mjs";
1
+ import { P as g, E as y, a as f, T as b, R as v } from "./index-BPsf460l.mjs";
2
+ import { C as B, h as G, F as K, i as V, S as W, b as X, e as _, d as Y, g as J, f as Q, c as Z } from "./index-BPsf460l.mjs";
3
3
  class k {
4
4
  constructor(e) {
5
5
  if (this.listeners = [], e instanceof g)
6
6
  this.pluginManager = e;
7
7
  else {
8
8
  const i = e;
9
- this.pluginManager = new g(), i.plugins && Array.isArray(i.plugins) && i.plugins.forEach((n) => {
10
- this.pluginManager.register(n);
9
+ this.pluginManager = new g(), i.plugins && Array.isArray(i.plugins) && i.plugins.forEach((s) => {
10
+ this.pluginManager.register(s);
11
11
  }), i.element && (this.domElement = i.element, this.setupDOMElement(i));
12
12
  }
13
13
  const t = this.pluginManager.buildSchema();
@@ -25,15 +25,15 @@ class k {
25
25
  }), document.addEventListener("keydown", (i) => {
26
26
  if (this.contentElement !== document.activeElement && !(document.activeElement instanceof HTMLElement && document.activeElement.contentEditable === "true"))
27
27
  return;
28
- const n = [];
29
- (i.ctrlKey || i.metaKey) && n.push("ctrl"), i.shiftKey && n.push("shift"), i.altKey && n.push("alt");
30
- const s = i.key.toLowerCase(), o = n.length > 0 ? `${n.join("+")}+${s}` : s, r = t[o];
28
+ const s = [];
29
+ (i.ctrlKey || i.metaKey) && s.push("ctrl"), i.shiftKey && s.push("shift"), i.altKey && s.push("alt");
30
+ const n = i.key.toLowerCase(), o = s.length > 0 ? `${s.join("+")}+${n}` : n, r = t[o];
31
31
  r && (i.preventDefault(), this.execCommand(r));
32
32
  });
33
33
  }
34
34
  handleToolbarCommand(e, t) {
35
- const n = this.pluginManager.getToolbarItems().find((s) => s.id && s.id === e || s.command === e);
36
- n && (t !== void 0 ? this.execCommand(n.command, t) : this.execCommand(n.command));
35
+ const s = this.pluginManager.getToolbarItems().find((n) => n.id && n.id === e || n.command === e);
36
+ s && (t !== void 0 ? this.execCommand(s.command, t) : this.execCommand(s.command));
37
37
  }
38
38
  setState(e) {
39
39
  this.state = e, this.listeners.forEach((t) => t(e));
@@ -55,8 +55,8 @@ class k {
55
55
  const i = this.commands[e];
56
56
  if (!i)
57
57
  return console.warn(`Command not found: ${e}`), !1;
58
- let n;
59
- return t !== void 0 ? n = i(this.state, t) : n = i(this.state), n ? (this.setState(n), !0) : !1;
58
+ let s;
59
+ return t !== void 0 ? s = i(this.state, t) : s = i(this.state), s ? (this.setState(s), !0) : !1;
60
60
  }
61
61
  setContent(e) {
62
62
  typeof e == "string" ? this.contentElement && (this.contentElement.innerHTML = e) : this.setState(this.state.apply(e));
@@ -82,8 +82,8 @@ class E {
82
82
  return console.warn(`Plugin "${this.plugin.name}" already initialized`), !1;
83
83
  try {
84
84
  return this.context = e, (t = this.plugin.context) != null && t.initialize && this.plugin.context.initialize(), (i = this.plugin.context) != null && i.onEditorReady && e.provider && this.plugin.context.onEditorReady(e), this.initialized = !0, !0;
85
- } catch (n) {
86
- return console.error(`Failed to initialize plugin "${this.plugin.name}":`, n), !1;
85
+ } catch (s) {
86
+ return console.error(`Failed to initialize plugin "${this.plugin.name}":`, s), !1;
87
87
  }
88
88
  }
89
89
  /**
@@ -107,10 +107,10 @@ class E {
107
107
  if (!this.initialized)
108
108
  return console.warn(`Plugin "${this.plugin.name}" not initialized, cannot execute command "${e}"`), null;
109
109
  try {
110
- const n = (i = this.plugin.commands) == null ? void 0 : i[e];
111
- return n ? n(...t) : (console.warn(`Command "${e}" not found in plugin "${this.plugin.name}"`), null);
112
- } catch (n) {
113
- return console.error(`Error executing command "${e}" in plugin "${this.plugin.name}":`, n), null;
110
+ const s = (i = this.plugin.commands) == null ? void 0 : i[e];
111
+ return s ? s(...t) : (console.warn(`Command "${e}" not found in plugin "${this.plugin.name}"`), null);
112
+ } catch (s) {
113
+ return console.error(`Error executing command "${e}" in plugin "${this.plugin.name}":`, s), null;
114
114
  }
115
115
  }
116
116
  /**
@@ -428,8 +428,8 @@ class L {
428
428
  }
429
429
  handleKeyDown(e, t) {
430
430
  if (!this.enabled) return !1;
431
- const i = this.getEventKey(e), n = this.shortcuts.get(i);
432
- return n ? (n.preventDefault !== !1 && (e.preventDefault(), e.stopPropagation()), t(n.command, n.params), !0) : !1;
431
+ const i = this.getEventKey(e), s = this.shortcuts.get(i);
432
+ return s ? (s.preventDefault !== !1 && (e.preventDefault(), e.stopPropagation()), t(s.command, s.params), !0) : !1;
433
433
  }
434
434
  enable() {
435
435
  this.enabled = !0;
@@ -454,17 +454,17 @@ class L {
454
454
  }
455
455
  getShortcutsHelp() {
456
456
  const e = this.getAllShortcuts(), t = /* @__PURE__ */ new Map();
457
- e.forEach((n) => {
458
- const s = this.getShortcutCategory(n.command);
459
- t.has(s) || t.set(s, []), t.get(s).push(n);
457
+ e.forEach((s) => {
458
+ const n = this.getShortcutCategory(s.command);
459
+ t.has(n) || t.set(n, []), t.get(n).push(s);
460
460
  });
461
461
  let i = `# Keyboard Shortcuts
462
462
 
463
463
  `;
464
- return t.forEach((n, s) => {
465
- i += `## ${s}
464
+ return t.forEach((s, n) => {
465
+ i += `## ${n}
466
466
 
467
- `, n.forEach((o) => {
467
+ `, s.forEach((o) => {
468
468
  const r = this.getShortcutDescription(o);
469
469
  i += `- **${r}**: ${o.description || o.command}
470
470
  `;
@@ -476,13 +476,13 @@ class L {
476
476
  return e.includes("toggle") && (e.includes("Bold") || e.includes("Italic") || e.includes("Underline") || e.includes("Strike") || e.includes("Code") || e.includes("Super") || e.includes("Sub")) ? "Text Formatting" : e.includes("Heading") || e.includes("Paragraph") ? "Block Formatting" : e.includes("List") || e.includes("Checklist") ? "Lists" : e.includes("Alignment") || e.includes("Indent") ? "Alignment & Indentation" : e.includes("undo") || e.includes("redo") ? "History" : e.includes("insert") ? "Insert" : e.includes("find") || e.includes("replace") ? "Find & Replace" : e.includes("Accessibility") || e.includes("spell") ? "Tools" : "Other";
477
477
  }
478
478
  }
479
- function I(a = {}) {
479
+ function T(a = {}) {
480
480
  const {
481
481
  enabled: e = !1,
482
482
  provider: t = "browser",
483
483
  apiUrl: i = "",
484
- apiHeaders: n = {},
485
- language: s = "en",
484
+ apiHeaders: s = {},
485
+ language: n = "en",
486
486
  customDictionary: o = [],
487
487
  ignoreAllCaps: r = !0,
488
488
  ignoreNumbers: l = !0
@@ -494,7 +494,7 @@ function I(a = {}) {
494
494
  if (e)
495
495
  switch (console.log("[Spellcheck Plugin] Initialized", {
496
496
  provider: t,
497
- language: s
497
+ language: n
498
498
  }), t) {
499
499
  case "browser":
500
500
  console.log("[Spellcheck] Using browser spellcheck");
@@ -529,14 +529,14 @@ function I(a = {}) {
529
529
  ] : []
530
530
  };
531
531
  }
532
- function T(a = {}) {
532
+ function I(a = {}) {
533
533
  const {
534
534
  uploadUrl: e = "",
535
535
  libraryUrl: t = "",
536
536
  maxFileSize: i = 10 * 1024 * 1024,
537
537
  // 10MB
538
- allowedTypes: n = ["image/jpeg", "image/png", "image/gif", "image/webp"],
539
- headers: s = {},
538
+ allowedTypes: s = ["image/jpeg", "image/png", "image/gif", "image/webp"],
539
+ headers: n = {},
540
540
  withCredentials: o = !1,
541
541
  chunkSize: r = 1024 * 1024,
542
542
  // 1MB chunks
@@ -553,7 +553,7 @@ function T(a = {}) {
553
553
  uploadUrl: e,
554
554
  libraryUrl: t,
555
555
  maxFileSize: i,
556
- allowedTypes: n
556
+ allowedTypes: s
557
557
  }), e || console.warn("[Media] No uploadUrl provided - upload will not work");
558
558
  },
559
559
  destroy: () => {
@@ -567,7 +567,7 @@ function T(a = {}) {
567
567
  insertImage: async (c) => {
568
568
  if (console.log("[Media] Insert image command (not implemented)", c), !c)
569
569
  return console.log("[Media] No file provided - should open picker"), null;
570
- if (!n.includes(c.type)) {
570
+ if (!s.includes(c.type)) {
571
571
  const p = new Error(`File type ${c.type} not allowed`);
572
572
  return h == null || h(p), null;
573
573
  }
@@ -673,19 +673,19 @@ class u {
673
673
  e == null || e.addEventListener("click", () => this.close());
674
674
  const t = this.element.querySelector(".editora-btn-cancel");
675
675
  t == null || t.addEventListener("click", () => {
676
- var n, s;
677
- (s = (n = this.config).onCancel) == null || s.call(n), this.close();
676
+ var s, n;
677
+ (n = (s = this.config).onCancel) == null || n.call(s), this.close();
678
678
  });
679
679
  const i = this.element.querySelector(".editora-btn-primary");
680
- i == null || i.addEventListener("click", () => this.handleSubmit()), this.config.closeOnEscape && this.element.addEventListener("cancel", (n) => {
681
- n.preventDefault(), this.close();
682
- }), this.config.closeOnBackdrop && this.element.addEventListener("click", (n) => {
683
- const s = this.element.getBoundingClientRect();
684
- (n.clientX < s.left || n.clientX > s.right || n.clientY < s.top || n.clientY > s.bottom) && this.close();
680
+ i == null || i.addEventListener("click", () => this.handleSubmit()), this.config.closeOnEscape && this.element.addEventListener("cancel", (s) => {
681
+ s.preventDefault(), this.close();
682
+ }), this.config.closeOnBackdrop && this.element.addEventListener("click", (s) => {
683
+ const n = this.element.getBoundingClientRect();
684
+ (s.clientX < n.left || s.clientX > n.right || s.clientY < n.top || s.clientY > n.bottom) && this.close();
685
685
  });
686
686
  }
687
687
  handleSubmit() {
688
- var t, i, n, s;
688
+ var t, i, s, n;
689
689
  const e = this.element.querySelector("form");
690
690
  if (e) {
691
691
  const o = new FormData(e);
@@ -694,7 +694,7 @@ class u {
694
694
  const o = this.element.querySelectorAll("input, select, textarea"), r = new FormData();
695
695
  o.forEach((l) => {
696
696
  l.name && r.append(l.name, l.value);
697
- }), (s = (n = this.config).onSubmit) == null || s.call(n, r);
697
+ }), (n = (s = this.config).onSubmit) == null || n.call(s, r);
698
698
  }
699
699
  this.close();
700
700
  }
@@ -715,17 +715,17 @@ class D {
715
715
  createElement() {
716
716
  const e = document.createElement("div");
717
717
  e.className = "editora-dropdown", this.config.width && (e.style.width = this.config.width);
718
- const t = this.config.options.find((n) => n.value === this.selectedValue), i = (t == null ? void 0 : t.label) || this.config.placeholder || "Select...";
718
+ const t = this.config.options.find((s) => s.value === this.selectedValue), i = (t == null ? void 0 : t.label) || this.config.placeholder || "Select...";
719
719
  return e.innerHTML = `
720
720
  <button class="editora-dropdown-toggle" type="button">
721
721
  <span class="editora-dropdown-label">${i}</span>
722
722
  <span class="editora-dropdown-arrow">▼</span>
723
723
  </button>
724
724
  <div class="editora-dropdown-menu" style="display: none;">
725
- ${this.config.options.map((n) => `
726
- <div class="editora-dropdown-item" data-value="${n.value}">
727
- ${n.icon ? `<span class="editora-dropdown-icon">${n.icon}</span>` : ""}
728
- <span>${n.label}</span>
725
+ ${this.config.options.map((s) => `
726
+ <div class="editora-dropdown-item" data-value="${s.value}">
727
+ ${s.icon ? `<span class="editora-dropdown-icon">${s.icon}</span>` : ""}
728
+ <span>${s.label}</span>
729
729
  </div>
730
730
  `).join("")}
731
731
  </div>
@@ -733,21 +733,21 @@ class D {
733
733
  }
734
734
  attachEventListeners() {
735
735
  const e = this.element.querySelector(".editora-dropdown-toggle"), t = this.element.querySelector(".editora-dropdown-menu");
736
- e.addEventListener("click", (n) => {
737
- n.stopPropagation(), this.isOpen = !this.isOpen, t.style.display = this.isOpen ? "block" : "none";
738
- }), this.element.querySelectorAll(".editora-dropdown-item").forEach((n) => {
739
- n.addEventListener("click", () => {
736
+ e.addEventListener("click", (s) => {
737
+ s.stopPropagation(), this.isOpen = !this.isOpen, t.style.display = this.isOpen ? "block" : "none";
738
+ }), this.element.querySelectorAll(".editora-dropdown-item").forEach((s) => {
739
+ s.addEventListener("click", () => {
740
740
  var o, r;
741
- const s = n.getAttribute("data-value");
742
- s && (this.setValue(s), (r = (o = this.config).onChange) == null || r.call(o, s), this.close());
741
+ const n = s.getAttribute("data-value");
742
+ n && (this.setValue(n), (r = (o = this.config).onChange) == null || r.call(o, n), this.close());
743
743
  });
744
- }), document.addEventListener("click", (n) => {
745
- this.element.contains(n.target) || this.close();
744
+ }), document.addEventListener("click", (s) => {
745
+ this.element.contains(s.target) || this.close();
746
746
  });
747
747
  }
748
748
  setValue(e) {
749
749
  this.selectedValue = e;
750
- const t = this.config.options.find((n) => n.value === e), i = this.element.querySelector(".editora-dropdown-label");
750
+ const t = this.config.options.find((s) => s.value === e), i = this.element.querySelector(".editora-dropdown-label");
751
751
  i && t && (i.textContent = t.label);
752
752
  }
753
753
  getValue() {
@@ -825,19 +825,19 @@ class F {
825
825
  }
826
826
  attachEventListeners() {
827
827
  const e = this.element.querySelector('input[type="color"]'), t = this.element.querySelector('input[type="text"]');
828
- e.addEventListener("input", (n) => {
828
+ e.addEventListener("input", (s) => {
829
829
  var o, r;
830
- const s = n.target.value;
831
- t.value = s, this.selectedColor = s, (r = (o = this.config).onChange) == null || r.call(o, s);
832
- }), t.addEventListener("input", (n) => {
830
+ const n = s.target.value;
831
+ t.value = n, this.selectedColor = n, (r = (o = this.config).onChange) == null || r.call(o, n);
832
+ }), t.addEventListener("input", (s) => {
833
833
  var o, r;
834
- const s = n.target.value;
835
- /^#[0-9A-Fa-f]{6}$/.test(s) && (e.value = s, this.selectedColor = s, (r = (o = this.config).onChange) == null || r.call(o, s));
836
- }), this.element.querySelectorAll(".editora-color-preset").forEach((n) => {
837
- n.addEventListener("click", () => {
834
+ const n = s.target.value;
835
+ /^#[0-9A-Fa-f]{6}$/.test(n) && (e.value = n, this.selectedColor = n, (r = (o = this.config).onChange) == null || r.call(o, n));
836
+ }), this.element.querySelectorAll(".editora-color-preset").forEach((s) => {
837
+ s.addEventListener("click", () => {
838
838
  var o, r;
839
- const s = n.getAttribute("data-color");
840
- s && (e.value = s, t.value = s, this.selectedColor = s, (r = (o = this.config).onChange) == null || r.call(o, s));
839
+ const n = s.getAttribute("data-color");
840
+ n && (e.value = n, t.value = n, this.selectedColor = n, (r = (o = this.config).onChange) == null || r.call(o, n));
841
841
  });
842
842
  });
843
843
  }
@@ -858,7 +858,7 @@ class F {
858
858
  }
859
859
  class j {
860
860
  constructor(e) {
861
- const { initialUrl: t = "", initialText: i = "", onSubmit: n, onCancel: s } = e;
861
+ const { initialUrl: t = "", initialText: i = "", onSubmit: s, onCancel: n } = e;
862
862
  this.dialog = new u({
863
863
  title: "Insert/Edit Link",
864
864
  content: this.createFormHTML(t, i),
@@ -868,10 +868,10 @@ class j {
868
868
  alert("Please enter a URL");
869
869
  return;
870
870
  }
871
- n({ url: r, text: l, openInNewTab: d }), this.dialog.close();
871
+ s({ url: r, text: l, openInNewTab: d }), this.dialog.close();
872
872
  },
873
873
  onCancel: () => {
874
- s == null || s(), this.dialog.close();
874
+ n == null || n(), this.dialog.close();
875
875
  },
876
876
  width: "500px"
877
877
  });
@@ -944,9 +944,9 @@ class q {
944
944
  this.dialog = new u({
945
945
  title: "Insert Table",
946
946
  content: this.createFormHTML(),
947
- onSubmit: (n) => {
948
- const s = parseInt(n.get("rows"), 10), o = parseInt(n.get("cols"), 10), r = n.get("headerRow") === "on";
949
- if (s < 1 || s > 100) {
947
+ onSubmit: (s) => {
948
+ const n = parseInt(s.get("rows"), 10), o = parseInt(s.get("cols"), 10), r = s.get("headerRow") === "on";
949
+ if (n < 1 || n > 100) {
950
950
  alert("Please enter a valid number of rows (1-100)");
951
951
  return;
952
952
  }
@@ -954,7 +954,7 @@ class q {
954
954
  alert("Please enter a valid number of columns (1-20)");
955
955
  return;
956
956
  }
957
- t({ rows: s, cols: o, headerRow: r }), this.dialog.close();
957
+ t({ rows: n, cols: o, headerRow: r }), this.dialog.close();
958
958
  },
959
959
  onCancel: () => {
960
960
  i == null || i(), this.dialog.close();
@@ -1033,11 +1033,11 @@ class q {
1033
1033
  attachPreviewListeners() {
1034
1034
  const e = document.querySelector(".table-dialog-form");
1035
1035
  if (!e) return;
1036
- const t = e.querySelector("#table-rows"), i = e.querySelector("#table-cols"), n = e.querySelector("#table-header"), s = e.querySelector("#table-preview-content"), o = () => {
1037
- const r = parseInt((t == null ? void 0 : t.value) || "3", 10), l = parseInt((i == null ? void 0 : i.value) || "3", 10), d = n == null ? void 0 : n.checked;
1038
- s && (s.textContent = `${r} rows × ${l} columns${d ? " with header" : ""}`);
1036
+ const t = e.querySelector("#table-rows"), i = e.querySelector("#table-cols"), s = e.querySelector("#table-header"), n = e.querySelector("#table-preview-content"), o = () => {
1037
+ const r = parseInt((t == null ? void 0 : t.value) || "3", 10), l = parseInt((i == null ? void 0 : i.value) || "3", 10), d = s == null ? void 0 : s.checked;
1038
+ n && (n.textContent = `${r} rows × ${l} columns${d ? " with header" : ""}`);
1039
1039
  };
1040
- t == null || t.addEventListener("input", o), i == null || i.addEventListener("input", o), n == null || n.addEventListener("change", o);
1040
+ t == null || t.addEventListener("input", o), i == null || i.addEventListener("input", o), s == null || s.addEventListener("change", o);
1041
1041
  }
1042
1042
  }
1043
1043
  class A {
@@ -1047,14 +1047,14 @@ class A {
1047
1047
  this.dialog = new u({
1048
1048
  title: "Insert Image",
1049
1049
  content: this.createFormHTML(),
1050
- onSubmit: (n) => {
1051
- const s = (n.get("src") || "").trim(), o = (n.get("alt") || "").trim(), r = (n.get("width") || "").trim(), l = (n.get("height") || "").trim();
1052
- if (!s) {
1050
+ onSubmit: (s) => {
1051
+ const n = (s.get("src") || "").trim(), o = (s.get("alt") || "").trim(), r = (s.get("width") || "").trim(), l = (s.get("height") || "").trim();
1052
+ if (!n) {
1053
1053
  alert("Please enter an image URL or upload an image");
1054
1054
  return;
1055
1055
  }
1056
1056
  t({
1057
- src: s,
1057
+ src: n,
1058
1058
  alt: o,
1059
1059
  width: r || void 0,
1060
1060
  height: l || void 0
@@ -1152,10 +1152,10 @@ class A {
1152
1152
  attachImagePreview() {
1153
1153
  const e = document.querySelector(".image-dialog-form");
1154
1154
  if (!e) return;
1155
- const t = e.querySelector("#image-src"), i = e.querySelector("#image-preview"), n = e.querySelector("#preview-img");
1155
+ const t = e.querySelector("#image-src"), i = e.querySelector("#image-preview"), s = e.querySelector("#preview-img");
1156
1156
  t == null || t.addEventListener("input", () => {
1157
- const s = t.value.trim();
1158
- s && this.isValidImageUrl(s) ? (n.src = s, i.style.display = "block", n.onerror = () => {
1157
+ const n = t.value.trim();
1158
+ n && this.isValidImageUrl(n) ? (s.src = n, i.style.display = "block", s.onerror = () => {
1159
1159
  i.style.display = "none";
1160
1160
  }) : i.style.display = "none";
1161
1161
  });
@@ -1165,16 +1165,16 @@ class A {
1165
1165
  const e = document.querySelector(".image-dialog-form");
1166
1166
  if (!e) return;
1167
1167
  const t = e.querySelector("#image-upload"), i = e.querySelector("#image-src");
1168
- t == null || t.addEventListener("change", async (n) => {
1168
+ t == null || t.addEventListener("change", async (s) => {
1169
1169
  var r;
1170
- const s = (r = n.target.files) == null ? void 0 : r[0];
1171
- if (!s) return;
1170
+ const n = (r = s.target.files) == null ? void 0 : r[0];
1171
+ if (!n) return;
1172
1172
  const o = new FileReader();
1173
1173
  o.onload = (l) => {
1174
1174
  var h;
1175
1175
  const d = (h = l.target) == null ? void 0 : h.result;
1176
1176
  i.value = d, i.dispatchEvent(new Event("input"));
1177
- }, o.readAsDataURL(s);
1177
+ }, o.readAsDataURL(n);
1178
1178
  });
1179
1179
  }
1180
1180
  isValidImageUrl(e) {
@@ -1320,12 +1320,12 @@ class P {
1320
1320
  </select>
1321
1321
  </div>
1322
1322
  `, e.querySelectorAll(".math-symbol-btn").forEach((i) => {
1323
- i.addEventListener("click", (n) => {
1324
- n.preventDefault();
1325
- const s = i.getAttribute("data-symbol");
1326
- if (s && this.latexInput) {
1323
+ i.addEventListener("click", (s) => {
1324
+ s.preventDefault();
1325
+ const n = i.getAttribute("data-symbol");
1326
+ if (n && this.latexInput) {
1327
1327
  const o = this.latexInput.selectionStart, r = this.latexInput.selectionEnd, l = this.latexInput.value;
1328
- this.latexInput.value = l.substring(0, o) + s + l.substring(r), this.latexInput.focus(), this.latexInput.selectionStart = this.latexInput.selectionEnd = o + s.length, this.updatePreview();
1328
+ this.latexInput.value = l.substring(0, o) + n + l.substring(r), this.latexInput.focus(), this.latexInput.selectionStart = this.latexInput.selectionEnd = o + n.length, this.updatePreview();
1329
1329
  }
1330
1330
  });
1331
1331
  }), e;
@@ -1475,16 +1475,16 @@ class $ {
1475
1475
  this.charactersGrid.innerHTML = "";
1476
1476
  let t = [];
1477
1477
  e === "all" ? t = Object.values(this.characters).flat() : t = this.characters[e] || [], t.forEach((i) => {
1478
- const n = document.createElement("button");
1479
- n.className = "char-button", n.textContent = i, n.title = `Insert ${i} (U+${i.charCodeAt(0).toString(16).toUpperCase()})`, n.addEventListener("click", (s) => {
1480
- s.preventDefault(), this.handleSelect(i);
1481
- }), this.charactersGrid.appendChild(n);
1478
+ const s = document.createElement("button");
1479
+ s.className = "char-button", s.textContent = i, s.title = `Insert ${i} (U+${i.charCodeAt(0).toString(16).toUpperCase()})`, s.addEventListener("click", (n) => {
1480
+ n.preventDefault(), this.handleSelect(i);
1481
+ }), this.charactersGrid.appendChild(s);
1482
1482
  });
1483
1483
  }
1484
1484
  filterCharacters() {
1485
1485
  const e = this.searchInput.value.toLowerCase();
1486
1486
  this.charactersGrid.querySelectorAll(".char-button").forEach((i) => {
1487
- const n = i.textContent || "", s = `u+${n.charCodeAt(0).toString(16)}`, o = !e || n.includes(e) || s.includes(e);
1487
+ const s = i.textContent || "", n = `u+${s.charCodeAt(0).toString(16)}`, o = !e || s.includes(e) || n.includes(e);
1488
1488
  i.style.display = o ? "flex" : "none";
1489
1489
  });
1490
1490
  }
@@ -1624,17 +1624,17 @@ class H {
1624
1624
  this.emojisGrid.innerHTML = "";
1625
1625
  let t = [];
1626
1626
  e === "all" ? t = Object.values(this.emojis).flat() : t = this.emojis[e] || [], t.forEach((i) => {
1627
- const n = document.createElement("button");
1628
- n.className = "emoji-button", n.textContent = i, n.title = `Insert ${i}`, n.addEventListener("click", (s) => {
1629
- s.preventDefault(), this.handleSelect(i);
1630
- }), this.emojisGrid.appendChild(n);
1627
+ const s = document.createElement("button");
1628
+ s.className = "emoji-button", s.textContent = i, s.title = `Insert ${i}`, s.addEventListener("click", (n) => {
1629
+ n.preventDefault(), this.handleSelect(i);
1630
+ }), this.emojisGrid.appendChild(s);
1631
1631
  });
1632
1632
  }
1633
1633
  filterEmojis() {
1634
1634
  const e = this.searchInput.value.toLowerCase();
1635
1635
  this.emojisGrid.querySelectorAll(".emoji-button").forEach((i) => {
1636
- const n = i.textContent || "", s = !e || n.includes(e);
1637
- i.style.display = s ? "flex" : "none";
1636
+ const s = i.textContent || "", n = !e || s.includes(e);
1637
+ i.style.display = n ? "flex" : "none";
1638
1638
  });
1639
1639
  }
1640
1640
  handleSelect(e) {
@@ -1667,11 +1667,11 @@ class S {
1667
1667
  items: typeof this.options.toolbar == "string" ? this.options.toolbar : void 0
1668
1668
  },
1669
1669
  this.options.plugins || []
1670
- ), this.toolbar.setCommandHandler((i, n) => {
1671
- this.execCommand(i, n);
1670
+ ), this.toolbar.setCommandHandler((i, s) => {
1671
+ this.execCommand(i, s);
1672
1672
  }), this.toolbar.render(this.toolbarElement)), this.contentElement.addEventListener("input", () => {
1673
1673
  const i = this.getHTML();
1674
- this.changeListeners.forEach((n) => n(i));
1674
+ this.changeListeners.forEach((s) => s(i));
1675
1675
  }), this.options.onInit && this.options.onInit(this.getAPI());
1676
1676
  }
1677
1677
  /**
@@ -1830,8 +1830,8 @@ class x {
1830
1830
  * Add event listener
1831
1831
  */
1832
1832
  on(e, t) {
1833
- const i = (n) => {
1834
- t(n.detail);
1833
+ const i = (s) => {
1834
+ t(s.detail);
1835
1835
  };
1836
1836
  return this.containerElement.addEventListener(e, i), () => {
1837
1837
  this.containerElement.removeEventListener(e, i);
@@ -1868,21 +1868,26 @@ export {
1868
1868
  L as KeyboardShortcutManager,
1869
1869
  j as LinkDialog,
1870
1870
  P as MathDialog,
1871
+ I as MediaPlugin,
1871
1872
  V as PluginLoader,
1872
1873
  g as PluginManager,
1873
1874
  E as PluginRuntime,
1874
1875
  S as ReactAdapter,
1875
1876
  v as RichTextEditorElement,
1876
1877
  W as Schema,
1878
+ T as SpellcheckPlugin,
1877
1879
  X as StatusBar,
1878
1880
  q as TableDialog,
1879
1881
  b as ToolbarRenderer,
1880
1882
  x as VanillaAdapter,
1883
+ _ as calculateTextStats,
1884
+ Y as countLines,
1881
1885
  U as createEditor,
1882
- T as createMediaPlugin,
1883
1886
  M as createPluginRuntime,
1884
1887
  z as createReactAdapter,
1885
- I as createSpellcheckPlugin,
1888
+ J as getCursorPosition,
1889
+ Q as getSelectionInfo,
1890
+ Z as getTextOffset,
1886
1891
  R as initWebComponent
1887
1892
  };
1888
1893
  //# sourceMappingURL=index.esm.js.map