@editora/core 1.0.7 → 1.0.9

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 (87) hide show
  1. package/README.md +5 -0
  2. package/dist/{A11yCheckerPlugin.native-BRdGYMju.mjs → A11yCheckerPlugin.native-58d12bed.mjs} +23 -12
  3. package/dist/{AnchorPlugin.native-BcYGEtd9.mjs → AnchorPlugin.native-289a112a.mjs} +112 -102
  4. package/dist/ApprovalWorkflowPlugin.native-449ce66c.mjs +1115 -0
  5. package/dist/{BackgroundColorPlugin.native-50iAT9xU.mjs → BackgroundColorPlugin.native-8aceb5cc.mjs} +16 -9
  6. package/dist/{BlockquotePlugin.native-JFmOLsxN.mjs → BlockquotePlugin.native-3541c714.mjs} +3 -2
  7. package/dist/BlocksLibraryPlugin.native-1cc51e63.mjs +1386 -0
  8. package/dist/{BoldPlugin.native-BAzzoqU5.mjs → BoldPlugin.native-f9d7f8e4.mjs} +1 -1
  9. package/dist/{CapitalizationPlugin.native-DOMsh5R7.mjs → CapitalizationPlugin.native-42c135dc.mjs} +3 -2
  10. package/dist/{ChecklistPlugin.native-nuSSEFNI.mjs → ChecklistPlugin.native-3b397ee9.mjs} +43 -22
  11. package/dist/CitationsPlugin.native-169fb1e8.mjs +1532 -0
  12. package/dist/{ClearFormattingPlugin.native-Bq_XcTh2.mjs → ClearFormattingPlugin.native-77baa514.mjs} +11 -6
  13. package/dist/{CodePlugin.native-DlpTPdkd.mjs → CodePlugin.native-989cf0aa.mjs} +629 -580
  14. package/dist/{CodeSamplePlugin.native-CgGoH-X4.mjs → CodeSamplePlugin.native-6cc0148e.mjs} +19 -10
  15. package/dist/{CommentsPlugin.native-DPSqTkiv.mjs → CommentsPlugin.native-03659874.mjs} +55 -28
  16. package/dist/ConditionalContentPlugin.native-4983143a.mjs +1424 -0
  17. package/dist/ContentRulesPlugin.native-63ed405b.mjs +1149 -0
  18. package/dist/DataBindingPlugin.native-427e9d75.mjs +956 -0
  19. package/dist/{DirectionPlugin.native-CDnbdNyl.mjs → DirectionPlugin.native-4e742f42.mjs} +19 -10
  20. package/dist/DocSchemaPlugin.native-8e41eda0.mjs +1382 -0
  21. package/dist/{DocumentManagerPlugin.native-C2cs_1w4.mjs → DocumentManagerPlugin.native-e69895ad.mjs} +4 -4
  22. package/dist/{EmbedIframePlugin.native-DKJx2OS7.mjs → EmbedIframePlugin.native-55209c87.mjs} +70 -70
  23. package/dist/{EmojisPlugin.native-CitxxlWX.mjs → EmojisPlugin.native-65c5ac47.mjs} +11 -6
  24. package/dist/{FontFamilyPlugin.native-j8hMTbg4.mjs → FontFamilyPlugin.native-f9bc255a.mjs} +7 -4
  25. package/dist/{FontSizePlugin.native-B_jCh7dY.mjs → FontSizePlugin.native-f5647872.mjs} +19 -10
  26. package/dist/{FootnotePlugin.native-D730OGRm.mjs → FootnotePlugin.native-494657b3.mjs} +77 -39
  27. package/dist/{FullscreenPlugin.native-ChXyxeNw.mjs → FullscreenPlugin.native-87ce92e9.mjs} +1 -1
  28. package/dist/{HeadingPlugin.native-DrLYwQnQ.mjs → HeadingPlugin.native-e38c4a16.mjs} +1 -1
  29. package/dist/{HistoryPlugin.native-TDnVMsEO.mjs → HistoryPlugin.native-92ed4be4.mjs} +43 -22
  30. package/dist/{IndentPlugin.native-BHixp8sP.mjs → IndentPlugin.native-e4ee902b.mjs} +23 -12
  31. package/dist/{ItalicPlugin.native-CQjjDyUL.mjs → ItalicPlugin.native-7c95cfbc.mjs} +1 -1
  32. package/dist/{LineHeightPlugin.native-CM7iXdQj.mjs → LineHeightPlugin.native-5668f78c.mjs} +19 -10
  33. package/dist/{LinkPlugin.native-DYCIcdTm.mjs → LinkPlugin.native-6df29111.mjs} +9 -5
  34. package/dist/{ListPlugin.native-V7EZC1lM.mjs → ListPlugin.native-fe2e115a.mjs} +9 -5
  35. package/dist/{MathPlugin.native-f_mDp8VL.mjs → MathPlugin.native-735bbac2.mjs} +9 -5
  36. package/dist/{MediaManagerPlugin.native-BiXiK8FC.mjs → MediaManagerPlugin.native-3cf48a00.mjs} +219 -207
  37. package/dist/MentionPlugin.native-3b1e8c05.mjs +778 -0
  38. package/dist/{MergeTagPlugin.native-C3eOfEgw.mjs → MergeTagPlugin.native-31cf7d48.mjs} +51 -26
  39. package/dist/PIIRedactionPlugin.native-7ab10b9f.mjs +1449 -0
  40. package/dist/{PageBreakPlugin.native-CXdX5fAv.mjs → PageBreakPlugin.native-1794c5fb.mjs} +67 -52
  41. package/dist/{PreviewPlugin.native-DBvfpmIv.mjs → PreviewPlugin.native-f7b67cc0.mjs} +38 -33
  42. package/dist/{PrintPlugin.native-7qt5v7L5.mjs → PrintPlugin.native-f6a168c2.mjs} +5 -3
  43. package/dist/SlashCommandsPlugin.native-8d45e511.mjs +790 -0
  44. package/dist/SmartPastePlugin.native-a6c5efec.mjs +1447 -0
  45. package/dist/{SpecialCharactersPlugin.native-CZDato89.mjs → SpecialCharactersPlugin.native-7f06d4ba.mjs} +17 -9
  46. package/dist/{SpellCheckPlugin.native-BZB9AewP.mjs → SpellCheckPlugin.native-04e20834.mjs} +41 -21
  47. package/dist/{StrikethroughPlugin.native-0Be7j49s.mjs → StrikethroughPlugin.native-905e9501.mjs} +9 -5
  48. package/dist/{TablePlugin.native-DrHX-efe.mjs → TablePlugin.native-7d5458c1.mjs} +58 -30
  49. package/dist/{TemplatePlugin.native-CrpfKRJ8.mjs → TemplatePlugin.native-580f0f63.mjs} +32 -17
  50. package/dist/{TextAlignmentPlugin.native-sM_1s00t.mjs → TextAlignmentPlugin.native-9357b3ed.mjs} +11 -6
  51. package/dist/{TextColorPlugin.native-Bwl_bSmc.mjs → TextColorPlugin.native-d53ed459.mjs} +26 -14
  52. package/dist/TrackChangesPlugin.native-e96da509.mjs +818 -0
  53. package/dist/TranslationWorkflowPlugin.native-4e711b1e.mjs +1797 -0
  54. package/dist/{UnderlinePlugin.native-QpIcK4L2.mjs → UnderlinePlugin.native-8080c998.mjs} +1 -1
  55. package/dist/VersionDiffPlugin.native-5bbeff85.mjs +801 -0
  56. package/dist/_commonjsHelpers-69d58be2.mjs +31 -0
  57. package/dist/{anchoredPopover-Bxds0VoB.mjs → anchoredPopover-5cca53ba.mjs} +1 -1
  58. package/dist/documentManager-8327fb6e.mjs +9166 -0
  59. package/dist/{editorContainerHelpers-C7kdWnS0.mjs → editorContainerHelpers-69585c07.mjs} +3 -2
  60. package/dist/editora.min.js +14 -13
  61. package/dist/editora.umd.js +14 -13
  62. package/dist/{html2canvas.esm-AYkPY5LS.mjs → html2canvas.esm-c51cb3b9.mjs} +978 -894
  63. package/dist/index-072ef022.js +11 -0
  64. package/dist/index-49d31221.mjs +16860 -0
  65. package/dist/{index-yzU4NdPT.mjs → index-7da30697.mjs} +490 -358
  66. package/dist/index.cjs.js +1 -1
  67. package/dist/index.es-b47a189f.mjs +5782 -0
  68. package/dist/index.esm.js +12 -7
  69. package/dist/{jspdf.es.min-BJGtOnRT.mjs → jspdf.es.min-780c82db.mjs} +4808 -3784
  70. package/dist/plugin-loader.js +77 -40
  71. package/dist/{purify.es-CKpwg8Tk.mjs → purify.es-3bdbcfc5.mjs} +20 -10
  72. package/dist/style.css +1 -0
  73. package/dist/webcomponent-core.js +546 -414
  74. package/dist/webcomponent-core.min.css +1 -1
  75. package/dist/webcomponent-core.min.js +40 -39
  76. package/dist/webcomponent.cjs.js +1 -1
  77. package/dist/webcomponent.esm.js +1 -1
  78. package/dist/webcomponent.js +484 -315
  79. package/dist/webcomponent.min.css +1 -1
  80. package/dist/webcomponent.min.js +6035 -558
  81. package/package.json +11 -5
  82. package/dist/_commonjsHelpers-DOllISpa.mjs +0 -32
  83. package/dist/core.css +0 -1
  84. package/dist/documentManager-vQ1VkbUY.mjs +0 -8418
  85. package/dist/index-BpE6GFbz.js +0 -10
  86. package/dist/index-BslAFzmv.mjs +0 -16544
  87. package/dist/index.es-BYD2KEo6.mjs +0 -6666
@@ -1,16 +1,16 @@
1
- class b {
1
+ class v {
2
2
  constructor(t, e, o) {
3
3
  this.doc = t, this.selection = e, this.schema = o;
4
4
  }
5
5
  static create(t, e) {
6
6
  const o = e || t.node("doc", {}, [t.node("paragraph")]);
7
- return new b(o, { anchor: 0, head: 0 }, t);
7
+ return new v(o, { anchor: 0, head: 0 }, t);
8
8
  }
9
9
  apply(t, e) {
10
- return new b(t, e || this.selection, this.schema);
10
+ return new v(t, e || this.selection, this.schema);
11
11
  }
12
12
  }
13
- class C {
13
+ class D {
14
14
  constructor(t, e) {
15
15
  this.nodes = new Map(Object.entries(t)), this.marks = new Map(Object.entries(e));
16
16
  }
@@ -21,7 +21,7 @@ class C {
21
21
  return { type: "text", text: t, marks: e };
22
22
  }
23
23
  }
24
- class E {
24
+ class N {
25
25
  constructor() {
26
26
  this.plugins = [], this.pluginConfigs = /* @__PURE__ */ new Map();
27
27
  }
@@ -31,14 +31,14 @@ class E {
31
31
  if (t.initialize)
32
32
  try {
33
33
  t.initialize(o);
34
- } catch (r) {
35
- console.error(`Failed to initialize plugin "${t.name}":`, r);
34
+ } catch (n) {
35
+ console.error(`Failed to initialize plugin "${t.name}":`, n);
36
36
  }
37
37
  if (t.init && t.init !== t.initialize)
38
38
  try {
39
39
  t.init(o);
40
- } catch (r) {
41
- console.error(`Failed to run init hook for plugin "${t.name}":`, r);
40
+ } catch (n) {
41
+ console.error(`Failed to run init hook for plugin "${t.name}":`, n);
42
42
  }
43
43
  }
44
44
  unregister(t) {
@@ -58,7 +58,7 @@ class E {
58
58
  const t = {}, e = {};
59
59
  return this.plugins.forEach((o) => {
60
60
  o.nodes && Object.assign(t, o.nodes), o.marks && Object.assign(e, o.marks);
61
- }), new C(t, e);
61
+ }), new D(t, e);
62
62
  }
63
63
  getCommands() {
64
64
  const t = {};
@@ -73,32 +73,32 @@ class E {
73
73
  * Execute plugin command with mode awareness
74
74
  */
75
75
  async executePluginCommand(t, e, ...o) {
76
- const r = this.getPlugin(t);
77
- if (!r)
76
+ const n = this.getPlugin(t);
77
+ if (!n)
78
78
  throw new Error(`Plugin not found: ${t}`);
79
- const i = this.getPluginConfig(t) || r.config || {}, n = i.mode || "local";
79
+ const i = this.getPluginConfig(t) || n.config || {}, r = i.mode || "local";
80
80
  try {
81
- switch (n) {
81
+ switch (r) {
82
82
  case "local":
83
- return r.executeLocal ? r.executeLocal(e, ...o) : null;
83
+ return n.executeLocal ? n.executeLocal(e, ...o) : null;
84
84
  case "api":
85
- if (!r.executeAPI)
85
+ if (!n.executeAPI)
86
86
  throw new Error(`Plugin ${t} does not support API mode`);
87
- return await r.executeAPI(e, ...o);
87
+ return await n.executeAPI(e, ...o);
88
88
  case "hybrid":
89
- if (r.executeHybrid)
90
- return await r.executeHybrid(e, ...o);
89
+ if (n.executeHybrid)
90
+ return await n.executeHybrid(e, ...o);
91
91
  try {
92
- if (r.executeAPI)
93
- return await r.executeAPI(e, ...o);
92
+ if (n.executeAPI)
93
+ return await n.executeAPI(e, ...o);
94
94
  } catch (a) {
95
- if (console.warn(`API execution failed for ${t}, falling back to local`, a), r.executeLocal && i.fallbackToLocal !== !1)
96
- return r.executeLocal(e, ...o);
95
+ if (console.warn(`API execution failed for ${t}, falling back to local`, a), n.executeLocal && i.fallbackToLocal !== !1)
96
+ return n.executeLocal(e, ...o);
97
97
  throw a;
98
98
  }
99
99
  break;
100
100
  default:
101
- throw new Error(`Unknown plugin mode: ${n}`);
101
+ throw new Error(`Unknown plugin mode: ${r}`);
102
102
  }
103
103
  } catch (a) {
104
104
  throw console.error(`Error executing command ${e} on plugin ${t}:`, a), a;
@@ -112,7 +112,7 @@ class E {
112
112
  await Promise.all(t), this.plugins = [], this.pluginConfigs.clear();
113
113
  }
114
114
  }
115
- class S {
115
+ class P {
116
116
  constructor(t) {
117
117
  this.shortcuts = /* @__PURE__ */ new Map(), this.enabled = !0, this.isMac = typeof navigator != "undefined" && navigator.platform.toUpperCase().indexOf("MAC") >= 0, (t == null ? void 0 : t.enabled) === !1 && (this.enabled = !1), this.registerDefaultShortcuts(), t != null && t.shortcuts && t.shortcuts.forEach((e) => this.registerShortcut(e)), t != null && t.customShortcuts && Object.values(t.customShortcuts).forEach((e) => {
118
118
  this.registerShortcut(e);
@@ -398,9 +398,10 @@ class S {
398
398
  return t.ctrlKey && e.push("ctrl"), t.altKey && e.push("alt"), t.shiftKey && e.push("shift"), t.metaKey && e.push("meta"), e.push(t.key.toLowerCase()), e.join("+");
399
399
  }
400
400
  handleKeyDown(t, e) {
401
- if (!this.enabled) return !1;
402
- const o = this.getEventKey(t), r = this.shortcuts.get(o);
403
- return r ? (r.preventDefault !== !1 && (t.preventDefault(), t.stopPropagation()), e(r.command, r.params), !0) : !1;
401
+ if (!this.enabled)
402
+ return !1;
403
+ const o = this.getEventKey(t), n = this.shortcuts.get(o);
404
+ return n ? (n.preventDefault !== !1 && (t.preventDefault(), t.stopPropagation()), e(n.command, n.params), !0) : !1;
404
405
  }
405
406
  enable() {
406
407
  this.enabled = !0;
@@ -425,19 +426,19 @@ class S {
425
426
  }
426
427
  getShortcutsHelp() {
427
428
  const t = this.getAllShortcuts(), e = /* @__PURE__ */ new Map();
428
- t.forEach((r) => {
429
- const i = this.getShortcutCategory(r.command);
430
- e.has(i) || e.set(i, []), e.get(i).push(r);
429
+ t.forEach((n) => {
430
+ const i = this.getShortcutCategory(n.command);
431
+ e.has(i) || e.set(i, []), e.get(i).push(n);
431
432
  });
432
433
  let o = `# Keyboard Shortcuts
433
434
 
434
435
  `;
435
- return e.forEach((r, i) => {
436
+ return e.forEach((n, i) => {
436
437
  o += `## ${i}
437
438
 
438
- `, r.forEach((n) => {
439
- const a = this.getShortcutDescription(n);
440
- o += `- **${a}**: ${n.description || n.command}
439
+ `, n.forEach((r) => {
440
+ const a = this.getShortcutDescription(r);
441
+ o += `- **${a}**: ${r.description || r.command}
441
442
  `;
442
443
  }), o += `
443
444
  `;
@@ -447,7 +448,7 @@ class S {
447
448
  return t.includes("toggle") && (t.includes("Bold") || t.includes("Italic") || t.includes("Underline") || t.includes("Strike") || t.includes("Code") || t.includes("Super") || t.includes("Sub")) ? "Text Formatting" : t.includes("Heading") || t.includes("Paragraph") ? "Block Formatting" : t.includes("List") || t.includes("Checklist") ? "Lists" : t.includes("Alignment") || t.includes("Indent") ? "Alignment & Indentation" : t.includes("undo") || t.includes("redo") ? "History" : t.includes("insert") ? "Insert" : t.includes("find") || t.includes("replace") ? "Find & Replace" : t.includes("Accessibility") || t.includes("spell") ? "Tools" : "Other";
448
449
  }
449
450
  }
450
- class M {
451
+ class O {
451
452
  constructor(t = {}) {
452
453
  this.commands = /* @__PURE__ */ new Map(), Object.entries(t).forEach(([e, o]) => {
453
454
  this.register(e, o);
@@ -490,11 +491,11 @@ class M {
490
491
  this.commands.clear();
491
492
  }
492
493
  }
493
- class A {
494
+ class B {
494
495
  constructor(t = {}) {
495
- this.listeners = /* @__PURE__ */ new Map(), this.isReadonly = !1, this.isDestroyed = !1, this.isReadonly = t.readonly || !1, this.pluginManager = new E(), t.plugins && Array.isArray(t.plugins) && t.plugins.forEach((o) => this.pluginManager.register(o));
496
+ this.listeners = /* @__PURE__ */ new Map(), this.isReadonly = !1, this.isDestroyed = !1, this.isReadonly = t.readonly || !1, this.pluginManager = new N(), t.plugins && Array.isArray(t.plugins) && t.plugins.forEach((o) => this.pluginManager.register(o));
496
497
  const e = this.pluginManager.buildSchema();
497
- this.state = b.create(e), this.commandRegistry = new M(this.pluginManager.getCommands());
498
+ this.state = v.create(e), this.commandRegistry = new O(this.pluginManager.getCommands());
498
499
  }
499
500
  /**
500
501
  * Execute a command
@@ -507,12 +508,12 @@ class A {
507
508
  const o = this.commandRegistry.get(t);
508
509
  if (!o)
509
510
  return console.warn(`Command not found: ${t}`), !1;
510
- let r;
511
- return e !== void 0 ? r = o(this.state, e) : r = o(this.state), r instanceof Promise ? (r.then((i) => {
511
+ let n;
512
+ return e !== void 0 ? n = o(this.state, e) : n = o(this.state), n instanceof Promise ? (n.then((i) => {
512
513
  i && typeof i == "object" && "doc" in i && "selection" in i && (this.setState(i), this.emit("change", this.state));
513
514
  }).catch((i) => {
514
515
  console.error(`Async command failed: ${t}`, i);
515
- }), !0) : r && typeof r == "object" && "doc" in r && "selection" in r ? (this.setState(r), this.emit("change", this.state), !0) : r !== !1 && r != null;
516
+ }), !0) : n && typeof n == "object" && "doc" in n && "selection" in n ? (this.setState(n), this.emit("change", this.state), !0) : n !== !1 && n != null;
516
517
  }
517
518
  /**
518
519
  * Update editor state
@@ -545,8 +546,8 @@ class A {
545
546
  return this.listeners.has(t) || this.listeners.set(t, []), this.listeners.get(t).push(e), () => {
546
547
  const o = this.listeners.get(t);
547
548
  if (o) {
548
- const r = o.indexOf(e);
549
- r > -1 && o.splice(r, 1);
549
+ const n = o.indexOf(e);
550
+ n > -1 && o.splice(n, 1);
550
551
  }
551
552
  };
552
553
  }
@@ -555,9 +556,9 @@ class A {
555
556
  */
556
557
  emit(t, ...e) {
557
558
  const o = this.listeners.get(t);
558
- o && o.forEach((r) => {
559
+ o && o.forEach((n) => {
559
560
  try {
560
- r(...e);
561
+ n(...e);
561
562
  } catch (i) {
562
563
  console.error(`Error in ${t} handler:`, i);
563
564
  }
@@ -576,10 +577,11 @@ class A {
576
577
  return this.isDestroyed;
577
578
  }
578
579
  }
579
- class L {
580
+ class z {
580
581
  // PluginLoader instance to get all registered plugins
581
582
  setLastCommandTrigger(t, e) {
582
- if (typeof window == "undefined" || !t) return;
583
+ if (typeof window == "undefined" || !t)
584
+ return;
583
585
  const o = e || t.getAttribute("data-command") || void 0;
584
586
  o && (window.__editoraLastCommandButton = t, window.__editoraLastCommand = o);
585
587
  }
@@ -596,11 +598,11 @@ class L {
596
598
  * Parse toolbar string into button groups
597
599
  */
598
600
  parseToolbarString(t) {
599
- const e = [], o = t.split("|").map((a) => a.trim()), r = this.getAvailableToolbarItems(), i = /* @__PURE__ */ new Map();
600
- r.forEach((a) => {
601
+ const e = [], o = t.split("|").map((a) => a.trim()), n = this.getAvailableToolbarItems(), i = /* @__PURE__ */ new Map();
602
+ n.forEach((a) => {
601
603
  a.command && i.set(a.command, a), a.type === "group" && a.label && i.set(a.label, a);
602
604
  });
603
- const n = {
605
+ const r = {
604
606
  bold: "toggleBold",
605
607
  italic: "toggleItalic",
606
608
  underline: "toggleUnderline",
@@ -611,6 +613,9 @@ class L {
611
613
  link: "openLinkDialog",
612
614
  image: "openImageDialog",
613
615
  table: "insertTable",
616
+ trackChanges: "toggleTrackChanges",
617
+ acceptTrackChanges: "acceptAllTrackChanges",
618
+ rejectTrackChanges: "rejectAllTrackChanges",
614
619
  anchor: "insertAnchor",
615
620
  code: "toggleSourceView",
616
621
  blockquote: "toggleBlockquote",
@@ -642,6 +647,14 @@ class L {
642
647
  toggleComments: "toggleComments",
643
648
  footnote: "insertFootnote",
644
649
  mergeTags: "insertMergeTag",
650
+ dataBinding: "openDataBindingDialog",
651
+ dataBindingPreview: "openDataBindingDialog",
652
+ contentRules: "toggleContentRulesPanel",
653
+ contentRulesAudit: "runContentRulesAudit",
654
+ contentRulesRealtime: "toggleContentRulesRealtime",
655
+ mention: "insertMention",
656
+ slash: "openSlashCommands",
657
+ slashCommands: "openSlashCommands",
645
658
  pageBreak: "insertPageBreak",
646
659
  template: "insertTemplate",
647
660
  importWord: "importWord",
@@ -652,49 +665,49 @@ class L {
652
665
  codeBlock: "insertCodeBlock"
653
666
  };
654
667
  return o.forEach((a) => {
655
- const s = [];
668
+ const l = [];
656
669
  a.split(/\s+/).filter(Boolean).forEach((d) => {
657
670
  if (d === "direction") {
658
- const u = i.get("setDirectionLTR"), h = i.get("setDirectionRTL");
659
- u && s.push({
671
+ const u = i.get("setDirectionLTR"), f = i.get("setDirectionRTL");
672
+ u && l.push({
660
673
  id: "directionLTR",
661
674
  label: u.label,
662
675
  command: u.command,
663
676
  icon: u.icon,
664
677
  type: u.type || "button",
665
678
  options: u.options
666
- }), h && s.push({
679
+ }), f && l.push({
667
680
  id: "directionRTL",
668
- label: h.label,
669
- command: h.command,
670
- icon: h.icon,
671
- type: h.type || "button",
672
- options: h.options
681
+ label: f.label,
682
+ command: f.command,
683
+ icon: f.icon,
684
+ type: f.type || "button",
685
+ options: f.options
673
686
  });
674
687
  return;
675
688
  }
676
689
  if (d === "comments") {
677
- const u = i.get("addComment"), h = i.get("toggleComments");
678
- u && s.push({
690
+ const u = i.get("addComment"), f = i.get("toggleComments");
691
+ u && l.push({
679
692
  id: "addComment",
680
693
  label: u.label,
681
694
  command: u.command,
682
695
  icon: u.icon,
683
696
  type: u.type || "button",
684
697
  options: u.options
685
- }), h && s.push({
698
+ }), f && l.push({
686
699
  id: "toggleComments",
687
- label: h.label,
688
- command: h.command,
689
- icon: h.icon,
690
- type: h.type || "button",
691
- options: h.options
700
+ label: f.label,
701
+ command: f.command,
702
+ icon: f.icon,
703
+ type: f.type || "button",
704
+ options: f.options
692
705
  });
693
706
  return;
694
707
  }
695
- const f = n[d] || d;
696
- let p = i.get(f);
697
- p || (p = i.get(d)), p && s.push({
708
+ const h = r[d] || d;
709
+ let p = i.get(h);
710
+ p || (p = i.get(d)), p && l.push({
698
711
  id: d,
699
712
  label: p.label,
700
713
  command: p.command,
@@ -703,7 +716,7 @@ class L {
703
716
  options: p.options,
704
717
  items: p.items
705
718
  });
706
- }), s.length > 0 && e.push(s);
719
+ }), l.length > 0 && e.push(l);
707
720
  }), e;
708
721
  }
709
722
  /**
@@ -718,11 +731,11 @@ class L {
718
731
  render(t) {
719
732
  this.container = t, t.innerHTML = "", t.className = "editora-toolbar", this.config.sticky && t.classList.add("editora-toolbar-sticky"), this.config.position && t.classList.add(`editora-toolbar-${this.config.position}`);
720
733
  const e = this.config.items || this.getDefaultToolbarString(), o = this.parseToolbarString(e);
721
- o.forEach((r, i) => {
722
- const n = document.createElement("div");
723
- if (n.className = "editora-toolbar-group", r.forEach((a) => {
724
- this.appendToolbarButton(n, a);
725
- }), t.appendChild(n), i < o.length - 1) {
734
+ o.forEach((n, i) => {
735
+ const r = document.createElement("div");
736
+ if (r.className = "editora-toolbar-group", n.forEach((a) => {
737
+ this.appendToolbarButton(r, a);
738
+ }), t.appendChild(r), i < o.length - 1) {
726
739
  const a = document.createElement("div");
727
740
  a.className = "editora-toolbar-separator", t.appendChild(a);
728
741
  }
@@ -756,18 +769,18 @@ class L {
756
769
  * Create a toolbar button element
757
770
  */
758
771
  createGroupButton(t) {
759
- const e = document.createElement("div");
760
- if (e.className = "editora-toolbar-group-button", e.title = t.label, t.icon)
772
+ const e = document.createElement("div"), o = t.label.toLowerCase().replace(/\s+/g, "-");
773
+ if (e.className = `editora-toolbar-group-button ${o}`, e.title = t.label, t.icon)
761
774
  if (t.icon.startsWith("<svg") && t.icon.endsWith("</svg>")) {
762
- const o = document.createElement("span");
763
- o.className = "editora-toolbar-icon", o.innerHTML = t.icon, e.appendChild(o);
775
+ const n = document.createElement("span");
776
+ n.className = "editora-toolbar-icon", n.innerHTML = t.icon, e.appendChild(n);
764
777
  } else
765
778
  e.innerHTML = t.icon;
766
779
  if (t.items && t.items.length) {
767
- const o = document.createElement("div");
768
- o.className = "editora-toolbar-group-items", t.items.forEach((r) => {
769
- this.appendToolbarButton(o, r);
770
- }), e.appendChild(o);
780
+ const n = document.createElement("div");
781
+ n.className = `editora-toolbar-group-items ${o}`, t.items.forEach((i) => {
782
+ this.appendToolbarButton(n, i);
783
+ }), e.appendChild(n);
771
784
  }
772
785
  return e;
773
786
  }
@@ -805,25 +818,25 @@ class L {
805
818
  e.className = "editora-toolbar-dropdown";
806
819
  const o = document.createElement("button");
807
820
  o.className = "editora-toolbar-button editora-toolbar-dropdown-trigger", o.type = "button", o.textContent = t.label;
808
- const r = document.createElement("div");
809
- r.className = "editora-toolbar-dropdown-menu", r.style.display = "none", t.options && t.options.forEach((a) => {
810
- const s = document.createElement("button");
811
- s.className = "editora-toolbar-dropdown-item", s.type = "button", s.textContent = a.label, s.setAttribute("data-value", a.value), s.addEventListener("click", (c) => {
812
- c.preventDefault(), this.setLastCommandTrigger(o, t.command), this.commandHandler && t.command && this.commandHandler(t.command, a.value), r.style.display = "none";
813
- }), r.appendChild(s);
821
+ const n = document.createElement("div");
822
+ n.className = "editora-toolbar-dropdown-menu", n.style.display = "none", t.options && t.options.forEach((a) => {
823
+ const l = document.createElement("button");
824
+ l.className = "editora-toolbar-dropdown-item", l.type = "button", l.textContent = a.label, l.setAttribute("data-value", a.value), l.addEventListener("click", (c) => {
825
+ c.preventDefault(), this.setLastCommandTrigger(o, t.command), this.commandHandler && t.command && this.commandHandler(t.command, a.value), n.style.display = "none";
826
+ }), n.appendChild(l);
814
827
  }), o.addEventListener("click", (a) => {
815
828
  a.preventDefault(), a.stopPropagation(), this.setLastCommandTrigger(o, t.command);
816
- const s = r.style.display === "block";
817
- r.style.display = s ? "none" : "block";
829
+ const l = n.style.display === "block";
830
+ n.style.display = l ? "none" : "block";
818
831
  });
819
832
  const i = (a) => {
820
- e.contains(a.target) || (r.style.display = "none");
821
- }, n = (a) => {
822
- a.key === "Escape" && (r.style.display = "none");
833
+ e.contains(a.target) || (n.style.display = "none");
834
+ }, r = (a) => {
835
+ a.key === "Escape" && (n.style.display = "none");
823
836
  };
824
- return document.addEventListener("mousedown", i, !0), document.addEventListener("keydown", n), e._cleanupDropdown = () => {
825
- document.removeEventListener("mousedown", i, !0), document.removeEventListener("keydown", n);
826
- }, e.appendChild(o), e.appendChild(r), e;
837
+ return document.addEventListener("mousedown", i, !0), document.addEventListener("keydown", r), e._cleanupDropdown = () => {
838
+ document.removeEventListener("mousedown", i, !0), document.removeEventListener("keydown", r);
839
+ }, e.appendChild(o), e.appendChild(n), e;
827
840
  }
828
841
  /**
829
842
  * Create an inline menu element (like dropdown but triggered by button click)
@@ -840,30 +853,30 @@ class L {
840
853
  o.innerHTML = t.icon;
841
854
  else
842
855
  o.textContent = t.label;
843
- const r = document.createElement("div");
844
- r.className = "editora-toolbar-dropdown-menu", r.style.display = "none", t.options && t.options.forEach((a) => {
845
- const s = document.createElement("button");
846
- s.className = "editora-toolbar-dropdown-item", s.type = "button", s.textContent = a.label, s.setAttribute("data-value", a.value), s.addEventListener("click", (c) => {
847
- c.preventDefault(), c.stopPropagation(), this.setLastCommandTrigger(o, t.command), this.commandHandler && t.command && this.commandHandler(t.command, a.value), r.style.display = "none";
848
- }), r.appendChild(s);
856
+ const n = document.createElement("div");
857
+ n.className = "editora-toolbar-dropdown-menu", n.style.display = "none", t.options && t.options.forEach((a) => {
858
+ const l = document.createElement("button");
859
+ l.className = "editora-toolbar-dropdown-item", l.type = "button", l.textContent = a.label, l.setAttribute("data-value", a.value), l.addEventListener("click", (c) => {
860
+ c.preventDefault(), c.stopPropagation(), this.setLastCommandTrigger(o, t.command), this.commandHandler && t.command && this.commandHandler(t.command, a.value), n.style.display = "none";
861
+ }), n.appendChild(l);
849
862
  }), o.addEventListener("click", (a) => {
850
863
  var c;
851
864
  a.preventDefault(), a.stopPropagation(), this.setLastCommandTrigger(o, t.command);
852
- const s = (c = this.container) == null ? void 0 : c.querySelectorAll(
865
+ const l = (c = this.container) == null ? void 0 : c.querySelectorAll(
853
866
  ".editora-toolbar-dropdown-menu"
854
867
  );
855
- s == null || s.forEach((d) => {
856
- d !== r && (d.style.display = "none");
857
- }), r.style.display = r.style.display === "none" ? "block" : "none";
868
+ l == null || l.forEach((d) => {
869
+ d !== n && (d.style.display = "none");
870
+ }), n.style.display = n.style.display === "none" ? "block" : "none";
858
871
  });
859
872
  const i = (a) => {
860
- e.contains(a.target) || (r.style.display = "none");
861
- }, n = (a) => {
862
- a.key === "Escape" && (r.style.display = "none");
873
+ e.contains(a.target) || (n.style.display = "none");
874
+ }, r = (a) => {
875
+ a.key === "Escape" && (n.style.display = "none");
863
876
  };
864
- return document.addEventListener("mousedown", i, !0), document.addEventListener("keydown", n), e._cleanupDropdown = () => {
865
- document.removeEventListener("mousedown", i, !0), document.removeEventListener("keydown", n);
866
- }, e.appendChild(o), e.appendChild(r), e;
877
+ return document.addEventListener("mousedown", i, !0), document.addEventListener("keydown", r), e._cleanupDropdown = () => {
878
+ document.removeEventListener("mousedown", i, !0), document.removeEventListener("keydown", r);
879
+ }, e.appendChild(o), e.appendChild(n), e;
867
880
  }
868
881
  /**
869
882
  * Get default toolbar string if none provided
@@ -875,7 +888,8 @@ class L {
875
888
  * Update button state
876
889
  */
877
890
  updateButtonState(t, e) {
878
- if (!this.container) return;
891
+ if (!this.container)
892
+ return;
879
893
  const o = this.container.querySelector(
880
894
  `[data-command="${t}"]`
881
895
  );
@@ -891,7 +905,7 @@ class L {
891
905
  }), this.container.innerHTML = ""), this.commandHandler = void 0;
892
906
  }
893
907
  }
894
- class T {
908
+ class R {
895
909
  constructor(t) {
896
910
  this.visible = !1, this.config = t;
897
911
  }
@@ -933,7 +947,7 @@ class T {
933
947
  this.container && this.container.parentNode && this.container.parentNode.removeChild(this.container), this.container = void 0, this.visible = !1;
934
948
  }
935
949
  }
936
- class I {
950
+ class H {
937
951
  constructor(t = {}) {
938
952
  this.statusInfo = {}, this.config = t;
939
953
  }
@@ -954,7 +968,8 @@ class I {
954
968
  * Render status bar content
955
969
  */
956
970
  render() {
957
- if (!this.container) return;
971
+ if (!this.container)
972
+ return;
958
973
  this.container.innerHTML = "";
959
974
  const t = document.createElement("div");
960
975
  t.className = "editora-statusbar-left";
@@ -969,20 +984,20 @@ class I {
969
984
  o.push(`Ln ${i.line}, Col ${i.column}`);
970
985
  }
971
986
  this.statusInfo.language && o.push(this.statusInfo.language);
972
- const r = [];
973
- this.statusInfo.wordCount !== void 0 && r.push(`${this.statusInfo.wordCount} words`), this.statusInfo.charCount !== void 0 && r.push(`${this.statusInfo.charCount} chars`), this.statusInfo.lineCount !== void 0 && r.push(`${this.statusInfo.lineCount} lines`), this.statusInfo.custom && Object.entries(this.statusInfo.custom).forEach(([i, n]) => {
974
- r.push(`${i}: ${n}`);
975
- }), o.forEach((i, n) => {
987
+ const n = [];
988
+ this.statusInfo.wordCount !== void 0 && n.push(`${this.statusInfo.wordCount} words`), this.statusInfo.charCount !== void 0 && n.push(`${this.statusInfo.charCount} chars`), this.statusInfo.lineCount !== void 0 && n.push(`${this.statusInfo.lineCount} lines`), this.statusInfo.custom && Object.entries(this.statusInfo.custom).forEach(([i, r]) => {
989
+ n.push(`${i}: ${r}`);
990
+ }), o.forEach((i, r) => {
976
991
  const a = document.createElement("span");
977
- if (a.className = "editora-statusbar-item", a.textContent = i, t.appendChild(a), n < o.length - 1) {
978
- const s = document.createElement("span");
979
- s.className = "editora-statusbar-separator", s.textContent = "|", t.appendChild(s);
992
+ if (a.className = "editora-statusbar-item", a.textContent = i, t.appendChild(a), r < o.length - 1) {
993
+ const l = document.createElement("span");
994
+ l.className = "editora-statusbar-separator", l.textContent = "|", t.appendChild(l);
980
995
  }
981
- }), r.forEach((i, n) => {
996
+ }), n.forEach((i, r) => {
982
997
  const a = document.createElement("span");
983
- if (a.className = "editora-statusbar-item", a.textContent = i, e.appendChild(a), n < r.length - 1) {
984
- const s = document.createElement("span");
985
- s.className = "editora-statusbar-separator", s.textContent = "|", e.appendChild(s);
998
+ if (a.className = "editora-statusbar-item", a.textContent = i, e.appendChild(a), r < n.length - 1) {
999
+ const l = document.createElement("span");
1000
+ l.className = "editora-statusbar-separator", l.textContent = "|", e.appendChild(l);
986
1001
  }
987
1002
  }), this.container.appendChild(t), this.container.appendChild(e);
988
1003
  }
@@ -993,50 +1008,51 @@ class I {
993
1008
  this.container && this.container.parentNode && this.container.parentNode.removeChild(this.container), this.container = void 0;
994
1009
  }
995
1010
  }
996
- function D(l, t) {
997
- const e = l.textContent || "", o = P(l, t.startContainer, t.startOffset), i = e.substring(0, o).split(`
998
- `), n = i.length, a = i[i.length - 1].length + 1;
999
- return { line: n, column: a };
1011
+ function j(s, t) {
1012
+ const e = s.textContent || "", o = F(s, t.startContainer, t.startOffset), i = e.substring(0, o).split(`
1013
+ `), r = i.length, a = i[i.length - 1].length + 1;
1014
+ return { line: r, column: a };
1000
1015
  }
1001
- function P(l, t, e) {
1002
- var n;
1016
+ function F(s, t, e) {
1017
+ var r;
1003
1018
  let o = 0;
1004
- const r = document.createTreeWalker(
1005
- l,
1019
+ const n = document.createTreeWalker(
1020
+ s,
1006
1021
  NodeFilter.SHOW_TEXT,
1007
1022
  null
1008
1023
  );
1009
- let i = r.firstChild();
1024
+ let i = n.firstChild();
1010
1025
  for (; i; ) {
1011
1026
  if (i === t) {
1012
1027
  o += e;
1013
1028
  break;
1014
- } else i.nodeType === Node.TEXT_NODE && (o += ((n = i.textContent) == null ? void 0 : n.length) || 0);
1015
- i = r.nextNode();
1029
+ } else
1030
+ i.nodeType === Node.TEXT_NODE && (o += ((r = i.textContent) == null ? void 0 : r.length) || 0);
1031
+ i = n.nextNode();
1016
1032
  }
1017
1033
  return o;
1018
1034
  }
1019
- function N(l) {
1020
- var o, r;
1021
- const t = l.querySelectorAll("div, p, br, h1, h2, h3, h4, h5, h6, blockquote, li, pre");
1035
+ function $(s) {
1036
+ var o, n;
1037
+ const t = s.querySelectorAll("div, p, br, h1, h2, h3, h4, h5, h6, blockquote, li, pre");
1022
1038
  let e = 1;
1023
1039
  if (t.length > 0) {
1024
1040
  e = t.length;
1025
1041
  const i = t[t.length - 1];
1026
- (i.tagName === "BR" || ((o = i.innerHTML) == null ? void 0 : o.trim()) === "" || ((r = i.textContent) == null ? void 0 : r.trim()) === "") && e++;
1042
+ (i.tagName === "BR" || ((o = i.innerHTML) == null ? void 0 : o.trim()) === "" || ((n = i.textContent) == null ? void 0 : n.trim()) === "") && e++;
1027
1043
  } else {
1028
- const n = (l.textContent || "").split(`
1044
+ const r = (s.textContent || "").split(`
1029
1045
  `).length;
1030
- e = Math.max(1, n);
1046
+ e = Math.max(1, r);
1031
1047
  }
1032
1048
  return e;
1033
1049
  }
1034
- function z(l) {
1035
- const t = l.trim() ? l.trim().split(/\s+/).length : 0, e = l.length;
1050
+ function _(s) {
1051
+ const t = s.trim() ? s.trim().split(/\s+/).length : 0, e = s.length;
1036
1052
  return { words: t, chars: e };
1037
1053
  }
1038
- function O(l, t) {
1039
- const e = l.toString();
1054
+ function W(s, t) {
1055
+ const e = s.toString();
1040
1056
  return {
1041
1057
  startLine: t.line,
1042
1058
  startColumn: t.column,
@@ -1047,7 +1063,7 @@ function O(l, t) {
1047
1063
  selectedWords: e.trim().split(/\s+/).filter(Boolean).length
1048
1064
  };
1049
1065
  }
1050
- const v = class v {
1066
+ class A {
1051
1067
  /**
1052
1068
  * Resolve configuration from multiple sources with priority
1053
1069
  */
@@ -1065,12 +1081,12 @@ const v = class v {
1065
1081
  static normalizeConfig(t) {
1066
1082
  const e = { ...t };
1067
1083
  if (e.toolbarFloating !== void 0 || e.toolbarSticky !== void 0) {
1068
- const n = typeof e.toolbar == "object" && e.toolbar ? { ...e.toolbar } : typeof e.toolbar == "string" ? { items: e.toolbar } : {};
1069
- e.toolbarFloating !== void 0 && (n.floating = !!e.toolbarFloating), e.toolbarSticky !== void 0 && (n.sticky = !!e.toolbarSticky), e.toolbar = n;
1084
+ const r = typeof e.toolbar == "object" && e.toolbar ? { ...e.toolbar } : typeof e.toolbar == "string" ? { items: e.toolbar } : {};
1085
+ e.toolbarFloating !== void 0 && (r.floating = !!e.toolbarFloating), e.toolbarSticky !== void 0 && (r.sticky = !!e.toolbarSticky), e.toolbar = r;
1070
1086
  }
1071
1087
  if (e.toolbarItems !== void 0 && typeof e.toolbar == "object" && e.toolbar && (e.toolbar.items = e.toolbarItems), e.autosaveEnabled !== void 0 || e.autosaveIntervalMs !== void 0 || e.autosaveStorageKey !== void 0 || e.autosaveProvider !== void 0 || e.autosaveApiUrl !== void 0) {
1072
- const n = typeof e.autosave == "object" && e.autosave ? { ...e.autosave } : {};
1073
- e.autosaveEnabled !== void 0 && (n.enabled = !!e.autosaveEnabled), e.autosaveIntervalMs !== void 0 && (n.intervalMs = Number(e.autosaveIntervalMs)), e.autosaveStorageKey !== void 0 && (n.storageKey = e.autosaveStorageKey), e.autosaveProvider !== void 0 && (n.provider = e.autosaveProvider), e.autosaveApiUrl !== void 0 && (n.apiUrl = e.autosaveApiUrl), e.autosave = n;
1088
+ const r = typeof e.autosave == "object" && e.autosave ? { ...e.autosave } : {};
1089
+ e.autosaveEnabled !== void 0 && (r.enabled = !!e.autosaveEnabled), e.autosaveIntervalMs !== void 0 && (r.intervalMs = Number(e.autosaveIntervalMs)), e.autosaveStorageKey !== void 0 && (r.storageKey = e.autosaveStorageKey), e.autosaveProvider !== void 0 && (r.provider = e.autosaveProvider), e.autosaveApiUrl !== void 0 && (r.apiUrl = e.autosaveApiUrl), e.autosave = r;
1074
1090
  }
1075
1091
  const o = {
1076
1092
  enabled: !1,
@@ -1085,27 +1101,27 @@ const v = class v {
1085
1101
  enabled: e.autosave
1086
1102
  };
1087
1103
  else if (typeof e.autosave == "object" && e.autosave) {
1088
- const n = {
1104
+ const r = {
1089
1105
  ...o,
1090
1106
  ...e.autosave
1091
1107
  };
1092
- n.intervalMs === void 0 && n.interval !== void 0 && (n.intervalMs = Number(n.interval)), n.enabled === void 0 && (n.enabled = !0), (!Number.isFinite(n.intervalMs) || n.intervalMs <= 0) && (n.intervalMs = o.intervalMs), e.autosave = n;
1108
+ r.intervalMs === void 0 && r.interval !== void 0 && (r.intervalMs = Number(r.interval)), r.enabled === void 0 && (r.enabled = !0), (!Number.isFinite(r.intervalMs) || r.intervalMs <= 0) && (r.intervalMs = o.intervalMs), e.autosave = r;
1093
1109
  } else
1094
1110
  e.autosave = o;
1095
1111
  if (e.languageLocale !== void 0 || e.languageDirection !== void 0) {
1096
- const n = typeof e.language == "object" && e.language ? { ...e.language } : {};
1097
- e.languageLocale !== void 0 && (n.locale = e.languageLocale), e.languageDirection !== void 0 && (n.direction = e.languageDirection), e.language = n;
1112
+ const r = typeof e.language == "object" && e.language ? { ...e.language } : {};
1113
+ e.languageLocale !== void 0 && (r.locale = e.languageLocale), e.languageDirection !== void 0 && (r.direction = e.languageDirection), e.language = r;
1098
1114
  }
1099
- const r = { locale: "en", direction: "ltr" };
1115
+ const n = { locale: "en", direction: "ltr" };
1100
1116
  if (typeof e.language == "string" ? e.language = {
1101
1117
  locale: e.language,
1102
- direction: r.direction
1118
+ direction: n.direction
1103
1119
  } : typeof e.language == "object" && e.language ? e.language = {
1104
- ...r,
1120
+ ...n,
1105
1121
  ...e.language
1106
- } : e.language = r, e.spellcheckEnabled !== void 0 || e.spellcheckProvider !== void 0 || e.spellcheckApiUrl !== void 0) {
1107
- const n = typeof e.spellcheck == "object" && e.spellcheck ? { ...e.spellcheck } : {};
1108
- e.spellcheckEnabled !== void 0 && (n.enabled = !!e.spellcheckEnabled), e.spellcheckProvider !== void 0 && (n.provider = e.spellcheckProvider), e.spellcheckApiUrl !== void 0 && (n.apiUrl = e.spellcheckApiUrl), e.spellcheck = n;
1122
+ } : e.language = n, e.spellcheckEnabled !== void 0 || e.spellcheckProvider !== void 0 || e.spellcheckApiUrl !== void 0) {
1123
+ const r = typeof e.spellcheck == "object" && e.spellcheck ? { ...e.spellcheck } : {};
1124
+ e.spellcheckEnabled !== void 0 && (r.enabled = !!e.spellcheckEnabled), e.spellcheckProvider !== void 0 && (r.provider = e.spellcheckProvider), e.spellcheckApiUrl !== void 0 && (r.apiUrl = e.spellcheckApiUrl), e.spellcheck = r;
1109
1125
  }
1110
1126
  const i = {
1111
1127
  enabled: !1,
@@ -1118,11 +1134,11 @@ const v = class v {
1118
1134
  enabled: e.spellcheck
1119
1135
  };
1120
1136
  else if (typeof e.spellcheck == "object" && e.spellcheck) {
1121
- const n = {
1137
+ const r = {
1122
1138
  ...i,
1123
1139
  ...e.spellcheck
1124
1140
  };
1125
- !n.provider && n.mode && (n.provider = n.mode === "local" ? "browser" : "api"), n.enabled === void 0 && (n.enabled = !!(n.mode || n.provider || n.apiUrl)), e.spellcheck = n;
1141
+ !r.provider && r.mode && (r.provider = r.mode === "local" ? "browser" : "api"), r.enabled === void 0 && (r.enabled = !!(r.mode || r.provider || r.apiUrl)), e.spellcheck = r;
1126
1142
  } else
1127
1143
  e.spellcheck = i;
1128
1144
  return e.contextMenuEnabled !== void 0 && (e.contextMenu = {
@@ -1184,9 +1200,9 @@ const v = class v {
1184
1200
  */
1185
1201
  static parseAttributes(t) {
1186
1202
  const e = {};
1187
- for (const [o, r] of Object.entries(t)) {
1203
+ for (const [o, n] of Object.entries(t)) {
1188
1204
  const i = this.kebabToCamel(o);
1189
- e[i] = this.parseAttributeValue(r);
1205
+ e[i] = this.parseAttributeValue(n);
1190
1206
  }
1191
1207
  return e;
1192
1208
  }
@@ -1194,10 +1210,14 @@ const v = class v {
1194
1210
  * Parse attribute value to appropriate type
1195
1211
  */
1196
1212
  static parseAttributeValue(t) {
1197
- if (t === "true") return !0;
1198
- if (t === "false") return !1;
1199
- if (/^\d+$/.test(t)) return parseInt(t, 10);
1200
- if (/^\d+\.\d+$/.test(t)) return parseFloat(t);
1213
+ if (t === "true")
1214
+ return !0;
1215
+ if (t === "false")
1216
+ return !1;
1217
+ if (/^\d+$/.test(t))
1218
+ return parseInt(t, 10);
1219
+ if (/^\d+\.\d+$/.test(t))
1220
+ return parseFloat(t);
1201
1221
  if (t.startsWith("{") || t.startsWith("["))
1202
1222
  try {
1203
1223
  return JSON.parse(t);
@@ -1234,12 +1254,12 @@ const v = class v {
1234
1254
  static merge(...t) {
1235
1255
  const e = {};
1236
1256
  for (const o of t)
1237
- for (const [r, i] of Object.entries(o))
1238
- i != null && (typeof i == "object" && !Array.isArray(i) && e[r] ? e[r] = this.merge(e[r], i) : e[r] = i);
1257
+ for (const [n, i] of Object.entries(o))
1258
+ i != null && (typeof i == "object" && !Array.isArray(i) && e[n] ? e[n] = this.merge(e[n], i) : e[n] = i);
1239
1259
  return e;
1240
1260
  }
1241
- };
1242
- v.EDITOR_DEFAULTS = {
1261
+ }
1262
+ A.EDITOR_DEFAULTS = {
1243
1263
  height: 400,
1244
1264
  width: "100%",
1245
1265
  readonly: !1,
@@ -1289,8 +1309,7 @@ v.EDITOR_DEFAULTS = {
1289
1309
  },
1290
1310
  statusbar: !1
1291
1311
  };
1292
- let y = v;
1293
- class B {
1312
+ class U {
1294
1313
  constructor() {
1295
1314
  this.loadedPlugins = /* @__PURE__ */ new Map(), this.pluginRegistry = /* @__PURE__ */ new Map();
1296
1315
  }
@@ -1309,16 +1328,16 @@ class B {
1309
1328
  const o = this.pluginRegistry.get(t);
1310
1329
  if (!o)
1311
1330
  return console.warn(`Plugin not found: ${t}`), null;
1312
- const r = await o();
1313
- return e && this.applyPluginConfig(r, e), this.loadedPlugins.set(t, r), r;
1331
+ const n = await o();
1332
+ return e && this.applyPluginConfig(n, e), this.loadedPlugins.set(t, n), n;
1314
1333
  }
1315
1334
  /**
1316
1335
  * Load multiple plugins
1317
1336
  */
1318
1337
  async loadMultiple(t, e) {
1319
1338
  return (await Promise.all(
1320
- t.map((r) => this.load(r, e))
1321
- )).filter((r) => r !== null);
1339
+ t.map((n) => this.load(n, e))
1340
+ )).filter((n) => n !== null);
1322
1341
  }
1323
1342
  /**
1324
1343
  * Parse plugin string "lists link image media"
@@ -1364,7 +1383,7 @@ class B {
1364
1383
  return this.loadedPlugins.has(t);
1365
1384
  }
1366
1385
  }
1367
- const j = [
1386
+ const K = [
1368
1387
  "p",
1369
1388
  "br",
1370
1389
  "strong",
@@ -1399,11 +1418,12 @@ const j = [
1399
1418
  "code",
1400
1419
  "span",
1401
1420
  "div",
1421
+ "section",
1402
1422
  "sup",
1403
1423
  "sub",
1404
1424
  "hr"
1405
- ], H = {
1406
- "*": ["class", "style", "id", "data-*"],
1425
+ ], q = {
1426
+ "*": ["class", "style", "id", "data-*", "role", "aria-*", "tabindex", "contenteditable", "spellcheck"],
1407
1427
  a: ["href", "target", "rel", "title"],
1408
1428
  img: ["src", "alt", "width", "height", "loading"],
1409
1429
  video: ["src", "controls", "width", "height", "autoplay", "loop", "muted"],
@@ -1412,75 +1432,147 @@ const j = [
1412
1432
  td: ["colspan", "rowspan", "align", "valign"],
1413
1433
  th: ["colspan", "rowspan", "align", "valign"]
1414
1434
  };
1415
- function k(l, t, e) {
1435
+ function M(s, t, e) {
1416
1436
  if ((t == null ? void 0 : t.sanitize) === !1)
1417
- return l;
1418
- const o = t != null && t.allowedTags && t.allowedTags.length > 0 ? t.allowedTags : j, i = !!(t != null && t.allowedAttributes) && Object.keys(t.allowedAttributes).length > 0 ? t.allowedAttributes : H, n = document.createElement("div");
1419
- return n.innerHTML = l, x(n, o, i), n.innerHTML;
1437
+ return s;
1438
+ const o = t != null && t.allowedTags && t.allowedTags.length > 0 ? t.allowedTags : K, i = !!(t != null && t.allowedAttributes) && Object.keys(t.allowedAttributes).length > 0 ? t.allowedAttributes : q, r = document.createElement("div");
1439
+ return r.innerHTML = s, L(r, o, i), r.innerHTML;
1420
1440
  }
1421
- function x(l, t, e) {
1422
- const o = Array.from(l.childNodes);
1423
- for (const r of o)
1424
- if (r.nodeType === Node.ELEMENT_NODE) {
1425
- const i = r, n = i.tagName.toLowerCase();
1426
- if (!t.includes(n)) {
1441
+ function L(s, t, e) {
1442
+ const o = Array.from(s.childNodes);
1443
+ for (const n of o)
1444
+ if (n.nodeType === Node.ELEMENT_NODE) {
1445
+ const i = n, r = i.tagName.toLowerCase();
1446
+ if (!t.includes(r)) {
1427
1447
  for (; i.firstChild; )
1428
- l.insertBefore(i.firstChild, i);
1429
- l.removeChild(i);
1448
+ s.insertBefore(i.firstChild, i);
1449
+ s.removeChild(i);
1430
1450
  continue;
1431
1451
  }
1432
- R(i, e), x(i, t, e);
1433
- } else r.nodeType !== Node.TEXT_NODE && l.removeChild(r);
1452
+ V(i, e), L(i, t, e);
1453
+ } else
1454
+ n.nodeType !== Node.TEXT_NODE && s.removeChild(n);
1434
1455
  }
1435
- function R(l, t) {
1436
- const e = l.tagName.toLowerCase(), o = Array.from(l.attributes), r = t[e] || [], i = t["*"] || [], n = [...r, ...i];
1456
+ function V(s, t) {
1457
+ const e = s.tagName.toLowerCase(), o = Array.from(s.attributes), n = t[e] || [], i = t["*"] || [], r = [...n, ...i];
1437
1458
  for (const a of o) {
1438
- const s = a.name.toLowerCase();
1459
+ const l = a.name.toLowerCase();
1439
1460
  let c = !1;
1440
- n.includes(s) && (c = !0);
1441
- for (const d of n)
1461
+ r.includes(l) && (c = !0);
1462
+ for (const d of r)
1442
1463
  if (d.endsWith("*")) {
1443
- const f = d.slice(0, -1);
1444
- if (s.startsWith(f)) {
1464
+ const h = d.slice(0, -1);
1465
+ if (l.startsWith(h)) {
1445
1466
  c = !0;
1446
1467
  break;
1447
1468
  }
1448
1469
  }
1449
- (s.startsWith("on") || s === "javascript:" || s === "href" && a.value.trim().toLowerCase().startsWith("javascript:") || s === "src" && a.value.trim().toLowerCase().startsWith("javascript:")) && (c = !1), c || l.removeAttribute(a.name);
1470
+ (l.startsWith("on") || l === "javascript:" || l === "href" && a.value.trim().toLowerCase().startsWith("javascript:") || l === "src" && a.value.trim().toLowerCase().startsWith("javascript:")) && (c = !1), c || s.removeAttribute(a.name);
1450
1471
  }
1451
- l.hasAttribute("href") && (l.getAttribute("href") || "").trim().toLowerCase().startsWith("javascript:") && l.removeAttribute("href"), l.hasAttribute("src") && (l.getAttribute("src") || "").trim().toLowerCase().startsWith("javascript:") && l.removeAttribute("src");
1472
+ s.hasAttribute("href") && (s.getAttribute("href") || "").trim().toLowerCase().startsWith("javascript:") && s.removeAttribute("href"), s.hasAttribute("src") && (s.getAttribute("src") || "").trim().toLowerCase().startsWith("javascript:") && s.removeAttribute("src");
1473
+ }
1474
+ function G(s, t, e) {
1475
+ return (e == null ? void 0 : e.sanitizeOnPaste) === !1 ? s : M(s, t);
1476
+ }
1477
+ function X(s, t, e) {
1478
+ return (e == null ? void 0 : e.sanitizeOnInput) === !1 ? s : M(s, t);
1479
+ }
1480
+ const Y = `.editora-editor{display:flex;flex-direction:column;border:1px solid #ddd;border-radius:4px;background:#fff;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen,Ubuntu,Cantarell,sans-serif;font-size:14px;overflow:hidden}.editora-editor *{box-sizing:border-box}.editora-theme-light{background:#fff;color:#333}.editora-theme-dark{--editora-dark-toolbar-bg-start: #353d48;--editora-dark-toolbar-bg-end: #2d3540;--editora-dark-button-bg-start: #46505f;--editora-dark-button-bg-end: #3b4553;--editora-dark-button-hover-start: #525d6d;--editora-dark-button-hover-end: #465262;--editora-dark-button-active-start: #5eaaf6;--editora-dark-button-active-end: #4a95de;--editora-dark-border: #475263;--editora-dark-border-strong: #566275;--editora-dark-text: #e1e9f5;--editora-dark-text-strong: #f3f7ff;--editora-dark-text-muted: #aeb9cc;--editora-dark-surface: #1d242d;--editora-dark-content: #1f2732;background:linear-gradient(180deg,#1b2330 0%,#1c2430 100%);color:var(--editora-dark-text);border-color:var(--editora-dark-border)}.editora-toolbar{display:flex;align-items:center;gap:4px;padding:8px;background:#f5f5f5;border-bottom:1px solid #ddd;flex-wrap:wrap}.editora-theme-dark .editora-toolbar{background:linear-gradient(180deg,var(--editora-dark-toolbar-bg-start) 0%,var(--editora-dark-toolbar-bg-end) 100%);border-bottom-color:var(--editora-dark-border);box-shadow:inset 0 1px #ffffff0d}.editora-toolbar-sticky{position:sticky;top:0;z-index:100;position:-webkit-sticky}.editora-toolbar-group{display:flex;align-items:center;gap:2px}.editora-toolbar-button{padding:6px 12px;border:1px solid #ccc;background:white;cursor:pointer;border-radius:3px;font-weight:600;font-size:14px;height:30px;display:flex;align-items:center;white-space:nowrap}.editora-toolbar-group-button{display:flex;align-items:center}.editora-toolbar-input.font-size{width:40px;padding:.25rem;text-align:center;font-size:14px;background:#fff;border:1px solid var(--rte-color-border-light);border-radius:var(--rte-radius-sm)}.editora-toolbar-group-items{display:flex;align-items:center;border:1px solid #ccc;.editora-toolbar-button{border:none;border-radius:0;&:first-child{border-right:1px solid #ccc;border-top-left-radius:3px;border-bottom-left-radius:3px}&:last-child{border:0px solid #ccc;border-radius:0!important}&:hover{background:#e0e0e0;border-color:#ccc}}}.editora-theme-dark .editora-toolbar-button{background:linear-gradient(180deg,var(--editora-dark-button-bg-start) 0%,var(--editora-dark-button-bg-end) 100%);border-color:var(--editora-dark-border-strong);color:var(--editora-dark-text);box-shadow:inset 0 1px #ffffff14,0 1px 1px #00000059}.editora-theme-dark .editora-toolbar-group-items{border-color:var(--editora-dark-border-strong);background:linear-gradient(180deg,var(--editora-dark-button-bg-start) 0%,var(--editora-dark-button-bg-end) 100%)}.editora-theme-dark .editora-toolbar-group-items .editora-toolbar-button:first-child{border-right-color:#566275}.editora-theme-dark .editora-toolbar-group-items .editora-toolbar-button:last-child{border-left-color:#566275}.editora-theme-dark .editora-toolbar-input.font-size{background-color:#2e3642;color:var(--editora-dark-text-strong);border-color:var(--editora-dark-border-strong);caret-color:var(--editora-dark-text-strong)}.editora-theme-dark .editora-toolbar-input.font-size::placeholder{color:var(--editora-dark-text-strong);opacity:1}.editora-toolbar-button:hover{background:#e0e0e0;border-color:#ccc}.editora-theme-dark .editora-toolbar-button:hover{background:linear-gradient(180deg,var(--editora-dark-button-hover-start) 0%,var(--editora-dark-button-hover-end) 100%);border-color:#66748a;color:var(--editora-dark-text-strong)}.editora-toolbar-button:active,.editora-toolbar-button.active{background:#d0d0d0;border-color:#999}.editora-theme-dark .editora-toolbar-button:active,.editora-theme-dark .editora-toolbar-button.active{background:linear-gradient(180deg,var(--editora-dark-button-active-start) 0%,var(--editora-dark-button-active-end) 100%);border-color:#67adf4;color:#0f1b2a}.editora-theme-dark .editora-toolbar-button:disabled{background:#313946;border-color:#424d5e;color:#7f8ca1}.editora-theme-dark .editora-toolbar-button[data-command=insertTable],.editora-theme-dark .editora-toolbar-button[data-command=print],.editora-theme-dark .editora-toolbar-button[data-command=toggleSpellCheck],.editora-theme-dark .editora-toolbar-button[data-command=toggleA11yChecker],.editora-theme-dark .editora-toolbar-button[data-command=setDirectionLTR],.editora-theme-dark .editora-toolbar-button[data-command=setDirectionRTL]{color:#f1f6ff}.editora-toolbar-button:disabled{opacity:.5;cursor:not-allowed}.editora-toolbar-icon{display:inline-flex;align-items:center;justify-content:center;width:24px;height:24px;line-height:1}.editora-toolbar-button svg,.editora-toolbar-icon svg{width:20px;height:20px;display:block;color:currentColor;fill:currentColor}.editora-theme-dark .editora-toolbar-icon,.editora-theme-dark .editora-toolbar-icon *{color:inherit}.editora-theme-dark :is(.editora-toolbar-button,.editora-toolbar-icon) svg :is([stroke="#000" i],[stroke="#000000" i],[stroke=black i],[stroke="#0f0f0f" i],[stroke="#111111" i],[style*="stroke:#000" i],[style*="stroke: #000" i],[style*="stroke:black" i],[style*="stroke: black" i],[style*="stroke:#0f0f0f" i],[style*="stroke: #0f0f0f" i]){stroke:currentColor!important}.editora-theme-dark :is(.editora-toolbar-button,.editora-toolbar-icon) svg :is([fill="#000" i],[fill="#000000" i],[fill=black i],[fill="#0f0f0f" i],[fill="#111111" i],[style*="fill:#000" i],[style*="fill: #000" i],[style*="fill:black" i],[style*="fill: black" i],[style*="fill:#0f0f0f" i],[style*="fill: #0f0f0f" i]){fill:currentColor!important}.editora-toolbar-separator{width:1px;height:24px;background:#ddd;margin:0 4px}.editora-theme-dark .editora-toolbar-separator{background:#4d596b}.editora-toolbar-dropdown{position:relative}.editora-toolbar-dropdown-menu{position:absolute;top:100%;left:0;min-width:150px;margin-top:4px;padding:4px 0;background:#fff;border:1px solid #ddd;border-radius:4px;box-shadow:0 2px 8px #00000026;z-index:1000}.editora-theme-dark .editora-toolbar-dropdown-menu{background:#29323d;border-color:#4d596b;box-shadow:0 8px 20px #00000073}.editora-toolbar-dropdown-item{display:block;width:100%;padding:8px 12px;border:none;background:transparent;color:#333;text-align:left;cursor:pointer;font-size:13px;transition:background .15s ease}.editora-theme-dark .editora-toolbar-dropdown-item{color:#d7deea}.editora-toolbar-dropdown-item:hover{background:#f5f5f5}.editora-theme-dark .editora-toolbar-dropdown-item:hover{background:#3a4554;color:#f0f6ff}.editora-content{flex:1;min-height:200px;padding:16px;outline:none;overflow-y:auto;line-height:1.6}.editora-theme-dark .editora-content{color:#ecf3ff;background:linear-gradient(180deg,var(--editora-dark-content) 0%,#1c232e 100%)}.editora-content:empty:before{content:attr(data-placeholder);color:#999;pointer-events:none}.editora-theme-dark .editora-content:empty:before{color:#8f9bb0}.editora-content h1{font-size:2em;margin:.67em 0;font-weight:600}.editora-content h2{font-size:1.5em;margin:.75em 0;font-weight:600}.editora-content h3{font-size:1.17em;margin:.83em 0;font-weight:600}.editora-content p{margin:1em 0}.editora-theme-dark .editora-content,.editora-theme-dark .editora-content :is(p,span,div,li,ul,ol,td,th,h1,h2,h3,h4,h5,h6,strong,em,u,s,small,sub,sup,blockquote,code,pre,a){color:#ecf3ff}.editora-content ul,.editora-content ol{margin:1em 0;padding-left:2em}.editora-content a{color:#06c;text-decoration:underline}.editora-theme-dark .editora-content a{color:#ecf3ff}.editora-content code{padding:2px 4px;background:#f5f5f5;border-radius:3px;font-family:Monaco,Menlo,Consolas,monospace;font-size:.9em}.editora-theme-dark .editora-content code{background:#1e1e1e}.editora-content pre{padding:12px;background:#f5f5f5;border-radius:4px;overflow-x:auto;margin:1em 0}.editora-theme-dark .editora-content pre{background:#1e1e1e}.editora-theme-dark .rte-code-block{background:linear-gradient(180deg,#212a36 0%,#1b2430 100%)!important;border-color:#4f5b70!important;color:#e7effc!important}.editora-theme-dark .rte-code-block code{color:#e7effc!important}.editora-theme-dark .rte-code-block:before{background:#111927!important;color:#dce8ff!important}.editora-theme-dark .rte-code-block .rte-code-copy{background:#2b3441!important;border-color:#5a667b!important;color:#dce8ff!important}.editora-content blockquote{margin:1em 0;padding-left:1em;border-left:4px solid #ddd;color:#666}.editora-theme-dark .editora-content blockquote{border-left-color:#3c3c3c;color:#ecf3ff}.editora-floating-toolbar{position:absolute;padding:4px;background:#fff;border:1px solid #ddd;border-radius:4px;box-shadow:0 2px 8px #00000026;z-index:1000}.editora-theme-dark .editora-floating-toolbar{background:#29323d;border-color:#4d596b;box-shadow:0 8px 20px #00000073}.editora-statusbar-container{display:flex;flex-direction:column}.editora-statusbar-left{display:flex;align-items:center;gap:8px}.editora-statusbar-right{display:flex;align-items:center;gap:8px;margin-left:auto}.editora-statusbar{display:flex;align-items:center;gap:12px;padding:6px 12px;background:#f5f5f5;border-top:1px solid #ddd;font-size:12px;color:#666}.editora-theme-dark .editora-statusbar{background:linear-gradient(180deg,#2c3440 0%,#252d37 100%);border-top-color:#3f4a5b;color:#d7deea}.editora-statusbar-item{white-space:nowrap}.editora-statusbar-separator{color:#ddd}.editora-theme-dark .editora-statusbar-separator{color:#566275}.editora-editor[readonly] .editora-content{background:#fafafa;cursor:not-allowed}.editora-theme-dark.editora-editor[readonly] .editora-content{background:#1a1a1a}.editora-editor:focus-within{border-color:#06c;box-shadow:0 0 0 3px #0066cc1a}.editora-theme-dark.editora-editor:focus-within{border-color:#4db8ff;box-shadow:0 0 0 3px #4db8ff1a}.editora-editor[disabled]{opacity:.6;pointer-events:none}@media (max-width: 768px){.editora-toolbar{padding:4px}.editora-toolbar-button{min-width:28px;min-height:28px;padding:4px 8px;font-size:12px}.editora-content{padding:12px}}.editora-content ::selection{background:rgba(0,102,204,.2)}.editora-theme-dark .editora-content ::selection{background:rgba(77,184,255,.2)}.editora-content table{border-collapse:collapse;width:100%;margin:1em 0}.editora-content th,.editora-content td{border:1px solid #ddd;padding:8px 12px;text-align:left}.editora-theme-dark .editora-content th,.editora-theme-dark .editora-content td{border-color:#3c3c3c}.editora-content th{background:#f5f5f5;font-weight:600}.editora-theme-dark .editora-content th{background:#252526}.editora-content img{max-width:100%;height:auto;border-radius:4px;display:block}.editora-content video{max-width:100%;height:auto;border-radius:4px;display:block}.editora-editor.loading{opacity:.7;pointer-events:none}.editora-editor.loading:after{content:"";position:absolute;top:50%;left:50%;width:24px;height:24px;margin:-12px 0 0 -12px;border:3px solid #ddd;border-top-color:#06c;border-radius:50%;animation:editora-spin .8s linear infinite}@keyframes editora-spin{to{transform:rotate(360deg)}}.toolbar-container-wrapper{display:flex;align-items:center;background:#ffffff;border-bottom:1px solid #e0e0e0;padding:0;margin:0;width:100%;box-sizing:border-box;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,sans-serif;font-size:14px;line-height:1.5;position:relative}.toolbar-container-wrapper[data-toolbar-sticky=true]{position:sticky;top:0;z-index:999;box-shadow:0 2px 4px #0000001a}.toolbar-container-wrapper[data-toolbar-floating=true]{position:fixed;top:0;left:0;right:0;z-index:1000;box-shadow:0 4px 12px #00000026}.toolbar-container-wrapper[data-toolbar-position=bottom]{border-bottom:none;border-top:1px solid #e0e0e0}.toolbar-container-wrapper .toolbar-wrapper{display:flex;width:100%;padding:8px;gap:4px;flex-wrap:wrap;align-items:center}.toolbar-container-wrapper .toolbar{display:flex;width:100%;gap:4px;flex-wrap:wrap;align-items:center}.toolbar-container-wrapper .toolbar-container{display:flex;gap:4px;flex-wrap:wrap;align-items:center;flex:1;position:relative}.toolbar-container-wrapper .toolbar-item{display:flex;align-items:center;gap:2px}.toolbar-container-wrapper .toolbar-button{padding:6px 10px;border:1px solid #d1d5db;background:#ffffff;border-radius:4px;cursor:pointer;font-size:13px;display:flex;align-items:center;justify-content:center;gap:4px;transition:all .15s ease;min-height:32px;white-space:nowrap}.toolbar-container-wrapper .toolbar-button:hover{background-color:#f3f4f6;border-color:#9ca3af}.toolbar-container-wrapper .toolbar-button:active,.toolbar-container-wrapper .toolbar-button[data-active=true]{background-color:#06c;color:#fff;border-color:#0052a3;box-shadow:inset 0 1px 3px #0000001a}.toolbar-container-wrapper .toolbar-button:disabled{opacity:.5;cursor:not-allowed;background-color:#f9fafb}.toolbar-container-wrapper .toolbar-more-button{padding:6px 8px;font-size:16px;font-weight:500;line-height:1}.toolbar-container-wrapper .toolbar-separator{width:1px;height:24px;background-color:#d1d5db;margin:0 4px}.toolbar-container-wrapper .toolbar-icon{display:inline-flex;align-items:center;justify-content:center;width:18px;height:18px;flex-shrink:0}.toolbar-container-wrapper .toolbar-icon svg{width:100%;height:100%}.toolbar-container-wrapper .toolbar-dropdown{position:relative;display:flex;align-items:center}.toolbar-container-wrapper .toolbar-dropdown-arrow{font-size:10px;margin-left:2px;line-height:1}.toolbar-container-wrapper .toolbar-dropdown-menu{position:absolute;top:100%;left:0;background:#ffffff;border:1px solid #d1d5db;border-radius:6px;box-shadow:0 4px 12px #00000026;z-index:1000;min-width:160px;padding:4px 0;margin-top:4px;display:none}.toolbar-container-wrapper .toolbar-dropdown-menu.show{display:block}.toolbar-container-wrapper .toolbar-dropdown-item{display:block;width:100%;padding:8px 12px;border:none;background:transparent;text-align:left;cursor:pointer;font-size:13px;color:#1f2937;transition:background-color .15s ease;font-family:inherit}.toolbar-container-wrapper .toolbar-dropdown-item:hover{background-color:#f3f4f6}.toolbar-container-wrapper .toolbar-dropdown-item:active{background-color:#e5e7eb}.toolbar-container-wrapper .toolbar-input{padding:6px 8px;border:1px solid #d1d5db;border-radius:4px;font-size:13px;font-family:inherit;background-color:#fff;color:#1f2937;transition:all .15s ease}.toolbar-container-wrapper .toolbar-input:focus{outline:none;border-color:#06c;box-shadow:0 0 0 3px #0066cc1a;background-color:#fff}.toolbar-container-wrapper .toolbar-input::placeholder{color:#9ca3af}.toolbar-overflow-menu{animation:slideDown .2s ease-out}@keyframes slideDown{0%{opacity:0;transform:translateY(-8px)}to{opacity:1;transform:translateY(0)}}.toolbar-overflow-item{transition:background-color .15s ease}.floating-toolbar{user-select:none;-webkit-user-select:none;font-family:system-ui,-apple-system,sans-serif;font-size:14px;animation:fadeInUp .15s ease-out}@keyframes fadeInUp{0%{opacity:0;transform:translate(-50%) translateY(10px)}to{opacity:1;transform:translate(-50%) translateY(0)}}.floating-toolbar-btn{display:flex;align-items:center;justify-content:center;width:32px;height:32px;border:none;background:transparent;border-radius:4px;color:#495057;cursor:pointer;font-size:14px;font-weight:500;transition:all .15s ease;outline:none}.floating-toolbar-btn:hover{background:#f8f9fa;color:#212529}.floating-toolbar-btn:active{background:#e9ecef;transform:scale(.95)}.floating-toolbar-btn.floating-toolbar-toggle{color:#dc3545;font-weight:700}.floating-toolbar-btn.floating-toolbar-toggle:hover{background:#f8d7da;color:#721c24}.floating-toolbar-separator{width:1px;height:20px;background:#e1e5e9;margin:0 2px}@media (max-width: 768px){.toolbar-container-wrapper .toolbar-button{padding:5px 8px;font-size:12px;min-height:28px}.toolbar-container-wrapper .toolbar-icon{width:16px;height:16px}.toolbar-container-wrapper .toolbar-dropdown-menu{min-width:140px}.toolbar-container-wrapper .toolbar-dropdown-item{padding:6px 10px;font-size:12px}.floating-toolbar{padding:4px;gap:2px}.floating-toolbar-btn{width:28px;height:28px;font-size:12px}}@media (max-width: 480px){.toolbar-container-wrapper{padding:4px}.toolbar-container-wrapper .toolbar-wrapper{padding:4px;gap:2px}.toolbar-container-wrapper .toolbar-button{padding:4px 6px;font-size:11px;min-height:24px}.toolbar-container-wrapper .toolbar-icon{width:14px;height:14px}}.floating-toolbar{pointer-events:auto}.floating-toolbar{max-width:calc(100vw - 20px);overflow-x:auto}@media (prefers-color-scheme: dark){.floating-toolbar{background:#2d3748;border-color:#4a5568;color:#e2e8f0}.floating-toolbar-btn:hover{background:#4a5568;color:#f7fafc}.floating-toolbar-btn:active{background:#718096}.floating-toolbar-separator{background:#4a5568}}
1481
+ `;
1482
+ let y;
1483
+ const J = "__editoraCommandEditorRoot", Q = "__editoraLastCommandButton", C = "editora-editor, [data-editora-editor], .rte-editor, .editora-editor", E = ".rte-content, .editora-content", w = /* @__PURE__ */ new Set();
1484
+ let g = null, S = !1, k = null, x = null;
1485
+ function T(s) {
1486
+ if (!(s instanceof HTMLElement))
1487
+ return !1;
1488
+ const t = s;
1489
+ return typeof t.execCommand == "function" && (t.tagName.toLowerCase() === "editora-editor" || t.classList.contains("editora-editor") || t.hasAttribute("data-editora-editor"));
1490
+ }
1491
+ function Z(s) {
1492
+ return s ? s.nodeType === Node.ELEMENT_NODE ? s : s.parentElement : null;
1493
+ }
1494
+ function b(s) {
1495
+ if (!s)
1496
+ return null;
1497
+ if (T(s))
1498
+ return s;
1499
+ const t = s.matches(C) ? s : s.closest(C);
1500
+ return !t || !T(t) ? null : t;
1452
1501
  }
1453
- function F(l, t, e) {
1454
- return (e == null ? void 0 : e.sanitizeOnPaste) === !1 ? l : k(l, t);
1502
+ function tt() {
1503
+ var n;
1504
+ if (typeof window == "undefined")
1505
+ return null;
1506
+ const s = window[J];
1507
+ if (s instanceof HTMLElement) {
1508
+ const i = b(s);
1509
+ if (i)
1510
+ return i;
1511
+ const r = s.matches(E) ? s : s.querySelector(E);
1512
+ if (r) {
1513
+ const a = b(r);
1514
+ if (a)
1515
+ return a;
1516
+ }
1517
+ }
1518
+ const t = window[Q];
1519
+ if (t instanceof HTMLElement) {
1520
+ const i = b(t);
1521
+ if (i)
1522
+ return i;
1523
+ }
1524
+ const e = document.activeElement;
1525
+ if (e) {
1526
+ const i = b(e);
1527
+ if (i)
1528
+ return i;
1529
+ }
1530
+ const o = (n = window.getSelection) == null ? void 0 : n.call(window);
1531
+ if (o && o.rangeCount > 0) {
1532
+ const i = b(Z(o.getRangeAt(0).startContainer));
1533
+ if (i)
1534
+ return i;
1535
+ }
1536
+ if (g && g.isConnected)
1537
+ return g;
1538
+ for (const i of w)
1539
+ if (i.isConnected)
1540
+ return i;
1541
+ return null;
1455
1542
  }
1456
- function $(l, t, e) {
1457
- return (e == null ? void 0 : e.sanitizeOnInput) === !1 ? l : k(l, t);
1543
+ function et() {
1544
+ if (typeof window == "undefined" || S)
1545
+ return;
1546
+ k = typeof window.executeEditorCommand == "function" ? window.executeEditorCommand.bind(window) : null, x = typeof window.execEditorCommand == "function" ? window.execEditorCommand.bind(window) : null;
1547
+ const s = (t, e) => {
1548
+ const o = tt();
1549
+ return o ? o.execCommand(t, e) : k ? k(t, e) : x ? x(t, e) : !1;
1550
+ };
1551
+ window.executeEditorCommand = s, window.execEditorCommand = s, S = !0;
1458
1552
  }
1459
- const U = '.editora-editor{display:flex;flex-direction:column;border:1px solid #ddd;border-radius:4px;background:#fff;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen,Ubuntu,Cantarell,sans-serif;font-size:14px;overflow:hidden}.editora-editor *{box-sizing:border-box}.editora-theme-light{background:#fff;color:#333}.editora-theme-dark{--editora-dark-toolbar-bg-start: #353d48;--editora-dark-toolbar-bg-end: #2d3540;--editora-dark-button-bg-start: #46505f;--editora-dark-button-bg-end: #3b4553;--editora-dark-button-hover-start: #525d6d;--editora-dark-button-hover-end: #465262;--editora-dark-button-active-start: #5eaaf6;--editora-dark-button-active-end: #4a95de;--editora-dark-border: #475263;--editora-dark-border-strong: #566275;--editora-dark-text: #e1e9f5;--editora-dark-text-strong: #f3f7ff;--editora-dark-text-muted: #aeb9cc;--editora-dark-surface: #1d242d;--editora-dark-content: #1f2732;background:linear-gradient(180deg,#1b2330,#1c2430);color:var(--editora-dark-text);border-color:var(--editora-dark-border)}.editora-toolbar{display:flex;align-items:center;gap:4px;padding:8px;background:#f5f5f5;border-bottom:1px solid #ddd;flex-wrap:wrap}.editora-theme-dark .editora-toolbar{background:linear-gradient(180deg,var(--editora-dark-toolbar-bg-start) 0%,var(--editora-dark-toolbar-bg-end) 100%);border-bottom-color:var(--editora-dark-border);box-shadow:inset 0 1px #ffffff0d}.editora-toolbar-sticky{position:sticky;top:0;z-index:100;position:-webkit-sticky}.editora-toolbar-group{display:flex;align-items:center;gap:2px}.editora-toolbar-button{padding:6px 12px;border:1px solid #ccc;background:#fff;cursor:pointer;border-radius:3px;font-weight:600;font-size:14px;height:30px;display:flex;align-items:center;white-space:nowrap}.editora-toolbar-group-button{display:flex;align-items:center}.editora-toolbar-input.font-size{width:40px;padding:.25rem;text-align:center;font-size:14px;background:#fff;border:1px solid var(--rte-color-border-light);border-radius:var(--rte-radius-sm)}.editora-toolbar-group-items{display:flex;align-items:center;border:1px solid #ccc;.editora-toolbar-button{border:none;border-radius:0;&:first-child{border-right:1px solid #ccc;border-top-left-radius:3px;border-bottom-left-radius:3px}&:last-child{border-left:1px solid #ccc;border-top-right-radius:3px;border-bottom-right-radius:3px}}}.editora-theme-dark .editora-toolbar-button{background:linear-gradient(180deg,var(--editora-dark-button-bg-start) 0%,var(--editora-dark-button-bg-end) 100%);border-color:var(--editora-dark-border-strong);color:var(--editora-dark-text);box-shadow:inset 0 1px #ffffff14,0 1px 1px #00000059}.editora-theme-dark .editora-toolbar-group-items{border-color:var(--editora-dark-border-strong);background:linear-gradient(180deg,var(--editora-dark-button-bg-start) 0%,var(--editora-dark-button-bg-end) 100%)}.editora-theme-dark .editora-toolbar-group-items .editora-toolbar-button:first-child{border-right-color:#566275}.editora-theme-dark .editora-toolbar-group-items .editora-toolbar-button:last-child{border-left-color:#566275}.editora-theme-dark .editora-toolbar-input.font-size{background-color:#2e3642;color:var(--editora-dark-text-strong);border-color:var(--editora-dark-border-strong);caret-color:var(--editora-dark-text-strong)}.editora-theme-dark .editora-toolbar-input.font-size::placeholder{color:var(--editora-dark-text-strong);opacity:1}.editora-toolbar-button:hover{background:#e0e0e0;border-color:#ccc}.editora-theme-dark .editora-toolbar-button:hover{background:linear-gradient(180deg,var(--editora-dark-button-hover-start) 0%,var(--editora-dark-button-hover-end) 100%);border-color:#66748a;color:var(--editora-dark-text-strong)}.editora-toolbar-button:active,.editora-toolbar-button.active{background:#d0d0d0;border-color:#999}.editora-theme-dark .editora-toolbar-button:active,.editora-theme-dark .editora-toolbar-button.active{background:linear-gradient(180deg,var(--editora-dark-button-active-start) 0%,var(--editora-dark-button-active-end) 100%);border-color:#67adf4;color:#0f1b2a}.editora-theme-dark .editora-toolbar-button:disabled{background:#313946;border-color:#424d5e;color:#7f8ca1}.editora-theme-dark .editora-toolbar-button[data-command=insertTable],.editora-theme-dark .editora-toolbar-button[data-command=print],.editora-theme-dark .editora-toolbar-button[data-command=toggleSpellCheck],.editora-theme-dark .editora-toolbar-button[data-command=toggleA11yChecker],.editora-theme-dark .editora-toolbar-button[data-command=setDirectionLTR],.editora-theme-dark .editora-toolbar-button[data-command=setDirectionRTL]{color:#f1f6ff}.editora-toolbar-button:disabled{opacity:.5;cursor:not-allowed}.editora-toolbar-icon{display:inline-flex;align-items:center;justify-content:center;width:24px;height:24px;line-height:1}.editora-toolbar-button svg,.editora-toolbar-icon svg{width:20px;height:20px;display:block;color:currentColor;fill:currentColor}.editora-theme-dark .editora-toolbar-icon,.editora-theme-dark .editora-toolbar-icon *{color:inherit}.editora-theme-dark :is(.editora-toolbar-button,.editora-toolbar-icon) svg :is([stroke="#000" i],[stroke="#000000" i],[stroke=black i],[stroke="#0f0f0f" i],[stroke="#111111" i],[style*="stroke:#000" i],[style*="stroke: #000" i],[style*="stroke:black" i],[style*="stroke: black" i],[style*="stroke:#0f0f0f" i],[style*="stroke: #0f0f0f" i]){stroke:currentColor!important}.editora-theme-dark :is(.editora-toolbar-button,.editora-toolbar-icon) svg :is([fill="#000" i],[fill="#000000" i],[fill=black i],[fill="#0f0f0f" i],[fill="#111111" i],[style*="fill:#000" i],[style*="fill: #000" i],[style*="fill:black" i],[style*="fill: black" i],[style*="fill:#0f0f0f" i],[style*="fill: #0f0f0f" i]){fill:currentColor!important}.editora-toolbar-separator{width:1px;height:24px;background:#ddd;margin:0 4px}.editora-theme-dark .editora-toolbar-separator{background:#4d596b}.editora-toolbar-dropdown{position:relative}.editora-toolbar-dropdown-menu{position:absolute;top:100%;left:0;min-width:150px;margin-top:4px;padding:4px 0;background:#fff;border:1px solid #ddd;border-radius:4px;box-shadow:0 2px 8px #00000026;z-index:1000}.editora-theme-dark .editora-toolbar-dropdown-menu{background:#29323d;border-color:#4d596b;box-shadow:0 8px 20px #00000073}.editora-toolbar-dropdown-item{display:block;width:100%;padding:8px 12px;border:none;background:transparent;color:#333;text-align:left;cursor:pointer;font-size:13px;transition:background .15s ease}.editora-theme-dark .editora-toolbar-dropdown-item{color:#d7deea}.editora-toolbar-dropdown-item:hover{background:#f5f5f5}.editora-theme-dark .editora-toolbar-dropdown-item:hover{background:#3a4554;color:#f0f6ff}.editora-content{flex:1;min-height:200px;padding:16px;outline:none;overflow-y:auto;line-height:1.6}.editora-theme-dark .editora-content{color:#ecf3ff;background:linear-gradient(180deg,var(--editora-dark-content) 0%,#1c232e 100%)}.editora-content:empty:before{content:attr(data-placeholder);color:#999;pointer-events:none}.editora-theme-dark .editora-content:empty:before{color:#8f9bb0}.editora-content h1{font-size:2em;margin:.67em 0;font-weight:600}.editora-content h2{font-size:1.5em;margin:.75em 0;font-weight:600}.editora-content h3{font-size:1.17em;margin:.83em 0;font-weight:600}.editora-content p{margin:1em 0}.editora-content ul,.editora-content ol{margin:1em 0;padding-left:2em}.editora-content a{color:#06c;text-decoration:underline}.editora-theme-dark .editora-content a{color:#4db8ff}.editora-content code{padding:2px 4px;background:#f5f5f5;border-radius:3px;font-family:Monaco,Menlo,Consolas,monospace;font-size:.9em}.editora-theme-dark .editora-content code{background:#1e1e1e}.editora-content pre{padding:12px;background:#f5f5f5;border-radius:4px;overflow-x:auto;margin:1em 0}.editora-theme-dark .editora-content pre{background:#1e1e1e}.editora-theme-dark .rte-code-block{background:linear-gradient(180deg,#212a36,#1b2430)!important;border-color:#4f5b70!important;color:#e7effc!important}.editora-theme-dark .rte-code-block code{color:#e7effc!important}.editora-theme-dark .rte-code-block:before{background:#111927!important;color:#dce8ff!important}.editora-theme-dark .rte-code-block .rte-code-copy{background:#2b3441!important;border-color:#5a667b!important;color:#dce8ff!important}.editora-content blockquote{margin:1em 0;padding-left:1em;border-left:4px solid #ddd;color:#666}.editora-theme-dark .editora-content blockquote{border-left-color:#3c3c3c;color:#9a9a9a}.editora-floating-toolbar{position:absolute;padding:4px;background:#fff;border:1px solid #ddd;border-radius:4px;box-shadow:0 2px 8px #00000026;z-index:1000}.editora-theme-dark .editora-floating-toolbar{background:#29323d;border-color:#4d596b;box-shadow:0 8px 20px #00000073}.editora-statusbar-container{display:flex;flex-direction:column}.editora-statusbar-left{display:flex;align-items:center;gap:8px}.editora-statusbar-right{display:flex;align-items:center;gap:8px;margin-left:auto}.editora-statusbar{display:flex;align-items:center;gap:12px;padding:6px 12px;background:#f5f5f5;border-top:1px solid #ddd;font-size:12px;color:#666}.editora-theme-dark .editora-statusbar{background:linear-gradient(180deg,#2c3440,#252d37);border-top-color:#3f4a5b;color:#d7deea}.editora-statusbar-item{white-space:nowrap}.editora-statusbar-separator{color:#ddd}.editora-theme-dark .editora-statusbar-separator{color:#566275}.editora-editor[readonly] .editora-content{background:#fafafa;cursor:not-allowed}.editora-theme-dark.editora-editor[readonly] .editora-content{background:#1a1a1a}.editora-editor:focus-within{border-color:#06c;box-shadow:0 0 0 3px #0066cc1a}.editora-theme-dark.editora-editor:focus-within{border-color:#4db8ff;box-shadow:0 0 0 3px #4db8ff1a}.editora-editor[disabled]{opacity:.6;pointer-events:none}@media(max-width:768px){.editora-toolbar{padding:4px}.editora-toolbar-button{min-width:28px;min-height:28px;padding:4px 8px;font-size:12px}.editora-content{padding:12px}}.editora-content ::selection{background:#06c3}.editora-theme-dark .editora-content ::selection{background:#4db8ff33}.editora-content table{border-collapse:collapse;width:100%;margin:1em 0}.editora-content th,.editora-content td{border:1px solid #ddd;padding:8px 12px;text-align:left}.editora-theme-dark .editora-content th,.editora-theme-dark .editora-content td{border-color:#3c3c3c}.editora-content th{background:#f5f5f5;font-weight:600}.editora-theme-dark .editora-content th{background:#252526}.editora-content img{max-width:100%;height:auto;border-radius:4px;display:block}.editora-content video{max-width:100%;height:auto;border-radius:4px;display:block}.editora-editor.loading{opacity:.7;pointer-events:none}.editora-editor.loading:after{content:"";position:absolute;top:50%;left:50%;width:24px;height:24px;margin:-12px 0 0 -12px;border:3px solid #ddd;border-top-color:#06c;border-radius:50%;animation:editora-spin .8s linear infinite}@keyframes editora-spin{to{transform:rotate(360deg)}}.toolbar-container-wrapper{display:flex;align-items:center;background:#fff;border-bottom:1px solid #e0e0e0;padding:0;margin:0;width:100%;box-sizing:border-box;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,sans-serif;font-size:14px;line-height:1.5;position:relative}.toolbar-container-wrapper[data-toolbar-sticky=true]{position:sticky;top:0;z-index:999;box-shadow:0 2px 4px #0000001a}.toolbar-container-wrapper[data-toolbar-floating=true]{position:fixed;top:0;left:0;right:0;z-index:1000;box-shadow:0 4px 12px #00000026}.toolbar-container-wrapper[data-toolbar-position=bottom]{border-bottom:none;border-top:1px solid #e0e0e0}.toolbar-container-wrapper .toolbar-wrapper{display:flex;width:100%;padding:8px;gap:4px;flex-wrap:wrap;align-items:center}.toolbar-container-wrapper .toolbar{display:flex;width:100%;gap:4px;flex-wrap:wrap;align-items:center}.toolbar-container-wrapper .toolbar-container{display:flex;gap:4px;flex-wrap:wrap;align-items:center;flex:1;position:relative}.toolbar-container-wrapper .toolbar-item{display:flex;align-items:center;gap:2px}.toolbar-container-wrapper .toolbar-button{padding:6px 10px;border:1px solid #d1d5db;background:#fff;border-radius:4px;cursor:pointer;font-size:13px;display:flex;align-items:center;justify-content:center;gap:4px;transition:all .15s ease;min-height:32px;white-space:nowrap}.toolbar-container-wrapper .toolbar-button:hover{background-color:#f3f4f6;border-color:#9ca3af}.toolbar-container-wrapper .toolbar-button:active,.toolbar-container-wrapper .toolbar-button[data-active=true]{background-color:#06c;color:#fff;border-color:#0052a3;box-shadow:inset 0 1px 3px #0000001a}.toolbar-container-wrapper .toolbar-button:disabled{opacity:.5;cursor:not-allowed;background-color:#f9fafb}.toolbar-container-wrapper .toolbar-more-button{padding:6px 8px;font-size:16px;font-weight:500;line-height:1}.toolbar-container-wrapper .toolbar-separator{width:1px;height:24px;background-color:#d1d5db;margin:0 4px}.toolbar-container-wrapper .toolbar-icon{display:inline-flex;align-items:center;justify-content:center;width:18px;height:18px;flex-shrink:0}.toolbar-container-wrapper .toolbar-icon svg{width:100%;height:100%}.toolbar-container-wrapper .toolbar-dropdown{position:relative;display:flex;align-items:center}.toolbar-container-wrapper .toolbar-dropdown-arrow{font-size:10px;margin-left:2px;line-height:1}.toolbar-container-wrapper .toolbar-dropdown-menu{position:absolute;top:100%;left:0;background:#fff;border:1px solid #d1d5db;border-radius:6px;box-shadow:0 4px 12px #00000026;z-index:1000;min-width:160px;padding:4px 0;margin-top:4px;display:none}.toolbar-container-wrapper .toolbar-dropdown-menu.show{display:block}.toolbar-container-wrapper .toolbar-dropdown-item{display:block;width:100%;padding:8px 12px;border:none;background:transparent;text-align:left;cursor:pointer;font-size:13px;color:#1f2937;transition:background-color .15s ease;font-family:inherit}.toolbar-container-wrapper .toolbar-dropdown-item:hover{background-color:#f3f4f6}.toolbar-container-wrapper .toolbar-dropdown-item:active{background-color:#e5e7eb}.toolbar-container-wrapper .toolbar-input{padding:6px 8px;border:1px solid #d1d5db;border-radius:4px;font-size:13px;font-family:inherit;background-color:#fff;color:#1f2937;transition:all .15s ease}.toolbar-container-wrapper .toolbar-input:focus{outline:none;border-color:#06c;box-shadow:0 0 0 3px #0066cc1a;background-color:#fff}.toolbar-container-wrapper .toolbar-input::placeholder{color:#9ca3af}.toolbar-overflow-menu{animation:slideDown .2s ease-out}@keyframes slideDown{0%{opacity:0;transform:translateY(-8px)}to{opacity:1;transform:translateY(0)}}.toolbar-overflow-item{transition:background-color .15s ease}.floating-toolbar{user-select:none;-webkit-user-select:none;font-family:system-ui,-apple-system,sans-serif;font-size:14px;animation:fadeInUp .15s ease-out}@keyframes fadeInUp{0%{opacity:0;transform:translate(-50%) translateY(10px)}to{opacity:1;transform:translate(-50%) translateY(0)}}.floating-toolbar-btn{display:flex;align-items:center;justify-content:center;width:32px;height:32px;border:none;background:transparent;border-radius:4px;color:#495057;cursor:pointer;font-size:14px;font-weight:500;transition:all .15s ease;outline:none}.floating-toolbar-btn:hover{background:#f8f9fa;color:#212529}.floating-toolbar-btn:active{background:#e9ecef;transform:scale(.95)}.floating-toolbar-btn.floating-toolbar-toggle{color:#dc3545;font-weight:700}.floating-toolbar-btn.floating-toolbar-toggle:hover{background:#f8d7da;color:#721c24}.floating-toolbar-separator{width:1px;height:20px;background:#e1e5e9;margin:0 2px}@media(max-width:768px){.toolbar-container-wrapper .toolbar-button{padding:5px 8px;font-size:12px;min-height:28px}.toolbar-container-wrapper .toolbar-icon{width:16px;height:16px}.toolbar-container-wrapper .toolbar-dropdown-menu{min-width:140px}.toolbar-container-wrapper .toolbar-dropdown-item{padding:6px 10px;font-size:12px}.floating-toolbar{padding:4px;gap:2px}.floating-toolbar-btn{width:28px;height:28px;font-size:12px}}@media(max-width:480px){.toolbar-container-wrapper{padding:4px}.toolbar-container-wrapper .toolbar-wrapper{padding:4px;gap:2px}.toolbar-container-wrapper .toolbar-button{padding:4px 6px;font-size:11px;min-height:24px}.toolbar-container-wrapper .toolbar-icon{width:14px;height:14px}}.floating-toolbar{pointer-events:auto}.floating-toolbar{max-width:calc(100vw - 20px);overflow-x:auto}@media(prefers-color-scheme:dark){.floating-toolbar{background:#2d3748;border-color:#4a5568;color:#e2e8f0}.floating-toolbar-btn:hover{background:#4a5568;color:#f7fafc}.floating-toolbar-btn:active{background:#718096}.floating-toolbar-separator{background:#4a5568}}';
1460
- let m;
1461
- function W() {
1462
- const l = "editora-webcomponent-styles";
1463
- if (!document.getElementById(l)) {
1553
+ function ot() {
1554
+ const s = "editora-webcomponent-styles";
1555
+ if (!document.getElementById(s)) {
1464
1556
  const t = document.createElement("style");
1465
- t.id = l, t.textContent = U, document.head.appendChild(t);
1557
+ t.id = s, t.textContent = Y, document.head.appendChild(t);
1466
1558
  }
1467
1559
  }
1468
- function w() {
1469
- if (!m) {
1470
- const l = g.__globalPluginLoader;
1471
- l ? m = l : m = new B();
1560
+ function I() {
1561
+ if (!y) {
1562
+ const s = m.__globalPluginLoader;
1563
+ s ? y = s : y = new U();
1472
1564
  }
1473
- return m;
1565
+ return y;
1474
1566
  }
1475
- function K(l) {
1476
- const t = w();
1477
- Object.entries(l).forEach(([e, o]) => {
1567
+ function it(s) {
1568
+ const t = I();
1569
+ Object.entries(s).forEach(([e, o]) => {
1478
1570
  t.register(e, o);
1479
1571
  });
1480
1572
  }
1481
- class g extends HTMLElement {
1573
+ class m extends HTMLElement {
1482
1574
  constructor() {
1483
- if (super(), this.pluginLoader = w(), this.config = {}, this.isInitialized = !1, this.keyboardShortcutManager = new S(), this.lastAutosavedContent = "", this.loadedPlugins = [], W(), !this.hasAttribute("data-initial-content")) {
1575
+ if (super(), this.pluginLoader = I(), this.config = {}, this.isInitialized = !1, this.keyboardShortcutManager = new P(), this.lastAutosavedContent = "", this.loadedPlugins = [], this.lastBeforeInputType = null, ot(), !this.hasAttribute("data-initial-content")) {
1484
1576
  const t = this.innerHTML.trim();
1485
1577
  t && this.setAttribute("data-initial-content", t);
1486
1578
  }
@@ -1546,13 +1638,13 @@ class g extends HTMLElement {
1546
1638
  * Wait for the global plugin loader to be available
1547
1639
  */
1548
1640
  async waitForPluginLoader() {
1549
- if (g.__globalPluginLoader) {
1550
- this.pluginLoader = g.__globalPluginLoader;
1641
+ if (m.__globalPluginLoader) {
1642
+ this.pluginLoader = m.__globalPluginLoader;
1551
1643
  return;
1552
1644
  }
1553
1645
  return new Promise((t) => {
1554
1646
  const e = () => {
1555
- g.__globalPluginLoader ? (this.pluginLoader = g.__globalPluginLoader, t()) : setTimeout(e, 0);
1647
+ m.__globalPluginLoader ? (this.pluginLoader = m.__globalPluginLoader, t()) : setTimeout(e, 0);
1556
1648
  };
1557
1649
  e();
1558
1650
  });
@@ -1580,19 +1672,20 @@ class g extends HTMLElement {
1580
1672
  */
1581
1673
  async initialize() {
1582
1674
  var o;
1583
- if (this.querySelector(".editora-toolbar") || this.isInitialized) return;
1584
- this.setAttribute("data-editora-editor", "true"), this.config.height && (this.style.height = typeof this.config.height == "number" ? `${this.config.height}px` : this.config.height), this.config.width && (this.style.width = typeof this.config.width == "number" ? `${this.config.width}px` : this.config.width), this.classList.add("editora-editor"), this.config.theme && this.classList.add(`editora-theme-${this.config.theme}`);
1675
+ if (this.querySelector(".editora-toolbar") || this.isInitialized)
1676
+ return;
1677
+ this.setAttribute("data-editora-editor", "true"), w.add(this), g || (g = this), et(), this.config.height && (this.style.height = typeof this.config.height == "number" ? `${this.config.height}px` : this.config.height), this.config.width && (this.style.width = typeof this.config.width == "number" ? `${this.config.width}px` : this.config.width), this.classList.add("editora-editor"), this.config.theme && this.classList.add(`editora-theme-${this.config.theme}`);
1585
1678
  const t = await this.loadPlugins();
1586
- this.loadedPlugins = t, t.forEach((r) => {
1587
- if (r.init && typeof r.init == "function")
1679
+ this.loadedPlugins = t, t.forEach((n) => {
1680
+ if (n.init && typeof n.init == "function")
1588
1681
  try {
1589
- r.init({ editorElement: this });
1682
+ n.init({ editorElement: this });
1590
1683
  } catch (i) {
1591
- console.error(`[RichTextEditor] Error initializing plugin ${r.name}:`, i);
1684
+ console.error(`[RichTextEditor] Error initializing plugin ${n.name}:`, i);
1592
1685
  }
1593
1686
  });
1594
1687
  const e = (o = this.restoreAutosavedContent()) != null ? o : this.getAttribute("data-initial-content") || "";
1595
- this.engine = new A({
1688
+ this.engine = new B({
1596
1689
  content: e,
1597
1690
  plugins: t,
1598
1691
  readonly: this.config.readonly
@@ -1615,31 +1708,31 @@ class g extends HTMLElement {
1615
1708
  */
1616
1709
  async loadPlugins() {
1617
1710
  this.pluginLoader || await this.waitForPluginLoader();
1618
- const t = [], e = this.config.plugins && (typeof this.config.plugins == "string" && this.config.plugins.length > 0 || Array.isArray(this.config.plugins) && this.config.plugins.length > 0), r = this.getAccessibilityConfig().checker === !0;
1711
+ const t = [], e = this.config.plugins && (typeof this.config.plugins == "string" && this.config.plugins.length > 0 || Array.isArray(this.config.plugins) && this.config.plugins.length > 0), n = this.getAccessibilityConfig().checker === !0;
1619
1712
  if (e) {
1620
1713
  if (typeof this.config.plugins == "string") {
1621
1714
  const i = this.config.plugins.split(/\s+/).filter(Boolean);
1622
- r && !i.includes("a11yChecker") && i.push("a11yChecker");
1623
- for (const n of i) {
1624
- const a = await this.pluginLoader.load(n, this.getPluginLoadConfig(n));
1715
+ n && !i.includes("a11yChecker") && i.push("a11yChecker");
1716
+ for (const r of i) {
1717
+ const a = await this.pluginLoader.load(r, this.getPluginLoadConfig(r));
1625
1718
  a && t.push(a);
1626
1719
  }
1627
1720
  } else if (Array.isArray(this.config.plugins)) {
1628
1721
  for (const i of this.config.plugins)
1629
1722
  if (typeof i == "string") {
1630
- const n = await this.pluginLoader.load(i, this.getPluginLoadConfig(i));
1631
- n && t.push(n);
1723
+ const r = await this.pluginLoader.load(i, this.getPluginLoadConfig(i));
1724
+ r && t.push(r);
1632
1725
  } else
1633
1726
  t.push(i);
1634
- if (r && !t.some((i) => (i == null ? void 0 : i.name) === "a11yChecker")) {
1727
+ if (n && !t.some((i) => (i == null ? void 0 : i.name) === "a11yChecker")) {
1635
1728
  const i = await this.pluginLoader.load("a11yChecker", this.getPluginLoadConfig("a11yChecker"));
1636
1729
  i && t.push(i);
1637
1730
  }
1638
1731
  }
1639
1732
  } else {
1640
1733
  const i = this.pluginLoader.getRegisteredPluginNames();
1641
- for (const n of i) {
1642
- const a = await this.pluginLoader.load(n, this.getPluginLoadConfig(n));
1734
+ for (const r of i) {
1735
+ const a = await this.pluginLoader.load(r, this.getPluginLoadConfig(r));
1643
1736
  a && t.push(a);
1644
1737
  }
1645
1738
  }
@@ -1647,14 +1740,20 @@ class g extends HTMLElement {
1647
1740
  }
1648
1741
  resolveToolbarItems() {
1649
1742
  const t = this.config.toolbarItems;
1650
- if (typeof t == "string") return t;
1651
- if (Array.isArray(t)) return t.join(" ");
1743
+ if (typeof t == "string")
1744
+ return t;
1745
+ if (Array.isArray(t))
1746
+ return t.join(" ");
1652
1747
  const e = this.config.toolbar;
1653
- if (typeof e == "string") return e;
1654
- if (!e || typeof e != "object") return;
1748
+ if (typeof e == "string")
1749
+ return e;
1750
+ if (!e || typeof e != "object")
1751
+ return;
1655
1752
  const o = e.items;
1656
- if (typeof o == "string") return o;
1657
- if (Array.isArray(o)) return o.join(" ");
1753
+ if (typeof o == "string")
1754
+ return o;
1755
+ if (Array.isArray(o))
1756
+ return o.join(" ");
1658
1757
  }
1659
1758
  isToolbarStickyEnabled() {
1660
1759
  const t = this.config.toolbar;
@@ -1716,12 +1815,14 @@ class g extends HTMLElement {
1716
1815
  };
1717
1816
  }
1718
1817
  isEditorInViewport() {
1719
- if (!this.contentElement || typeof window == "undefined") return !0;
1818
+ if (!this.contentElement || typeof window == "undefined")
1819
+ return !0;
1720
1820
  const t = this.contentElement.getBoundingClientRect();
1721
1821
  return t.bottom >= 0 && t.top <= window.innerHeight;
1722
1822
  }
1723
1823
  applyAccessibilitySettings() {
1724
- if (!this.contentElement) return;
1824
+ if (!this.contentElement)
1825
+ return;
1725
1826
  const t = this.getAccessibilityConfig();
1726
1827
  if (t.enableARIA) {
1727
1828
  this.contentElement.setAttribute("role", "textbox"), this.contentElement.setAttribute("aria-multiline", "true"), this.contentElement.setAttribute("aria-disabled", this.config.readonly ? "true" : "false");
@@ -1732,7 +1833,8 @@ class g extends HTMLElement {
1732
1833
  this.contentElement.tabIndex = t.keyboardNavigation ? 0 : -1;
1733
1834
  }
1734
1835
  applyLanguageSettings() {
1735
- if (!this.contentElement) return;
1836
+ if (!this.contentElement)
1837
+ return;
1736
1838
  const t = this.getLanguageConfig();
1737
1839
  this.contentElement.setAttribute("lang", t.locale), this.contentElement.setAttribute("dir", t.direction);
1738
1840
  }
@@ -1754,7 +1856,8 @@ class g extends HTMLElement {
1754
1856
  return { enabled: !1, provider: "browser" };
1755
1857
  }
1756
1858
  applySpellcheckSettings() {
1757
- if (!this.contentElement) return;
1859
+ if (!this.contentElement)
1860
+ return;
1758
1861
  const t = this.getSpellcheckConfig(), e = t.enabled && t.provider === "browser";
1759
1862
  this.contentElement.spellcheck = e, this.contentElement.setAttribute("spellcheck", e ? "true" : "false");
1760
1863
  }
@@ -1765,12 +1868,12 @@ class g extends HTMLElement {
1765
1868
  editorElement: this,
1766
1869
  contentElement: this.contentElement,
1767
1870
  toolbarElement: this.toolbarElement
1768
- }, r = this.loadedPlugins.find((n) => n.commands && n.commands[t]);
1769
- if (r && r.commands) {
1770
- const n = r.commands[t];
1771
- if (typeof n == "function")
1871
+ }, n = this.loadedPlugins.find((r) => r.commands && r.commands[t]);
1872
+ if (n && n.commands) {
1873
+ const r = n.commands[t];
1874
+ if (typeof r == "function")
1772
1875
  try {
1773
- return n(t === "toggleFullscreen" ? this : e, o), !0;
1876
+ return r(t === "toggleFullscreen" ? this : e, o), !0;
1774
1877
  } catch (a) {
1775
1878
  return console.error(`[RichTextEditor] Error executing native command ${t}:`, a), !1;
1776
1879
  }
@@ -1785,16 +1888,29 @@ class g extends HTMLElement {
1785
1888
  return i;
1786
1889
  }
1787
1890
  const o = {
1788
- spellCheck: ["spellcheck", "spellCheck"]
1789
- }, r = [
1891
+ spellCheck: ["spellcheck", "spellCheck"],
1892
+ trackChanges: ["trackchanges", "track-changes", "trackChanges"],
1893
+ versionDiff: ["versiondiff", "version-diff", "versionDiff"],
1894
+ "version-diff": ["versiondiff", "version-diff", "versionDiff"],
1895
+ conditionalContent: ["conditionalcontent", "conditional-content", "conditionalContent"],
1896
+ "conditional-content": ["conditionalcontent", "conditional-content", "conditionalContent"],
1897
+ dataBinding: ["databinding", "data-binding", "dataBinding"],
1898
+ "data-binding": ["databinding", "data-binding", "dataBinding"],
1899
+ contentRules: ["contentrules", "content-rules", "contentRules"],
1900
+ "content-rules": ["contentrules", "content-rules", "contentRules"],
1901
+ mentions: ["mention", "mentions"],
1902
+ mention: ["mention", "mentions"],
1903
+ slashCommands: ["slashcommands", "slash-commands", "slashCommands"],
1904
+ "slash-commands": ["slashcommands", "slash-commands", "slashCommands"]
1905
+ }, n = [
1790
1906
  t,
1791
1907
  t.toLowerCase(),
1792
1908
  ...o[t] || []
1793
1909
  ];
1794
- for (const i of r) {
1795
- const n = this.config[i];
1796
- if (n && typeof n == "object" && !Array.isArray(n))
1797
- return n;
1910
+ for (const i of n) {
1911
+ const r = this.config[i];
1912
+ if (r && typeof r == "object" && !Array.isArray(r))
1913
+ return r;
1798
1914
  }
1799
1915
  }
1800
1916
  getContentSanitizeConfig() {
@@ -1816,10 +1932,10 @@ class g extends HTMLElement {
1816
1932
  provider: "localStorage"
1817
1933
  };
1818
1934
  if (t && typeof t == "object") {
1819
- const r = Number((o = (e = t.intervalMs) != null ? e : t.interval) != null ? o : 3e4);
1935
+ const n = Number((o = (e = t.intervalMs) != null ? e : t.interval) != null ? o : 3e4);
1820
1936
  return {
1821
1937
  enabled: !!t.enabled,
1822
- intervalMs: Number.isFinite(r) && r > 0 ? r : 3e4,
1938
+ intervalMs: Number.isFinite(n) && n > 0 ? n : 3e4,
1823
1939
  storageKey: String(t.storageKey || "rte-autosave"),
1824
1940
  provider: t.provider || "localStorage",
1825
1941
  apiUrl: t.apiUrl
@@ -1854,7 +1970,8 @@ class g extends HTMLElement {
1854
1970
  }
1855
1971
  restoreAutosavedContent() {
1856
1972
  const t = this.getAutosaveConfig();
1857
- if (!t.enabled || t.provider !== "localStorage") return null;
1973
+ if (!t.enabled || t.provider !== "localStorage")
1974
+ return null;
1858
1975
  try {
1859
1976
  const e = localStorage.getItem(t.storageKey);
1860
1977
  if (e)
@@ -1876,16 +1993,17 @@ class g extends HTMLElement {
1876
1993
  }, t.intervalMs));
1877
1994
  }
1878
1995
  insertHTMLAtSelection(t) {
1879
- if (!this.contentElement) return;
1996
+ if (!this.contentElement)
1997
+ return;
1880
1998
  const e = window.getSelection();
1881
1999
  if (e && e.rangeCount > 0) {
1882
2000
  const o = e.getRangeAt(0);
1883
2001
  o.deleteContents();
1884
- const r = document.createElement("div");
1885
- r.innerHTML = t;
2002
+ const n = document.createElement("div");
2003
+ n.innerHTML = t;
1886
2004
  const i = document.createDocumentFragment();
1887
- for (; r.firstChild; )
1888
- i.appendChild(r.firstChild);
2005
+ for (; n.firstChild; )
2006
+ i.appendChild(n.firstChild);
1889
2007
  o.insertNode(i), o.collapse(!1), e.removeAllRanges(), e.addRange(o);
1890
2008
  } else
1891
2009
  this.contentElement.focus(), document.execCommand("insertHTML", !1, t);
@@ -1894,8 +2012,8 @@ class g extends HTMLElement {
1894
2012
  * Create UI elements
1895
2013
  */
1896
2014
  createUI(t, e) {
1897
- const o = this.querySelector('[slot="toolbar"]'), r = this.querySelector('[slot="statusbar"]');
1898
- this.innerHTML = "", this.config.toolbar !== !1 && !o ? (this.toolbarElement = document.createElement("div"), this.toolbarElement.className = "editora-toolbar-container", this.appendChild(this.toolbarElement), this.toolbar = new L(
2015
+ const o = this.querySelector('[slot="toolbar"]'), n = this.querySelector('[slot="statusbar"]');
2016
+ this.innerHTML = "", this.config.toolbar !== !1 && !o ? (this.toolbarElement = document.createElement("div"), this.toolbarElement.className = "editora-toolbar-container", this.appendChild(this.toolbarElement), this.toolbar = new z(
1899
2017
  {
1900
2018
  items: this.resolveToolbarItems(),
1901
2019
  sticky: this.isToolbarStickyEnabled(),
@@ -1904,17 +2022,17 @@ class g extends HTMLElement {
1904
2022
  t,
1905
2023
  this.pluginLoader
1906
2024
  // Pass plugin loader to get all registered plugins
1907
- ), this.toolbar.setCommandHandler((i, n) => {
2025
+ ), this.toolbar.setCommandHandler((i, r) => {
1908
2026
  var a;
1909
2027
  if (this.contentElement) {
1910
2028
  this.contentElement.focus();
1911
- const s = window.getSelection();
1912
- if (!s || s.rangeCount === 0 || !this.contentElement.contains(s.anchorNode)) {
2029
+ const l = window.getSelection();
2030
+ if (!l || l.rangeCount === 0 || !this.contentElement.contains(l.anchorNode)) {
1913
2031
  const c = document.createRange(), d = this.contentElement.lastChild || this.contentElement;
1914
- d.nodeType === Node.TEXT_NODE ? c.setStart(d, ((a = d.textContent) == null ? void 0 : a.length) || 0) : d.nodeType === Node.ELEMENT_NODE ? (c.selectNodeContents(d), c.collapse(!1)) : c.setStart(this.contentElement, 0), c.collapse(!0), s == null || s.removeAllRanges(), s == null || s.addRange(c);
2032
+ d.nodeType === Node.TEXT_NODE ? c.setStart(d, ((a = d.textContent) == null ? void 0 : a.length) || 0) : d.nodeType === Node.ELEMENT_NODE ? (c.selectNodeContents(d), c.collapse(!1)) : c.setStart(this.contentElement, 0), c.collapse(!0), l == null || l.removeAllRanges(), l == null || l.addRange(c);
1915
2033
  }
1916
2034
  }
1917
- return this.executeCommand(i, n);
2035
+ return this.executeCommand(i, r);
1918
2036
  }), this.toolbar.render(this.toolbarElement)) : o && this.appendChild(o), this.contentElement = document.createElement("div"), this.contentElement.className = "editora-content rte-content", this.contentElement.contentEditable = this.config.readonly ? "false" : "true", this.applyLanguageSettings(), this.applyAccessibilitySettings(), this.applySpellcheckSettings(), this.config.placeholder && this.contentElement.setAttribute("data-placeholder", this.config.placeholder);
1919
2037
  try {
1920
2038
  document.execCommand("defaultParagraphSeparator", !1, "p");
@@ -1925,14 +2043,14 @@ class g extends HTMLElement {
1925
2043
  const i = document.createElement("div");
1926
2044
  i.innerHTML = e.trim(), !Array.from(i.childNodes).some((a) => {
1927
2045
  if (a.nodeType === Node.ELEMENT_NODE) {
1928
- const s = a.tagName;
1929
- return ["P", "DIV", "H1", "H2", "H3", "H4", "H5", "H6", "UL", "OL", "BLOCKQUOTE", "PRE"].includes(s);
2046
+ const l = a.tagName;
2047
+ return ["P", "DIV", "H1", "H2", "H3", "H4", "H5", "H6", "UL", "OL", "BLOCKQUOTE", "PRE"].includes(l);
1930
2048
  }
1931
2049
  return !1;
1932
2050
  }) && e.trim() ? this.contentElement.innerHTML = `<p>${e.trim()}</p>` : this.contentElement.innerHTML = e;
1933
2051
  } else
1934
2052
  this.config.placeholder ? this.contentElement.innerHTML = "" : this.contentElement.innerHTML = "<p><br></p>";
1935
- this.appendChild(this.contentElement), this.isToolbarFloatingEnabled() && (this.floatingToolbar = new T({ enabled: !0 }), this.floatingToolbar.create(this)), r ? this.appendChild(r) : this.isStatusbarEnabled() && (this.statusBarElement = document.createElement("div"), this.statusBarElement.className = "editora-statusbar-container", this.appendChild(this.statusBarElement), this.statusBar = new I({ position: this.getStatusbarPosition() }), this.statusBar.create(this.statusBarElement)), this.config.autofocus && setTimeout(() => {
2053
+ this.appendChild(this.contentElement), this.isToolbarFloatingEnabled() && (this.floatingToolbar = new R({ enabled: !0 }), this.floatingToolbar.create(this)), n ? this.appendChild(n) : this.isStatusbarEnabled() && (this.statusBarElement = document.createElement("div"), this.statusBarElement.className = "editora-statusbar-container", this.appendChild(this.statusBarElement), this.statusBar = new H({ position: this.getStatusbarPosition() }), this.statusBar.create(this.statusBarElement)), this.config.autofocus && setTimeout(() => {
1936
2054
  var i;
1937
2055
  return (i = this.contentElement) == null ? void 0 : i.focus();
1938
2056
  }, 0);
@@ -1941,74 +2059,81 @@ class g extends HTMLElement {
1941
2059
  * Setup event listeners
1942
2060
  */
1943
2061
  setupEventListeners() {
1944
- if (!this.contentElement || !this.engine) return;
2062
+ if (!this.contentElement || !this.engine)
2063
+ return;
1945
2064
  const t = this.keyboardShortcutManager;
1946
- this.contentElement.addEventListener("input", () => {
1947
- if (!this.contentElement) return;
2065
+ this.contentElement.addEventListener("beforeinput", (o) => {
2066
+ this.lastBeforeInputType = o.inputType || null;
2067
+ }), this.contentElement.addEventListener("input", () => {
2068
+ if (!this.contentElement)
2069
+ return;
1948
2070
  let o = this.contentElement.innerHTML;
1949
- const r = this.getPerformanceConfig(), i = this.getContentSanitizeConfig(), n = this.getSecurityConfig();
1950
- if (n.sanitizeOnInput !== !1 && i.sanitize !== !1) {
1951
- const s = $(o, i, n);
1952
- if (s !== o) {
1953
- const c = window.getSelection(), d = c && c.rangeCount > 0 ? c.getRangeAt(0) : null;
1954
- if (this.contentElement.innerHTML = s, d && c)
2071
+ const n = this.getPerformanceConfig(), i = this.getContentSanitizeConfig(), r = this.getSecurityConfig(), a = this.lastBeforeInputType;
2072
+ if (this.lastBeforeInputType = null, r.sanitizeOnInput !== !1 && i.sanitize !== !1 && !a) {
2073
+ const d = X(o, i, r);
2074
+ if (d !== o) {
2075
+ const h = window.getSelection(), p = h && h.rangeCount > 0 ? h.getRangeAt(0) : null;
2076
+ if (this.contentElement.innerHTML = d, p && h)
1955
2077
  try {
1956
- c.removeAllRanges(), c.addRange(d);
1957
- } catch (f) {
2078
+ h.removeAllRanges(), h.addRange(p);
2079
+ } catch (u) {
1958
2080
  }
1959
- o = s;
2081
+ o = d;
1960
2082
  }
1961
2083
  }
1962
2084
  this.contentChangeDebounceTimer && clearTimeout(this.contentChangeDebounceTimer);
1963
- const a = () => {
2085
+ const c = () => {
1964
2086
  this.dispatchEvent(new CustomEvent("content-change", {
1965
2087
  detail: { html: o },
1966
2088
  bubbles: !0
1967
2089
  }));
1968
2090
  };
1969
- r.debounceInputMs > 0 ? this.contentChangeDebounceTimer = setTimeout(a, r.debounceInputMs) : a(), this.updateStatusBar();
2091
+ n.debounceInputMs > 0 ? this.contentChangeDebounceTimer = setTimeout(c, n.debounceInputMs) : c(), this.updateStatusBar();
1970
2092
  }), this.contentElement.addEventListener("contextmenu", (o) => {
1971
- const r = this.config.contextMenu;
1972
- (r === !1 || typeof r == "object" && r !== null && r.enabled === !1) && o.preventDefault();
2093
+ const n = this.config.contextMenu;
2094
+ (n === !1 || typeof n == "object" && n !== null && n.enabled === !1) && o.preventDefault();
1973
2095
  }), this.contentElement.addEventListener("paste", (o) => {
1974
- var d, f;
2096
+ var d, h;
2097
+ if (o.__editoraSmartPasteHandled === !0 || o.defaultPrevented)
2098
+ return;
1975
2099
  o.preventDefault();
1976
- const r = this.config.paste || {};
2100
+ const n = this.config.paste || {};
1977
2101
  let i = ((d = o.clipboardData) == null ? void 0 : d.getData("text/html")) || "";
1978
- const n = ((f = o.clipboardData) == null ? void 0 : f.getData("text/plain")) || "", a = this.getContentSanitizeConfig(), s = this.getSecurityConfig(), c = !!i && /class=["'][^"']*Mso|xmlns:w=|urn:schemas-microsoft-com:office/i.test(i);
1979
- if ((r.clean || !r.keepFormatting) && n) {
1980
- document.execCommand("insertText", !1, n);
2102
+ const r = ((h = o.clipboardData) == null ? void 0 : h.getData("text/plain")) || "", a = this.getContentSanitizeConfig(), l = this.getSecurityConfig(), c = !!i && /class=["'][^"']*Mso|xmlns:w=|urn:schemas-microsoft-com:office/i.test(i);
2103
+ if ((n.clean || !n.keepFormatting) && r) {
2104
+ document.execCommand("insertText", !1, r);
1981
2105
  return;
1982
2106
  }
1983
- if (r.convertWord === !1 && c && n) {
1984
- document.execCommand("insertText", !1, n);
2107
+ if (n.convertWord === !1 && c && r) {
2108
+ document.execCommand("insertText", !1, r);
1985
2109
  return;
1986
2110
  }
1987
2111
  if (i) {
1988
- s.sanitizeOnPaste !== !1 && a.sanitize !== !1 && (i = F(i, a, s)), this.insertHTMLAtSelection(i);
2112
+ l.sanitizeOnPaste !== !1 && a.sanitize !== !1 && (i = G(i, a, l)), this.insertHTMLAtSelection(i);
1989
2113
  return;
1990
2114
  }
1991
- n && document.execCommand("insertText", !1, n);
2115
+ r && document.execCommand("insertText", !1, r);
1992
2116
  }), this.contentElement.addEventListener("focus", () => {
1993
- this.dispatchEvent(new Event("editor-focus", { bubbles: !0 })), this.updateStatusBar();
2117
+ g = this, this.dispatchEvent(new Event("editor-focus", { bubbles: !0 })), this.updateStatusBar();
1994
2118
  }), this.contentElement.addEventListener("blur", () => {
1995
2119
  this.contentChangeDebounceTimer && (clearTimeout(this.contentChangeDebounceTimer), this.contentChangeDebounceTimer = void 0), this.contentElement && this.dispatchEvent(new CustomEvent("content-change", {
1996
2120
  detail: { html: this.contentElement.innerHTML },
1997
2121
  bubbles: !0
1998
2122
  })), this.dispatchEvent(new Event("editor-blur", { bubbles: !0 })), this.updateFloatingToolbar(), this.updateStatusBar();
1999
2123
  }), this.contentElement.addEventListener("keydown", (o) => {
2000
- this.getAccessibilityConfig().keyboardNavigation && t.handleKeyDown(o, (i, n) => {
2001
- this.executeCommand(i, n);
2124
+ this.getAccessibilityConfig().keyboardNavigation && t.handleKeyDown(o, (i, r) => {
2125
+ this.executeCommand(i, r);
2002
2126
  });
2003
2127
  });
2004
2128
  const e = () => {
2005
- const o = this.getSelectionRangeInEditor(), r = document.activeElement, i = !!r && !!this.contentElement && (r === this.contentElement || this.contentElement.contains(r));
2129
+ const o = this.getSelectionRangeInEditor(), n = document.activeElement, i = !!n && !!this.contentElement && (n === this.contentElement || this.contentElement.contains(n));
2006
2130
  this.getPerformanceConfig().viewportOnlyScan && !this.isEditorInViewport() && !i || !o && !i || (this.updateFloatingToolbar(), this.updateStatusBar());
2007
2131
  };
2008
2132
  this.selectionChangeHandler = e, document.addEventListener("selectionchange", this.selectionChangeHandler);
2009
2133
  }
2010
2134
  getSelectionRangeInEditor() {
2011
- if (!this.contentElement) return null;
2135
+ if (!this.contentElement)
2136
+ return null;
2012
2137
  const t = window.getSelection();
2013
2138
  if (!t || t.rangeCount === 0)
2014
2139
  return null;
@@ -2016,7 +2141,8 @@ class g extends HTMLElement {
2016
2141
  return this.contentElement.contains(o) ? e : null;
2017
2142
  }
2018
2143
  isSelectionBackward(t) {
2019
- if (!t.anchorNode || !t.focusNode) return !1;
2144
+ if (!t.anchorNode || !t.focusNode)
2145
+ return !1;
2020
2146
  try {
2021
2147
  const e = document.createRange();
2022
2148
  return e.setStart(t.anchorNode, t.anchorOffset), e.setEnd(t.focusNode, t.focusOffset), e.collapsed;
@@ -2032,32 +2158,37 @@ class g extends HTMLElement {
2032
2158
  * Update floating toolbar position
2033
2159
  */
2034
2160
  updateFloatingToolbar() {
2035
- if (!this.floatingToolbar) return;
2036
- const t = this.getPerformanceConfig(), e = document.activeElement === this.contentElement || !!this.contentElement && this.contentElement.contains(document.activeElement);
2037
- if (t.viewportOnlyScan && !this.isEditorInViewport() && !e) {
2161
+ if (!this.floatingToolbar || !this.contentElement)
2162
+ return;
2163
+ if (this.config.readonly || this.contentElement.contentEditable === "false" || this.contentElement.getAttribute("data-readonly") === "true" || this.getAttribute("readonly") === "true" || this.getAttribute("data-readonly") === "true") {
2038
2164
  this.floatingToolbar.hide();
2039
2165
  return;
2040
2166
  }
2041
- const o = this.getSelectionRangeInEditor();
2042
- if (!o) {
2167
+ const e = this.getPerformanceConfig(), o = document.activeElement === this.contentElement || !!this.contentElement && this.contentElement.contains(document.activeElement);
2168
+ if (e.viewportOnlyScan && !this.isEditorInViewport() && !o) {
2043
2169
  this.floatingToolbar.hide();
2044
2170
  return;
2045
2171
  }
2046
- if (o.collapsed) {
2172
+ const n = this.getSelectionRangeInEditor();
2173
+ if (!n) {
2047
2174
  this.floatingToolbar.hide();
2048
2175
  return;
2049
2176
  }
2050
- const r = window.getSelection();
2051
- if (!r) {
2177
+ if (n.collapsed) {
2052
2178
  this.floatingToolbar.hide();
2053
2179
  return;
2054
2180
  }
2055
- const i = this.getSelectionAnchorRect(r, o);
2181
+ const i = window.getSelection();
2056
2182
  if (!i) {
2057
2183
  this.floatingToolbar.hide();
2058
2184
  return;
2059
2185
  }
2060
- this.floatingToolbar.show(i.left, i.top - 40);
2186
+ const r = this.getSelectionAnchorRect(i, n);
2187
+ if (!r) {
2188
+ this.floatingToolbar.hide();
2189
+ return;
2190
+ }
2191
+ this.floatingToolbar.show(r.left, r.top - 40);
2061
2192
  }
2062
2193
  /**
2063
2194
  * Update status bar with selection and cursor information
@@ -2066,19 +2197,20 @@ class g extends HTMLElement {
2066
2197
  * Update status bar with current content and cursor information
2067
2198
  */
2068
2199
  updateStatusBar() {
2069
- if (!this.statusBar || !this.contentElement) return;
2200
+ if (!this.statusBar || !this.contentElement)
2201
+ return;
2070
2202
  const t = this.getPerformanceConfig(), e = document.activeElement === this.contentElement || this.contentElement.contains(document.activeElement);
2071
2203
  if (t.viewportOnlyScan && !this.isEditorInViewport() && !e)
2072
2204
  return;
2073
- const o = this.contentElement.textContent || "", { words: r, chars: i } = z(o), n = N(this.contentElement);
2074
- let a, s;
2205
+ const o = this.contentElement.textContent || "", { words: n, chars: i } = _(o), r = $(this.contentElement);
2206
+ let a, l;
2075
2207
  const c = this.getSelectionRangeInEditor();
2076
- c && (a = D(this.contentElement, c), c.collapsed || (s = O(c, a), a = void 0)), this.statusBar.update({
2077
- wordCount: r,
2208
+ c && (a = j(this.contentElement, c), c.collapsed || (l = W(c, a), a = void 0)), this.statusBar.update({
2209
+ wordCount: n,
2078
2210
  charCount: i,
2079
- lineCount: n,
2211
+ lineCount: r,
2080
2212
  cursorPosition: a,
2081
- selectionInfo: s
2213
+ selectionInfo: l
2082
2214
  });
2083
2215
  }
2084
2216
  /**
@@ -2158,7 +2290,7 @@ class g extends HTMLElement {
2158
2290
  const o = this.attributes[e];
2159
2291
  t[o.name] = o.value;
2160
2292
  }
2161
- return y.resolve({
2293
+ return A.resolve({
2162
2294
  jsConfig: this.jsConfig,
2163
2295
  attributes: t
2164
2296
  });
@@ -2198,8 +2330,8 @@ class g extends HTMLElement {
2198
2330
  * Destroy the editor
2199
2331
  */
2200
2332
  destroy() {
2201
- var t, e, o, r;
2202
- this.contentChangeDebounceTimer && (clearTimeout(this.contentChangeDebounceTimer), this.contentChangeDebounceTimer = void 0), this.contentElement && this.persistAutosave(this.contentElement.innerHTML || ""), this.stopAutosave(), this.selectionChangeHandler && (document.removeEventListener("selectionchange", this.selectionChangeHandler), this.selectionChangeHandler = void 0), (t = this.engine) == null || t.destroy(), (e = this.toolbar) == null || e.destroy(), (o = this.floatingToolbar) == null || o.destroy(), (r = this.statusBar) == null || r.destroy(), this.innerHTML = "", this.contentElement = void 0, this.toolbarElement = void 0, this.statusBarElement = void 0, this.loadedPlugins = [], this.isInitialized = !1, this.dispatchEvent(new Event("editor-destroy", { bubbles: !0 }));
2333
+ var t, e, o, n;
2334
+ this.contentChangeDebounceTimer && (clearTimeout(this.contentChangeDebounceTimer), this.contentChangeDebounceTimer = void 0), this.contentElement && this.persistAutosave(this.contentElement.innerHTML || ""), this.stopAutosave(), this.selectionChangeHandler && (document.removeEventListener("selectionchange", this.selectionChangeHandler), this.selectionChangeHandler = void 0), (t = this.engine) == null || t.destroy(), (e = this.toolbar) == null || e.destroy(), (o = this.floatingToolbar) == null || o.destroy(), (n = this.statusBar) == null || n.destroy(), this.innerHTML = "", this.contentElement = void 0, this.toolbarElement = void 0, this.statusBarElement = void 0, this.loadedPlugins = [], this.isInitialized = !1, w.delete(this), g === this && (g = null), this.dispatchEvent(new Event("editor-destroy", { bubbles: !0 }));
2203
2335
  }
2204
2336
  // Public API methods
2205
2337
  getContent() {
@@ -2222,23 +2354,23 @@ class g extends HTMLElement {
2222
2354
  }
2223
2355
  }
2224
2356
  export {
2225
- M as C,
2226
- b as E,
2227
- T as F,
2228
- S as K,
2229
- E as P,
2230
- g as R,
2231
- C as S,
2232
- L as T,
2233
- A as a,
2234
- I as b,
2235
- P as c,
2236
- N as d,
2237
- z as e,
2238
- O as f,
2239
- D as g,
2240
- y as h,
2241
- B as i,
2242
- K as j
2357
+ O as C,
2358
+ v as E,
2359
+ R as F,
2360
+ P as K,
2361
+ N as P,
2362
+ m as R,
2363
+ D as S,
2364
+ z as T,
2365
+ B as a,
2366
+ H as b,
2367
+ F as c,
2368
+ $ as d,
2369
+ _ as e,
2370
+ W as f,
2371
+ j as g,
2372
+ A as h,
2373
+ U as i,
2374
+ it as j
2243
2375
  };
2244
- //# sourceMappingURL=index-yzU4NdPT.mjs.map
2376
+ //# sourceMappingURL=index-7da30697.mjs.map