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