@editora/core 1.0.6 → 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/{AnchorPlugin.native-C1Rw5m04.mjs → AnchorPlugin.native-BcYGEtd9.mjs} +129 -105
- package/dist/ApprovalWorkflowPlugin.native-C3jtAYjG.mjs +1076 -0
- package/dist/{BackgroundColorPlugin.native-BE-p9DRd.mjs → BackgroundColorPlugin.native-50iAT9xU.mjs} +119 -122
- package/dist/BlocksLibraryPlugin.native-HMWKxWNs.mjs +1327 -0
- package/dist/CitationsPlugin.native-BnU0qCwR.mjs +1464 -0
- package/dist/CodePlugin.native-DlpTPdkd.mjs +2691 -0
- package/dist/{CommentsPlugin.native-tMnWn8a2.mjs → CommentsPlugin.native-DPSqTkiv.mjs} +153 -135
- 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/{DocumentManagerPlugin.native-BvZL5CSG.mjs → DocumentManagerPlugin.native-C2cs_1w4.mjs} +43 -43
- package/dist/{EmbedIframePlugin.native-CSWIB1jm.mjs → EmbedIframePlugin.native-DKJx2OS7.mjs} +61 -58
- package/dist/{EmojisPlugin.native-DxTm_DL-.mjs → EmojisPlugin.native-CitxxlWX.mjs} +135 -104
- package/dist/{LinkPlugin.native-CS2g-G18.mjs → LinkPlugin.native-DYCIcdTm.mjs} +47 -45
- package/dist/{MathPlugin.native-KUxz0o8C.mjs → MathPlugin.native-f_mDp8VL.mjs} +149 -108
- package/dist/{MediaManagerPlugin.native-CgP5iInD.mjs → MediaManagerPlugin.native-BiXiK8FC.mjs} +238 -217
- package/dist/MentionPlugin.native-BMDlOqur.mjs +734 -0
- package/dist/MergeTagPlugin.native-C3eOfEgw.mjs +559 -0
- package/dist/PIIRedactionPlugin.native-DcsjmtV1.mjs +1396 -0
- package/dist/{PageBreakPlugin.native-CGiQxXqR.mjs → PageBreakPlugin.native-DijGuHJZ.mjs} +86 -77
- 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/{SpecialCharactersPlugin.native-DANrbExJ.mjs → SpecialCharactersPlugin.native-CZDato89.mjs} +143 -98
- package/dist/{SpellCheckPlugin.native-C8bPvRHy.mjs → SpellCheckPlugin.native-BZB9AewP.mjs} +239 -219
- package/dist/{TemplatePlugin.native-4lKEm-WY.mjs → TemplatePlugin.native-CrpfKRJ8.mjs} +167 -143
- package/dist/{TextColorPlugin.native-Clgtb50j.mjs → TextColorPlugin.native-Bwl_bSmc.mjs} +134 -118
- 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/_commonjsHelpers-DOllISpa.mjs +32 -0
- package/dist/anchoredPopover-Bxds0VoB.mjs +110 -0
- package/dist/documentManager-vQ1VkbUY.mjs +8418 -0
- package/dist/editora.min.js +13 -13
- package/dist/editora.umd.js +13 -13
- package/dist/html2canvas.esm-AYkPY5LS.mjs +4803 -0
- package/dist/index-BslAFzmv.mjs +16544 -0
- package/dist/index-D1LOqg5C.js +10 -0
- package/dist/{index-OwnkG39N.mjs → index-DqC57IEH.mjs} +438 -328
- package/dist/index.cjs.js +1 -1
- package/dist/{index.es-CuicffkQ.mjs → index.es-BYD2KEo6.mjs} +5 -4
- package/dist/index.esm.js +2 -2
- package/dist/jspdf.es.min-BJGtOnRT.mjs +7890 -0
- package/dist/plugin-loader.js +77 -40
- package/dist/webcomponent-core.js +456 -346
- package/dist/webcomponent-core.min.css +1 -1
- package/dist/webcomponent-core.min.js +87 -107
- package/dist/webcomponent.cjs.js +1 -1
- package/dist/webcomponent.esm.js +1 -1
- package/dist/webcomponent.js +503 -356
- package/dist/webcomponent.min.css +1 -1
- package/dist/webcomponent.min.js +6003 -658
- package/package.json +2 -2
- package/dist/CodePlugin.native-B263UI8O.mjs +0 -2173
- package/dist/MergeTagPlugin.native-DIGWhdnF.mjs +0 -419
- package/dist/colorSelectionApply-CK1My9N2.mjs +0 -67
- package/dist/documentManager-irzj9n3V.mjs +0 -37627
- package/dist/index-CqWQFb3D.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,35 +73,35 @@ 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
|
|
94
|
-
} catch (
|
|
95
|
-
if (console.warn(`API execution failed for ${t}, falling back to local`,
|
|
96
|
-
return
|
|
97
|
-
throw
|
|
92
|
+
if (n.executeAPI)
|
|
93
|
+
return await n.executeAPI(e, ...o);
|
|
94
|
+
} catch (a) {
|
|
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
|
+
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
|
-
} catch (
|
|
104
|
-
throw console.error(`Error executing command ${e} on plugin ${t}:`,
|
|
103
|
+
} catch (a) {
|
|
104
|
+
throw console.error(`Error executing command ${e} on plugin ${t}:`, a), a;
|
|
105
105
|
}
|
|
106
106
|
}
|
|
107
107
|
/**
|
|
@@ -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
|
|
440
|
-
o += `- **${
|
|
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,8 +576,13 @@ 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
|
+
setLastCommandTrigger(t, e) {
|
|
582
|
+
if (typeof window == "undefined" || !t) return;
|
|
583
|
+
const o = e || t.getAttribute("data-command") || void 0;
|
|
584
|
+
o && (window.__editoraLastCommandButton = t, window.__editoraLastCommand = o);
|
|
585
|
+
}
|
|
581
586
|
constructor(t, e, o) {
|
|
582
587
|
this.config = t, this.plugins = e, this.pluginLoader = o;
|
|
583
588
|
}
|
|
@@ -591,11 +596,11 @@ class L {
|
|
|
591
596
|
* Parse toolbar string into button groups
|
|
592
597
|
*/
|
|
593
598
|
parseToolbarString(t) {
|
|
594
|
-
const e = [], o = t.split("|").map((
|
|
595
|
-
|
|
596
|
-
|
|
599
|
+
const e = [], o = t.split("|").map((a) => a.trim()), n = this.getAvailableToolbarItems(), i = /* @__PURE__ */ new Map();
|
|
600
|
+
n.forEach((a) => {
|
|
601
|
+
a.command && i.set(a.command, a), a.type === "group" && a.label && i.set(a.label, a);
|
|
597
602
|
});
|
|
598
|
-
const
|
|
603
|
+
const r = {
|
|
599
604
|
bold: "toggleBold",
|
|
600
605
|
italic: "toggleItalic",
|
|
601
606
|
underline: "toggleUnderline",
|
|
@@ -606,6 +611,9 @@ class L {
|
|
|
606
611
|
link: "openLinkDialog",
|
|
607
612
|
image: "openImageDialog",
|
|
608
613
|
table: "insertTable",
|
|
614
|
+
trackChanges: "toggleTrackChanges",
|
|
615
|
+
acceptTrackChanges: "acceptAllTrackChanges",
|
|
616
|
+
rejectTrackChanges: "rejectAllTrackChanges",
|
|
609
617
|
anchor: "insertAnchor",
|
|
610
618
|
code: "toggleSourceView",
|
|
611
619
|
blockquote: "toggleBlockquote",
|
|
@@ -637,6 +645,14 @@ class L {
|
|
|
637
645
|
toggleComments: "toggleComments",
|
|
638
646
|
footnote: "insertFootnote",
|
|
639
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",
|
|
640
656
|
pageBreak: "insertPageBreak",
|
|
641
657
|
template: "insertTemplate",
|
|
642
658
|
importWord: "importWord",
|
|
@@ -646,11 +662,11 @@ class L {
|
|
|
646
662
|
insertVideo: "insertVideo",
|
|
647
663
|
codeBlock: "insertCodeBlock"
|
|
648
664
|
};
|
|
649
|
-
return o.forEach((
|
|
665
|
+
return o.forEach((a) => {
|
|
650
666
|
const l = [];
|
|
651
|
-
|
|
667
|
+
a.split(/\s+/).filter(Boolean).forEach((d) => {
|
|
652
668
|
if (d === "direction") {
|
|
653
|
-
const u = i.get("setDirectionLTR"),
|
|
669
|
+
const u = i.get("setDirectionLTR"), f = i.get("setDirectionRTL");
|
|
654
670
|
u && l.push({
|
|
655
671
|
id: "directionLTR",
|
|
656
672
|
label: u.label,
|
|
@@ -658,18 +674,18 @@ class L {
|
|
|
658
674
|
icon: u.icon,
|
|
659
675
|
type: u.type || "button",
|
|
660
676
|
options: u.options
|
|
661
|
-
}),
|
|
677
|
+
}), f && l.push({
|
|
662
678
|
id: "directionRTL",
|
|
663
|
-
label:
|
|
664
|
-
command:
|
|
665
|
-
icon:
|
|
666
|
-
type:
|
|
667
|
-
options:
|
|
679
|
+
label: f.label,
|
|
680
|
+
command: f.command,
|
|
681
|
+
icon: f.icon,
|
|
682
|
+
type: f.type || "button",
|
|
683
|
+
options: f.options
|
|
668
684
|
});
|
|
669
685
|
return;
|
|
670
686
|
}
|
|
671
687
|
if (d === "comments") {
|
|
672
|
-
const u = i.get("addComment"),
|
|
688
|
+
const u = i.get("addComment"), f = i.get("toggleComments");
|
|
673
689
|
u && l.push({
|
|
674
690
|
id: "addComment",
|
|
675
691
|
label: u.label,
|
|
@@ -677,18 +693,18 @@ class L {
|
|
|
677
693
|
icon: u.icon,
|
|
678
694
|
type: u.type || "button",
|
|
679
695
|
options: u.options
|
|
680
|
-
}),
|
|
696
|
+
}), f && l.push({
|
|
681
697
|
id: "toggleComments",
|
|
682
|
-
label:
|
|
683
|
-
command:
|
|
684
|
-
icon:
|
|
685
|
-
type:
|
|
686
|
-
options:
|
|
698
|
+
label: f.label,
|
|
699
|
+
command: f.command,
|
|
700
|
+
icon: f.icon,
|
|
701
|
+
type: f.type || "button",
|
|
702
|
+
options: f.options
|
|
687
703
|
});
|
|
688
704
|
return;
|
|
689
705
|
}
|
|
690
|
-
const
|
|
691
|
-
let p = i.get(
|
|
706
|
+
const h = r[d] || d;
|
|
707
|
+
let p = i.get(h);
|
|
692
708
|
p || (p = i.get(d)), p && l.push({
|
|
693
709
|
id: d,
|
|
694
710
|
label: p.label,
|
|
@@ -713,13 +729,13 @@ class L {
|
|
|
713
729
|
render(t) {
|
|
714
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}`);
|
|
715
731
|
const e = this.config.items || this.getDefaultToolbarString(), o = this.parseToolbarString(e);
|
|
716
|
-
o.forEach((
|
|
717
|
-
const
|
|
718
|
-
if (
|
|
719
|
-
this.appendToolbarButton(
|
|
720
|
-
}), t.appendChild(
|
|
721
|
-
const
|
|
722
|
-
|
|
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) {
|
|
737
|
+
const a = document.createElement("div");
|
|
738
|
+
a.className = "editora-toolbar-separator", t.appendChild(a);
|
|
723
739
|
}
|
|
724
740
|
});
|
|
725
741
|
}
|
|
@@ -751,18 +767,18 @@ class L {
|
|
|
751
767
|
* Create a toolbar button element
|
|
752
768
|
*/
|
|
753
769
|
createGroupButton(t) {
|
|
754
|
-
const e = document.createElement("div");
|
|
755
|
-
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)
|
|
756
772
|
if (t.icon.startsWith("<svg") && t.icon.endsWith("</svg>")) {
|
|
757
|
-
const
|
|
758
|
-
|
|
773
|
+
const n = document.createElement("span");
|
|
774
|
+
n.className = "editora-toolbar-icon", n.innerHTML = t.icon, e.appendChild(n);
|
|
759
775
|
} else
|
|
760
776
|
e.innerHTML = t.icon;
|
|
761
777
|
if (t.items && t.items.length) {
|
|
762
|
-
const
|
|
763
|
-
|
|
764
|
-
this.appendToolbarButton(
|
|
765
|
-
}), 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);
|
|
766
782
|
}
|
|
767
783
|
return e;
|
|
768
784
|
}
|
|
@@ -772,7 +788,7 @@ class L {
|
|
|
772
788
|
createInput(t) {
|
|
773
789
|
const e = document.createElement("input");
|
|
774
790
|
return e.className = `editora-toolbar-input ${t.label.toLowerCase().replace(/\s+/g, "-")}`, e.type = "text", e.title = t.label, e.placeholder = t.placeholder || "", t.command && e.setAttribute("data-command", t.command), t.active && e.classList.add("active"), t.disabled && (e.disabled = !0), e.addEventListener("click", (o) => {
|
|
775
|
-
o.preventDefault(), this.commandHandler && t.command && this.commandHandler(t.command);
|
|
791
|
+
o.preventDefault(), this.setLastCommandTrigger(e, t.command), this.commandHandler && t.command && this.commandHandler(t.command);
|
|
776
792
|
}), e;
|
|
777
793
|
}
|
|
778
794
|
/**
|
|
@@ -800,23 +816,25 @@ class L {
|
|
|
800
816
|
e.className = "editora-toolbar-dropdown";
|
|
801
817
|
const o = document.createElement("button");
|
|
802
818
|
o.className = "editora-toolbar-button editora-toolbar-dropdown-trigger", o.type = "button", o.textContent = t.label;
|
|
803
|
-
const
|
|
804
|
-
|
|
805
|
-
const
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
}),
|
|
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);
|
|
809
825
|
}), o.addEventListener("click", (a) => {
|
|
810
|
-
a.preventDefault(), a.stopPropagation();
|
|
811
|
-
const
|
|
812
|
-
|
|
826
|
+
a.preventDefault(), a.stopPropagation(), this.setLastCommandTrigger(o, t.command);
|
|
827
|
+
const l = n.style.display === "block";
|
|
828
|
+
n.style.display = l ? "none" : "block";
|
|
813
829
|
});
|
|
814
830
|
const i = (a) => {
|
|
815
|
-
e.contains(a.target) || (
|
|
831
|
+
e.contains(a.target) || (n.style.display = "none");
|
|
832
|
+
}, r = (a) => {
|
|
833
|
+
a.key === "Escape" && (n.style.display = "none");
|
|
816
834
|
};
|
|
817
|
-
return document.addEventListener("
|
|
818
|
-
document.removeEventListener("
|
|
819
|
-
}, 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;
|
|
820
838
|
}
|
|
821
839
|
/**
|
|
822
840
|
* Create an inline menu element (like dropdown but triggered by button click)
|
|
@@ -827,30 +845,36 @@ class L {
|
|
|
827
845
|
const o = document.createElement("button");
|
|
828
846
|
if (o.className = "editora-toolbar-button", o.type = "button", o.title = t.label, t.icon)
|
|
829
847
|
if (t.icon.startsWith("<svg") && t.icon.endsWith("</svg>")) {
|
|
830
|
-
const
|
|
831
|
-
|
|
848
|
+
const a = document.createElement("span");
|
|
849
|
+
a.className = "editora-toolbar-icon", a.innerHTML = t.icon, o.appendChild(a);
|
|
832
850
|
} else
|
|
833
851
|
o.innerHTML = t.icon;
|
|
834
852
|
else
|
|
835
853
|
o.textContent = t.label;
|
|
836
|
-
const
|
|
837
|
-
|
|
838
|
-
const
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
}),
|
|
842
|
-
}), o.addEventListener("click", (
|
|
843
|
-
var
|
|
844
|
-
|
|
845
|
-
const
|
|
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);
|
|
860
|
+
}), o.addEventListener("click", (a) => {
|
|
861
|
+
var c;
|
|
862
|
+
a.preventDefault(), a.stopPropagation(), this.setLastCommandTrigger(o, t.command);
|
|
863
|
+
const l = (c = this.container) == null ? void 0 : c.querySelectorAll(
|
|
846
864
|
".editora-toolbar-dropdown-menu"
|
|
847
865
|
);
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
}),
|
|
851
|
-
})
|
|
852
|
-
|
|
853
|
-
|
|
866
|
+
l == null || l.forEach((d) => {
|
|
867
|
+
d !== n && (d.style.display = "none");
|
|
868
|
+
}), n.style.display = n.style.display === "none" ? "block" : "none";
|
|
869
|
+
});
|
|
870
|
+
const i = (a) => {
|
|
871
|
+
e.contains(a.target) || (n.style.display = "none");
|
|
872
|
+
}, r = (a) => {
|
|
873
|
+
a.key === "Escape" && (n.style.display = "none");
|
|
874
|
+
};
|
|
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;
|
|
854
878
|
}
|
|
855
879
|
/**
|
|
856
880
|
* Get default toolbar string if none provided
|
|
@@ -878,7 +902,7 @@ class L {
|
|
|
878
902
|
}), this.container.innerHTML = ""), this.commandHandler = void 0;
|
|
879
903
|
}
|
|
880
904
|
}
|
|
881
|
-
class
|
|
905
|
+
class H {
|
|
882
906
|
constructor(t) {
|
|
883
907
|
this.visible = !1, this.config = t;
|
|
884
908
|
}
|
|
@@ -920,7 +944,7 @@ class T {
|
|
|
920
944
|
this.container && this.container.parentNode && this.container.parentNode.removeChild(this.container), this.container = void 0, this.visible = !1;
|
|
921
945
|
}
|
|
922
946
|
}
|
|
923
|
-
class
|
|
947
|
+
class j {
|
|
924
948
|
constructor(t = {}) {
|
|
925
949
|
this.statusInfo = {}, this.config = t;
|
|
926
950
|
}
|
|
@@ -956,18 +980,18 @@ class I {
|
|
|
956
980
|
o.push(`Ln ${i.line}, Col ${i.column}`);
|
|
957
981
|
}
|
|
958
982
|
this.statusInfo.language && o.push(this.statusInfo.language);
|
|
959
|
-
const
|
|
960
|
-
this.statusInfo.wordCount !== void 0 &&
|
|
961
|
-
|
|
962
|
-
}), o.forEach((i,
|
|
963
|
-
const
|
|
964
|
-
if (
|
|
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) => {
|
|
987
|
+
const a = document.createElement("span");
|
|
988
|
+
if (a.className = "editora-statusbar-item", a.textContent = i, t.appendChild(a), r < o.length - 1) {
|
|
965
989
|
const l = document.createElement("span");
|
|
966
990
|
l.className = "editora-statusbar-separator", l.textContent = "|", t.appendChild(l);
|
|
967
991
|
}
|
|
968
|
-
}),
|
|
969
|
-
const
|
|
970
|
-
if (
|
|
992
|
+
}), n.forEach((i, r) => {
|
|
993
|
+
const a = document.createElement("span");
|
|
994
|
+
if (a.className = "editora-statusbar-item", a.textContent = i, e.appendChild(a), r < n.length - 1) {
|
|
971
995
|
const l = document.createElement("span");
|
|
972
996
|
l.className = "editora-statusbar-separator", l.textContent = "|", e.appendChild(l);
|
|
973
997
|
}
|
|
@@ -980,49 +1004,49 @@ class I {
|
|
|
980
1004
|
this.container && this.container.parentNode && this.container.parentNode.removeChild(this.container), this.container = void 0;
|
|
981
1005
|
}
|
|
982
1006
|
}
|
|
983
|
-
function
|
|
984
|
-
const e = s.textContent || "", o =
|
|
985
|
-
`),
|
|
986
|
-
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 };
|
|
987
1011
|
}
|
|
988
|
-
function
|
|
989
|
-
var
|
|
1012
|
+
function $(s, t, e) {
|
|
1013
|
+
var r;
|
|
990
1014
|
let o = 0;
|
|
991
|
-
const
|
|
1015
|
+
const n = document.createTreeWalker(
|
|
992
1016
|
s,
|
|
993
1017
|
NodeFilter.SHOW_TEXT,
|
|
994
1018
|
null
|
|
995
1019
|
);
|
|
996
|
-
let i =
|
|
1020
|
+
let i = n.firstChild();
|
|
997
1021
|
for (; i; ) {
|
|
998
1022
|
if (i === t) {
|
|
999
1023
|
o += e;
|
|
1000
1024
|
break;
|
|
1001
|
-
} else i.nodeType === Node.TEXT_NODE && (o += ((
|
|
1002
|
-
i =
|
|
1025
|
+
} else i.nodeType === Node.TEXT_NODE && (o += ((r = i.textContent) == null ? void 0 : r.length) || 0);
|
|
1026
|
+
i = n.nextNode();
|
|
1003
1027
|
}
|
|
1004
1028
|
return o;
|
|
1005
1029
|
}
|
|
1006
|
-
function
|
|
1007
|
-
var o,
|
|
1030
|
+
function _(s) {
|
|
1031
|
+
var o, n;
|
|
1008
1032
|
const t = s.querySelectorAll("div, p, br, h1, h2, h3, h4, h5, h6, blockquote, li, pre");
|
|
1009
1033
|
let e = 1;
|
|
1010
1034
|
if (t.length > 0) {
|
|
1011
1035
|
e = t.length;
|
|
1012
1036
|
const i = t[t.length - 1];
|
|
1013
|
-
(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++;
|
|
1014
1038
|
} else {
|
|
1015
|
-
const
|
|
1039
|
+
const r = (s.textContent || "").split(`
|
|
1016
1040
|
`).length;
|
|
1017
|
-
e = Math.max(1,
|
|
1041
|
+
e = Math.max(1, r);
|
|
1018
1042
|
}
|
|
1019
1043
|
return e;
|
|
1020
1044
|
}
|
|
1021
|
-
function
|
|
1045
|
+
function W(s) {
|
|
1022
1046
|
const t = s.trim() ? s.trim().split(/\s+/).length : 0, e = s.length;
|
|
1023
1047
|
return { words: t, chars: e };
|
|
1024
1048
|
}
|
|
1025
|
-
function
|
|
1049
|
+
function U(s, t) {
|
|
1026
1050
|
const e = s.toString();
|
|
1027
1051
|
return {
|
|
1028
1052
|
startLine: t.line,
|
|
@@ -1034,7 +1058,7 @@ function B(s, t) {
|
|
|
1034
1058
|
selectedWords: e.trim().split(/\s+/).filter(Boolean).length
|
|
1035
1059
|
};
|
|
1036
1060
|
}
|
|
1037
|
-
const
|
|
1061
|
+
const E = class E {
|
|
1038
1062
|
/**
|
|
1039
1063
|
* Resolve configuration from multiple sources with priority
|
|
1040
1064
|
*/
|
|
@@ -1052,12 +1076,12 @@ const v = class v {
|
|
|
1052
1076
|
static normalizeConfig(t) {
|
|
1053
1077
|
const e = { ...t };
|
|
1054
1078
|
if (e.toolbarFloating !== void 0 || e.toolbarSticky !== void 0) {
|
|
1055
|
-
const
|
|
1056
|
-
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;
|
|
1057
1081
|
}
|
|
1058
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) {
|
|
1059
|
-
const
|
|
1060
|
-
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;
|
|
1061
1085
|
}
|
|
1062
1086
|
const o = {
|
|
1063
1087
|
enabled: !1,
|
|
@@ -1072,27 +1096,27 @@ const v = class v {
|
|
|
1072
1096
|
enabled: e.autosave
|
|
1073
1097
|
};
|
|
1074
1098
|
else if (typeof e.autosave == "object" && e.autosave) {
|
|
1075
|
-
const
|
|
1099
|
+
const r = {
|
|
1076
1100
|
...o,
|
|
1077
1101
|
...e.autosave
|
|
1078
1102
|
};
|
|
1079
|
-
|
|
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;
|
|
1080
1104
|
} else
|
|
1081
1105
|
e.autosave = o;
|
|
1082
1106
|
if (e.languageLocale !== void 0 || e.languageDirection !== void 0) {
|
|
1083
|
-
const
|
|
1084
|
-
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;
|
|
1085
1109
|
}
|
|
1086
|
-
const
|
|
1110
|
+
const n = { locale: "en", direction: "ltr" };
|
|
1087
1111
|
if (typeof e.language == "string" ? e.language = {
|
|
1088
1112
|
locale: e.language,
|
|
1089
|
-
direction:
|
|
1113
|
+
direction: n.direction
|
|
1090
1114
|
} : typeof e.language == "object" && e.language ? e.language = {
|
|
1091
|
-
...
|
|
1115
|
+
...n,
|
|
1092
1116
|
...e.language
|
|
1093
|
-
} : e.language =
|
|
1094
|
-
const
|
|
1095
|
-
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;
|
|
1096
1120
|
}
|
|
1097
1121
|
const i = {
|
|
1098
1122
|
enabled: !1,
|
|
@@ -1105,11 +1129,11 @@ const v = class v {
|
|
|
1105
1129
|
enabled: e.spellcheck
|
|
1106
1130
|
};
|
|
1107
1131
|
else if (typeof e.spellcheck == "object" && e.spellcheck) {
|
|
1108
|
-
const
|
|
1132
|
+
const r = {
|
|
1109
1133
|
...i,
|
|
1110
1134
|
...e.spellcheck
|
|
1111
1135
|
};
|
|
1112
|
-
!
|
|
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;
|
|
1113
1137
|
} else
|
|
1114
1138
|
e.spellcheck = i;
|
|
1115
1139
|
return e.contextMenuEnabled !== void 0 && (e.contextMenu = {
|
|
@@ -1171,9 +1195,9 @@ const v = class v {
|
|
|
1171
1195
|
*/
|
|
1172
1196
|
static parseAttributes(t) {
|
|
1173
1197
|
const e = {};
|
|
1174
|
-
for (const [o,
|
|
1198
|
+
for (const [o, n] of Object.entries(t)) {
|
|
1175
1199
|
const i = this.kebabToCamel(o);
|
|
1176
|
-
e[i] = this.parseAttributeValue(
|
|
1200
|
+
e[i] = this.parseAttributeValue(n);
|
|
1177
1201
|
}
|
|
1178
1202
|
return e;
|
|
1179
1203
|
}
|
|
@@ -1221,12 +1245,12 @@ const v = class v {
|
|
|
1221
1245
|
static merge(...t) {
|
|
1222
1246
|
const e = {};
|
|
1223
1247
|
for (const o of t)
|
|
1224
|
-
for (const [
|
|
1225
|
-
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);
|
|
1226
1250
|
return e;
|
|
1227
1251
|
}
|
|
1228
1252
|
};
|
|
1229
|
-
|
|
1253
|
+
E.EDITOR_DEFAULTS = {
|
|
1230
1254
|
height: 400,
|
|
1231
1255
|
width: "100%",
|
|
1232
1256
|
readonly: !1,
|
|
@@ -1276,8 +1300,8 @@ v.EDITOR_DEFAULTS = {
|
|
|
1276
1300
|
},
|
|
1277
1301
|
statusbar: !1
|
|
1278
1302
|
};
|
|
1279
|
-
let
|
|
1280
|
-
class
|
|
1303
|
+
let w = E;
|
|
1304
|
+
class K {
|
|
1281
1305
|
constructor() {
|
|
1282
1306
|
this.loadedPlugins = /* @__PURE__ */ new Map(), this.pluginRegistry = /* @__PURE__ */ new Map();
|
|
1283
1307
|
}
|
|
@@ -1296,16 +1320,16 @@ class O {
|
|
|
1296
1320
|
const o = this.pluginRegistry.get(t);
|
|
1297
1321
|
if (!o)
|
|
1298
1322
|
return console.warn(`Plugin not found: ${t}`), null;
|
|
1299
|
-
const
|
|
1300
|
-
return e && this.applyPluginConfig(
|
|
1323
|
+
const n = await o();
|
|
1324
|
+
return e && this.applyPluginConfig(n, e), this.loadedPlugins.set(t, n), n;
|
|
1301
1325
|
}
|
|
1302
1326
|
/**
|
|
1303
1327
|
* Load multiple plugins
|
|
1304
1328
|
*/
|
|
1305
1329
|
async loadMultiple(t, e) {
|
|
1306
1330
|
return (await Promise.all(
|
|
1307
|
-
t.map((
|
|
1308
|
-
)).filter((
|
|
1331
|
+
t.map((n) => this.load(n, e))
|
|
1332
|
+
)).filter((n) => n !== null);
|
|
1309
1333
|
}
|
|
1310
1334
|
/**
|
|
1311
1335
|
* Parse plugin string "lists link image media"
|
|
@@ -1351,7 +1375,7 @@ class O {
|
|
|
1351
1375
|
return this.loadedPlugins.has(t);
|
|
1352
1376
|
}
|
|
1353
1377
|
}
|
|
1354
|
-
const
|
|
1378
|
+
const q = [
|
|
1355
1379
|
"p",
|
|
1356
1380
|
"br",
|
|
1357
1381
|
"strong",
|
|
@@ -1386,11 +1410,12 @@ const j = [
|
|
|
1386
1410
|
"code",
|
|
1387
1411
|
"span",
|
|
1388
1412
|
"div",
|
|
1413
|
+
"section",
|
|
1389
1414
|
"sup",
|
|
1390
1415
|
"sub",
|
|
1391
1416
|
"hr"
|
|
1392
|
-
],
|
|
1393
|
-
"*": ["class", "style", "id", "data-*"],
|
|
1417
|
+
], V = {
|
|
1418
|
+
"*": ["class", "style", "id", "data-*", "role", "aria-*", "tabindex", "contenteditable", "spellcheck"],
|
|
1394
1419
|
a: ["href", "target", "rel", "title"],
|
|
1395
1420
|
img: ["src", "alt", "width", "height", "loading"],
|
|
1396
1421
|
video: ["src", "controls", "width", "height", "autoplay", "loop", "muted"],
|
|
@@ -1399,75 +1424,135 @@ const j = [
|
|
|
1399
1424
|
td: ["colspan", "rowspan", "align", "valign"],
|
|
1400
1425
|
th: ["colspan", "rowspan", "align", "valign"]
|
|
1401
1426
|
};
|
|
1402
|
-
function
|
|
1427
|
+
function L(s, t, e) {
|
|
1403
1428
|
if ((t == null ? void 0 : t.sanitize) === !1)
|
|
1404
1429
|
return s;
|
|
1405
|
-
const o = t != null && t.allowedTags && t.allowedTags.length > 0 ? t.allowedTags :
|
|
1406
|
-
return
|
|
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;
|
|
1407
1432
|
}
|
|
1408
|
-
function
|
|
1433
|
+
function I(s, t, e) {
|
|
1409
1434
|
const o = Array.from(s.childNodes);
|
|
1410
|
-
for (const
|
|
1411
|
-
if (
|
|
1412
|
-
const i =
|
|
1413
|
-
if (!t.includes(
|
|
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)) {
|
|
1414
1439
|
for (; i.firstChild; )
|
|
1415
1440
|
s.insertBefore(i.firstChild, i);
|
|
1416
1441
|
s.removeChild(i);
|
|
1417
1442
|
continue;
|
|
1418
1443
|
}
|
|
1419
|
-
|
|
1420
|
-
} else
|
|
1444
|
+
G(i, e), I(i, t, e);
|
|
1445
|
+
} else n.nodeType !== Node.TEXT_NODE && s.removeChild(n);
|
|
1421
1446
|
}
|
|
1422
|
-
function
|
|
1423
|
-
const e = s.tagName.toLowerCase(), o = Array.from(s.attributes),
|
|
1424
|
-
for (const
|
|
1425
|
-
const l =
|
|
1447
|
+
function G(s, t) {
|
|
1448
|
+
const e = s.tagName.toLowerCase(), o = Array.from(s.attributes), n = t[e] || [], i = t["*"] || [], r = [...n, ...i];
|
|
1449
|
+
for (const a of o) {
|
|
1450
|
+
const l = a.name.toLowerCase();
|
|
1426
1451
|
let c = !1;
|
|
1427
|
-
|
|
1428
|
-
for (const d of
|
|
1452
|
+
r.includes(l) && (c = !0);
|
|
1453
|
+
for (const d of r)
|
|
1429
1454
|
if (d.endsWith("*")) {
|
|
1430
|
-
const
|
|
1431
|
-
if (l.startsWith(
|
|
1455
|
+
const h = d.slice(0, -1);
|
|
1456
|
+
if (l.startsWith(h)) {
|
|
1432
1457
|
c = !0;
|
|
1433
1458
|
break;
|
|
1434
1459
|
}
|
|
1435
1460
|
}
|
|
1436
|
-
(l.startsWith("on") || l === "javascript:" || l === "href" &&
|
|
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);
|
|
1437
1462
|
}
|
|
1438
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");
|
|
1439
1464
|
}
|
|
1440
|
-
function
|
|
1441
|
-
return (e == null ? void 0 : e.sanitizeOnPaste) === !1 ? s :
|
|
1465
|
+
function X(s, t, e) {
|
|
1466
|
+
return (e == null ? void 0 : e.sanitizeOnPaste) === !1 ? s : L(s, t);
|
|
1442
1467
|
}
|
|
1443
|
-
function
|
|
1444
|
-
return (e == null ? void 0 : e.sanitizeOnInput) === !1 ? s :
|
|
1468
|
+
function Y(s, t, e) {
|
|
1469
|
+
return (e == null ? void 0 : e.sanitizeOnInput) === !1 ? s : L(s, t);
|
|
1470
|
+
}
|
|
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"));
|
|
1445
1479
|
}
|
|
1446
|
-
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}}';
|
|
1447
|
-
|
|
1448
|
-
|
|
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() {
|
|
1449
1534
|
const s = "editora-webcomponent-styles";
|
|
1450
1535
|
if (!document.getElementById(s)) {
|
|
1451
1536
|
const t = document.createElement("style");
|
|
1452
|
-
t.id = s, t.textContent =
|
|
1537
|
+
t.id = s, t.textContent = J, document.head.appendChild(t);
|
|
1453
1538
|
}
|
|
1454
1539
|
}
|
|
1455
|
-
function
|
|
1456
|
-
if (!
|
|
1457
|
-
const s =
|
|
1458
|
-
s ?
|
|
1540
|
+
function D() {
|
|
1541
|
+
if (!y) {
|
|
1542
|
+
const s = m.__globalPluginLoader;
|
|
1543
|
+
s ? y = s : y = new K();
|
|
1459
1544
|
}
|
|
1460
|
-
return
|
|
1545
|
+
return y;
|
|
1461
1546
|
}
|
|
1462
|
-
function
|
|
1463
|
-
const t =
|
|
1547
|
+
function nt(s) {
|
|
1548
|
+
const t = D();
|
|
1464
1549
|
Object.entries(s).forEach(([e, o]) => {
|
|
1465
1550
|
t.register(e, o);
|
|
1466
1551
|
});
|
|
1467
1552
|
}
|
|
1468
|
-
class
|
|
1553
|
+
class m extends HTMLElement {
|
|
1469
1554
|
constructor() {
|
|
1470
|
-
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")) {
|
|
1471
1556
|
const t = this.innerHTML.trim();
|
|
1472
1557
|
t && this.setAttribute("data-initial-content", t);
|
|
1473
1558
|
}
|
|
@@ -1533,13 +1618,13 @@ class g extends HTMLElement {
|
|
|
1533
1618
|
* Wait for the global plugin loader to be available
|
|
1534
1619
|
*/
|
|
1535
1620
|
async waitForPluginLoader() {
|
|
1536
|
-
if (
|
|
1537
|
-
this.pluginLoader =
|
|
1621
|
+
if (m.__globalPluginLoader) {
|
|
1622
|
+
this.pluginLoader = m.__globalPluginLoader;
|
|
1538
1623
|
return;
|
|
1539
1624
|
}
|
|
1540
1625
|
return new Promise((t) => {
|
|
1541
1626
|
const e = () => {
|
|
1542
|
-
|
|
1627
|
+
m.__globalPluginLoader ? (this.pluginLoader = m.__globalPluginLoader, t()) : setTimeout(e, 0);
|
|
1543
1628
|
};
|
|
1544
1629
|
e();
|
|
1545
1630
|
});
|
|
@@ -1568,18 +1653,18 @@ class g extends HTMLElement {
|
|
|
1568
1653
|
async initialize() {
|
|
1569
1654
|
var o;
|
|
1570
1655
|
if (this.querySelector(".editora-toolbar") || this.isInitialized) return;
|
|
1571
|
-
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}`);
|
|
1572
1657
|
const t = await this.loadPlugins();
|
|
1573
|
-
this.loadedPlugins = t, t.forEach((
|
|
1574
|
-
if (
|
|
1658
|
+
this.loadedPlugins = t, t.forEach((n) => {
|
|
1659
|
+
if (n.init && typeof n.init == "function")
|
|
1575
1660
|
try {
|
|
1576
|
-
|
|
1661
|
+
n.init({ editorElement: this });
|
|
1577
1662
|
} catch (i) {
|
|
1578
|
-
console.error(`[RichTextEditor] Error initializing plugin ${
|
|
1663
|
+
console.error(`[RichTextEditor] Error initializing plugin ${n.name}:`, i);
|
|
1579
1664
|
}
|
|
1580
1665
|
});
|
|
1581
1666
|
const e = (o = this.restoreAutosavedContent()) != null ? o : this.getAttribute("data-initial-content") || "";
|
|
1582
|
-
this.engine = new
|
|
1667
|
+
this.engine = new z({
|
|
1583
1668
|
content: e,
|
|
1584
1669
|
plugins: t,
|
|
1585
1670
|
readonly: this.config.readonly
|
|
@@ -1602,32 +1687,32 @@ class g extends HTMLElement {
|
|
|
1602
1687
|
*/
|
|
1603
1688
|
async loadPlugins() {
|
|
1604
1689
|
this.pluginLoader || await this.waitForPluginLoader();
|
|
1605
|
-
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;
|
|
1606
1691
|
if (e) {
|
|
1607
1692
|
if (typeof this.config.plugins == "string") {
|
|
1608
1693
|
const i = this.config.plugins.split(/\s+/).filter(Boolean);
|
|
1609
|
-
|
|
1610
|
-
for (const
|
|
1611
|
-
const
|
|
1612
|
-
|
|
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));
|
|
1697
|
+
a && t.push(a);
|
|
1613
1698
|
}
|
|
1614
1699
|
} else if (Array.isArray(this.config.plugins)) {
|
|
1615
1700
|
for (const i of this.config.plugins)
|
|
1616
1701
|
if (typeof i == "string") {
|
|
1617
|
-
const
|
|
1618
|
-
|
|
1702
|
+
const r = await this.pluginLoader.load(i, this.getPluginLoadConfig(i));
|
|
1703
|
+
r && t.push(r);
|
|
1619
1704
|
} else
|
|
1620
1705
|
t.push(i);
|
|
1621
|
-
if (
|
|
1706
|
+
if (n && !t.some((i) => (i == null ? void 0 : i.name) === "a11yChecker")) {
|
|
1622
1707
|
const i = await this.pluginLoader.load("a11yChecker", this.getPluginLoadConfig("a11yChecker"));
|
|
1623
1708
|
i && t.push(i);
|
|
1624
1709
|
}
|
|
1625
1710
|
}
|
|
1626
1711
|
} else {
|
|
1627
1712
|
const i = this.pluginLoader.getRegisteredPluginNames();
|
|
1628
|
-
for (const
|
|
1629
|
-
const
|
|
1630
|
-
|
|
1713
|
+
for (const r of i) {
|
|
1714
|
+
const a = await this.pluginLoader.load(r, this.getPluginLoadConfig(r));
|
|
1715
|
+
a && t.push(a);
|
|
1631
1716
|
}
|
|
1632
1717
|
}
|
|
1633
1718
|
return t;
|
|
@@ -1746,19 +1831,23 @@ class g extends HTMLElement {
|
|
|
1746
1831
|
this.contentElement.spellcheck = e, this.contentElement.setAttribute("spellcheck", e ? "true" : "false");
|
|
1747
1832
|
}
|
|
1748
1833
|
executeCommand(t, e) {
|
|
1749
|
-
var
|
|
1834
|
+
var i;
|
|
1750
1835
|
typeof window != "undefined" && (window.__editoraCommandEditorRoot = this);
|
|
1751
|
-
const o =
|
|
1752
|
-
|
|
1753
|
-
|
|
1754
|
-
|
|
1836
|
+
const o = {
|
|
1837
|
+
editorElement: this,
|
|
1838
|
+
contentElement: this.contentElement,
|
|
1839
|
+
toolbarElement: this.toolbarElement
|
|
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")
|
|
1755
1844
|
try {
|
|
1756
|
-
return
|
|
1845
|
+
return r(t === "toggleFullscreen" ? this : e, o), !0;
|
|
1757
1846
|
} catch (a) {
|
|
1758
1847
|
return console.error(`[RichTextEditor] Error executing native command ${t}:`, a), !1;
|
|
1759
1848
|
}
|
|
1760
1849
|
}
|
|
1761
|
-
return ((
|
|
1850
|
+
return ((i = this.engine) == null ? void 0 : i.execCommand(t, e)) || !1;
|
|
1762
1851
|
}
|
|
1763
1852
|
getPluginLoadConfig(t) {
|
|
1764
1853
|
const e = this.config.pluginConfig;
|
|
@@ -1768,16 +1857,29 @@ class g extends HTMLElement {
|
|
|
1768
1857
|
return i;
|
|
1769
1858
|
}
|
|
1770
1859
|
const o = {
|
|
1771
|
-
spellCheck: ["spellcheck", "spellCheck"]
|
|
1772
|
-
|
|
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 = [
|
|
1773
1875
|
t,
|
|
1774
1876
|
t.toLowerCase(),
|
|
1775
1877
|
...o[t] || []
|
|
1776
1878
|
];
|
|
1777
|
-
for (const i of
|
|
1778
|
-
const
|
|
1779
|
-
if (
|
|
1780
|
-
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;
|
|
1781
1883
|
}
|
|
1782
1884
|
}
|
|
1783
1885
|
getContentSanitizeConfig() {
|
|
@@ -1799,10 +1901,10 @@ class g extends HTMLElement {
|
|
|
1799
1901
|
provider: "localStorage"
|
|
1800
1902
|
};
|
|
1801
1903
|
if (t && typeof t == "object") {
|
|
1802
|
-
const
|
|
1904
|
+
const n = Number((o = (e = t.intervalMs) != null ? e : t.interval) != null ? o : 3e4);
|
|
1803
1905
|
return {
|
|
1804
1906
|
enabled: !!t.enabled,
|
|
1805
|
-
intervalMs: Number.isFinite(
|
|
1907
|
+
intervalMs: Number.isFinite(n) && n > 0 ? n : 3e4,
|
|
1806
1908
|
storageKey: String(t.storageKey || "rte-autosave"),
|
|
1807
1909
|
provider: t.provider || "localStorage",
|
|
1808
1910
|
apiUrl: t.apiUrl
|
|
@@ -1864,11 +1966,11 @@ class g extends HTMLElement {
|
|
|
1864
1966
|
if (e && e.rangeCount > 0) {
|
|
1865
1967
|
const o = e.getRangeAt(0);
|
|
1866
1968
|
o.deleteContents();
|
|
1867
|
-
const
|
|
1868
|
-
|
|
1969
|
+
const n = document.createElement("div");
|
|
1970
|
+
n.innerHTML = t;
|
|
1869
1971
|
const i = document.createDocumentFragment();
|
|
1870
|
-
for (;
|
|
1871
|
-
i.appendChild(
|
|
1972
|
+
for (; n.firstChild; )
|
|
1973
|
+
i.appendChild(n.firstChild);
|
|
1872
1974
|
o.insertNode(i), o.collapse(!1), e.removeAllRanges(), e.addRange(o);
|
|
1873
1975
|
} else
|
|
1874
1976
|
this.contentElement.focus(), document.execCommand("insertHTML", !1, t);
|
|
@@ -1877,8 +1979,8 @@ class g extends HTMLElement {
|
|
|
1877
1979
|
* Create UI elements
|
|
1878
1980
|
*/
|
|
1879
1981
|
createUI(t, e) {
|
|
1880
|
-
const o = this.querySelector('[slot="toolbar"]'),
|
|
1881
|
-
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(
|
|
1882
1984
|
{
|
|
1883
1985
|
items: this.resolveToolbarItems(),
|
|
1884
1986
|
sticky: this.isToolbarStickyEnabled(),
|
|
@@ -1887,17 +1989,17 @@ class g extends HTMLElement {
|
|
|
1887
1989
|
t,
|
|
1888
1990
|
this.pluginLoader
|
|
1889
1991
|
// Pass plugin loader to get all registered plugins
|
|
1890
|
-
), this.toolbar.setCommandHandler((i,
|
|
1891
|
-
var
|
|
1992
|
+
), this.toolbar.setCommandHandler((i, r) => {
|
|
1993
|
+
var a;
|
|
1892
1994
|
if (this.contentElement) {
|
|
1893
1995
|
this.contentElement.focus();
|
|
1894
1996
|
const l = window.getSelection();
|
|
1895
1997
|
if (!l || l.rangeCount === 0 || !this.contentElement.contains(l.anchorNode)) {
|
|
1896
1998
|
const c = document.createRange(), d = this.contentElement.lastChild || this.contentElement;
|
|
1897
|
-
d.nodeType === Node.TEXT_NODE ? c.setStart(d, ((
|
|
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);
|
|
1898
2000
|
}
|
|
1899
2001
|
}
|
|
1900
|
-
return this.executeCommand(i,
|
|
2002
|
+
return this.executeCommand(i, r);
|
|
1901
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);
|
|
1902
2004
|
try {
|
|
1903
2005
|
document.execCommand("defaultParagraphSeparator", !1, "p");
|
|
@@ -1906,16 +2008,16 @@ class g extends HTMLElement {
|
|
|
1906
2008
|
}
|
|
1907
2009
|
if (e) {
|
|
1908
2010
|
const i = document.createElement("div");
|
|
1909
|
-
i.innerHTML = e.trim(), !Array.from(i.childNodes).some((
|
|
1910
|
-
if (
|
|
1911
|
-
const l =
|
|
2011
|
+
i.innerHTML = e.trim(), !Array.from(i.childNodes).some((a) => {
|
|
2012
|
+
if (a.nodeType === Node.ELEMENT_NODE) {
|
|
2013
|
+
const l = a.tagName;
|
|
1912
2014
|
return ["P", "DIV", "H1", "H2", "H3", "H4", "H5", "H6", "UL", "OL", "BLOCKQUOTE", "PRE"].includes(l);
|
|
1913
2015
|
}
|
|
1914
2016
|
return !1;
|
|
1915
2017
|
}) && e.trim() ? this.contentElement.innerHTML = `<p>${e.trim()}</p>` : this.contentElement.innerHTML = e;
|
|
1916
2018
|
} else
|
|
1917
2019
|
this.config.placeholder ? this.contentElement.innerHTML = "" : this.contentElement.innerHTML = "<p><br></p>";
|
|
1918
|
-
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(() => {
|
|
1919
2021
|
var i;
|
|
1920
2022
|
return (i = this.contentElement) == null ? void 0 : i.focus();
|
|
1921
2023
|
}, 0);
|
|
@@ -1926,66 +2028,70 @@ class g extends HTMLElement {
|
|
|
1926
2028
|
setupEventListeners() {
|
|
1927
2029
|
if (!this.contentElement || !this.engine) return;
|
|
1928
2030
|
const t = this.keyboardShortcutManager;
|
|
1929
|
-
this.contentElement.addEventListener("
|
|
2031
|
+
this.contentElement.addEventListener("beforeinput", (o) => {
|
|
2032
|
+
this.lastBeforeInputType = o.inputType || null;
|
|
2033
|
+
}), this.contentElement.addEventListener("input", () => {
|
|
1930
2034
|
if (!this.contentElement) return;
|
|
1931
2035
|
let o = this.contentElement.innerHTML;
|
|
1932
|
-
const
|
|
1933
|
-
if (
|
|
1934
|
-
const
|
|
1935
|
-
if (
|
|
1936
|
-
const
|
|
1937
|
-
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)
|
|
1938
2042
|
try {
|
|
1939
|
-
|
|
1940
|
-
} catch (
|
|
2043
|
+
h.removeAllRanges(), h.addRange(p);
|
|
2044
|
+
} catch (u) {
|
|
1941
2045
|
}
|
|
1942
|
-
o =
|
|
2046
|
+
o = d;
|
|
1943
2047
|
}
|
|
1944
2048
|
}
|
|
1945
2049
|
this.contentChangeDebounceTimer && clearTimeout(this.contentChangeDebounceTimer);
|
|
1946
|
-
const
|
|
2050
|
+
const c = () => {
|
|
1947
2051
|
this.dispatchEvent(new CustomEvent("content-change", {
|
|
1948
2052
|
detail: { html: o },
|
|
1949
2053
|
bubbles: !0
|
|
1950
2054
|
}));
|
|
1951
2055
|
};
|
|
1952
|
-
|
|
2056
|
+
n.debounceInputMs > 0 ? this.contentChangeDebounceTimer = setTimeout(c, n.debounceInputMs) : c(), this.updateStatusBar();
|
|
1953
2057
|
}), this.contentElement.addEventListener("contextmenu", (o) => {
|
|
1954
|
-
const
|
|
1955
|
-
(
|
|
2058
|
+
const n = this.config.contextMenu;
|
|
2059
|
+
(n === !1 || typeof n == "object" && n !== null && n.enabled === !1) && o.preventDefault();
|
|
1956
2060
|
}), this.contentElement.addEventListener("paste", (o) => {
|
|
1957
|
-
var d,
|
|
2061
|
+
var d, h;
|
|
2062
|
+
if (o.__editoraSmartPasteHandled === !0 || o.defaultPrevented)
|
|
2063
|
+
return;
|
|
1958
2064
|
o.preventDefault();
|
|
1959
|
-
const
|
|
2065
|
+
const n = this.config.paste || {};
|
|
1960
2066
|
let i = ((d = o.clipboardData) == null ? void 0 : d.getData("text/html")) || "";
|
|
1961
|
-
const
|
|
1962
|
-
if ((
|
|
1963
|
-
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);
|
|
1964
2070
|
return;
|
|
1965
2071
|
}
|
|
1966
|
-
if (
|
|
1967
|
-
document.execCommand("insertText", !1,
|
|
2072
|
+
if (n.convertWord === !1 && c && r) {
|
|
2073
|
+
document.execCommand("insertText", !1, r);
|
|
1968
2074
|
return;
|
|
1969
2075
|
}
|
|
1970
2076
|
if (i) {
|
|
1971
|
-
l.sanitizeOnPaste !== !1 &&
|
|
2077
|
+
l.sanitizeOnPaste !== !1 && a.sanitize !== !1 && (i = X(i, a, l)), this.insertHTMLAtSelection(i);
|
|
1972
2078
|
return;
|
|
1973
2079
|
}
|
|
1974
|
-
|
|
2080
|
+
r && document.execCommand("insertText", !1, r);
|
|
1975
2081
|
}), this.contentElement.addEventListener("focus", () => {
|
|
1976
|
-
this.dispatchEvent(new Event("editor-focus", { bubbles: !0 })), this.updateStatusBar();
|
|
2082
|
+
g = this, this.dispatchEvent(new Event("editor-focus", { bubbles: !0 })), this.updateStatusBar();
|
|
1977
2083
|
}), this.contentElement.addEventListener("blur", () => {
|
|
1978
2084
|
this.contentChangeDebounceTimer && (clearTimeout(this.contentChangeDebounceTimer), this.contentChangeDebounceTimer = void 0), this.contentElement && this.dispatchEvent(new CustomEvent("content-change", {
|
|
1979
2085
|
detail: { html: this.contentElement.innerHTML },
|
|
1980
2086
|
bubbles: !0
|
|
1981
2087
|
})), this.dispatchEvent(new Event("editor-blur", { bubbles: !0 })), this.updateFloatingToolbar(), this.updateStatusBar();
|
|
1982
2088
|
}), this.contentElement.addEventListener("keydown", (o) => {
|
|
1983
|
-
this.getAccessibilityConfig().keyboardNavigation && t.handleKeyDown(o, (i,
|
|
1984
|
-
this.executeCommand(i,
|
|
2089
|
+
this.getAccessibilityConfig().keyboardNavigation && t.handleKeyDown(o, (i, r) => {
|
|
2090
|
+
this.executeCommand(i, r);
|
|
1985
2091
|
});
|
|
1986
2092
|
});
|
|
1987
2093
|
const e = () => {
|
|
1988
|
-
const o = this.getSelectionRangeInEditor(),
|
|
2094
|
+
const o = this.getSelectionRangeInEditor(), n = document.activeElement, i = !!n && !!this.contentElement && (n === this.contentElement || this.contentElement.contains(n));
|
|
1989
2095
|
this.getPerformanceConfig().viewportOnlyScan && !this.isEditorInViewport() && !i || !o && !i || (this.updateFloatingToolbar(), this.updateStatusBar());
|
|
1990
2096
|
};
|
|
1991
2097
|
this.selectionChangeHandler = e, document.addEventListener("selectionchange", this.selectionChangeHandler);
|
|
@@ -2015,32 +2121,36 @@ class g extends HTMLElement {
|
|
|
2015
2121
|
* Update floating toolbar position
|
|
2016
2122
|
*/
|
|
2017
2123
|
updateFloatingToolbar() {
|
|
2018
|
-
if (!this.floatingToolbar) return;
|
|
2019
|
-
|
|
2020
|
-
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") {
|
|
2021
2126
|
this.floatingToolbar.hide();
|
|
2022
2127
|
return;
|
|
2023
2128
|
}
|
|
2024
|
-
const o = this.
|
|
2025
|
-
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) {
|
|
2026
2131
|
this.floatingToolbar.hide();
|
|
2027
2132
|
return;
|
|
2028
2133
|
}
|
|
2029
|
-
|
|
2134
|
+
const n = this.getSelectionRangeInEditor();
|
|
2135
|
+
if (!n) {
|
|
2030
2136
|
this.floatingToolbar.hide();
|
|
2031
2137
|
return;
|
|
2032
2138
|
}
|
|
2033
|
-
|
|
2034
|
-
if (!r) {
|
|
2139
|
+
if (n.collapsed) {
|
|
2035
2140
|
this.floatingToolbar.hide();
|
|
2036
2141
|
return;
|
|
2037
2142
|
}
|
|
2038
|
-
const i =
|
|
2143
|
+
const i = window.getSelection();
|
|
2039
2144
|
if (!i) {
|
|
2040
2145
|
this.floatingToolbar.hide();
|
|
2041
2146
|
return;
|
|
2042
2147
|
}
|
|
2043
|
-
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);
|
|
2044
2154
|
}
|
|
2045
2155
|
/**
|
|
2046
2156
|
* Update status bar with selection and cursor information
|
|
@@ -2053,14 +2163,14 @@ class g extends HTMLElement {
|
|
|
2053
2163
|
const t = this.getPerformanceConfig(), e = document.activeElement === this.contentElement || this.contentElement.contains(document.activeElement);
|
|
2054
2164
|
if (t.viewportOnlyScan && !this.isEditorInViewport() && !e)
|
|
2055
2165
|
return;
|
|
2056
|
-
const o = this.contentElement.textContent || "", { words:
|
|
2057
|
-
let
|
|
2166
|
+
const o = this.contentElement.textContent || "", { words: n, chars: i } = W(o), r = _(this.contentElement);
|
|
2167
|
+
let a, l;
|
|
2058
2168
|
const c = this.getSelectionRangeInEditor();
|
|
2059
|
-
c && (
|
|
2060
|
-
wordCount:
|
|
2169
|
+
c && (a = F(this.contentElement, c), c.collapsed || (l = U(c, a), a = void 0)), this.statusBar.update({
|
|
2170
|
+
wordCount: n,
|
|
2061
2171
|
charCount: i,
|
|
2062
|
-
lineCount:
|
|
2063
|
-
cursorPosition:
|
|
2172
|
+
lineCount: r,
|
|
2173
|
+
cursorPosition: a,
|
|
2064
2174
|
selectionInfo: l
|
|
2065
2175
|
});
|
|
2066
2176
|
}
|
|
@@ -2141,7 +2251,7 @@ class g extends HTMLElement {
|
|
|
2141
2251
|
const o = this.attributes[e];
|
|
2142
2252
|
t[o.name] = o.value;
|
|
2143
2253
|
}
|
|
2144
|
-
return
|
|
2254
|
+
return w.resolve({
|
|
2145
2255
|
jsConfig: this.jsConfig,
|
|
2146
2256
|
attributes: t
|
|
2147
2257
|
});
|
|
@@ -2181,8 +2291,8 @@ class g extends HTMLElement {
|
|
|
2181
2291
|
* Destroy the editor
|
|
2182
2292
|
*/
|
|
2183
2293
|
destroy() {
|
|
2184
|
-
var t, e, o,
|
|
2185
|
-
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 }));
|
|
2186
2296
|
}
|
|
2187
2297
|
// Public API methods
|
|
2188
2298
|
getContent() {
|
|
@@ -2205,23 +2315,23 @@ class g extends HTMLElement {
|
|
|
2205
2315
|
}
|
|
2206
2316
|
}
|
|
2207
2317
|
export {
|
|
2208
|
-
|
|
2209
|
-
|
|
2210
|
-
|
|
2211
|
-
|
|
2212
|
-
|
|
2213
|
-
|
|
2214
|
-
|
|
2215
|
-
|
|
2216
|
-
|
|
2217
|
-
|
|
2218
|
-
|
|
2219
|
-
|
|
2220
|
-
|
|
2221
|
-
|
|
2222
|
-
|
|
2223
|
-
|
|
2224
|
-
|
|
2225
|
-
|
|
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
|
|
2226
2336
|
};
|
|
2227
|
-
//# sourceMappingURL=index-
|
|
2337
|
+
//# sourceMappingURL=index-DqC57IEH.mjs.map
|