@editora/core 1.0.3 → 1.0.5

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 (131) hide show
  1. package/README.md +34 -0
  2. package/dist/{A11yCheckerPlugin.native-CZKpi3uF.mjs → A11yCheckerPlugin.native-BRdGYMju.mjs} +225 -173
  3. package/dist/AnchorPlugin.native-C1Rw5m04.mjs +404 -0
  4. package/dist/BackgroundColorPlugin.native-BE-p9DRd.mjs +489 -0
  5. package/dist/ChecklistPlugin.native-nuSSEFNI.mjs +309 -0
  6. package/dist/ClearFormattingPlugin.native-Bq_XcTh2.mjs +140 -0
  7. package/dist/{CodePlugin.native-CK9d8rmt.mjs → CodePlugin.native-B263UI8O.mjs} +624 -473
  8. package/dist/CodeSamplePlugin.native-CgGoH-X4.mjs +384 -0
  9. package/dist/CommentsPlugin.native-tMnWn8a2.mjs +723 -0
  10. package/dist/DirectionPlugin.native-CDnbdNyl.mjs +130 -0
  11. package/dist/{EmbedIframePlugin.native-ifr9KLdN.mjs → EmbedIframePlugin.native-CSWIB1jm.mjs} +154 -50
  12. package/dist/{EmojisPlugin.native-D6mJSnSR.mjs → EmojisPlugin.native-DxTm_DL-.mjs} +156 -103
  13. package/dist/FontFamilyPlugin.native-j8hMTbg4.mjs +158 -0
  14. package/dist/FontSizePlugin.native-B_jCh7dY.mjs +286 -0
  15. package/dist/FootnotePlugin.native-D730OGRm.mjs +425 -0
  16. package/dist/HistoryPlugin.native-TDnVMsEO.mjs +257 -0
  17. package/dist/IndentPlugin.native-BHixp8sP.mjs +150 -0
  18. package/dist/LineHeightPlugin.native-CM7iXdQj.mjs +151 -0
  19. package/dist/{LinkPlugin.native-BdAOV-iu.mjs → LinkPlugin.native-CS2g-G18.mjs} +128 -53
  20. package/dist/{ListPlugin.native-CLFU5AUQ.mjs → ListPlugin.native-V7EZC1lM.mjs} +59 -12
  21. package/dist/MathPlugin.native-KUxz0o8C.mjs +251 -0
  22. package/dist/MediaManagerPlugin.native-CgP5iInD.mjs +970 -0
  23. package/dist/MergeTagPlugin.native-DIGWhdnF.mjs +419 -0
  24. package/dist/PageBreakPlugin.native-CGiQxXqR.mjs +297 -0
  25. package/dist/{PrintPlugin.native-BUpm52VJ.mjs → PrintPlugin.native-7qt5v7L5.mjs} +10 -10
  26. package/dist/{SpecialCharactersPlugin.native-x7a2SWXc.mjs → SpecialCharactersPlugin.native-DANrbExJ.mjs} +143 -97
  27. package/dist/SpellCheckPlugin.native-C8bPvRHy.mjs +1019 -0
  28. package/dist/StrikethroughPlugin.native-0Be7j49s.mjs +73 -0
  29. package/dist/{TablePlugin.native-EEWXn1-s.mjs → TablePlugin.native-DrHX-efe.mjs} +149 -145
  30. package/dist/TemplatePlugin.native-4lKEm-WY.mjs +578 -0
  31. package/dist/TextAlignmentPlugin.native-sM_1s00t.mjs +108 -0
  32. package/dist/{TextColorPlugin.native-D6SmTglm.mjs → TextColorPlugin.native-Clgtb50j.mjs} +173 -92
  33. package/dist/colorSelectionApply-CK1My9N2.mjs +67 -0
  34. package/dist/core.css +1 -1
  35. package/dist/editora.min.js +31 -29
  36. package/dist/editora.umd.js +31 -29
  37. package/dist/index-CqWQFb3D.js +10 -0
  38. package/dist/index-OwnkG39N.mjs +2227 -0
  39. package/dist/index.cjs.js +14 -18
  40. package/dist/index.esm.js +204 -521
  41. package/dist/plugin-loader.js +26 -26
  42. package/dist/webcomponent-core.js +1286 -295
  43. package/dist/webcomponent-core.min.css +1 -1
  44. package/dist/webcomponent-core.min.js +111 -78
  45. package/dist/webcomponent.cjs.js +1 -1
  46. package/dist/webcomponent.esm.js +1 -1
  47. package/dist/webcomponent.js +1252 -261
  48. package/dist/webcomponent.min.css +1 -1
  49. package/dist/webcomponent.min.js +3552 -2037
  50. package/index.d.ts +355 -0
  51. package/package.json +21 -18
  52. package/dist/A11yCheckerPlugin.native-CZKpi3uF.mjs.map +0 -1
  53. package/dist/AnchorPlugin.native-7es9PVZ9.mjs +0 -340
  54. package/dist/AnchorPlugin.native-7es9PVZ9.mjs.map +0 -1
  55. package/dist/BackgroundColorPlugin.native-Dip5uqTg.mjs +0 -449
  56. package/dist/BackgroundColorPlugin.native-Dip5uqTg.mjs.map +0 -1
  57. package/dist/BlockquotePlugin.native-JFmOLsxN.mjs.map +0 -1
  58. package/dist/BoldPlugin.native-BAzzoqU5.mjs.map +0 -1
  59. package/dist/CapitalizationPlugin.native-DOMsh5R7.mjs.map +0 -1
  60. package/dist/ChecklistPlugin.native-Dccs3nLe.mjs +0 -153
  61. package/dist/ChecklistPlugin.native-Dccs3nLe.mjs.map +0 -1
  62. package/dist/ClearFormattingPlugin.native-BZPDHswo.mjs +0 -27
  63. package/dist/ClearFormattingPlugin.native-BZPDHswo.mjs.map +0 -1
  64. package/dist/CodePlugin.native-CK9d8rmt.mjs.map +0 -1
  65. package/dist/CodeSamplePlugin.native-DMbEdO9j.mjs +0 -326
  66. package/dist/CodeSamplePlugin.native-DMbEdO9j.mjs.map +0 -1
  67. package/dist/CommentsPlugin.native-2zQV8Ia4.mjs +0 -473
  68. package/dist/CommentsPlugin.native-2zQV8Ia4.mjs.map +0 -1
  69. package/dist/DirectionPlugin.native-Be7wCzkI.mjs +0 -59
  70. package/dist/DirectionPlugin.native-Be7wCzkI.mjs.map +0 -1
  71. package/dist/DocumentManagerPlugin.native-BvZL5CSG.mjs.map +0 -1
  72. package/dist/EmbedIframePlugin.native-ifr9KLdN.mjs.map +0 -1
  73. package/dist/EmojisPlugin.native-D6mJSnSR.mjs.map +0 -1
  74. package/dist/FontFamilyPlugin.native-BzS_9qbM.mjs +0 -106
  75. package/dist/FontFamilyPlugin.native-BzS_9qbM.mjs.map +0 -1
  76. package/dist/FontSizePlugin.native-DkLMLPue.mjs +0 -186
  77. package/dist/FontSizePlugin.native-DkLMLPue.mjs.map +0 -1
  78. package/dist/FootnotePlugin.native-BciVc9W6.mjs +0 -128
  79. package/dist/FootnotePlugin.native-BciVc9W6.mjs.map +0 -1
  80. package/dist/FullscreenPlugin.native-ChXyxeNw.mjs.map +0 -1
  81. package/dist/HeadingPlugin.native-DrLYwQnQ.mjs.map +0 -1
  82. package/dist/HistoryPlugin.native-DoDRifCf.mjs +0 -89
  83. package/dist/HistoryPlugin.native-DoDRifCf.mjs.map +0 -1
  84. package/dist/IndentPlugin.native-CbFugPoi.mjs +0 -133
  85. package/dist/IndentPlugin.native-CbFugPoi.mjs.map +0 -1
  86. package/dist/ItalicPlugin.native-CQjjDyUL.mjs.map +0 -1
  87. package/dist/LineHeightPlugin.native-CWQT2FIa.mjs +0 -73
  88. package/dist/LineHeightPlugin.native-CWQT2FIa.mjs.map +0 -1
  89. package/dist/LinkPlugin.native-BdAOV-iu.mjs.map +0 -1
  90. package/dist/ListPlugin.native-CLFU5AUQ.mjs.map +0 -1
  91. package/dist/MathPlugin.native-DE_ii-LA.mjs +0 -182
  92. package/dist/MathPlugin.native-DE_ii-LA.mjs.map +0 -1
  93. package/dist/MediaManagerPlugin.native-DaYFDzNM.mjs +0 -533
  94. package/dist/MediaManagerPlugin.native-DaYFDzNM.mjs.map +0 -1
  95. package/dist/MergeTagPlugin.native-CrxyThyn.mjs +0 -178
  96. package/dist/MergeTagPlugin.native-CrxyThyn.mjs.map +0 -1
  97. package/dist/PageBreakPlugin.native-DDjcDyRW.mjs +0 -172
  98. package/dist/PageBreakPlugin.native-DDjcDyRW.mjs.map +0 -1
  99. package/dist/PreviewPlugin.native-DBvfpmIv.mjs.map +0 -1
  100. package/dist/PrintPlugin.native-BUpm52VJ.mjs.map +0 -1
  101. package/dist/SpecialCharactersPlugin.native-x7a2SWXc.mjs.map +0 -1
  102. package/dist/SpellCheckPlugin.native-B7yTh0iE.mjs +0 -465
  103. package/dist/SpellCheckPlugin.native-B7yTh0iE.mjs.map +0 -1
  104. package/dist/StrikethroughPlugin.native-ChaZLaXw.mjs +0 -43
  105. package/dist/StrikethroughPlugin.native-ChaZLaXw.mjs.map +0 -1
  106. package/dist/TablePlugin.native-EEWXn1-s.mjs.map +0 -1
  107. package/dist/TemplatePlugin.native-BlSn1c9h.mjs +0 -564
  108. package/dist/TemplatePlugin.native-BlSn1c9h.mjs.map +0 -1
  109. package/dist/TextAlignmentPlugin.native-CQIs1m7R.mjs +0 -97
  110. package/dist/TextAlignmentPlugin.native-CQIs1m7R.mjs.map +0 -1
  111. package/dist/TextColorPlugin.native-D6SmTglm.mjs.map +0 -1
  112. package/dist/UnderlinePlugin.native-QpIcK4L2.mjs.map +0 -1
  113. package/dist/documentManager-irzj9n3V.mjs.map +0 -1
  114. package/dist/editorContainerHelpers-C7kdWnS0.mjs.map +0 -1
  115. package/dist/editora.min.js.map +0 -1
  116. package/dist/editora.umd.js.map +0 -1
  117. package/dist/index-BF5RBhL9.js +0 -4
  118. package/dist/index-BF5RBhL9.js.map +0 -1
  119. package/dist/index-BPsf460l.mjs +0 -1243
  120. package/dist/index-BPsf460l.mjs.map +0 -1
  121. package/dist/index.cjs.js.map +0 -1
  122. package/dist/index.es-CuicffkQ.mjs.map +0 -1
  123. package/dist/index.esm.js.map +0 -1
  124. package/dist/plugin-loader.js.map +0 -1
  125. package/dist/purify.es-CKpwg8Tk.mjs.map +0 -1
  126. package/dist/webcomponent-core.js.map +0 -1
  127. package/dist/webcomponent-core.min.js.map +0 -1
  128. package/dist/webcomponent.cjs.js.map +0 -1
  129. package/dist/webcomponent.esm.js.map +0 -1
  130. package/dist/webcomponent.js.map +0 -1
  131. package/dist/webcomponent.min.js.map +0 -1
package/dist/index.esm.js CHANGED
@@ -1,13 +1,13 @@
1
- import { P as g, E as y, a as f, T as b, R as v } from "./index-BPsf460l.mjs";
2
- import { C as B, h as G, F as K, i as V, S as W, b as X, e as _, d as Y, g as J, f as Q, c as Z } from "./index-BPsf460l.mjs";
3
- class k {
1
+ import { P as g, E as y, a as b, T as f, R as v } from "./index-OwnkG39N.mjs";
2
+ import { C as G, h as O, F as V, K, i as B, S as W, b as X, e as _, d as Y, g as J, f as Q, c as Z } from "./index-OwnkG39N.mjs";
3
+ class L {
4
4
  constructor(e) {
5
5
  if (this.listeners = [], e instanceof g)
6
6
  this.pluginManager = e;
7
7
  else {
8
8
  const i = e;
9
- this.pluginManager = new g(), i.plugins && Array.isArray(i.plugins) && i.plugins.forEach((s) => {
10
- this.pluginManager.register(s);
9
+ this.pluginManager = new g(), i.plugins && Array.isArray(i.plugins) && i.plugins.forEach((n) => {
10
+ this.pluginManager.register(n);
11
11
  }), i.element && (this.domElement = i.element, this.setupDOMElement(i));
12
12
  }
13
13
  const t = this.pluginManager.buildSchema();
@@ -25,15 +25,15 @@ class k {
25
25
  }), document.addEventListener("keydown", (i) => {
26
26
  if (this.contentElement !== document.activeElement && !(document.activeElement instanceof HTMLElement && document.activeElement.contentEditable === "true"))
27
27
  return;
28
- const s = [];
29
- (i.ctrlKey || i.metaKey) && s.push("ctrl"), i.shiftKey && s.push("shift"), i.altKey && s.push("alt");
30
- const n = i.key.toLowerCase(), o = s.length > 0 ? `${s.join("+")}+${n}` : n, r = t[o];
31
- r && (i.preventDefault(), this.execCommand(r));
28
+ const n = [];
29
+ (i.ctrlKey || i.metaKey) && n.push("ctrl"), i.shiftKey && n.push("shift"), i.altKey && n.push("alt");
30
+ const o = i.key.toLowerCase(), s = n.length > 0 ? `${n.join("+")}+${o}` : o, a = t[s];
31
+ a && (i.preventDefault(), this.execCommand(a));
32
32
  });
33
33
  }
34
34
  handleToolbarCommand(e, t) {
35
- const s = this.pluginManager.getToolbarItems().find((n) => n.id && n.id === e || n.command === e);
36
- s && (t !== void 0 ? this.execCommand(s.command, t) : this.execCommand(s.command));
35
+ const n = this.pluginManager.getToolbarItems().find((o) => o.id && o.id === e || o.command === e);
36
+ n != null && n.command && (t !== void 0 ? this.execCommand(n.command, t) : this.execCommand(n.command));
37
37
  }
38
38
  setState(e) {
39
39
  this.state = e, this.listeners.forEach((t) => t(e));
@@ -55,8 +55,12 @@ class k {
55
55
  const i = this.commands[e];
56
56
  if (!i)
57
57
  return console.warn(`Command not found: ${e}`), !1;
58
- let s;
59
- return t !== void 0 ? s = i(this.state, t) : s = i(this.state), s ? (this.setState(s), !0) : !1;
58
+ let n;
59
+ return t !== void 0 ? n = i(this.state, t) : n = i(this.state), n instanceof Promise ? (n.then((o) => {
60
+ o && typeof o == "object" && "doc" in o && "selection" in o && this.setState(o);
61
+ }).catch((o) => {
62
+ console.error(`Async command failed: ${e}`, o);
63
+ }), !0) : n && typeof n == "object" && "doc" in n && "selection" in n ? (this.setState(n), !0) : n !== !1 && n != null;
60
64
  }
61
65
  setContent(e) {
62
66
  typeof e == "string" ? this.contentElement && (this.contentElement.innerHTML = e) : this.setState(this.state.apply(e));
@@ -82,8 +86,8 @@ class E {
82
86
  return console.warn(`Plugin "${this.plugin.name}" already initialized`), !1;
83
87
  try {
84
88
  return this.context = e, (t = this.plugin.context) != null && t.initialize && this.plugin.context.initialize(), (i = this.plugin.context) != null && i.onEditorReady && e.provider && this.plugin.context.onEditorReady(e), this.initialized = !0, !0;
85
- } catch (s) {
86
- return console.error(`Failed to initialize plugin "${this.plugin.name}":`, s), !1;
89
+ } catch (n) {
90
+ return console.error(`Failed to initialize plugin "${this.plugin.name}":`, n), !1;
87
91
  }
88
92
  }
89
93
  /**
@@ -107,10 +111,10 @@ class E {
107
111
  if (!this.initialized)
108
112
  return console.warn(`Plugin "${this.plugin.name}" not initialized, cannot execute command "${e}"`), null;
109
113
  try {
110
- const s = (i = this.plugin.commands) == null ? void 0 : i[e];
111
- return s ? s(...t) : (console.warn(`Command "${e}" not found in plugin "${this.plugin.name}"`), null);
112
- } catch (s) {
113
- return console.error(`Error executing command "${e}" in plugin "${this.plugin.name}":`, s), null;
114
+ const n = (i = this.plugin.commands) == null ? void 0 : i[e];
115
+ return n ? n(...t) : (console.warn(`Command "${e}" not found in plugin "${this.plugin.name}"`), null);
116
+ } catch (n) {
117
+ return console.error(`Error executing command "${e}" in plugin "${this.plugin.name}":`, n), null;
114
118
  }
115
119
  }
116
120
  /**
@@ -138,355 +142,20 @@ class E {
138
142
  return this.context;
139
143
  }
140
144
  }
141
- function M(a) {
142
- return new E(a);
143
- }
144
- class L {
145
- constructor(e) {
146
- this.shortcuts = /* @__PURE__ */ new Map(), this.enabled = !0, this.isMac = typeof navigator != "undefined" && navigator.platform.toUpperCase().indexOf("MAC") >= 0, (e == null ? void 0 : e.enabled) === !1 && (this.enabled = !1), this.registerDefaultShortcuts(), e != null && e.shortcuts && e.shortcuts.forEach((t) => this.registerShortcut(t)), e != null && e.customShortcuts && Object.values(e.customShortcuts).forEach((t) => {
147
- this.registerShortcut(t);
148
- });
149
- }
150
- registerDefaultShortcuts() {
151
- this.registerShortcut({
152
- key: "b",
153
- ctrl: !this.isMac,
154
- meta: this.isMac,
155
- command: "toggleBold",
156
- description: "Bold",
157
- preventDefault: !0
158
- }), this.registerShortcut({
159
- key: "i",
160
- ctrl: !this.isMac,
161
- meta: this.isMac,
162
- command: "toggleItalic",
163
- description: "Italic",
164
- preventDefault: !0
165
- }), this.registerShortcut({
166
- key: "u",
167
- ctrl: !this.isMac,
168
- meta: this.isMac,
169
- command: "toggleUnderline",
170
- description: "Underline",
171
- preventDefault: !0
172
- }), this.registerShortcut({
173
- key: "d",
174
- ctrl: !this.isMac,
175
- meta: this.isMac,
176
- command: "toggleStrikethrough",
177
- description: "Strikethrough",
178
- preventDefault: !0
179
- }), this.registerShortcut({
180
- key: "z",
181
- ctrl: !this.isMac,
182
- meta: this.isMac,
183
- command: "undo",
184
- description: "Undo",
185
- preventDefault: !0
186
- }), this.registerShortcut({
187
- key: "z",
188
- ctrl: !this.isMac,
189
- meta: this.isMac,
190
- shift: !0,
191
- command: "redo",
192
- description: "Redo",
193
- preventDefault: !0
194
- }), this.registerShortcut({
195
- key: "y",
196
- ctrl: !this.isMac,
197
- meta: this.isMac,
198
- command: "redo",
199
- description: "Redo",
200
- preventDefault: !0
201
- });
202
- for (let e = 1; e <= 6; e++)
203
- this.registerShortcut({
204
- key: String(e),
205
- ctrl: !this.isMac,
206
- meta: this.isMac,
207
- alt: !0,
208
- command: "setBlockType",
209
- params: `h${e}`,
210
- description: `Heading ${e}`,
211
- preventDefault: !0
212
- });
213
- this.registerShortcut({
214
- key: "7",
215
- ctrl: !this.isMac,
216
- meta: this.isMac,
217
- alt: !0,
218
- command: "setBlockType",
219
- params: "p",
220
- description: "Paragraph",
221
- preventDefault: !0
222
- }), this.registerShortcut({
223
- key: "7",
224
- ctrl: !this.isMac,
225
- meta: this.isMac,
226
- shift: !0,
227
- command: "toggleOrderedList",
228
- description: "Numbered List",
229
- preventDefault: !0
230
- }), this.registerShortcut({
231
- key: "8",
232
- ctrl: !this.isMac,
233
- meta: this.isMac,
234
- shift: !0,
235
- command: "toggleBulletList",
236
- description: "Bullet List",
237
- preventDefault: !0
238
- }), this.registerShortcut({
239
- key: "k",
240
- ctrl: !this.isMac,
241
- meta: this.isMac,
242
- command: "openLinkDialog",
243
- description: "Insert/Edit Link",
244
- preventDefault: !0
245
- }), this.registerShortcut({
246
- key: "e",
247
- ctrl: !this.isMac,
248
- meta: this.isMac,
249
- alt: !0,
250
- command: "insertCodeBlock",
251
- description: "Code Block",
252
- preventDefault: !0
253
- }), this.registerShortcut({
254
- key: "q",
255
- ctrl: !this.isMac,
256
- meta: this.isMac,
257
- shift: !0,
258
- command: "toggleBlockquote",
259
- description: "Blockquote",
260
- preventDefault: !0
261
- }), this.registerShortcut({
262
- key: "l",
263
- ctrl: !this.isMac,
264
- meta: this.isMac,
265
- shift: !0,
266
- command: "setTextAlignment",
267
- params: "left",
268
- description: "Align Left",
269
- preventDefault: !0
270
- }), this.registerShortcut({
271
- key: "e",
272
- ctrl: !this.isMac,
273
- meta: this.isMac,
274
- shift: !0,
275
- alt: !0,
276
- command: "setTextAlignment",
277
- params: "center",
278
- description: "Align Center",
279
- preventDefault: !0
280
- }), this.registerShortcut({
281
- key: "r",
282
- ctrl: !this.isMac,
283
- meta: this.isMac,
284
- shift: !0,
285
- command: "setTextAlignment",
286
- params: "right",
287
- description: "Align Right",
288
- preventDefault: !0
289
- }), this.registerShortcut({
290
- key: "j",
291
- ctrl: !this.isMac,
292
- meta: this.isMac,
293
- shift: !0,
294
- command: "setTextAlignment",
295
- params: "justify",
296
- description: "Justify",
297
- preventDefault: !0
298
- }), this.registerShortcut({
299
- key: "\\",
300
- ctrl: !this.isMac,
301
- meta: this.isMac,
302
- command: "clearFormatting",
303
- description: "Clear Formatting",
304
- preventDefault: !0
305
- }), this.registerShortcut({
306
- key: "]",
307
- ctrl: !this.isMac,
308
- meta: this.isMac,
309
- command: "increaseIndent",
310
- description: "Indent",
311
- preventDefault: !0
312
- }), this.registerShortcut({
313
- key: "[",
314
- ctrl: !this.isMac,
315
- meta: this.isMac,
316
- command: "decreaseIndent",
317
- description: "Outdent",
318
- preventDefault: !0
319
- }), this.registerShortcut({
320
- key: "g",
321
- ctrl: !this.isMac,
322
- meta: this.isMac,
323
- shift: !0,
324
- command: "insertImage",
325
- description: "Insert Image",
326
- preventDefault: !0
327
- }), this.registerShortcut({
328
- key: "t",
329
- ctrl: !this.isMac,
330
- meta: this.isMac,
331
- shift: !0,
332
- alt: !0,
333
- command: "insertTable",
334
- description: "Insert Table",
335
- preventDefault: !0
336
- }), this.registerShortcut({
337
- key: "f11",
338
- command: "toggleFullscreen",
339
- description: "Toggle Fullscreen",
340
- preventDefault: !0
341
- }), this.registerShortcut({
342
- key: "p",
343
- ctrl: !this.isMac,
344
- meta: this.isMac,
345
- shift: !0,
346
- command: "togglePreview",
347
- description: "Preview",
348
- preventDefault: !0
349
- }), this.registerShortcut({
350
- key: "p",
351
- ctrl: !this.isMac,
352
- meta: this.isMac,
353
- command: "print",
354
- description: "Print",
355
- preventDefault: !0
356
- }), this.registerShortcut({
357
- key: "s",
358
- ctrl: !this.isMac,
359
- meta: this.isMac,
360
- shift: !0,
361
- alt: !0,
362
- command: "insertSpecialCharacter",
363
- description: "Insert Special Character",
364
- preventDefault: !0
365
- }), this.registerShortcut({
366
- key: "m",
367
- ctrl: !this.isMac,
368
- meta: this.isMac,
369
- shift: !0,
370
- command: "insertEmoji",
371
- description: "Insert Emoji",
372
- preventDefault: !0
373
- }), this.registerShortcut({
374
- key: "9",
375
- ctrl: !this.isMac,
376
- meta: this.isMac,
377
- shift: !0,
378
- command: "toggleChecklist",
379
- description: "Checklist",
380
- preventDefault: !0
381
- }), this.registerShortcut({
382
- key: "a",
383
- ctrl: !this.isMac,
384
- meta: this.isMac,
385
- shift: !0,
386
- alt: !0,
387
- command: "toggleA11yChecker",
388
- description: "Accessibility Checker",
389
- preventDefault: !0
390
- }), this.registerShortcut({
391
- key: "F7",
392
- command: "toggleSpellCheck",
393
- description: "Spell Check",
394
- preventDefault: !0
395
- }), this.registerShortcut({
396
- key: "m",
397
- ctrl: !this.isMac,
398
- meta: this.isMac,
399
- alt: !0,
400
- command: "insertMath",
401
- description: "Insert Math",
402
- preventDefault: !0
403
- }), this.registerShortcut({
404
- key: "f",
405
- ctrl: !this.isMac,
406
- meta: this.isMac,
407
- alt: !0,
408
- command: "insertFootnote",
409
- description: "Insert Footnote",
410
- preventDefault: !0
411
- });
412
- }
413
- registerShortcut(e) {
414
- const t = this.getShortcutKey(e);
415
- this.shortcuts.set(t, e);
416
- }
417
- unregisterShortcut(e) {
418
- const t = this.getShortcutKey(e);
419
- this.shortcuts.delete(t);
420
- }
421
- getShortcutKey(e) {
422
- const t = [];
423
- return e.ctrl && t.push("ctrl"), e.alt && t.push("alt"), e.shift && t.push("shift"), e.meta && t.push("meta"), t.push(e.key.toLowerCase()), t.join("+");
424
- }
425
- getEventKey(e) {
426
- const t = [];
427
- return e.ctrlKey && t.push("ctrl"), e.altKey && t.push("alt"), e.shiftKey && t.push("shift"), e.metaKey && t.push("meta"), t.push(e.key.toLowerCase()), t.join("+");
428
- }
429
- handleKeyDown(e, t) {
430
- if (!this.enabled) return !1;
431
- const i = this.getEventKey(e), s = this.shortcuts.get(i);
432
- return s ? (s.preventDefault !== !1 && (e.preventDefault(), e.stopPropagation()), t(s.command, s.params), !0) : !1;
433
- }
434
- enable() {
435
- this.enabled = !0;
436
- }
437
- disable() {
438
- this.enabled = !1;
439
- }
440
- isEnabled() {
441
- return this.enabled;
442
- }
443
- getAllShortcuts() {
444
- return Array.from(this.shortcuts.values());
445
- }
446
- getShortcutForCommand(e) {
447
- return Array.from(this.shortcuts.values()).find((t) => t.command === e);
448
- }
449
- getShortcutDescription(e) {
450
- const t = [];
451
- this.isMac ? (e.meta && t.push("⌘"), e.ctrl && t.push("⌃"), e.alt && t.push("⌥"), e.shift && t.push("⇧")) : (e.ctrl && t.push("Ctrl"), e.alt && t.push("Alt"), e.shift && t.push("Shift"));
452
- const i = e.key.length === 1 ? e.key.toUpperCase() : e.key;
453
- return t.push(i), t.join("+");
454
- }
455
- getShortcutsHelp() {
456
- const e = this.getAllShortcuts(), t = /* @__PURE__ */ new Map();
457
- e.forEach((s) => {
458
- const n = this.getShortcutCategory(s.command);
459
- t.has(n) || t.set(n, []), t.get(n).push(s);
460
- });
461
- let i = `# Keyboard Shortcuts
462
-
463
- `;
464
- return t.forEach((s, n) => {
465
- i += `## ${n}
466
-
467
- `, s.forEach((o) => {
468
- const r = this.getShortcutDescription(o);
469
- i += `- **${r}**: ${o.description || o.command}
470
- `;
471
- }), i += `
472
- `;
473
- }), i;
474
- }
475
- getShortcutCategory(e) {
476
- return e.includes("toggle") && (e.includes("Bold") || e.includes("Italic") || e.includes("Underline") || e.includes("Strike") || e.includes("Code") || e.includes("Super") || e.includes("Sub")) ? "Text Formatting" : e.includes("Heading") || e.includes("Paragraph") ? "Block Formatting" : e.includes("List") || e.includes("Checklist") ? "Lists" : e.includes("Alignment") || e.includes("Indent") ? "Alignment & Indentation" : e.includes("undo") || e.includes("redo") ? "History" : e.includes("insert") ? "Insert" : e.includes("find") || e.includes("replace") ? "Find & Replace" : e.includes("Accessibility") || e.includes("spell") ? "Tools" : "Other";
477
- }
145
+ function k(l) {
146
+ return new E(l);
478
147
  }
479
- function T(a = {}) {
148
+ function T(l = {}) {
480
149
  const {
481
150
  enabled: e = !1,
482
151
  provider: t = "browser",
483
152
  apiUrl: i = "",
484
- apiHeaders: s = {},
485
- language: n = "en",
486
- customDictionary: o = [],
487
- ignoreAllCaps: r = !0,
488
- ignoreNumbers: l = !0
489
- } = a;
153
+ apiHeaders: n = {},
154
+ language: o = "en",
155
+ customDictionary: s = [],
156
+ ignoreAllCaps: a = !0,
157
+ ignoreNumbers: r = !0
158
+ } = l;
490
159
  return {
491
160
  name: "spellcheck",
492
161
  context: {
@@ -494,7 +163,7 @@ function T(a = {}) {
494
163
  if (e)
495
164
  switch (console.log("[Spellcheck Plugin] Initialized", {
496
165
  provider: t,
497
- language: n
166
+ language: o
498
167
  }), t) {
499
168
  case "browser":
500
169
  console.log("[Spellcheck] Using browser spellcheck");
@@ -529,22 +198,22 @@ function T(a = {}) {
529
198
  ] : []
530
199
  };
531
200
  }
532
- function I(a = {}) {
201
+ function I(l = {}) {
533
202
  const {
534
203
  uploadUrl: e = "",
535
204
  libraryUrl: t = "",
536
205
  maxFileSize: i = 10 * 1024 * 1024,
537
206
  // 10MB
538
- allowedTypes: s = ["image/jpeg", "image/png", "image/gif", "image/webp"],
539
- headers: n = {},
540
- withCredentials: o = !1,
541
- chunkSize: r = 1024 * 1024,
207
+ allowedTypes: n = ["image/jpeg", "image/png", "image/gif", "image/webp"],
208
+ headers: o = {},
209
+ withCredentials: s = !1,
210
+ chunkSize: a = 1024 * 1024,
542
211
  // 1MB chunks
543
- enableChunking: l = !0,
212
+ enableChunking: r = !0,
544
213
  onProgress: d,
545
214
  onError: h,
546
- onSuccess: w
547
- } = a;
215
+ onSuccess: C
216
+ } = l;
548
217
  return {
549
218
  name: "media",
550
219
  context: {
@@ -553,7 +222,7 @@ function I(a = {}) {
553
222
  uploadUrl: e,
554
223
  libraryUrl: t,
555
224
  maxFileSize: i,
556
- allowedTypes: s
225
+ allowedTypes: n
557
226
  }), e || console.warn("[Media] No uploadUrl provided - upload will not work");
558
227
  },
559
228
  destroy: () => {
@@ -567,7 +236,7 @@ function I(a = {}) {
567
236
  insertImage: async (c) => {
568
237
  if (console.log("[Media] Insert image command (not implemented)", c), !c)
569
238
  return console.log("[Media] No file provided - should open picker"), null;
570
- if (!s.includes(c.type)) {
239
+ if (!n.includes(c.type)) {
571
240
  const p = new Error(`File type ${c.type} not allowed`);
572
241
  return h == null || h(p), null;
573
242
  }
@@ -648,7 +317,12 @@ class u {
648
317
  }
649
318
  createElement() {
650
319
  const e = document.createElement("dialog");
651
- if (e.className = "editora-dialog", this.config.width && (e.style.width = this.config.width), this.config.height && (e.style.height = this.config.height), e.innerHTML = `
320
+ e.className = "editora-dialog", this.config.width && (e.style.width = this.config.width), this.config.height && (e.style.height = this.config.height);
321
+ const t = this.config.buttons && this.config.buttons.length > 0 ? this.config.buttons.map((i, n) => `<button type="button" class="editora-btn ${i.type === "danger" ? "editora-btn-danger" : i.type === "primary" || i.primary ? "editora-btn-primary" : "editora-btn-cancel"}" data-dialog-button="${n}">${i.label}</button>`).join("") : `
322
+ <button type="button" class="editora-btn editora-btn-cancel" data-dialog-default="cancel">Cancel</button>
323
+ <button type="button" class="editora-btn editora-btn-primary" data-dialog-default="ok">OK</button>
324
+ `;
325
+ if (e.innerHTML = `
652
326
  <div class="editora-dialog-container">
653
327
  <div class="editora-dialog-header">
654
328
  <h3>${this.config.title}</h3>
@@ -658,43 +332,52 @@ class u {
658
332
  ${typeof this.config.content == "string" ? this.config.content : ""}
659
333
  </div>
660
334
  <div class="editora-dialog-footer">
661
- <button type="button" class="editora-btn editora-btn-cancel">Cancel</button>
662
- <button type="button" class="editora-btn editora-btn-primary">OK</button>
335
+ ${t}
663
336
  </div>
664
337
  </div>
665
338
  `, typeof this.config.content != "string") {
666
- const t = e.querySelector(".editora-dialog-body");
667
- t && (t.innerHTML = "", t.appendChild(this.config.content));
339
+ const i = e.querySelector(".editora-dialog-body");
340
+ i && (i.innerHTML = "", i.appendChild(this.config.content));
668
341
  }
669
342
  return e;
670
343
  }
671
344
  attachEventListeners() {
672
345
  const e = this.element.querySelector(".editora-dialog-close");
673
- e == null || e.addEventListener("click", () => this.close());
674
- const t = this.element.querySelector(".editora-btn-cancel");
675
- t == null || t.addEventListener("click", () => {
676
- var s, n;
677
- (n = (s = this.config).onCancel) == null || n.call(s), this.close();
678
- });
679
- const i = this.element.querySelector(".editora-btn-primary");
680
- i == null || i.addEventListener("click", () => this.handleSubmit()), this.config.closeOnEscape && this.element.addEventListener("cancel", (s) => {
681
- s.preventDefault(), this.close();
682
- }), this.config.closeOnBackdrop && this.element.addEventListener("click", (s) => {
683
- const n = this.element.getBoundingClientRect();
684
- (s.clientX < n.left || s.clientX > n.right || s.clientY < n.top || s.clientY > n.bottom) && this.close();
346
+ if (e == null || e.addEventListener("click", () => this.close()), this.config.buttons && this.config.buttons.length > 0)
347
+ this.element.querySelectorAll("[data-dialog-button]").forEach((i) => {
348
+ i.addEventListener("click", () => {
349
+ var s, a;
350
+ const n = Number(i.getAttribute("data-dialog-button")), o = (s = this.config.buttons) == null ? void 0 : s[n];
351
+ (a = o == null ? void 0 : o.onClick) == null || a.call(o);
352
+ });
353
+ });
354
+ else {
355
+ const t = this.element.querySelector('[data-dialog-default="cancel"]');
356
+ t == null || t.addEventListener("click", () => {
357
+ var n, o;
358
+ (o = (n = this.config).onCancel) == null || o.call(n), this.close();
359
+ });
360
+ const i = this.element.querySelector('[data-dialog-default="ok"]');
361
+ i == null || i.addEventListener("click", () => this.handleSubmit());
362
+ }
363
+ this.config.closeOnEscape && this.element.addEventListener("cancel", (t) => {
364
+ t.preventDefault(), this.close();
365
+ }), this.config.closeOnBackdrop && this.element.addEventListener("click", (t) => {
366
+ const i = this.element.getBoundingClientRect();
367
+ (t.clientX < i.left || t.clientX > i.right || t.clientY < i.top || t.clientY > i.bottom) && this.close();
685
368
  });
686
369
  }
687
370
  handleSubmit() {
688
- var t, i, s, n;
371
+ var t, i, n, o;
689
372
  const e = this.element.querySelector("form");
690
373
  if (e) {
691
- const o = new FormData(e);
692
- (i = (t = this.config).onSubmit) == null || i.call(t, o);
374
+ const s = new FormData(e);
375
+ (i = (t = this.config).onSubmit) == null || i.call(t, s);
693
376
  } else {
694
- const o = this.element.querySelectorAll("input, select, textarea"), r = new FormData();
695
- o.forEach((l) => {
696
- l.name && r.append(l.name, l.value);
697
- }), (n = (s = this.config).onSubmit) == null || n.call(s, r);
377
+ const s = this.element.querySelectorAll("input, select, textarea"), a = new FormData();
378
+ s.forEach((r) => {
379
+ r.name && a.append(r.name, r.value);
380
+ }), (o = (n = this.config).onSubmit) == null || o.call(n, a);
698
381
  }
699
382
  this.close();
700
383
  }
@@ -708,24 +391,24 @@ class u {
708
391
  this.close();
709
392
  }
710
393
  }
711
- class D {
394
+ class F {
712
395
  constructor(e) {
713
396
  this.isOpen = !1, this.config = e, this.selectedValue = e.value, this.element = this.createElement(), this.attachEventListeners();
714
397
  }
715
398
  createElement() {
716
399
  const e = document.createElement("div");
717
400
  e.className = "editora-dropdown", this.config.width && (e.style.width = this.config.width);
718
- const t = this.config.options.find((s) => s.value === this.selectedValue), i = (t == null ? void 0 : t.label) || this.config.placeholder || "Select...";
401
+ const t = this.config.options.find((n) => n.value === this.selectedValue), i = (t == null ? void 0 : t.label) || this.config.placeholder || "Select...";
719
402
  return e.innerHTML = `
720
403
  <button class="editora-dropdown-toggle" type="button">
721
404
  <span class="editora-dropdown-label">${i}</span>
722
405
  <span class="editora-dropdown-arrow">▼</span>
723
406
  </button>
724
407
  <div class="editora-dropdown-menu" style="display: none;">
725
- ${this.config.options.map((s) => `
726
- <div class="editora-dropdown-item" data-value="${s.value}">
727
- ${s.icon ? `<span class="editora-dropdown-icon">${s.icon}</span>` : ""}
728
- <span>${s.label}</span>
408
+ ${this.config.options.map((n) => `
409
+ <div class="editora-dropdown-item" data-value="${n.value}">
410
+ ${n.icon ? `<span class="editora-dropdown-icon">${n.icon}</span>` : ""}
411
+ <span>${n.label}</span>
729
412
  </div>
730
413
  `).join("")}
731
414
  </div>
@@ -733,21 +416,21 @@ class D {
733
416
  }
734
417
  attachEventListeners() {
735
418
  const e = this.element.querySelector(".editora-dropdown-toggle"), t = this.element.querySelector(".editora-dropdown-menu");
736
- e.addEventListener("click", (s) => {
737
- s.stopPropagation(), this.isOpen = !this.isOpen, t.style.display = this.isOpen ? "block" : "none";
738
- }), this.element.querySelectorAll(".editora-dropdown-item").forEach((s) => {
739
- s.addEventListener("click", () => {
740
- var o, r;
741
- const n = s.getAttribute("data-value");
742
- n && (this.setValue(n), (r = (o = this.config).onChange) == null || r.call(o, n), this.close());
419
+ e.addEventListener("click", (n) => {
420
+ n.stopPropagation(), this.isOpen = !this.isOpen, t.style.display = this.isOpen ? "block" : "none";
421
+ }), this.element.querySelectorAll(".editora-dropdown-item").forEach((n) => {
422
+ n.addEventListener("click", () => {
423
+ var s, a;
424
+ const o = n.getAttribute("data-value");
425
+ o && (this.setValue(o), (a = (s = this.config).onChange) == null || a.call(s, o), this.close());
743
426
  });
744
- }), document.addEventListener("click", (s) => {
745
- this.element.contains(s.target) || this.close();
427
+ }), document.addEventListener("click", (n) => {
428
+ this.element.contains(n.target) || this.close();
746
429
  });
747
430
  }
748
431
  setValue(e) {
749
432
  this.selectedValue = e;
750
- const t = this.config.options.find((s) => s.value === e), i = this.element.querySelector(".editora-dropdown-label");
433
+ const t = this.config.options.find((n) => n.value === e), i = this.element.querySelector(".editora-dropdown-label");
751
434
  i && t && (i.textContent = t.label);
752
435
  }
753
436
  getValue() {
@@ -765,7 +448,7 @@ class D {
765
448
  this.element.remove();
766
449
  }
767
450
  }
768
- class F {
451
+ class M {
769
452
  constructor(e) {
770
453
  this.defaultPresets = [
771
454
  "#000000",
@@ -825,19 +508,19 @@ class F {
825
508
  }
826
509
  attachEventListeners() {
827
510
  const e = this.element.querySelector('input[type="color"]'), t = this.element.querySelector('input[type="text"]');
828
- e.addEventListener("input", (s) => {
829
- var o, r;
830
- const n = s.target.value;
831
- t.value = n, this.selectedColor = n, (r = (o = this.config).onChange) == null || r.call(o, n);
832
- }), t.addEventListener("input", (s) => {
833
- var o, r;
834
- const n = s.target.value;
835
- /^#[0-9A-Fa-f]{6}$/.test(n) && (e.value = n, this.selectedColor = n, (r = (o = this.config).onChange) == null || r.call(o, n));
836
- }), this.element.querySelectorAll(".editora-color-preset").forEach((s) => {
837
- s.addEventListener("click", () => {
838
- var o, r;
839
- const n = s.getAttribute("data-color");
840
- n && (e.value = n, t.value = n, this.selectedColor = n, (r = (o = this.config).onChange) == null || r.call(o, n));
511
+ e.addEventListener("input", (n) => {
512
+ var s, a;
513
+ const o = n.target.value;
514
+ t.value = o, this.selectedColor = o, (a = (s = this.config).onChange) == null || a.call(s, o);
515
+ }), t.addEventListener("input", (n) => {
516
+ var s, a;
517
+ const o = n.target.value;
518
+ /^#[0-9A-Fa-f]{6}$/.test(o) && (e.value = o, this.selectedColor = o, (a = (s = this.config).onChange) == null || a.call(s, o));
519
+ }), this.element.querySelectorAll(".editora-color-preset").forEach((n) => {
520
+ n.addEventListener("click", () => {
521
+ var s, a;
522
+ const o = n.getAttribute("data-color");
523
+ o && (e.value = o, t.value = o, this.selectedColor = o, (a = (s = this.config).onChange) == null || a.call(s, o));
841
524
  });
842
525
  });
843
526
  }
@@ -856,22 +539,22 @@ class F {
856
539
  this.element.remove();
857
540
  }
858
541
  }
859
- class j {
542
+ class q {
860
543
  constructor(e) {
861
- const { initialUrl: t = "", initialText: i = "", onSubmit: s, onCancel: n } = e;
544
+ const { initialUrl: t = "", initialText: i = "", onSubmit: n, onCancel: o } = e;
862
545
  this.dialog = new u({
863
546
  title: "Insert/Edit Link",
864
547
  content: this.createFormHTML(t, i),
865
- onSubmit: (o) => {
866
- const r = (o.get("url") || "").trim(), l = (o.get("text") || "").trim(), d = o.get("openInNewTab") === "on";
867
- if (!r) {
548
+ onSubmit: (s) => {
549
+ const a = (s.get("url") || "").trim(), r = (s.get("text") || "").trim(), d = s.get("openInNewTab") === "on";
550
+ if (!a) {
868
551
  alert("Please enter a URL");
869
552
  return;
870
553
  }
871
- s({ url: r, text: l, openInNewTab: d }), this.dialog.close();
554
+ n({ url: a, text: r, openInNewTab: d }), this.dialog.close();
872
555
  },
873
556
  onCancel: () => {
874
- n == null || n(), this.dialog.close();
557
+ o == null || o(), this.dialog.close();
875
558
  },
876
559
  width: "500px"
877
560
  });
@@ -938,23 +621,23 @@ class j {
938
621
  this.dialog.close();
939
622
  }
940
623
  }
941
- class q {
624
+ class j {
942
625
  constructor(e) {
943
626
  const { onSubmit: t, onCancel: i } = e;
944
627
  this.dialog = new u({
945
628
  title: "Insert Table",
946
629
  content: this.createFormHTML(),
947
- onSubmit: (s) => {
948
- const n = parseInt(s.get("rows"), 10), o = parseInt(s.get("cols"), 10), r = s.get("headerRow") === "on";
949
- if (n < 1 || n > 100) {
630
+ onSubmit: (n) => {
631
+ const o = parseInt(n.get("rows"), 10), s = parseInt(n.get("cols"), 10), a = n.get("headerRow") === "on";
632
+ if (o < 1 || o > 100) {
950
633
  alert("Please enter a valid number of rows (1-100)");
951
634
  return;
952
635
  }
953
- if (o < 1 || o > 20) {
636
+ if (s < 1 || s > 20) {
954
637
  alert("Please enter a valid number of columns (1-20)");
955
638
  return;
956
639
  }
957
- t({ rows: n, cols: o, headerRow: r }), this.dialog.close();
640
+ t({ rows: o, cols: s, headerRow: a }), this.dialog.close();
958
641
  },
959
642
  onCancel: () => {
960
643
  i == null || i(), this.dialog.close();
@@ -1033,31 +716,31 @@ class q {
1033
716
  attachPreviewListeners() {
1034
717
  const e = document.querySelector(".table-dialog-form");
1035
718
  if (!e) return;
1036
- const t = e.querySelector("#table-rows"), i = e.querySelector("#table-cols"), s = e.querySelector("#table-header"), n = e.querySelector("#table-preview-content"), o = () => {
1037
- const r = parseInt((t == null ? void 0 : t.value) || "3", 10), l = parseInt((i == null ? void 0 : i.value) || "3", 10), d = s == null ? void 0 : s.checked;
1038
- n && (n.textContent = `${r} rows × ${l} columns${d ? " with header" : ""}`);
719
+ const t = e.querySelector("#table-rows"), i = e.querySelector("#table-cols"), n = e.querySelector("#table-header"), o = e.querySelector("#table-preview-content"), s = () => {
720
+ const a = parseInt((t == null ? void 0 : t.value) || "3", 10), r = parseInt((i == null ? void 0 : i.value) || "3", 10), d = n == null ? void 0 : n.checked;
721
+ o && (o.textContent = `${a} rows × ${r} columns${d ? " with header" : ""}`);
1039
722
  };
1040
- t == null || t.addEventListener("input", o), i == null || i.addEventListener("input", o), s == null || s.addEventListener("change", o);
723
+ t == null || t.addEventListener("input", s), i == null || i.addEventListener("input", s), n == null || n.addEventListener("change", s);
1041
724
  }
1042
725
  }
1043
- class A {
726
+ class $ {
1044
727
  constructor(e) {
1045
728
  this.config = e;
1046
729
  const { onSubmit: t, onCancel: i } = e;
1047
730
  this.dialog = new u({
1048
731
  title: "Insert Image",
1049
732
  content: this.createFormHTML(),
1050
- onSubmit: (s) => {
1051
- const n = (s.get("src") || "").trim(), o = (s.get("alt") || "").trim(), r = (s.get("width") || "").trim(), l = (s.get("height") || "").trim();
1052
- if (!n) {
733
+ onSubmit: (n) => {
734
+ const o = (n.get("src") || "").trim(), s = (n.get("alt") || "").trim(), a = (n.get("width") || "").trim(), r = (n.get("height") || "").trim();
735
+ if (!o) {
1053
736
  alert("Please enter an image URL or upload an image");
1054
737
  return;
1055
738
  }
1056
739
  t({
1057
- src: n,
1058
- alt: o,
1059
- width: r || void 0,
1060
- height: l || void 0
740
+ src: o,
741
+ alt: s,
742
+ width: a || void 0,
743
+ height: r || void 0
1061
744
  }), this.dialog.close();
1062
745
  },
1063
746
  onCancel: () => {
@@ -1152,10 +835,10 @@ class A {
1152
835
  attachImagePreview() {
1153
836
  const e = document.querySelector(".image-dialog-form");
1154
837
  if (!e) return;
1155
- const t = e.querySelector("#image-src"), i = e.querySelector("#image-preview"), s = e.querySelector("#preview-img");
838
+ const t = e.querySelector("#image-src"), i = e.querySelector("#image-preview"), n = e.querySelector("#preview-img");
1156
839
  t == null || t.addEventListener("input", () => {
1157
- const n = t.value.trim();
1158
- n && this.isValidImageUrl(n) ? (s.src = n, i.style.display = "block", s.onerror = () => {
840
+ const o = t.value.trim();
841
+ o && this.isValidImageUrl(o) ? (n.src = o, i.style.display = "block", n.onerror = () => {
1159
842
  i.style.display = "none";
1160
843
  }) : i.style.display = "none";
1161
844
  });
@@ -1165,16 +848,16 @@ class A {
1165
848
  const e = document.querySelector(".image-dialog-form");
1166
849
  if (!e) return;
1167
850
  const t = e.querySelector("#image-upload"), i = e.querySelector("#image-src");
1168
- t == null || t.addEventListener("change", async (s) => {
1169
- var r;
1170
- const n = (r = s.target.files) == null ? void 0 : r[0];
1171
- if (!n) return;
1172
- const o = new FileReader();
1173
- o.onload = (l) => {
851
+ t == null || t.addEventListener("change", async (n) => {
852
+ var a;
853
+ const o = (a = n.target.files) == null ? void 0 : a[0];
854
+ if (!o) return;
855
+ const s = new FileReader();
856
+ s.onload = (r) => {
1174
857
  var h;
1175
- const d = (h = l.target) == null ? void 0 : h.result;
858
+ const d = (h = r.target) == null ? void 0 : h.result;
1176
859
  i.value = d, i.dispatchEvent(new Event("input"));
1177
- }, o.readAsDataURL(n);
860
+ }, s.readAsDataURL(o);
1178
861
  });
1179
862
  }
1180
863
  isValidImageUrl(e) {
@@ -1320,12 +1003,12 @@ class P {
1320
1003
  </select>
1321
1004
  </div>
1322
1005
  `, e.querySelectorAll(".math-symbol-btn").forEach((i) => {
1323
- i.addEventListener("click", (s) => {
1324
- s.preventDefault();
1325
- const n = i.getAttribute("data-symbol");
1326
- if (n && this.latexInput) {
1327
- const o = this.latexInput.selectionStart, r = this.latexInput.selectionEnd, l = this.latexInput.value;
1328
- this.latexInput.value = l.substring(0, o) + n + l.substring(r), this.latexInput.focus(), this.latexInput.selectionStart = this.latexInput.selectionEnd = o + n.length, this.updatePreview();
1006
+ i.addEventListener("click", (n) => {
1007
+ n.preventDefault();
1008
+ const o = i.getAttribute("data-symbol");
1009
+ if (o && this.latexInput) {
1010
+ const s = this.latexInput.selectionStart, a = this.latexInput.selectionEnd, r = this.latexInput.value;
1011
+ this.latexInput.value = r.substring(0, s) + o + r.substring(a), this.latexInput.focus(), this.latexInput.selectionStart = this.latexInput.selectionEnd = s + o.length, this.updatePreview();
1329
1012
  }
1330
1013
  });
1331
1014
  }), e;
@@ -1355,7 +1038,7 @@ class P {
1355
1038
  this.dialog.close();
1356
1039
  }
1357
1040
  }
1358
- class $ {
1041
+ class H {
1359
1042
  constructor(e) {
1360
1043
  this.characters = {
1361
1044
  common: ["©", "®", "™", "§", "¶", "†", "‡", "•", "‣", "⁃", "◦", "▪", "▫", "◊", "○", "●", "□", "■", "△", "▲", "▽", "▼", "◇", "◆", "★", "☆"],
@@ -1475,17 +1158,17 @@ class $ {
1475
1158
  this.charactersGrid.innerHTML = "";
1476
1159
  let t = [];
1477
1160
  e === "all" ? t = Object.values(this.characters).flat() : t = this.characters[e] || [], t.forEach((i) => {
1478
- const s = document.createElement("button");
1479
- s.className = "char-button", s.textContent = i, s.title = `Insert ${i} (U+${i.charCodeAt(0).toString(16).toUpperCase()})`, s.addEventListener("click", (n) => {
1480
- n.preventDefault(), this.handleSelect(i);
1481
- }), this.charactersGrid.appendChild(s);
1161
+ const n = document.createElement("button");
1162
+ n.className = "char-button", n.textContent = i, n.title = `Insert ${i} (U+${i.charCodeAt(0).toString(16).toUpperCase()})`, n.addEventListener("click", (o) => {
1163
+ o.preventDefault(), this.handleSelect(i);
1164
+ }), this.charactersGrid.appendChild(n);
1482
1165
  });
1483
1166
  }
1484
1167
  filterCharacters() {
1485
1168
  const e = this.searchInput.value.toLowerCase();
1486
1169
  this.charactersGrid.querySelectorAll(".char-button").forEach((i) => {
1487
- const s = i.textContent || "", n = `u+${s.charCodeAt(0).toString(16)}`, o = !e || s.includes(e) || n.includes(e);
1488
- i.style.display = o ? "flex" : "none";
1170
+ const n = i.textContent || "", o = `u+${n.charCodeAt(0).toString(16)}`, s = !e || n.includes(e) || o.includes(e);
1171
+ i.style.display = s ? "flex" : "none";
1489
1172
  });
1490
1173
  }
1491
1174
  handleSelect(e) {
@@ -1498,7 +1181,7 @@ class $ {
1498
1181
  this.dialog.close();
1499
1182
  }
1500
1183
  }
1501
- class H {
1184
+ class A {
1502
1185
  constructor(e) {
1503
1186
  this.emojis = {
1504
1187
  popular: ["😀", "😃", "😄", "😁", "😊", "😍", "🤩", "😘", "😗", "😚", "😙", "🙂", "🤗", "🤔", "🤨", "😐", "😑", "😶", "🙄", "😏", "👍", "👎", "👌", "✌️", "🤞", "🤝", "👏", "🙌", "👋", "🤚", "✋", "🖐️", "🖖", "👊", "✊", "🤛", "🤜", "💪"],
@@ -1624,17 +1307,17 @@ class H {
1624
1307
  this.emojisGrid.innerHTML = "";
1625
1308
  let t = [];
1626
1309
  e === "all" ? t = Object.values(this.emojis).flat() : t = this.emojis[e] || [], t.forEach((i) => {
1627
- const s = document.createElement("button");
1628
- s.className = "emoji-button", s.textContent = i, s.title = `Insert ${i}`, s.addEventListener("click", (n) => {
1629
- n.preventDefault(), this.handleSelect(i);
1630
- }), this.emojisGrid.appendChild(s);
1310
+ const n = document.createElement("button");
1311
+ n.className = "emoji-button", n.textContent = i, n.title = `Insert ${i}`, n.addEventListener("click", (o) => {
1312
+ o.preventDefault(), this.handleSelect(i);
1313
+ }), this.emojisGrid.appendChild(n);
1631
1314
  });
1632
1315
  }
1633
1316
  filterEmojis() {
1634
1317
  const e = this.searchInput.value.toLowerCase();
1635
1318
  this.emojisGrid.querySelectorAll(".emoji-button").forEach((i) => {
1636
- const s = i.textContent || "", n = !e || s.includes(e);
1637
- i.style.display = n ? "flex" : "none";
1319
+ const n = i.textContent || "", o = !e || n.includes(e);
1320
+ i.style.display = o ? "flex" : "none";
1638
1321
  });
1639
1322
  }
1640
1323
  handleSelect(e) {
@@ -1647,9 +1330,9 @@ class H {
1647
1330
  this.dialog.close();
1648
1331
  }
1649
1332
  }
1650
- class S {
1333
+ class x {
1651
1334
  constructor(e = {}) {
1652
- this.changeListeners = [], this.options = e, this.engine = new f({
1335
+ this.changeListeners = [], this.options = e, this.engine = new b({
1653
1336
  content: e.content,
1654
1337
  plugins: e.plugins || [],
1655
1338
  readonly: e.readonly
@@ -1662,16 +1345,16 @@ class S {
1662
1345
  * Mount editor to DOM elements
1663
1346
  */
1664
1347
  mount(e, t) {
1665
- this.contentElement = e, this.toolbarElement = t, this.contentElement.contentEditable = this.options.readonly ? "false" : "true", this.contentElement.className = "rte-content", this.options.content && (this.contentElement.innerHTML = this.options.content), this.options.toolbar !== !1 && this.toolbarElement && (this.toolbar = new b(
1348
+ this.contentElement = e, this.toolbarElement = t, this.contentElement.contentEditable = this.options.readonly ? "false" : "true", this.contentElement.className = "rte-content", this.options.content && (this.contentElement.innerHTML = this.options.content), this.options.toolbar !== !1 && this.toolbarElement && (this.toolbar = new f(
1666
1349
  {
1667
1350
  items: typeof this.options.toolbar == "string" ? this.options.toolbar : void 0
1668
1351
  },
1669
1352
  this.options.plugins || []
1670
- ), this.toolbar.setCommandHandler((i, s) => {
1671
- this.execCommand(i, s);
1353
+ ), this.toolbar.setCommandHandler((i, n) => {
1354
+ this.execCommand(i, n);
1672
1355
  }), this.toolbar.render(this.toolbarElement)), this.contentElement.addEventListener("input", () => {
1673
1356
  const i = this.getHTML();
1674
- this.changeListeners.forEach((s) => s(i));
1357
+ this.changeListeners.forEach((n) => n(i));
1675
1358
  }), this.options.onInit && this.options.onInit(this.getAPI());
1676
1359
  }
1677
1360
  /**
@@ -1764,14 +1447,14 @@ class S {
1764
1447
  this.engine.destroy(), (e = this.toolbar) == null || e.destroy(), this.changeListeners = [], this.options.onDestroy && this.options.onDestroy();
1765
1448
  }
1766
1449
  }
1767
- function z(a) {
1768
- return new S(a);
1450
+ function D(l) {
1451
+ return new x(l);
1769
1452
  }
1770
- class x {
1453
+ class w {
1771
1454
  constructor(e) {
1772
1455
  this.options = e, this.containerElement = e.element;
1773
1456
  const t = this.resolvePlugins(e.plugins);
1774
- this.engine = new f({
1457
+ this.engine = new b({
1775
1458
  content: e.content,
1776
1459
  plugins: t,
1777
1460
  readonly: e.readonly
@@ -1787,7 +1470,7 @@ class x {
1787
1470
  * Initialize DOM elements
1788
1471
  */
1789
1472
  initializeDOM() {
1790
- this.containerElement.innerHTML = "", this.containerElement.classList.add("editora-editor"), this.options.enableToolbar !== !1 && this.options.toolbar !== !1 && (this.toolbarElement = document.createElement("div"), this.toolbarElement.className = "editora-toolbar-container", this.containerElement.appendChild(this.toolbarElement), this.toolbar = new b(
1473
+ this.containerElement.innerHTML = "", this.containerElement.classList.add("editora-editor"), this.options.enableToolbar !== !1 && this.options.toolbar !== !1 && (this.toolbarElement = document.createElement("div"), this.toolbarElement.className = "editora-toolbar-container", this.containerElement.appendChild(this.toolbarElement), this.toolbar = new f(
1791
1474
  {
1792
1475
  items: typeof this.options.toolbar == "string" ? this.options.toolbar : void 0
1793
1476
  },
@@ -1830,8 +1513,8 @@ class x {
1830
1513
  * Add event listener
1831
1514
  */
1832
1515
  on(e, t) {
1833
- const i = (s) => {
1834
- t(s.detail);
1516
+ const i = (n) => {
1517
+ t(n.detail);
1835
1518
  };
1836
1519
  return this.containerElement.addEventListener(e, i), () => {
1837
1520
  this.containerElement.removeEventListener(e, i);
@@ -1845,49 +1528,49 @@ class x {
1845
1528
  this.engine.destroy(), (e = this.toolbar) == null || e.destroy(), this.containerElement.innerHTML = "";
1846
1529
  }
1847
1530
  }
1848
- function U(a) {
1849
- return new x(a);
1531
+ function z(l) {
1532
+ return new w(l);
1850
1533
  }
1851
- function R() {
1534
+ function U() {
1852
1535
  typeof window != "undefined" && !customElements.get("editora-editor") && customElements.define("editora-editor", v);
1853
1536
  }
1854
1537
  export {
1855
- $ as CharacterDialog,
1856
- F as ColorPicker,
1857
- B as CommandRegistry,
1858
- G as ConfigResolver,
1538
+ H as CharacterDialog,
1539
+ M as ColorPicker,
1540
+ G as CommandRegistry,
1541
+ O as ConfigResolver,
1859
1542
  u as Dialog,
1860
1543
  m as DocumentModel,
1861
- D as Dropdown,
1862
- k as Editor,
1863
- f as EditorEngine,
1544
+ F as Dropdown,
1545
+ L as Editor,
1546
+ b as EditorEngine,
1864
1547
  y as EditorState,
1865
- H as EmojiDialog,
1866
- K as FloatingToolbar,
1867
- A as ImageDialog,
1868
- L as KeyboardShortcutManager,
1869
- j as LinkDialog,
1548
+ A as EmojiDialog,
1549
+ V as FloatingToolbar,
1550
+ $ as ImageDialog,
1551
+ K as KeyboardShortcutManager,
1552
+ q as LinkDialog,
1870
1553
  P as MathDialog,
1871
1554
  I as MediaPlugin,
1872
- V as PluginLoader,
1555
+ B as PluginLoader,
1873
1556
  g as PluginManager,
1874
1557
  E as PluginRuntime,
1875
- S as ReactAdapter,
1558
+ x as ReactAdapter,
1876
1559
  v as RichTextEditorElement,
1877
1560
  W as Schema,
1878
1561
  T as SpellcheckPlugin,
1879
1562
  X as StatusBar,
1880
- q as TableDialog,
1881
- b as ToolbarRenderer,
1882
- x as VanillaAdapter,
1563
+ j as TableDialog,
1564
+ f as ToolbarRenderer,
1565
+ w as VanillaAdapter,
1883
1566
  _ as calculateTextStats,
1884
1567
  Y as countLines,
1885
- U as createEditor,
1886
- M as createPluginRuntime,
1887
- z as createReactAdapter,
1568
+ z as createEditor,
1569
+ k as createPluginRuntime,
1570
+ D as createReactAdapter,
1888
1571
  J as getCursorPosition,
1889
1572
  Q as getSelectionInfo,
1890
1573
  Z as getTextOffset,
1891
- R as initWebComponent
1574
+ U as initWebComponent
1892
1575
  };
1893
1576
  //# sourceMappingURL=index.esm.js.map