@editora/core 1.0.7 → 1.0.8
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/LICENSE +21 -0
- package/dist/ApprovalWorkflowPlugin.native-C3jtAYjG.mjs +1076 -0
- package/dist/BlocksLibraryPlugin.native-HMWKxWNs.mjs +1327 -0
- package/dist/CitationsPlugin.native-BnU0qCwR.mjs +1464 -0
- package/dist/ConditionalContentPlugin.native-CfhY46rU.mjs +1367 -0
- package/dist/ContentRulesPlugin.native-nBLQ8QFZ.mjs +1099 -0
- package/dist/DataBindingPlugin.native-jQ1JPRTp.mjs +917 -0
- package/dist/DocSchemaPlugin.native-CHOge18O.mjs +1325 -0
- package/dist/MentionPlugin.native-BMDlOqur.mjs +734 -0
- package/dist/PIIRedactionPlugin.native-DcsjmtV1.mjs +1396 -0
- package/dist/{PageBreakPlugin.native-CXdX5fAv.mjs → PageBreakPlugin.native-DijGuHJZ.mjs} +37 -37
- package/dist/{PreviewPlugin.native-DBvfpmIv.mjs → PreviewPlugin.native-WuIwOAOR.mjs} +30 -30
- package/dist/SlashCommandsPlugin.native-CmxvMEaE.mjs +755 -0
- package/dist/SmartPastePlugin.native-BOKKtF07.mjs +1398 -0
- package/dist/TrackChangesPlugin.native-Bghu2q4a.mjs +761 -0
- package/dist/TranslationWorkflowPlugin.native-Bz6jDGvj.mjs +1728 -0
- package/dist/VersionDiffPlugin.native-Bvxgy--t.mjs +776 -0
- package/dist/editora.min.js +13 -13
- package/dist/editora.umd.js +13 -13
- package/dist/index-D1LOqg5C.js +10 -0
- package/dist/{index-yzU4NdPT.mjs → index-DqC57IEH.mjs} +424 -331
- package/dist/index.cjs.js +1 -1
- package/dist/index.esm.js +2 -2
- package/dist/plugin-loader.js +77 -40
- package/dist/webcomponent-core.js +479 -386
- package/dist/webcomponent-core.min.css +1 -1
- package/dist/webcomponent-core.min.js +39 -39
- package/dist/webcomponent.cjs.js +1 -1
- package/dist/webcomponent.esm.js +1 -1
- package/dist/webcomponent.js +417 -287
- package/dist/webcomponent.min.css +1 -1
- package/dist/webcomponent.min.js +5664 -394
- package/package.json +2 -2
- package/dist/index-BpE6GFbz.js +0 -10
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
class
|
|
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
|
|
7
|
+
return new v(o, { anchor: 0, head: 0 }, t);
|
|
8
8
|
}
|
|
9
9
|
apply(t, e) {
|
|
10
|
-
return new
|
|
10
|
+
return new v(t, e || this.selection, this.schema);
|
|
11
11
|
}
|
|
12
12
|
}
|
|
13
|
-
class
|
|
13
|
+
class N {
|
|
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
|
|
24
|
+
class P {
|
|
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 (
|
|
35
|
-
console.error(`Failed to initialize plugin "${t.name}":`,
|
|
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 (
|
|
41
|
-
console.error(`Failed to run init hook for plugin "${t.name}":`,
|
|
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
|
|
61
|
+
}), new N(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
|
|
77
|
-
if (!
|
|
76
|
+
const n = this.getPlugin(t);
|
|
77
|
+
if (!n)
|
|
78
78
|
throw new Error(`Plugin not found: ${t}`);
|
|
79
|
-
const i = this.getPluginConfig(t) ||
|
|
79
|
+
const i = this.getPluginConfig(t) || n.config || {}, r = i.mode || "local";
|
|
80
80
|
try {
|
|
81
|
-
switch (
|
|
81
|
+
switch (r) {
|
|
82
82
|
case "local":
|
|
83
|
-
return
|
|
83
|
+
return n.executeLocal ? n.executeLocal(e, ...o) : null;
|
|
84
84
|
case "api":
|
|
85
|
-
if (!
|
|
85
|
+
if (!n.executeAPI)
|
|
86
86
|
throw new Error(`Plugin ${t} does not support API mode`);
|
|
87
|
-
return await
|
|
87
|
+
return await n.executeAPI(e, ...o);
|
|
88
88
|
case "hybrid":
|
|
89
|
-
if (
|
|
90
|
-
return await
|
|
89
|
+
if (n.executeHybrid)
|
|
90
|
+
return await n.executeHybrid(e, ...o);
|
|
91
91
|
try {
|
|
92
|
-
if (
|
|
93
|
-
return await
|
|
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),
|
|
96
|
-
return
|
|
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: ${
|
|
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
|
|
115
|
+
class O {
|
|
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);
|
|
@@ -399,8 +399,8 @@ class S {
|
|
|
399
399
|
}
|
|
400
400
|
handleKeyDown(t, e) {
|
|
401
401
|
if (!this.enabled) return !1;
|
|
402
|
-
const o = this.getEventKey(t),
|
|
403
|
-
return
|
|
402
|
+
const o = this.getEventKey(t), n = this.shortcuts.get(o);
|
|
403
|
+
return n ? (n.preventDefault !== !1 && (t.preventDefault(), t.stopPropagation()), e(n.command, n.params), !0) : !1;
|
|
404
404
|
}
|
|
405
405
|
enable() {
|
|
406
406
|
this.enabled = !0;
|
|
@@ -425,19 +425,19 @@ class S {
|
|
|
425
425
|
}
|
|
426
426
|
getShortcutsHelp() {
|
|
427
427
|
const t = this.getAllShortcuts(), e = /* @__PURE__ */ new Map();
|
|
428
|
-
t.forEach((
|
|
429
|
-
const i = this.getShortcutCategory(
|
|
430
|
-
e.has(i) || e.set(i, []), e.get(i).push(
|
|
428
|
+
t.forEach((n) => {
|
|
429
|
+
const i = this.getShortcutCategory(n.command);
|
|
430
|
+
e.has(i) || e.set(i, []), e.get(i).push(n);
|
|
431
431
|
});
|
|
432
432
|
let o = `# Keyboard Shortcuts
|
|
433
433
|
|
|
434
434
|
`;
|
|
435
|
-
return e.forEach((
|
|
435
|
+
return e.forEach((n, i) => {
|
|
436
436
|
o += `## ${i}
|
|
437
437
|
|
|
438
|
-
`,
|
|
439
|
-
const a = this.getShortcutDescription(
|
|
440
|
-
o += `- **${a}**: ${
|
|
438
|
+
`, n.forEach((r) => {
|
|
439
|
+
const a = this.getShortcutDescription(r);
|
|
440
|
+
o += `- **${a}**: ${r.description || r.command}
|
|
441
441
|
`;
|
|
442
442
|
}), o += `
|
|
443
443
|
`;
|
|
@@ -447,7 +447,7 @@ class S {
|
|
|
447
447
|
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
448
|
}
|
|
449
449
|
}
|
|
450
|
-
class
|
|
450
|
+
class B {
|
|
451
451
|
constructor(t = {}) {
|
|
452
452
|
this.commands = /* @__PURE__ */ new Map(), Object.entries(t).forEach(([e, o]) => {
|
|
453
453
|
this.register(e, o);
|
|
@@ -490,11 +490,11 @@ class M {
|
|
|
490
490
|
this.commands.clear();
|
|
491
491
|
}
|
|
492
492
|
}
|
|
493
|
-
class
|
|
493
|
+
class z {
|
|
494
494
|
constructor(t = {}) {
|
|
495
|
-
this.listeners = /* @__PURE__ */ new Map(), this.isReadonly = !1, this.isDestroyed = !1, this.isReadonly = t.readonly || !1, this.pluginManager = new
|
|
495
|
+
this.listeners = /* @__PURE__ */ new Map(), this.isReadonly = !1, this.isDestroyed = !1, this.isReadonly = t.readonly || !1, this.pluginManager = new P(), t.plugins && Array.isArray(t.plugins) && t.plugins.forEach((o) => this.pluginManager.register(o));
|
|
496
496
|
const e = this.pluginManager.buildSchema();
|
|
497
|
-
this.state =
|
|
497
|
+
this.state = v.create(e), this.commandRegistry = new B(this.pluginManager.getCommands());
|
|
498
498
|
}
|
|
499
499
|
/**
|
|
500
500
|
* Execute a command
|
|
@@ -507,12 +507,12 @@ class A {
|
|
|
507
507
|
const o = this.commandRegistry.get(t);
|
|
508
508
|
if (!o)
|
|
509
509
|
return console.warn(`Command not found: ${t}`), !1;
|
|
510
|
-
let
|
|
511
|
-
return e !== void 0 ?
|
|
510
|
+
let n;
|
|
511
|
+
return e !== void 0 ? n = o(this.state, e) : n = o(this.state), n instanceof Promise ? (n.then((i) => {
|
|
512
512
|
i && typeof i == "object" && "doc" in i && "selection" in i && (this.setState(i), this.emit("change", this.state));
|
|
513
513
|
}).catch((i) => {
|
|
514
514
|
console.error(`Async command failed: ${t}`, i);
|
|
515
|
-
}), !0) :
|
|
515
|
+
}), !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
516
|
}
|
|
517
517
|
/**
|
|
518
518
|
* Update editor state
|
|
@@ -545,8 +545,8 @@ class A {
|
|
|
545
545
|
return this.listeners.has(t) || this.listeners.set(t, []), this.listeners.get(t).push(e), () => {
|
|
546
546
|
const o = this.listeners.get(t);
|
|
547
547
|
if (o) {
|
|
548
|
-
const
|
|
549
|
-
|
|
548
|
+
const n = o.indexOf(e);
|
|
549
|
+
n > -1 && o.splice(n, 1);
|
|
550
550
|
}
|
|
551
551
|
};
|
|
552
552
|
}
|
|
@@ -555,9 +555,9 @@ class A {
|
|
|
555
555
|
*/
|
|
556
556
|
emit(t, ...e) {
|
|
557
557
|
const o = this.listeners.get(t);
|
|
558
|
-
o && o.forEach((
|
|
558
|
+
o && o.forEach((n) => {
|
|
559
559
|
try {
|
|
560
|
-
|
|
560
|
+
n(...e);
|
|
561
561
|
} catch (i) {
|
|
562
562
|
console.error(`Error in ${t} handler:`, i);
|
|
563
563
|
}
|
|
@@ -576,7 +576,7 @@ class A {
|
|
|
576
576
|
return this.isDestroyed;
|
|
577
577
|
}
|
|
578
578
|
}
|
|
579
|
-
class
|
|
579
|
+
class R {
|
|
580
580
|
// PluginLoader instance to get all registered plugins
|
|
581
581
|
setLastCommandTrigger(t, e) {
|
|
582
582
|
if (typeof window == "undefined" || !t) return;
|
|
@@ -596,11 +596,11 @@ class L {
|
|
|
596
596
|
* Parse toolbar string into button groups
|
|
597
597
|
*/
|
|
598
598
|
parseToolbarString(t) {
|
|
599
|
-
const e = [], o = t.split("|").map((a) => a.trim()),
|
|
600
|
-
|
|
599
|
+
const e = [], o = t.split("|").map((a) => a.trim()), n = this.getAvailableToolbarItems(), i = /* @__PURE__ */ new Map();
|
|
600
|
+
n.forEach((a) => {
|
|
601
601
|
a.command && i.set(a.command, a), a.type === "group" && a.label && i.set(a.label, a);
|
|
602
602
|
});
|
|
603
|
-
const
|
|
603
|
+
const r = {
|
|
604
604
|
bold: "toggleBold",
|
|
605
605
|
italic: "toggleItalic",
|
|
606
606
|
underline: "toggleUnderline",
|
|
@@ -611,6 +611,9 @@ class L {
|
|
|
611
611
|
link: "openLinkDialog",
|
|
612
612
|
image: "openImageDialog",
|
|
613
613
|
table: "insertTable",
|
|
614
|
+
trackChanges: "toggleTrackChanges",
|
|
615
|
+
acceptTrackChanges: "acceptAllTrackChanges",
|
|
616
|
+
rejectTrackChanges: "rejectAllTrackChanges",
|
|
614
617
|
anchor: "insertAnchor",
|
|
615
618
|
code: "toggleSourceView",
|
|
616
619
|
blockquote: "toggleBlockquote",
|
|
@@ -642,6 +645,14 @@ class L {
|
|
|
642
645
|
toggleComments: "toggleComments",
|
|
643
646
|
footnote: "insertFootnote",
|
|
644
647
|
mergeTags: "insertMergeTag",
|
|
648
|
+
dataBinding: "openDataBindingDialog",
|
|
649
|
+
dataBindingPreview: "openDataBindingDialog",
|
|
650
|
+
contentRules: "toggleContentRulesPanel",
|
|
651
|
+
contentRulesAudit: "runContentRulesAudit",
|
|
652
|
+
contentRulesRealtime: "toggleContentRulesRealtime",
|
|
653
|
+
mention: "insertMention",
|
|
654
|
+
slash: "openSlashCommands",
|
|
655
|
+
slashCommands: "openSlashCommands",
|
|
645
656
|
pageBreak: "insertPageBreak",
|
|
646
657
|
template: "insertTemplate",
|
|
647
658
|
importWord: "importWord",
|
|
@@ -652,49 +663,49 @@ class L {
|
|
|
652
663
|
codeBlock: "insertCodeBlock"
|
|
653
664
|
};
|
|
654
665
|
return o.forEach((a) => {
|
|
655
|
-
const
|
|
666
|
+
const l = [];
|
|
656
667
|
a.split(/\s+/).filter(Boolean).forEach((d) => {
|
|
657
668
|
if (d === "direction") {
|
|
658
|
-
const u = i.get("setDirectionLTR"),
|
|
659
|
-
u &&
|
|
669
|
+
const u = i.get("setDirectionLTR"), f = i.get("setDirectionRTL");
|
|
670
|
+
u && l.push({
|
|
660
671
|
id: "directionLTR",
|
|
661
672
|
label: u.label,
|
|
662
673
|
command: u.command,
|
|
663
674
|
icon: u.icon,
|
|
664
675
|
type: u.type || "button",
|
|
665
676
|
options: u.options
|
|
666
|
-
}),
|
|
677
|
+
}), f && l.push({
|
|
667
678
|
id: "directionRTL",
|
|
668
|
-
label:
|
|
669
|
-
command:
|
|
670
|
-
icon:
|
|
671
|
-
type:
|
|
672
|
-
options:
|
|
679
|
+
label: f.label,
|
|
680
|
+
command: f.command,
|
|
681
|
+
icon: f.icon,
|
|
682
|
+
type: f.type || "button",
|
|
683
|
+
options: f.options
|
|
673
684
|
});
|
|
674
685
|
return;
|
|
675
686
|
}
|
|
676
687
|
if (d === "comments") {
|
|
677
|
-
const u = i.get("addComment"),
|
|
678
|
-
u &&
|
|
688
|
+
const u = i.get("addComment"), f = i.get("toggleComments");
|
|
689
|
+
u && l.push({
|
|
679
690
|
id: "addComment",
|
|
680
691
|
label: u.label,
|
|
681
692
|
command: u.command,
|
|
682
693
|
icon: u.icon,
|
|
683
694
|
type: u.type || "button",
|
|
684
695
|
options: u.options
|
|
685
|
-
}),
|
|
696
|
+
}), f && l.push({
|
|
686
697
|
id: "toggleComments",
|
|
687
|
-
label:
|
|
688
|
-
command:
|
|
689
|
-
icon:
|
|
690
|
-
type:
|
|
691
|
-
options:
|
|
698
|
+
label: f.label,
|
|
699
|
+
command: f.command,
|
|
700
|
+
icon: f.icon,
|
|
701
|
+
type: f.type || "button",
|
|
702
|
+
options: f.options
|
|
692
703
|
});
|
|
693
704
|
return;
|
|
694
705
|
}
|
|
695
|
-
const
|
|
696
|
-
let p = i.get(
|
|
697
|
-
p || (p = i.get(d)), p &&
|
|
706
|
+
const h = r[d] || d;
|
|
707
|
+
let p = i.get(h);
|
|
708
|
+
p || (p = i.get(d)), p && l.push({
|
|
698
709
|
id: d,
|
|
699
710
|
label: p.label,
|
|
700
711
|
command: p.command,
|
|
@@ -703,7 +714,7 @@ class L {
|
|
|
703
714
|
options: p.options,
|
|
704
715
|
items: p.items
|
|
705
716
|
});
|
|
706
|
-
}),
|
|
717
|
+
}), l.length > 0 && e.push(l);
|
|
707
718
|
}), e;
|
|
708
719
|
}
|
|
709
720
|
/**
|
|
@@ -718,11 +729,11 @@ class L {
|
|
|
718
729
|
render(t) {
|
|
719
730
|
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
731
|
const e = this.config.items || this.getDefaultToolbarString(), o = this.parseToolbarString(e);
|
|
721
|
-
o.forEach((
|
|
722
|
-
const
|
|
723
|
-
if (
|
|
724
|
-
this.appendToolbarButton(
|
|
725
|
-
}), t.appendChild(
|
|
732
|
+
o.forEach((n, i) => {
|
|
733
|
+
const r = document.createElement("div");
|
|
734
|
+
if (r.className = "editora-toolbar-group", n.forEach((a) => {
|
|
735
|
+
this.appendToolbarButton(r, a);
|
|
736
|
+
}), t.appendChild(r), i < o.length - 1) {
|
|
726
737
|
const a = document.createElement("div");
|
|
727
738
|
a.className = "editora-toolbar-separator", t.appendChild(a);
|
|
728
739
|
}
|
|
@@ -756,18 +767,18 @@ class L {
|
|
|
756
767
|
* Create a toolbar button element
|
|
757
768
|
*/
|
|
758
769
|
createGroupButton(t) {
|
|
759
|
-
const e = document.createElement("div");
|
|
760
|
-
if (e.className =
|
|
770
|
+
const e = document.createElement("div"), o = t.label.toLowerCase().replace(/\s+/g, "-");
|
|
771
|
+
if (e.className = `editora-toolbar-group-button ${o}`, e.title = t.label, t.icon)
|
|
761
772
|
if (t.icon.startsWith("<svg") && t.icon.endsWith("</svg>")) {
|
|
762
|
-
const
|
|
763
|
-
|
|
773
|
+
const n = document.createElement("span");
|
|
774
|
+
n.className = "editora-toolbar-icon", n.innerHTML = t.icon, e.appendChild(n);
|
|
764
775
|
} else
|
|
765
776
|
e.innerHTML = t.icon;
|
|
766
777
|
if (t.items && t.items.length) {
|
|
767
|
-
const
|
|
768
|
-
|
|
769
|
-
this.appendToolbarButton(
|
|
770
|
-
}), e.appendChild(
|
|
778
|
+
const n = document.createElement("div");
|
|
779
|
+
n.className = `editora-toolbar-group-items ${o}`, t.items.forEach((i) => {
|
|
780
|
+
this.appendToolbarButton(n, i);
|
|
781
|
+
}), e.appendChild(n);
|
|
771
782
|
}
|
|
772
783
|
return e;
|
|
773
784
|
}
|
|
@@ -805,25 +816,25 @@ class L {
|
|
|
805
816
|
e.className = "editora-toolbar-dropdown";
|
|
806
817
|
const o = document.createElement("button");
|
|
807
818
|
o.className = "editora-toolbar-button editora-toolbar-dropdown-trigger", o.type = "button", o.textContent = t.label;
|
|
808
|
-
const
|
|
809
|
-
|
|
810
|
-
const
|
|
811
|
-
|
|
812
|
-
c.preventDefault(), this.setLastCommandTrigger(o, t.command), this.commandHandler && t.command && this.commandHandler(t.command, a.value),
|
|
813
|
-
}),
|
|
819
|
+
const n = document.createElement("div");
|
|
820
|
+
n.className = "editora-toolbar-dropdown-menu", n.style.display = "none", t.options && t.options.forEach((a) => {
|
|
821
|
+
const l = document.createElement("button");
|
|
822
|
+
l.className = "editora-toolbar-dropdown-item", l.type = "button", l.textContent = a.label, l.setAttribute("data-value", a.value), l.addEventListener("click", (c) => {
|
|
823
|
+
c.preventDefault(), this.setLastCommandTrigger(o, t.command), this.commandHandler && t.command && this.commandHandler(t.command, a.value), n.style.display = "none";
|
|
824
|
+
}), n.appendChild(l);
|
|
814
825
|
}), o.addEventListener("click", (a) => {
|
|
815
826
|
a.preventDefault(), a.stopPropagation(), this.setLastCommandTrigger(o, t.command);
|
|
816
|
-
const
|
|
817
|
-
|
|
827
|
+
const l = n.style.display === "block";
|
|
828
|
+
n.style.display = l ? "none" : "block";
|
|
818
829
|
});
|
|
819
830
|
const i = (a) => {
|
|
820
|
-
e.contains(a.target) || (
|
|
821
|
-
},
|
|
822
|
-
a.key === "Escape" && (
|
|
831
|
+
e.contains(a.target) || (n.style.display = "none");
|
|
832
|
+
}, r = (a) => {
|
|
833
|
+
a.key === "Escape" && (n.style.display = "none");
|
|
823
834
|
};
|
|
824
|
-
return document.addEventListener("mousedown", i, !0), document.addEventListener("keydown",
|
|
825
|
-
document.removeEventListener("mousedown", i, !0), document.removeEventListener("keydown",
|
|
826
|
-
}, e.appendChild(o), e.appendChild(
|
|
835
|
+
return document.addEventListener("mousedown", i, !0), document.addEventListener("keydown", r), e._cleanupDropdown = () => {
|
|
836
|
+
document.removeEventListener("mousedown", i, !0), document.removeEventListener("keydown", r);
|
|
837
|
+
}, e.appendChild(o), e.appendChild(n), e;
|
|
827
838
|
}
|
|
828
839
|
/**
|
|
829
840
|
* Create an inline menu element (like dropdown but triggered by button click)
|
|
@@ -840,30 +851,30 @@ class L {
|
|
|
840
851
|
o.innerHTML = t.icon;
|
|
841
852
|
else
|
|
842
853
|
o.textContent = t.label;
|
|
843
|
-
const
|
|
844
|
-
|
|
845
|
-
const
|
|
846
|
-
|
|
847
|
-
c.preventDefault(), c.stopPropagation(), this.setLastCommandTrigger(o, t.command), this.commandHandler && t.command && this.commandHandler(t.command, a.value),
|
|
848
|
-
}),
|
|
854
|
+
const n = document.createElement("div");
|
|
855
|
+
n.className = "editora-toolbar-dropdown-menu", n.style.display = "none", t.options && t.options.forEach((a) => {
|
|
856
|
+
const l = document.createElement("button");
|
|
857
|
+
l.className = "editora-toolbar-dropdown-item", l.type = "button", l.textContent = a.label, l.setAttribute("data-value", a.value), l.addEventListener("click", (c) => {
|
|
858
|
+
c.preventDefault(), c.stopPropagation(), this.setLastCommandTrigger(o, t.command), this.commandHandler && t.command && this.commandHandler(t.command, a.value), n.style.display = "none";
|
|
859
|
+
}), n.appendChild(l);
|
|
849
860
|
}), o.addEventListener("click", (a) => {
|
|
850
861
|
var c;
|
|
851
862
|
a.preventDefault(), a.stopPropagation(), this.setLastCommandTrigger(o, t.command);
|
|
852
|
-
const
|
|
863
|
+
const l = (c = this.container) == null ? void 0 : c.querySelectorAll(
|
|
853
864
|
".editora-toolbar-dropdown-menu"
|
|
854
865
|
);
|
|
855
|
-
|
|
856
|
-
d !==
|
|
857
|
-
}),
|
|
866
|
+
l == null || l.forEach((d) => {
|
|
867
|
+
d !== n && (d.style.display = "none");
|
|
868
|
+
}), n.style.display = n.style.display === "none" ? "block" : "none";
|
|
858
869
|
});
|
|
859
870
|
const i = (a) => {
|
|
860
|
-
e.contains(a.target) || (
|
|
861
|
-
},
|
|
862
|
-
a.key === "Escape" && (
|
|
871
|
+
e.contains(a.target) || (n.style.display = "none");
|
|
872
|
+
}, r = (a) => {
|
|
873
|
+
a.key === "Escape" && (n.style.display = "none");
|
|
863
874
|
};
|
|
864
|
-
return document.addEventListener("mousedown", i, !0), document.addEventListener("keydown",
|
|
865
|
-
document.removeEventListener("mousedown", i, !0), document.removeEventListener("keydown",
|
|
866
|
-
}, e.appendChild(o), e.appendChild(
|
|
875
|
+
return document.addEventListener("mousedown", i, !0), document.addEventListener("keydown", r), e._cleanupDropdown = () => {
|
|
876
|
+
document.removeEventListener("mousedown", i, !0), document.removeEventListener("keydown", r);
|
|
877
|
+
}, e.appendChild(o), e.appendChild(n), e;
|
|
867
878
|
}
|
|
868
879
|
/**
|
|
869
880
|
* Get default toolbar string if none provided
|
|
@@ -891,7 +902,7 @@ class L {
|
|
|
891
902
|
}), this.container.innerHTML = ""), this.commandHandler = void 0;
|
|
892
903
|
}
|
|
893
904
|
}
|
|
894
|
-
class
|
|
905
|
+
class H {
|
|
895
906
|
constructor(t) {
|
|
896
907
|
this.visible = !1, this.config = t;
|
|
897
908
|
}
|
|
@@ -933,7 +944,7 @@ class T {
|
|
|
933
944
|
this.container && this.container.parentNode && this.container.parentNode.removeChild(this.container), this.container = void 0, this.visible = !1;
|
|
934
945
|
}
|
|
935
946
|
}
|
|
936
|
-
class
|
|
947
|
+
class j {
|
|
937
948
|
constructor(t = {}) {
|
|
938
949
|
this.statusInfo = {}, this.config = t;
|
|
939
950
|
}
|
|
@@ -969,20 +980,20 @@ class I {
|
|
|
969
980
|
o.push(`Ln ${i.line}, Col ${i.column}`);
|
|
970
981
|
}
|
|
971
982
|
this.statusInfo.language && o.push(this.statusInfo.language);
|
|
972
|
-
const
|
|
973
|
-
this.statusInfo.wordCount !== void 0 &&
|
|
974
|
-
|
|
975
|
-
}), o.forEach((i,
|
|
983
|
+
const n = [];
|
|
984
|
+
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]) => {
|
|
985
|
+
n.push(`${i}: ${r}`);
|
|
986
|
+
}), o.forEach((i, r) => {
|
|
976
987
|
const a = document.createElement("span");
|
|
977
|
-
if (a.className = "editora-statusbar-item", a.textContent = i, t.appendChild(a),
|
|
978
|
-
const
|
|
979
|
-
|
|
988
|
+
if (a.className = "editora-statusbar-item", a.textContent = i, t.appendChild(a), r < o.length - 1) {
|
|
989
|
+
const l = document.createElement("span");
|
|
990
|
+
l.className = "editora-statusbar-separator", l.textContent = "|", t.appendChild(l);
|
|
980
991
|
}
|
|
981
|
-
}),
|
|
992
|
+
}), n.forEach((i, r) => {
|
|
982
993
|
const a = document.createElement("span");
|
|
983
|
-
if (a.className = "editora-statusbar-item", a.textContent = i, e.appendChild(a),
|
|
984
|
-
const
|
|
985
|
-
|
|
994
|
+
if (a.className = "editora-statusbar-item", a.textContent = i, e.appendChild(a), r < n.length - 1) {
|
|
995
|
+
const l = document.createElement("span");
|
|
996
|
+
l.className = "editora-statusbar-separator", l.textContent = "|", e.appendChild(l);
|
|
986
997
|
}
|
|
987
998
|
}), this.container.appendChild(t), this.container.appendChild(e);
|
|
988
999
|
}
|
|
@@ -993,50 +1004,50 @@ class I {
|
|
|
993
1004
|
this.container && this.container.parentNode && this.container.parentNode.removeChild(this.container), this.container = void 0;
|
|
994
1005
|
}
|
|
995
1006
|
}
|
|
996
|
-
function
|
|
997
|
-
const e =
|
|
998
|
-
`),
|
|
999
|
-
return { line:
|
|
1007
|
+
function F(s, t) {
|
|
1008
|
+
const e = s.textContent || "", o = $(s, t.startContainer, t.startOffset), i = e.substring(0, o).split(`
|
|
1009
|
+
`), r = i.length, a = i[i.length - 1].length + 1;
|
|
1010
|
+
return { line: r, column: a };
|
|
1000
1011
|
}
|
|
1001
|
-
function
|
|
1002
|
-
var
|
|
1012
|
+
function $(s, t, e) {
|
|
1013
|
+
var r;
|
|
1003
1014
|
let o = 0;
|
|
1004
|
-
const
|
|
1005
|
-
|
|
1015
|
+
const n = document.createTreeWalker(
|
|
1016
|
+
s,
|
|
1006
1017
|
NodeFilter.SHOW_TEXT,
|
|
1007
1018
|
null
|
|
1008
1019
|
);
|
|
1009
|
-
let i =
|
|
1020
|
+
let i = n.firstChild();
|
|
1010
1021
|
for (; i; ) {
|
|
1011
1022
|
if (i === t) {
|
|
1012
1023
|
o += e;
|
|
1013
1024
|
break;
|
|
1014
|
-
} else i.nodeType === Node.TEXT_NODE && (o += ((
|
|
1015
|
-
i =
|
|
1025
|
+
} else i.nodeType === Node.TEXT_NODE && (o += ((r = i.textContent) == null ? void 0 : r.length) || 0);
|
|
1026
|
+
i = n.nextNode();
|
|
1016
1027
|
}
|
|
1017
1028
|
return o;
|
|
1018
1029
|
}
|
|
1019
|
-
function
|
|
1020
|
-
var o,
|
|
1021
|
-
const t =
|
|
1030
|
+
function _(s) {
|
|
1031
|
+
var o, n;
|
|
1032
|
+
const t = s.querySelectorAll("div, p, br, h1, h2, h3, h4, h5, h6, blockquote, li, pre");
|
|
1022
1033
|
let e = 1;
|
|
1023
1034
|
if (t.length > 0) {
|
|
1024
1035
|
e = t.length;
|
|
1025
1036
|
const i = t[t.length - 1];
|
|
1026
|
-
(i.tagName === "BR" || ((o = i.innerHTML) == null ? void 0 : o.trim()) === "" || ((
|
|
1037
|
+
(i.tagName === "BR" || ((o = i.innerHTML) == null ? void 0 : o.trim()) === "" || ((n = i.textContent) == null ? void 0 : n.trim()) === "") && e++;
|
|
1027
1038
|
} else {
|
|
1028
|
-
const
|
|
1039
|
+
const r = (s.textContent || "").split(`
|
|
1029
1040
|
`).length;
|
|
1030
|
-
e = Math.max(1,
|
|
1041
|
+
e = Math.max(1, r);
|
|
1031
1042
|
}
|
|
1032
1043
|
return e;
|
|
1033
1044
|
}
|
|
1034
|
-
function
|
|
1035
|
-
const t =
|
|
1045
|
+
function W(s) {
|
|
1046
|
+
const t = s.trim() ? s.trim().split(/\s+/).length : 0, e = s.length;
|
|
1036
1047
|
return { words: t, chars: e };
|
|
1037
1048
|
}
|
|
1038
|
-
function
|
|
1039
|
-
const e =
|
|
1049
|
+
function U(s, t) {
|
|
1050
|
+
const e = s.toString();
|
|
1040
1051
|
return {
|
|
1041
1052
|
startLine: t.line,
|
|
1042
1053
|
startColumn: t.column,
|
|
@@ -1047,7 +1058,7 @@ function O(l, t) {
|
|
|
1047
1058
|
selectedWords: e.trim().split(/\s+/).filter(Boolean).length
|
|
1048
1059
|
};
|
|
1049
1060
|
}
|
|
1050
|
-
const
|
|
1061
|
+
const E = class E {
|
|
1051
1062
|
/**
|
|
1052
1063
|
* Resolve configuration from multiple sources with priority
|
|
1053
1064
|
*/
|
|
@@ -1065,12 +1076,12 @@ const v = class v {
|
|
|
1065
1076
|
static normalizeConfig(t) {
|
|
1066
1077
|
const e = { ...t };
|
|
1067
1078
|
if (e.toolbarFloating !== void 0 || e.toolbarSticky !== void 0) {
|
|
1068
|
-
const
|
|
1069
|
-
e.toolbarFloating !== void 0 && (
|
|
1079
|
+
const r = typeof e.toolbar == "object" && e.toolbar ? { ...e.toolbar } : typeof e.toolbar == "string" ? { items: e.toolbar } : {};
|
|
1080
|
+
e.toolbarFloating !== void 0 && (r.floating = !!e.toolbarFloating), e.toolbarSticky !== void 0 && (r.sticky = !!e.toolbarSticky), e.toolbar = r;
|
|
1070
1081
|
}
|
|
1071
1082
|
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
|
|
1073
|
-
e.autosaveEnabled !== void 0 && (
|
|
1083
|
+
const r = typeof e.autosave == "object" && e.autosave ? { ...e.autosave } : {};
|
|
1084
|
+
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
1085
|
}
|
|
1075
1086
|
const o = {
|
|
1076
1087
|
enabled: !1,
|
|
@@ -1085,27 +1096,27 @@ const v = class v {
|
|
|
1085
1096
|
enabled: e.autosave
|
|
1086
1097
|
};
|
|
1087
1098
|
else if (typeof e.autosave == "object" && e.autosave) {
|
|
1088
|
-
const
|
|
1099
|
+
const r = {
|
|
1089
1100
|
...o,
|
|
1090
1101
|
...e.autosave
|
|
1091
1102
|
};
|
|
1092
|
-
|
|
1103
|
+
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
1104
|
} else
|
|
1094
1105
|
e.autosave = o;
|
|
1095
1106
|
if (e.languageLocale !== void 0 || e.languageDirection !== void 0) {
|
|
1096
|
-
const
|
|
1097
|
-
e.languageLocale !== void 0 && (
|
|
1107
|
+
const r = typeof e.language == "object" && e.language ? { ...e.language } : {};
|
|
1108
|
+
e.languageLocale !== void 0 && (r.locale = e.languageLocale), e.languageDirection !== void 0 && (r.direction = e.languageDirection), e.language = r;
|
|
1098
1109
|
}
|
|
1099
|
-
const
|
|
1110
|
+
const n = { locale: "en", direction: "ltr" };
|
|
1100
1111
|
if (typeof e.language == "string" ? e.language = {
|
|
1101
1112
|
locale: e.language,
|
|
1102
|
-
direction:
|
|
1113
|
+
direction: n.direction
|
|
1103
1114
|
} : typeof e.language == "object" && e.language ? e.language = {
|
|
1104
|
-
...
|
|
1115
|
+
...n,
|
|
1105
1116
|
...e.language
|
|
1106
|
-
} : e.language =
|
|
1107
|
-
const
|
|
1108
|
-
e.spellcheckEnabled !== void 0 && (
|
|
1117
|
+
} : e.language = n, e.spellcheckEnabled !== void 0 || e.spellcheckProvider !== void 0 || e.spellcheckApiUrl !== void 0) {
|
|
1118
|
+
const r = typeof e.spellcheck == "object" && e.spellcheck ? { ...e.spellcheck } : {};
|
|
1119
|
+
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
1120
|
}
|
|
1110
1121
|
const i = {
|
|
1111
1122
|
enabled: !1,
|
|
@@ -1118,11 +1129,11 @@ const v = class v {
|
|
|
1118
1129
|
enabled: e.spellcheck
|
|
1119
1130
|
};
|
|
1120
1131
|
else if (typeof e.spellcheck == "object" && e.spellcheck) {
|
|
1121
|
-
const
|
|
1132
|
+
const r = {
|
|
1122
1133
|
...i,
|
|
1123
1134
|
...e.spellcheck
|
|
1124
1135
|
};
|
|
1125
|
-
!
|
|
1136
|
+
!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
1137
|
} else
|
|
1127
1138
|
e.spellcheck = i;
|
|
1128
1139
|
return e.contextMenuEnabled !== void 0 && (e.contextMenu = {
|
|
@@ -1184,9 +1195,9 @@ const v = class v {
|
|
|
1184
1195
|
*/
|
|
1185
1196
|
static parseAttributes(t) {
|
|
1186
1197
|
const e = {};
|
|
1187
|
-
for (const [o,
|
|
1198
|
+
for (const [o, n] of Object.entries(t)) {
|
|
1188
1199
|
const i = this.kebabToCamel(o);
|
|
1189
|
-
e[i] = this.parseAttributeValue(
|
|
1200
|
+
e[i] = this.parseAttributeValue(n);
|
|
1190
1201
|
}
|
|
1191
1202
|
return e;
|
|
1192
1203
|
}
|
|
@@ -1234,12 +1245,12 @@ const v = class v {
|
|
|
1234
1245
|
static merge(...t) {
|
|
1235
1246
|
const e = {};
|
|
1236
1247
|
for (const o of t)
|
|
1237
|
-
for (const [
|
|
1238
|
-
i != null && (typeof i == "object" && !Array.isArray(i) && e[
|
|
1248
|
+
for (const [n, i] of Object.entries(o))
|
|
1249
|
+
i != null && (typeof i == "object" && !Array.isArray(i) && e[n] ? e[n] = this.merge(e[n], i) : e[n] = i);
|
|
1239
1250
|
return e;
|
|
1240
1251
|
}
|
|
1241
1252
|
};
|
|
1242
|
-
|
|
1253
|
+
E.EDITOR_DEFAULTS = {
|
|
1243
1254
|
height: 400,
|
|
1244
1255
|
width: "100%",
|
|
1245
1256
|
readonly: !1,
|
|
@@ -1289,8 +1300,8 @@ v.EDITOR_DEFAULTS = {
|
|
|
1289
1300
|
},
|
|
1290
1301
|
statusbar: !1
|
|
1291
1302
|
};
|
|
1292
|
-
let
|
|
1293
|
-
class
|
|
1303
|
+
let w = E;
|
|
1304
|
+
class K {
|
|
1294
1305
|
constructor() {
|
|
1295
1306
|
this.loadedPlugins = /* @__PURE__ */ new Map(), this.pluginRegistry = /* @__PURE__ */ new Map();
|
|
1296
1307
|
}
|
|
@@ -1309,16 +1320,16 @@ class B {
|
|
|
1309
1320
|
const o = this.pluginRegistry.get(t);
|
|
1310
1321
|
if (!o)
|
|
1311
1322
|
return console.warn(`Plugin not found: ${t}`), null;
|
|
1312
|
-
const
|
|
1313
|
-
return e && this.applyPluginConfig(
|
|
1323
|
+
const n = await o();
|
|
1324
|
+
return e && this.applyPluginConfig(n, e), this.loadedPlugins.set(t, n), n;
|
|
1314
1325
|
}
|
|
1315
1326
|
/**
|
|
1316
1327
|
* Load multiple plugins
|
|
1317
1328
|
*/
|
|
1318
1329
|
async loadMultiple(t, e) {
|
|
1319
1330
|
return (await Promise.all(
|
|
1320
|
-
t.map((
|
|
1321
|
-
)).filter((
|
|
1331
|
+
t.map((n) => this.load(n, e))
|
|
1332
|
+
)).filter((n) => n !== null);
|
|
1322
1333
|
}
|
|
1323
1334
|
/**
|
|
1324
1335
|
* Parse plugin string "lists link image media"
|
|
@@ -1364,7 +1375,7 @@ class B {
|
|
|
1364
1375
|
return this.loadedPlugins.has(t);
|
|
1365
1376
|
}
|
|
1366
1377
|
}
|
|
1367
|
-
const
|
|
1378
|
+
const q = [
|
|
1368
1379
|
"p",
|
|
1369
1380
|
"br",
|
|
1370
1381
|
"strong",
|
|
@@ -1399,11 +1410,12 @@ const j = [
|
|
|
1399
1410
|
"code",
|
|
1400
1411
|
"span",
|
|
1401
1412
|
"div",
|
|
1413
|
+
"section",
|
|
1402
1414
|
"sup",
|
|
1403
1415
|
"sub",
|
|
1404
1416
|
"hr"
|
|
1405
|
-
],
|
|
1406
|
-
"*": ["class", "style", "id", "data-*"],
|
|
1417
|
+
], V = {
|
|
1418
|
+
"*": ["class", "style", "id", "data-*", "role", "aria-*", "tabindex", "contenteditable", "spellcheck"],
|
|
1407
1419
|
a: ["href", "target", "rel", "title"],
|
|
1408
1420
|
img: ["src", "alt", "width", "height", "loading"],
|
|
1409
1421
|
video: ["src", "controls", "width", "height", "autoplay", "loop", "muted"],
|
|
@@ -1412,75 +1424,135 @@ const j = [
|
|
|
1412
1424
|
td: ["colspan", "rowspan", "align", "valign"],
|
|
1413
1425
|
th: ["colspan", "rowspan", "align", "valign"]
|
|
1414
1426
|
};
|
|
1415
|
-
function
|
|
1427
|
+
function L(s, t, e) {
|
|
1416
1428
|
if ((t == null ? void 0 : t.sanitize) === !1)
|
|
1417
|
-
return
|
|
1418
|
-
const o = t != null && t.allowedTags && t.allowedTags.length > 0 ? t.allowedTags :
|
|
1419
|
-
return
|
|
1429
|
+
return s;
|
|
1430
|
+
const o = t != null && t.allowedTags && t.allowedTags.length > 0 ? t.allowedTags : q, i = !!(t != null && t.allowedAttributes) && Object.keys(t.allowedAttributes).length > 0 ? t.allowedAttributes : V, r = document.createElement("div");
|
|
1431
|
+
return r.innerHTML = s, I(r, o, i), r.innerHTML;
|
|
1420
1432
|
}
|
|
1421
|
-
function
|
|
1422
|
-
const o = Array.from(
|
|
1423
|
-
for (const
|
|
1424
|
-
if (
|
|
1425
|
-
const i =
|
|
1426
|
-
if (!t.includes(
|
|
1433
|
+
function I(s, t, e) {
|
|
1434
|
+
const o = Array.from(s.childNodes);
|
|
1435
|
+
for (const n of o)
|
|
1436
|
+
if (n.nodeType === Node.ELEMENT_NODE) {
|
|
1437
|
+
const i = n, r = i.tagName.toLowerCase();
|
|
1438
|
+
if (!t.includes(r)) {
|
|
1427
1439
|
for (; i.firstChild; )
|
|
1428
|
-
|
|
1429
|
-
|
|
1440
|
+
s.insertBefore(i.firstChild, i);
|
|
1441
|
+
s.removeChild(i);
|
|
1430
1442
|
continue;
|
|
1431
1443
|
}
|
|
1432
|
-
|
|
1433
|
-
} else
|
|
1444
|
+
G(i, e), I(i, t, e);
|
|
1445
|
+
} else n.nodeType !== Node.TEXT_NODE && s.removeChild(n);
|
|
1434
1446
|
}
|
|
1435
|
-
function
|
|
1436
|
-
const e =
|
|
1447
|
+
function G(s, t) {
|
|
1448
|
+
const e = s.tagName.toLowerCase(), o = Array.from(s.attributes), n = t[e] || [], i = t["*"] || [], r = [...n, ...i];
|
|
1437
1449
|
for (const a of o) {
|
|
1438
|
-
const
|
|
1450
|
+
const l = a.name.toLowerCase();
|
|
1439
1451
|
let c = !1;
|
|
1440
|
-
|
|
1441
|
-
for (const d of
|
|
1452
|
+
r.includes(l) && (c = !0);
|
|
1453
|
+
for (const d of r)
|
|
1442
1454
|
if (d.endsWith("*")) {
|
|
1443
|
-
const
|
|
1444
|
-
if (
|
|
1455
|
+
const h = d.slice(0, -1);
|
|
1456
|
+
if (l.startsWith(h)) {
|
|
1445
1457
|
c = !0;
|
|
1446
1458
|
break;
|
|
1447
1459
|
}
|
|
1448
1460
|
}
|
|
1449
|
-
(
|
|
1461
|
+
(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
1462
|
}
|
|
1451
|
-
|
|
1463
|
+
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");
|
|
1464
|
+
}
|
|
1465
|
+
function X(s, t, e) {
|
|
1466
|
+
return (e == null ? void 0 : e.sanitizeOnPaste) === !1 ? s : L(s, t);
|
|
1452
1467
|
}
|
|
1453
|
-
function
|
|
1454
|
-
return (e == null ? void 0 : e.
|
|
1468
|
+
function Y(s, t, e) {
|
|
1469
|
+
return (e == null ? void 0 : e.sanitizeOnInput) === !1 ? s : L(s, t);
|
|
1455
1470
|
}
|
|
1456
|
-
function $(l, t, e) {
|
|
1457
|
-
|
|
1471
|
+
const J = '.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: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,#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:#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,#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}}';
|
|
1472
|
+
let y;
|
|
1473
|
+
const Q = "__editoraCommandEditorRoot", Z = "__editoraLastCommandButton", S = "editora-editor, [data-editora-editor], .rte-editor, .editora-editor", T = ".rte-content, .editora-content", C = /* @__PURE__ */ new Set();
|
|
1474
|
+
let g = null, A = !1, k = null, x = null;
|
|
1475
|
+
function M(s) {
|
|
1476
|
+
if (!(s instanceof HTMLElement)) return !1;
|
|
1477
|
+
const t = s;
|
|
1478
|
+
return typeof t.execCommand == "function" && (t.tagName.toLowerCase() === "editora-editor" || t.classList.contains("editora-editor") || t.hasAttribute("data-editora-editor"));
|
|
1458
1479
|
}
|
|
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
|
-
|
|
1461
|
-
|
|
1462
|
-
|
|
1463
|
-
if (!
|
|
1480
|
+
function tt(s) {
|
|
1481
|
+
return s ? s.nodeType === Node.ELEMENT_NODE ? s : s.parentElement : null;
|
|
1482
|
+
}
|
|
1483
|
+
function b(s) {
|
|
1484
|
+
if (!s) return null;
|
|
1485
|
+
if (M(s))
|
|
1486
|
+
return s;
|
|
1487
|
+
const t = s.matches(S) ? s : s.closest(S);
|
|
1488
|
+
return !t || !M(t) ? null : t;
|
|
1489
|
+
}
|
|
1490
|
+
function et() {
|
|
1491
|
+
var n;
|
|
1492
|
+
if (typeof window == "undefined") return null;
|
|
1493
|
+
const s = window[Q];
|
|
1494
|
+
if (s instanceof HTMLElement) {
|
|
1495
|
+
const i = b(s);
|
|
1496
|
+
if (i) return i;
|
|
1497
|
+
const r = s.matches(T) ? s : s.querySelector(T);
|
|
1498
|
+
if (r) {
|
|
1499
|
+
const a = b(r);
|
|
1500
|
+
if (a) return a;
|
|
1501
|
+
}
|
|
1502
|
+
}
|
|
1503
|
+
const t = window[Z];
|
|
1504
|
+
if (t instanceof HTMLElement) {
|
|
1505
|
+
const i = b(t);
|
|
1506
|
+
if (i) return i;
|
|
1507
|
+
}
|
|
1508
|
+
const e = document.activeElement;
|
|
1509
|
+
if (e) {
|
|
1510
|
+
const i = b(e);
|
|
1511
|
+
if (i) return i;
|
|
1512
|
+
}
|
|
1513
|
+
const o = (n = window.getSelection) == null ? void 0 : n.call(window);
|
|
1514
|
+
if (o && o.rangeCount > 0) {
|
|
1515
|
+
const i = b(tt(o.getRangeAt(0).startContainer));
|
|
1516
|
+
if (i) return i;
|
|
1517
|
+
}
|
|
1518
|
+
if (g && g.isConnected)
|
|
1519
|
+
return g;
|
|
1520
|
+
for (const i of C)
|
|
1521
|
+
if (i.isConnected) return i;
|
|
1522
|
+
return null;
|
|
1523
|
+
}
|
|
1524
|
+
function ot() {
|
|
1525
|
+
if (typeof window == "undefined" || A) return;
|
|
1526
|
+
k = typeof window.executeEditorCommand == "function" ? window.executeEditorCommand.bind(window) : null, x = typeof window.execEditorCommand == "function" ? window.execEditorCommand.bind(window) : null;
|
|
1527
|
+
const s = (t, e) => {
|
|
1528
|
+
const o = et();
|
|
1529
|
+
return o ? o.execCommand(t, e) : k ? k(t, e) : x ? x(t, e) : !1;
|
|
1530
|
+
};
|
|
1531
|
+
window.executeEditorCommand = s, window.execEditorCommand = s, A = !0;
|
|
1532
|
+
}
|
|
1533
|
+
function it() {
|
|
1534
|
+
const s = "editora-webcomponent-styles";
|
|
1535
|
+
if (!document.getElementById(s)) {
|
|
1464
1536
|
const t = document.createElement("style");
|
|
1465
|
-
t.id =
|
|
1537
|
+
t.id = s, t.textContent = J, document.head.appendChild(t);
|
|
1466
1538
|
}
|
|
1467
1539
|
}
|
|
1468
|
-
function
|
|
1469
|
-
if (!
|
|
1470
|
-
const
|
|
1471
|
-
|
|
1540
|
+
function D() {
|
|
1541
|
+
if (!y) {
|
|
1542
|
+
const s = m.__globalPluginLoader;
|
|
1543
|
+
s ? y = s : y = new K();
|
|
1472
1544
|
}
|
|
1473
|
-
return
|
|
1545
|
+
return y;
|
|
1474
1546
|
}
|
|
1475
|
-
function
|
|
1476
|
-
const t =
|
|
1477
|
-
Object.entries(
|
|
1547
|
+
function nt(s) {
|
|
1548
|
+
const t = D();
|
|
1549
|
+
Object.entries(s).forEach(([e, o]) => {
|
|
1478
1550
|
t.register(e, o);
|
|
1479
1551
|
});
|
|
1480
1552
|
}
|
|
1481
|
-
class
|
|
1553
|
+
class m extends HTMLElement {
|
|
1482
1554
|
constructor() {
|
|
1483
|
-
if (super(), this.pluginLoader =
|
|
1555
|
+
if (super(), this.pluginLoader = D(), this.config = {}, this.isInitialized = !1, this.keyboardShortcutManager = new O(), this.lastAutosavedContent = "", this.loadedPlugins = [], this.lastBeforeInputType = null, it(), !this.hasAttribute("data-initial-content")) {
|
|
1484
1556
|
const t = this.innerHTML.trim();
|
|
1485
1557
|
t && this.setAttribute("data-initial-content", t);
|
|
1486
1558
|
}
|
|
@@ -1546,13 +1618,13 @@ class g extends HTMLElement {
|
|
|
1546
1618
|
* Wait for the global plugin loader to be available
|
|
1547
1619
|
*/
|
|
1548
1620
|
async waitForPluginLoader() {
|
|
1549
|
-
if (
|
|
1550
|
-
this.pluginLoader =
|
|
1621
|
+
if (m.__globalPluginLoader) {
|
|
1622
|
+
this.pluginLoader = m.__globalPluginLoader;
|
|
1551
1623
|
return;
|
|
1552
1624
|
}
|
|
1553
1625
|
return new Promise((t) => {
|
|
1554
1626
|
const e = () => {
|
|
1555
|
-
|
|
1627
|
+
m.__globalPluginLoader ? (this.pluginLoader = m.__globalPluginLoader, t()) : setTimeout(e, 0);
|
|
1556
1628
|
};
|
|
1557
1629
|
e();
|
|
1558
1630
|
});
|
|
@@ -1581,18 +1653,18 @@ class g extends HTMLElement {
|
|
|
1581
1653
|
async initialize() {
|
|
1582
1654
|
var o;
|
|
1583
1655
|
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}`);
|
|
1656
|
+
this.setAttribute("data-editora-editor", "true"), C.add(this), g || (g = this), ot(), 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
1657
|
const t = await this.loadPlugins();
|
|
1586
|
-
this.loadedPlugins = t, t.forEach((
|
|
1587
|
-
if (
|
|
1658
|
+
this.loadedPlugins = t, t.forEach((n) => {
|
|
1659
|
+
if (n.init && typeof n.init == "function")
|
|
1588
1660
|
try {
|
|
1589
|
-
|
|
1661
|
+
n.init({ editorElement: this });
|
|
1590
1662
|
} catch (i) {
|
|
1591
|
-
console.error(`[RichTextEditor] Error initializing plugin ${
|
|
1663
|
+
console.error(`[RichTextEditor] Error initializing plugin ${n.name}:`, i);
|
|
1592
1664
|
}
|
|
1593
1665
|
});
|
|
1594
1666
|
const e = (o = this.restoreAutosavedContent()) != null ? o : this.getAttribute("data-initial-content") || "";
|
|
1595
|
-
this.engine = new
|
|
1667
|
+
this.engine = new z({
|
|
1596
1668
|
content: e,
|
|
1597
1669
|
plugins: t,
|
|
1598
1670
|
readonly: this.config.readonly
|
|
@@ -1615,31 +1687,31 @@ class g extends HTMLElement {
|
|
|
1615
1687
|
*/
|
|
1616
1688
|
async loadPlugins() {
|
|
1617
1689
|
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),
|
|
1690
|
+
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
1691
|
if (e) {
|
|
1620
1692
|
if (typeof this.config.plugins == "string") {
|
|
1621
1693
|
const i = this.config.plugins.split(/\s+/).filter(Boolean);
|
|
1622
|
-
|
|
1623
|
-
for (const
|
|
1624
|
-
const a = await this.pluginLoader.load(
|
|
1694
|
+
n && !i.includes("a11yChecker") && i.push("a11yChecker");
|
|
1695
|
+
for (const r of i) {
|
|
1696
|
+
const a = await this.pluginLoader.load(r, this.getPluginLoadConfig(r));
|
|
1625
1697
|
a && t.push(a);
|
|
1626
1698
|
}
|
|
1627
1699
|
} else if (Array.isArray(this.config.plugins)) {
|
|
1628
1700
|
for (const i of this.config.plugins)
|
|
1629
1701
|
if (typeof i == "string") {
|
|
1630
|
-
const
|
|
1631
|
-
|
|
1702
|
+
const r = await this.pluginLoader.load(i, this.getPluginLoadConfig(i));
|
|
1703
|
+
r && t.push(r);
|
|
1632
1704
|
} else
|
|
1633
1705
|
t.push(i);
|
|
1634
|
-
if (
|
|
1706
|
+
if (n && !t.some((i) => (i == null ? void 0 : i.name) === "a11yChecker")) {
|
|
1635
1707
|
const i = await this.pluginLoader.load("a11yChecker", this.getPluginLoadConfig("a11yChecker"));
|
|
1636
1708
|
i && t.push(i);
|
|
1637
1709
|
}
|
|
1638
1710
|
}
|
|
1639
1711
|
} else {
|
|
1640
1712
|
const i = this.pluginLoader.getRegisteredPluginNames();
|
|
1641
|
-
for (const
|
|
1642
|
-
const a = await this.pluginLoader.load(
|
|
1713
|
+
for (const r of i) {
|
|
1714
|
+
const a = await this.pluginLoader.load(r, this.getPluginLoadConfig(r));
|
|
1643
1715
|
a && t.push(a);
|
|
1644
1716
|
}
|
|
1645
1717
|
}
|
|
@@ -1765,12 +1837,12 @@ class g extends HTMLElement {
|
|
|
1765
1837
|
editorElement: this,
|
|
1766
1838
|
contentElement: this.contentElement,
|
|
1767
1839
|
toolbarElement: this.toolbarElement
|
|
1768
|
-
},
|
|
1769
|
-
if (
|
|
1770
|
-
const
|
|
1771
|
-
if (typeof
|
|
1840
|
+
}, n = this.loadedPlugins.find((r) => r.commands && r.commands[t]);
|
|
1841
|
+
if (n && n.commands) {
|
|
1842
|
+
const r = n.commands[t];
|
|
1843
|
+
if (typeof r == "function")
|
|
1772
1844
|
try {
|
|
1773
|
-
return
|
|
1845
|
+
return r(t === "toggleFullscreen" ? this : e, o), !0;
|
|
1774
1846
|
} catch (a) {
|
|
1775
1847
|
return console.error(`[RichTextEditor] Error executing native command ${t}:`, a), !1;
|
|
1776
1848
|
}
|
|
@@ -1785,16 +1857,29 @@ class g extends HTMLElement {
|
|
|
1785
1857
|
return i;
|
|
1786
1858
|
}
|
|
1787
1859
|
const o = {
|
|
1788
|
-
spellCheck: ["spellcheck", "spellCheck"]
|
|
1789
|
-
|
|
1860
|
+
spellCheck: ["spellcheck", "spellCheck"],
|
|
1861
|
+
trackChanges: ["trackchanges", "track-changes", "trackChanges"],
|
|
1862
|
+
versionDiff: ["versiondiff", "version-diff", "versionDiff"],
|
|
1863
|
+
"version-diff": ["versiondiff", "version-diff", "versionDiff"],
|
|
1864
|
+
conditionalContent: ["conditionalcontent", "conditional-content", "conditionalContent"],
|
|
1865
|
+
"conditional-content": ["conditionalcontent", "conditional-content", "conditionalContent"],
|
|
1866
|
+
dataBinding: ["databinding", "data-binding", "dataBinding"],
|
|
1867
|
+
"data-binding": ["databinding", "data-binding", "dataBinding"],
|
|
1868
|
+
contentRules: ["contentrules", "content-rules", "contentRules"],
|
|
1869
|
+
"content-rules": ["contentrules", "content-rules", "contentRules"],
|
|
1870
|
+
mentions: ["mention", "mentions"],
|
|
1871
|
+
mention: ["mention", "mentions"],
|
|
1872
|
+
slashCommands: ["slashcommands", "slash-commands", "slashCommands"],
|
|
1873
|
+
"slash-commands": ["slashcommands", "slash-commands", "slashCommands"]
|
|
1874
|
+
}, n = [
|
|
1790
1875
|
t,
|
|
1791
1876
|
t.toLowerCase(),
|
|
1792
1877
|
...o[t] || []
|
|
1793
1878
|
];
|
|
1794
|
-
for (const i of
|
|
1795
|
-
const
|
|
1796
|
-
if (
|
|
1797
|
-
return
|
|
1879
|
+
for (const i of n) {
|
|
1880
|
+
const r = this.config[i];
|
|
1881
|
+
if (r && typeof r == "object" && !Array.isArray(r))
|
|
1882
|
+
return r;
|
|
1798
1883
|
}
|
|
1799
1884
|
}
|
|
1800
1885
|
getContentSanitizeConfig() {
|
|
@@ -1816,10 +1901,10 @@ class g extends HTMLElement {
|
|
|
1816
1901
|
provider: "localStorage"
|
|
1817
1902
|
};
|
|
1818
1903
|
if (t && typeof t == "object") {
|
|
1819
|
-
const
|
|
1904
|
+
const n = Number((o = (e = t.intervalMs) != null ? e : t.interval) != null ? o : 3e4);
|
|
1820
1905
|
return {
|
|
1821
1906
|
enabled: !!t.enabled,
|
|
1822
|
-
intervalMs: Number.isFinite(
|
|
1907
|
+
intervalMs: Number.isFinite(n) && n > 0 ? n : 3e4,
|
|
1823
1908
|
storageKey: String(t.storageKey || "rte-autosave"),
|
|
1824
1909
|
provider: t.provider || "localStorage",
|
|
1825
1910
|
apiUrl: t.apiUrl
|
|
@@ -1881,11 +1966,11 @@ class g extends HTMLElement {
|
|
|
1881
1966
|
if (e && e.rangeCount > 0) {
|
|
1882
1967
|
const o = e.getRangeAt(0);
|
|
1883
1968
|
o.deleteContents();
|
|
1884
|
-
const
|
|
1885
|
-
|
|
1969
|
+
const n = document.createElement("div");
|
|
1970
|
+
n.innerHTML = t;
|
|
1886
1971
|
const i = document.createDocumentFragment();
|
|
1887
|
-
for (;
|
|
1888
|
-
i.appendChild(
|
|
1972
|
+
for (; n.firstChild; )
|
|
1973
|
+
i.appendChild(n.firstChild);
|
|
1889
1974
|
o.insertNode(i), o.collapse(!1), e.removeAllRanges(), e.addRange(o);
|
|
1890
1975
|
} else
|
|
1891
1976
|
this.contentElement.focus(), document.execCommand("insertHTML", !1, t);
|
|
@@ -1894,8 +1979,8 @@ class g extends HTMLElement {
|
|
|
1894
1979
|
* Create UI elements
|
|
1895
1980
|
*/
|
|
1896
1981
|
createUI(t, e) {
|
|
1897
|
-
const o = this.querySelector('[slot="toolbar"]'),
|
|
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
|
|
1982
|
+
const o = this.querySelector('[slot="toolbar"]'), n = this.querySelector('[slot="statusbar"]');
|
|
1983
|
+
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 R(
|
|
1899
1984
|
{
|
|
1900
1985
|
items: this.resolveToolbarItems(),
|
|
1901
1986
|
sticky: this.isToolbarStickyEnabled(),
|
|
@@ -1904,17 +1989,17 @@ class g extends HTMLElement {
|
|
|
1904
1989
|
t,
|
|
1905
1990
|
this.pluginLoader
|
|
1906
1991
|
// Pass plugin loader to get all registered plugins
|
|
1907
|
-
), this.toolbar.setCommandHandler((i,
|
|
1992
|
+
), this.toolbar.setCommandHandler((i, r) => {
|
|
1908
1993
|
var a;
|
|
1909
1994
|
if (this.contentElement) {
|
|
1910
1995
|
this.contentElement.focus();
|
|
1911
|
-
const
|
|
1912
|
-
if (!
|
|
1996
|
+
const l = window.getSelection();
|
|
1997
|
+
if (!l || l.rangeCount === 0 || !this.contentElement.contains(l.anchorNode)) {
|
|
1913
1998
|
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),
|
|
1999
|
+
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
2000
|
}
|
|
1916
2001
|
}
|
|
1917
|
-
return this.executeCommand(i,
|
|
2002
|
+
return this.executeCommand(i, r);
|
|
1918
2003
|
}), 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
2004
|
try {
|
|
1920
2005
|
document.execCommand("defaultParagraphSeparator", !1, "p");
|
|
@@ -1925,14 +2010,14 @@ class g extends HTMLElement {
|
|
|
1925
2010
|
const i = document.createElement("div");
|
|
1926
2011
|
i.innerHTML = e.trim(), !Array.from(i.childNodes).some((a) => {
|
|
1927
2012
|
if (a.nodeType === Node.ELEMENT_NODE) {
|
|
1928
|
-
const
|
|
1929
|
-
return ["P", "DIV", "H1", "H2", "H3", "H4", "H5", "H6", "UL", "OL", "BLOCKQUOTE", "PRE"].includes(
|
|
2013
|
+
const l = a.tagName;
|
|
2014
|
+
return ["P", "DIV", "H1", "H2", "H3", "H4", "H5", "H6", "UL", "OL", "BLOCKQUOTE", "PRE"].includes(l);
|
|
1930
2015
|
}
|
|
1931
2016
|
return !1;
|
|
1932
2017
|
}) && e.trim() ? this.contentElement.innerHTML = `<p>${e.trim()}</p>` : this.contentElement.innerHTML = e;
|
|
1933
2018
|
} else
|
|
1934
2019
|
this.config.placeholder ? this.contentElement.innerHTML = "" : this.contentElement.innerHTML = "<p><br></p>";
|
|
1935
|
-
this.appendChild(this.contentElement), this.isToolbarFloatingEnabled() && (this.floatingToolbar = new
|
|
2020
|
+
this.appendChild(this.contentElement), this.isToolbarFloatingEnabled() && (this.floatingToolbar = new H({ 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 j({ position: this.getStatusbarPosition() }), this.statusBar.create(this.statusBarElement)), this.config.autofocus && setTimeout(() => {
|
|
1936
2021
|
var i;
|
|
1937
2022
|
return (i = this.contentElement) == null ? void 0 : i.focus();
|
|
1938
2023
|
}, 0);
|
|
@@ -1943,66 +2028,70 @@ class g extends HTMLElement {
|
|
|
1943
2028
|
setupEventListeners() {
|
|
1944
2029
|
if (!this.contentElement || !this.engine) return;
|
|
1945
2030
|
const t = this.keyboardShortcutManager;
|
|
1946
|
-
this.contentElement.addEventListener("
|
|
2031
|
+
this.contentElement.addEventListener("beforeinput", (o) => {
|
|
2032
|
+
this.lastBeforeInputType = o.inputType || null;
|
|
2033
|
+
}), this.contentElement.addEventListener("input", () => {
|
|
1947
2034
|
if (!this.contentElement) return;
|
|
1948
2035
|
let o = this.contentElement.innerHTML;
|
|
1949
|
-
const
|
|
1950
|
-
if (
|
|
1951
|
-
const
|
|
1952
|
-
if (
|
|
1953
|
-
const
|
|
1954
|
-
if (this.contentElement.innerHTML =
|
|
2036
|
+
const n = this.getPerformanceConfig(), i = this.getContentSanitizeConfig(), r = this.getSecurityConfig(), a = this.lastBeforeInputType;
|
|
2037
|
+
if (this.lastBeforeInputType = null, r.sanitizeOnInput !== !1 && i.sanitize !== !1 && !a) {
|
|
2038
|
+
const d = Y(o, i, r);
|
|
2039
|
+
if (d !== o) {
|
|
2040
|
+
const h = window.getSelection(), p = h && h.rangeCount > 0 ? h.getRangeAt(0) : null;
|
|
2041
|
+
if (this.contentElement.innerHTML = d, p && h)
|
|
1955
2042
|
try {
|
|
1956
|
-
|
|
1957
|
-
} catch (
|
|
2043
|
+
h.removeAllRanges(), h.addRange(p);
|
|
2044
|
+
} catch (u) {
|
|
1958
2045
|
}
|
|
1959
|
-
o =
|
|
2046
|
+
o = d;
|
|
1960
2047
|
}
|
|
1961
2048
|
}
|
|
1962
2049
|
this.contentChangeDebounceTimer && clearTimeout(this.contentChangeDebounceTimer);
|
|
1963
|
-
const
|
|
2050
|
+
const c = () => {
|
|
1964
2051
|
this.dispatchEvent(new CustomEvent("content-change", {
|
|
1965
2052
|
detail: { html: o },
|
|
1966
2053
|
bubbles: !0
|
|
1967
2054
|
}));
|
|
1968
2055
|
};
|
|
1969
|
-
|
|
2056
|
+
n.debounceInputMs > 0 ? this.contentChangeDebounceTimer = setTimeout(c, n.debounceInputMs) : c(), this.updateStatusBar();
|
|
1970
2057
|
}), this.contentElement.addEventListener("contextmenu", (o) => {
|
|
1971
|
-
const
|
|
1972
|
-
(
|
|
2058
|
+
const n = this.config.contextMenu;
|
|
2059
|
+
(n === !1 || typeof n == "object" && n !== null && n.enabled === !1) && o.preventDefault();
|
|
1973
2060
|
}), this.contentElement.addEventListener("paste", (o) => {
|
|
1974
|
-
var d,
|
|
2061
|
+
var d, h;
|
|
2062
|
+
if (o.__editoraSmartPasteHandled === !0 || o.defaultPrevented)
|
|
2063
|
+
return;
|
|
1975
2064
|
o.preventDefault();
|
|
1976
|
-
const
|
|
2065
|
+
const n = this.config.paste || {};
|
|
1977
2066
|
let i = ((d = o.clipboardData) == null ? void 0 : d.getData("text/html")) || "";
|
|
1978
|
-
const
|
|
1979
|
-
if ((
|
|
1980
|
-
document.execCommand("insertText", !1,
|
|
2067
|
+
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);
|
|
2068
|
+
if ((n.clean || !n.keepFormatting) && r) {
|
|
2069
|
+
document.execCommand("insertText", !1, r);
|
|
1981
2070
|
return;
|
|
1982
2071
|
}
|
|
1983
|
-
if (
|
|
1984
|
-
document.execCommand("insertText", !1,
|
|
2072
|
+
if (n.convertWord === !1 && c && r) {
|
|
2073
|
+
document.execCommand("insertText", !1, r);
|
|
1985
2074
|
return;
|
|
1986
2075
|
}
|
|
1987
2076
|
if (i) {
|
|
1988
|
-
|
|
2077
|
+
l.sanitizeOnPaste !== !1 && a.sanitize !== !1 && (i = X(i, a, l)), this.insertHTMLAtSelection(i);
|
|
1989
2078
|
return;
|
|
1990
2079
|
}
|
|
1991
|
-
|
|
2080
|
+
r && document.execCommand("insertText", !1, r);
|
|
1992
2081
|
}), this.contentElement.addEventListener("focus", () => {
|
|
1993
|
-
this.dispatchEvent(new Event("editor-focus", { bubbles: !0 })), this.updateStatusBar();
|
|
2082
|
+
g = this, this.dispatchEvent(new Event("editor-focus", { bubbles: !0 })), this.updateStatusBar();
|
|
1994
2083
|
}), this.contentElement.addEventListener("blur", () => {
|
|
1995
2084
|
this.contentChangeDebounceTimer && (clearTimeout(this.contentChangeDebounceTimer), this.contentChangeDebounceTimer = void 0), this.contentElement && this.dispatchEvent(new CustomEvent("content-change", {
|
|
1996
2085
|
detail: { html: this.contentElement.innerHTML },
|
|
1997
2086
|
bubbles: !0
|
|
1998
2087
|
})), this.dispatchEvent(new Event("editor-blur", { bubbles: !0 })), this.updateFloatingToolbar(), this.updateStatusBar();
|
|
1999
2088
|
}), this.contentElement.addEventListener("keydown", (o) => {
|
|
2000
|
-
this.getAccessibilityConfig().keyboardNavigation && t.handleKeyDown(o, (i,
|
|
2001
|
-
this.executeCommand(i,
|
|
2089
|
+
this.getAccessibilityConfig().keyboardNavigation && t.handleKeyDown(o, (i, r) => {
|
|
2090
|
+
this.executeCommand(i, r);
|
|
2002
2091
|
});
|
|
2003
2092
|
});
|
|
2004
2093
|
const e = () => {
|
|
2005
|
-
const o = this.getSelectionRangeInEditor(),
|
|
2094
|
+
const o = this.getSelectionRangeInEditor(), n = document.activeElement, i = !!n && !!this.contentElement && (n === this.contentElement || this.contentElement.contains(n));
|
|
2006
2095
|
this.getPerformanceConfig().viewportOnlyScan && !this.isEditorInViewport() && !i || !o && !i || (this.updateFloatingToolbar(), this.updateStatusBar());
|
|
2007
2096
|
};
|
|
2008
2097
|
this.selectionChangeHandler = e, document.addEventListener("selectionchange", this.selectionChangeHandler);
|
|
@@ -2032,32 +2121,36 @@ class g extends HTMLElement {
|
|
|
2032
2121
|
* Update floating toolbar position
|
|
2033
2122
|
*/
|
|
2034
2123
|
updateFloatingToolbar() {
|
|
2035
|
-
if (!this.floatingToolbar) return;
|
|
2036
|
-
|
|
2037
|
-
if (t.viewportOnlyScan && !this.isEditorInViewport() && !e) {
|
|
2124
|
+
if (!this.floatingToolbar || !this.contentElement) return;
|
|
2125
|
+
if (this.config.readonly || this.contentElement.contentEditable === "false" || this.contentElement.getAttribute("data-readonly") === "true" || this.getAttribute("readonly") === "true" || this.getAttribute("data-readonly") === "true") {
|
|
2038
2126
|
this.floatingToolbar.hide();
|
|
2039
2127
|
return;
|
|
2040
2128
|
}
|
|
2041
|
-
const o = this.
|
|
2042
|
-
if (!o) {
|
|
2129
|
+
const e = this.getPerformanceConfig(), o = document.activeElement === this.contentElement || !!this.contentElement && this.contentElement.contains(document.activeElement);
|
|
2130
|
+
if (e.viewportOnlyScan && !this.isEditorInViewport() && !o) {
|
|
2043
2131
|
this.floatingToolbar.hide();
|
|
2044
2132
|
return;
|
|
2045
2133
|
}
|
|
2046
|
-
|
|
2134
|
+
const n = this.getSelectionRangeInEditor();
|
|
2135
|
+
if (!n) {
|
|
2047
2136
|
this.floatingToolbar.hide();
|
|
2048
2137
|
return;
|
|
2049
2138
|
}
|
|
2050
|
-
|
|
2051
|
-
if (!r) {
|
|
2139
|
+
if (n.collapsed) {
|
|
2052
2140
|
this.floatingToolbar.hide();
|
|
2053
2141
|
return;
|
|
2054
2142
|
}
|
|
2055
|
-
const i =
|
|
2143
|
+
const i = window.getSelection();
|
|
2056
2144
|
if (!i) {
|
|
2057
2145
|
this.floatingToolbar.hide();
|
|
2058
2146
|
return;
|
|
2059
2147
|
}
|
|
2060
|
-
this.
|
|
2148
|
+
const r = this.getSelectionAnchorRect(i, n);
|
|
2149
|
+
if (!r) {
|
|
2150
|
+
this.floatingToolbar.hide();
|
|
2151
|
+
return;
|
|
2152
|
+
}
|
|
2153
|
+
this.floatingToolbar.show(r.left, r.top - 40);
|
|
2061
2154
|
}
|
|
2062
2155
|
/**
|
|
2063
2156
|
* Update status bar with selection and cursor information
|
|
@@ -2070,15 +2163,15 @@ class g extends HTMLElement {
|
|
|
2070
2163
|
const t = this.getPerformanceConfig(), e = document.activeElement === this.contentElement || this.contentElement.contains(document.activeElement);
|
|
2071
2164
|
if (t.viewportOnlyScan && !this.isEditorInViewport() && !e)
|
|
2072
2165
|
return;
|
|
2073
|
-
const o = this.contentElement.textContent || "", { words:
|
|
2074
|
-
let a,
|
|
2166
|
+
const o = this.contentElement.textContent || "", { words: n, chars: i } = W(o), r = _(this.contentElement);
|
|
2167
|
+
let a, l;
|
|
2075
2168
|
const c = this.getSelectionRangeInEditor();
|
|
2076
|
-
c && (a =
|
|
2077
|
-
wordCount:
|
|
2169
|
+
c && (a = F(this.contentElement, c), c.collapsed || (l = U(c, a), a = void 0)), this.statusBar.update({
|
|
2170
|
+
wordCount: n,
|
|
2078
2171
|
charCount: i,
|
|
2079
|
-
lineCount:
|
|
2172
|
+
lineCount: r,
|
|
2080
2173
|
cursorPosition: a,
|
|
2081
|
-
selectionInfo:
|
|
2174
|
+
selectionInfo: l
|
|
2082
2175
|
});
|
|
2083
2176
|
}
|
|
2084
2177
|
/**
|
|
@@ -2158,7 +2251,7 @@ class g extends HTMLElement {
|
|
|
2158
2251
|
const o = this.attributes[e];
|
|
2159
2252
|
t[o.name] = o.value;
|
|
2160
2253
|
}
|
|
2161
|
-
return
|
|
2254
|
+
return w.resolve({
|
|
2162
2255
|
jsConfig: this.jsConfig,
|
|
2163
2256
|
attributes: t
|
|
2164
2257
|
});
|
|
@@ -2198,8 +2291,8 @@ class g extends HTMLElement {
|
|
|
2198
2291
|
* Destroy the editor
|
|
2199
2292
|
*/
|
|
2200
2293
|
destroy() {
|
|
2201
|
-
var t, e, o,
|
|
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(), (
|
|
2294
|
+
var t, e, o, n;
|
|
2295
|
+
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, C.delete(this), g === this && (g = null), this.dispatchEvent(new Event("editor-destroy", { bubbles: !0 }));
|
|
2203
2296
|
}
|
|
2204
2297
|
// Public API methods
|
|
2205
2298
|
getContent() {
|
|
@@ -2222,23 +2315,23 @@ class g extends HTMLElement {
|
|
|
2222
2315
|
}
|
|
2223
2316
|
}
|
|
2224
2317
|
export {
|
|
2225
|
-
|
|
2226
|
-
|
|
2227
|
-
|
|
2228
|
-
|
|
2229
|
-
|
|
2230
|
-
|
|
2231
|
-
|
|
2232
|
-
|
|
2233
|
-
|
|
2234
|
-
|
|
2235
|
-
|
|
2236
|
-
|
|
2237
|
-
|
|
2238
|
-
|
|
2239
|
-
|
|
2240
|
-
|
|
2241
|
-
|
|
2242
|
-
|
|
2318
|
+
B as C,
|
|
2319
|
+
v as E,
|
|
2320
|
+
H as F,
|
|
2321
|
+
O as K,
|
|
2322
|
+
P,
|
|
2323
|
+
m as R,
|
|
2324
|
+
N as S,
|
|
2325
|
+
R as T,
|
|
2326
|
+
z as a,
|
|
2327
|
+
j as b,
|
|
2328
|
+
$ as c,
|
|
2329
|
+
_ as d,
|
|
2330
|
+
W as e,
|
|
2331
|
+
U as f,
|
|
2332
|
+
F as g,
|
|
2333
|
+
w as h,
|
|
2334
|
+
K as i,
|
|
2335
|
+
nt as j
|
|
2243
2336
|
};
|
|
2244
|
-
//# sourceMappingURL=index-
|
|
2337
|
+
//# sourceMappingURL=index-DqC57IEH.mjs.map
|