@editora/core 1.0.5 → 1.0.7
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/dist/{AnchorPlugin.native-C1Rw5m04.mjs → AnchorPlugin.native-BcYGEtd9.mjs} +129 -105
- package/dist/{BackgroundColorPlugin.native-BE-p9DRd.mjs → BackgroundColorPlugin.native-50iAT9xU.mjs} +119 -122
- package/dist/CodePlugin.native-DlpTPdkd.mjs +2691 -0
- package/dist/{CommentsPlugin.native-tMnWn8a2.mjs → CommentsPlugin.native-DPSqTkiv.mjs} +153 -135
- 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/MergeTagPlugin.native-C3eOfEgw.mjs +559 -0
- package/dist/{PageBreakPlugin.native-CGiQxXqR.mjs → PageBreakPlugin.native-CXdX5fAv.mjs} +77 -68
- 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/_commonjsHelpers-DOllISpa.mjs +32 -0
- package/dist/anchoredPopover-Bxds0VoB.mjs +110 -0
- package/dist/documentManager-vQ1VkbUY.mjs +8418 -0
- package/dist/editora.min.js +10 -10
- package/dist/editora.umd.js +10 -10
- package/dist/html2canvas.esm-AYkPY5LS.mjs +4803 -0
- package/dist/{index-CqWQFb3D.js → index-BpE6GFbz.js} +4 -4
- package/dist/index-BslAFzmv.mjs +16544 -0
- package/dist/{index-OwnkG39N.mjs → index-yzU4NdPT.mjs} +200 -183
- 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 +15 -15
- package/dist/webcomponent-core.js +241 -224
- package/dist/webcomponent-core.min.css +1 -1
- package/dist/webcomponent-core.min.js +86 -106
- package/dist/webcomponent.cjs.js +1 -1
- package/dist/webcomponent.esm.js +1 -1
- package/dist/webcomponent.js +205 -188
- package/dist/webcomponent.min.css +1 -1
- package/dist/webcomponent.min.js +477 -402
- package/package.json +16 -10
- 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/webcomponent.js
CHANGED
|
@@ -150,9 +150,9 @@ class S {
|
|
|
150
150
|
const r = this.getPlugin(t);
|
|
151
151
|
if (!r)
|
|
152
152
|
throw new Error(`Plugin not found: ${t}`);
|
|
153
|
-
const i = this.getPluginConfig(t) || r.config || {},
|
|
153
|
+
const i = this.getPluginConfig(t) || r.config || {}, a = i.mode || "local";
|
|
154
154
|
try {
|
|
155
|
-
switch (
|
|
155
|
+
switch (a) {
|
|
156
156
|
case "local":
|
|
157
157
|
return r.executeLocal ? r.executeLocal(e, ...o) : null;
|
|
158
158
|
case "api":
|
|
@@ -172,7 +172,7 @@ class S {
|
|
|
172
172
|
}
|
|
173
173
|
break;
|
|
174
174
|
default:
|
|
175
|
-
throw new Error(`Unknown plugin mode: ${
|
|
175
|
+
throw new Error(`Unknown plugin mode: ${a}`);
|
|
176
176
|
}
|
|
177
177
|
} catch (s) {
|
|
178
178
|
throw console.error(`Error executing command ${e} on plugin ${t}:`, s), s;
|
|
@@ -317,6 +317,11 @@ class M {
|
|
|
317
317
|
}
|
|
318
318
|
class L {
|
|
319
319
|
// PluginLoader instance to get all registered plugins
|
|
320
|
+
setLastCommandTrigger(t, e) {
|
|
321
|
+
if (typeof window == "undefined" || !t) return;
|
|
322
|
+
const o = e || t.getAttribute("data-command") || void 0;
|
|
323
|
+
o && (window.__editoraLastCommandButton = t, window.__editoraLastCommand = o);
|
|
324
|
+
}
|
|
320
325
|
constructor(t, e, o) {
|
|
321
326
|
this.config = t, this.plugins = e, this.pluginLoader = o;
|
|
322
327
|
}
|
|
@@ -334,7 +339,7 @@ class L {
|
|
|
334
339
|
r.forEach((s) => {
|
|
335
340
|
s.command && i.set(s.command, s), s.type === "group" && s.label && i.set(s.label, s);
|
|
336
341
|
});
|
|
337
|
-
const
|
|
342
|
+
const a = {
|
|
338
343
|
bold: "toggleBold",
|
|
339
344
|
italic: "toggleItalic",
|
|
340
345
|
underline: "toggleUnderline",
|
|
@@ -426,7 +431,7 @@ class L {
|
|
|
426
431
|
});
|
|
427
432
|
return;
|
|
428
433
|
}
|
|
429
|
-
const g =
|
|
434
|
+
const g = a[d] || d;
|
|
430
435
|
let f = i.get(g);
|
|
431
436
|
f || (f = i.get(d)), f && l.push({
|
|
432
437
|
id: d,
|
|
@@ -453,10 +458,10 @@ class L {
|
|
|
453
458
|
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}`);
|
|
454
459
|
const e = this.config.items || this.getDefaultToolbarString(), o = this.parseToolbarString(e);
|
|
455
460
|
o.forEach((r, i) => {
|
|
456
|
-
const
|
|
457
|
-
if (
|
|
458
|
-
this.appendToolbarButton(
|
|
459
|
-
}), t.appendChild(
|
|
461
|
+
const a = document.createElement("div");
|
|
462
|
+
if (a.className = "editora-toolbar-group", r.forEach((s) => {
|
|
463
|
+
this.appendToolbarButton(a, s);
|
|
464
|
+
}), t.appendChild(a), i < o.length - 1) {
|
|
460
465
|
const s = document.createElement("div");
|
|
461
466
|
s.className = "editora-toolbar-separator", t.appendChild(s);
|
|
462
467
|
}
|
|
@@ -511,7 +516,7 @@ class L {
|
|
|
511
516
|
createInput(t) {
|
|
512
517
|
const e = document.createElement("input");
|
|
513
518
|
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) => {
|
|
514
|
-
o.preventDefault(), this.commandHandler && t.command && this.commandHandler(t.command);
|
|
519
|
+
o.preventDefault(), this.setLastCommandTrigger(e, t.command), this.commandHandler && t.command && this.commandHandler(t.command);
|
|
515
520
|
}), e;
|
|
516
521
|
}
|
|
517
522
|
/**
|
|
@@ -540,21 +545,23 @@ class L {
|
|
|
540
545
|
const o = document.createElement("button");
|
|
541
546
|
o.className = "editora-toolbar-button editora-toolbar-dropdown-trigger", o.type = "button", o.textContent = t.label;
|
|
542
547
|
const r = document.createElement("div");
|
|
543
|
-
r.className = "editora-toolbar-dropdown-menu", r.style.display = "none", t.options && t.options.forEach((
|
|
544
|
-
const
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
}), r.appendChild(
|
|
548
|
-
}), o.addEventListener("click", (
|
|
549
|
-
|
|
550
|
-
const
|
|
551
|
-
r.style.display =
|
|
548
|
+
r.className = "editora-toolbar-dropdown-menu", r.style.display = "none", t.options && t.options.forEach((s) => {
|
|
549
|
+
const l = document.createElement("button");
|
|
550
|
+
l.className = "editora-toolbar-dropdown-item", l.type = "button", l.textContent = s.label, l.setAttribute("data-value", s.value), l.addEventListener("click", (c) => {
|
|
551
|
+
c.preventDefault(), this.setLastCommandTrigger(o, t.command), this.commandHandler && t.command && this.commandHandler(t.command, s.value), r.style.display = "none";
|
|
552
|
+
}), r.appendChild(l);
|
|
553
|
+
}), o.addEventListener("click", (s) => {
|
|
554
|
+
s.preventDefault(), s.stopPropagation(), this.setLastCommandTrigger(o, t.command);
|
|
555
|
+
const l = r.style.display === "block";
|
|
556
|
+
r.style.display = l ? "none" : "block";
|
|
552
557
|
});
|
|
553
|
-
const i = (
|
|
554
|
-
e.contains(
|
|
558
|
+
const i = (s) => {
|
|
559
|
+
e.contains(s.target) || (r.style.display = "none");
|
|
560
|
+
}, a = (s) => {
|
|
561
|
+
s.key === "Escape" && (r.style.display = "none");
|
|
555
562
|
};
|
|
556
|
-
return document.addEventListener("
|
|
557
|
-
document.removeEventListener("
|
|
563
|
+
return document.addEventListener("mousedown", i, !0), document.addEventListener("keydown", a), e._cleanupDropdown = () => {
|
|
564
|
+
document.removeEventListener("mousedown", i, !0), document.removeEventListener("keydown", a);
|
|
558
565
|
}, e.appendChild(o), e.appendChild(r), e;
|
|
559
566
|
}
|
|
560
567
|
/**
|
|
@@ -566,30 +573,36 @@ class L {
|
|
|
566
573
|
const o = document.createElement("button");
|
|
567
574
|
if (o.className = "editora-toolbar-button", o.type = "button", o.title = t.label, t.icon)
|
|
568
575
|
if (t.icon.startsWith("<svg") && t.icon.endsWith("</svg>")) {
|
|
569
|
-
const
|
|
570
|
-
|
|
576
|
+
const s = document.createElement("span");
|
|
577
|
+
s.className = "editora-toolbar-icon", s.innerHTML = t.icon, o.appendChild(s);
|
|
571
578
|
} else
|
|
572
579
|
o.innerHTML = t.icon;
|
|
573
580
|
else
|
|
574
581
|
o.textContent = t.label;
|
|
575
582
|
const r = document.createElement("div");
|
|
576
|
-
|
|
577
|
-
const
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
}), r.appendChild(
|
|
581
|
-
}), o.addEventListener("click", (
|
|
582
|
-
var
|
|
583
|
-
|
|
584
|
-
const
|
|
583
|
+
r.className = "editora-toolbar-dropdown-menu", r.style.display = "none", t.options && t.options.forEach((s) => {
|
|
584
|
+
const l = document.createElement("button");
|
|
585
|
+
l.className = "editora-toolbar-dropdown-item", l.type = "button", l.textContent = s.label, l.setAttribute("data-value", s.value), l.addEventListener("click", (c) => {
|
|
586
|
+
c.preventDefault(), c.stopPropagation(), this.setLastCommandTrigger(o, t.command), this.commandHandler && t.command && this.commandHandler(t.command, s.value), r.style.display = "none";
|
|
587
|
+
}), r.appendChild(l);
|
|
588
|
+
}), o.addEventListener("click", (s) => {
|
|
589
|
+
var c;
|
|
590
|
+
s.preventDefault(), s.stopPropagation(), this.setLastCommandTrigger(o, t.command);
|
|
591
|
+
const l = (c = this.container) == null ? void 0 : c.querySelectorAll(
|
|
585
592
|
".editora-toolbar-dropdown-menu"
|
|
586
593
|
);
|
|
587
|
-
|
|
588
|
-
|
|
594
|
+
l == null || l.forEach((d) => {
|
|
595
|
+
d !== r && (d.style.display = "none");
|
|
589
596
|
}), r.style.display = r.style.display === "none" ? "block" : "none";
|
|
590
|
-
})
|
|
591
|
-
|
|
592
|
-
|
|
597
|
+
});
|
|
598
|
+
const i = (s) => {
|
|
599
|
+
e.contains(s.target) || (r.style.display = "none");
|
|
600
|
+
}, a = (s) => {
|
|
601
|
+
s.key === "Escape" && (r.style.display = "none");
|
|
602
|
+
};
|
|
603
|
+
return document.addEventListener("mousedown", i, !0), document.addEventListener("keydown", a), e._cleanupDropdown = () => {
|
|
604
|
+
document.removeEventListener("mousedown", i, !0), document.removeEventListener("keydown", a);
|
|
605
|
+
}, e.appendChild(o), e.appendChild(r), e;
|
|
593
606
|
}
|
|
594
607
|
/**
|
|
595
608
|
* Get default toolbar string if none provided
|
|
@@ -696,17 +709,17 @@ class I {
|
|
|
696
709
|
}
|
|
697
710
|
this.statusInfo.language && o.push(this.statusInfo.language);
|
|
698
711
|
const r = [];
|
|
699
|
-
this.statusInfo.wordCount !== void 0 && r.push(`${this.statusInfo.wordCount} words`), this.statusInfo.charCount !== void 0 && r.push(`${this.statusInfo.charCount} chars`), this.statusInfo.lineCount !== void 0 && r.push(`${this.statusInfo.lineCount} lines`), this.statusInfo.custom && Object.entries(this.statusInfo.custom).forEach(([i,
|
|
700
|
-
r.push(`${i}: ${
|
|
701
|
-
}), o.forEach((i,
|
|
712
|
+
this.statusInfo.wordCount !== void 0 && r.push(`${this.statusInfo.wordCount} words`), this.statusInfo.charCount !== void 0 && r.push(`${this.statusInfo.charCount} chars`), this.statusInfo.lineCount !== void 0 && r.push(`${this.statusInfo.lineCount} lines`), this.statusInfo.custom && Object.entries(this.statusInfo.custom).forEach(([i, a]) => {
|
|
713
|
+
r.push(`${i}: ${a}`);
|
|
714
|
+
}), o.forEach((i, a) => {
|
|
702
715
|
const s = document.createElement("span");
|
|
703
|
-
if (s.className = "editora-statusbar-item", s.textContent = i, t.appendChild(s),
|
|
716
|
+
if (s.className = "editora-statusbar-item", s.textContent = i, t.appendChild(s), a < o.length - 1) {
|
|
704
717
|
const l = document.createElement("span");
|
|
705
718
|
l.className = "editora-statusbar-separator", l.textContent = "|", t.appendChild(l);
|
|
706
719
|
}
|
|
707
|
-
}), r.forEach((i,
|
|
720
|
+
}), r.forEach((i, a) => {
|
|
708
721
|
const s = document.createElement("span");
|
|
709
|
-
if (s.className = "editora-statusbar-item", s.textContent = i, e.appendChild(s),
|
|
722
|
+
if (s.className = "editora-statusbar-item", s.textContent = i, e.appendChild(s), a < r.length - 1) {
|
|
710
723
|
const l = document.createElement("span");
|
|
711
724
|
l.className = "editora-statusbar-separator", l.textContent = "|", e.appendChild(l);
|
|
712
725
|
}
|
|
@@ -719,16 +732,16 @@ class I {
|
|
|
719
732
|
this.container && this.container.parentNode && this.container.parentNode.removeChild(this.container), this.container = void 0;
|
|
720
733
|
}
|
|
721
734
|
}
|
|
722
|
-
function P(
|
|
723
|
-
const e =
|
|
724
|
-
`),
|
|
725
|
-
return { line:
|
|
735
|
+
function P(n, t) {
|
|
736
|
+
const e = n.textContent || "", o = D(n, t.startContainer, t.startOffset), i = e.substring(0, o).split(`
|
|
737
|
+
`), a = i.length, s = i[i.length - 1].length + 1;
|
|
738
|
+
return { line: a, column: s };
|
|
726
739
|
}
|
|
727
|
-
function D(
|
|
728
|
-
var
|
|
740
|
+
function D(n, t, e) {
|
|
741
|
+
var a;
|
|
729
742
|
let o = 0;
|
|
730
743
|
const r = document.createTreeWalker(
|
|
731
|
-
|
|
744
|
+
n,
|
|
732
745
|
NodeFilter.SHOW_TEXT,
|
|
733
746
|
null
|
|
734
747
|
);
|
|
@@ -737,32 +750,32 @@ function D(a, t, e) {
|
|
|
737
750
|
if (i === t) {
|
|
738
751
|
o += e;
|
|
739
752
|
break;
|
|
740
|
-
} else i.nodeType === Node.TEXT_NODE && (o += ((
|
|
753
|
+
} else i.nodeType === Node.TEXT_NODE && (o += ((a = i.textContent) == null ? void 0 : a.length) || 0);
|
|
741
754
|
i = r.nextNode();
|
|
742
755
|
}
|
|
743
756
|
return o;
|
|
744
757
|
}
|
|
745
|
-
function N(
|
|
758
|
+
function N(n) {
|
|
746
759
|
var o, r;
|
|
747
|
-
const t =
|
|
760
|
+
const t = n.querySelectorAll("div, p, br, h1, h2, h3, h4, h5, h6, blockquote, li, pre");
|
|
748
761
|
let e = 1;
|
|
749
762
|
if (t.length > 0) {
|
|
750
763
|
e = t.length;
|
|
751
764
|
const i = t[t.length - 1];
|
|
752
765
|
(i.tagName === "BR" || ((o = i.innerHTML) == null ? void 0 : o.trim()) === "" || ((r = i.textContent) == null ? void 0 : r.trim()) === "") && e++;
|
|
753
766
|
} else {
|
|
754
|
-
const
|
|
767
|
+
const a = (n.textContent || "").split(`
|
|
755
768
|
`).length;
|
|
756
|
-
e = Math.max(1,
|
|
769
|
+
e = Math.max(1, a);
|
|
757
770
|
}
|
|
758
771
|
return e;
|
|
759
772
|
}
|
|
760
|
-
function z(
|
|
761
|
-
const t =
|
|
773
|
+
function z(n) {
|
|
774
|
+
const t = n.trim() ? n.trim().split(/\s+/).length : 0, e = n.length;
|
|
762
775
|
return { words: t, chars: e };
|
|
763
776
|
}
|
|
764
|
-
function B(
|
|
765
|
-
const e =
|
|
777
|
+
function B(n, t) {
|
|
778
|
+
const e = n.toString();
|
|
766
779
|
return {
|
|
767
780
|
startLine: t.line,
|
|
768
781
|
startColumn: t.column,
|
|
@@ -1096,9 +1109,9 @@ class O {
|
|
|
1096
1109
|
return e.forEach((r, i) => {
|
|
1097
1110
|
o += `## ${i}
|
|
1098
1111
|
|
|
1099
|
-
`, r.forEach((
|
|
1100
|
-
const s = this.getShortcutDescription(
|
|
1101
|
-
o += `- **${s}**: ${
|
|
1112
|
+
`, r.forEach((a) => {
|
|
1113
|
+
const s = this.getShortcutDescription(a);
|
|
1114
|
+
o += `- **${s}**: ${a.description || a.command}
|
|
1102
1115
|
`;
|
|
1103
1116
|
}), o += `
|
|
1104
1117
|
`;
|
|
@@ -1156,33 +1169,33 @@ const H = [
|
|
|
1156
1169
|
td: ["colspan", "rowspan", "align", "valign"],
|
|
1157
1170
|
th: ["colspan", "rowspan", "align", "valign"]
|
|
1158
1171
|
};
|
|
1159
|
-
function w(
|
|
1172
|
+
function w(n, t, e) {
|
|
1160
1173
|
if ((t == null ? void 0 : t.sanitize) === !1)
|
|
1161
|
-
return
|
|
1162
|
-
const o = t != null && t.allowedTags && t.allowedTags.length > 0 ? t.allowedTags : H, i = !!(t != null && t.allowedAttributes) && Object.keys(t.allowedAttributes).length > 0 ? t.allowedAttributes : j,
|
|
1163
|
-
return
|
|
1174
|
+
return n;
|
|
1175
|
+
const o = t != null && t.allowedTags && t.allowedTags.length > 0 ? t.allowedTags : H, i = !!(t != null && t.allowedAttributes) && Object.keys(t.allowedAttributes).length > 0 ? t.allowedAttributes : j, a = document.createElement("div");
|
|
1176
|
+
return a.innerHTML = n, C(a, o, i), a.innerHTML;
|
|
1164
1177
|
}
|
|
1165
|
-
function C(
|
|
1166
|
-
const o = Array.from(
|
|
1178
|
+
function C(n, t, e) {
|
|
1179
|
+
const o = Array.from(n.childNodes);
|
|
1167
1180
|
for (const r of o)
|
|
1168
1181
|
if (r.nodeType === Node.ELEMENT_NODE) {
|
|
1169
|
-
const i = r,
|
|
1170
|
-
if (!t.includes(
|
|
1182
|
+
const i = r, a = i.tagName.toLowerCase();
|
|
1183
|
+
if (!t.includes(a)) {
|
|
1171
1184
|
for (; i.firstChild; )
|
|
1172
|
-
|
|
1173
|
-
|
|
1185
|
+
n.insertBefore(i.firstChild, i);
|
|
1186
|
+
n.removeChild(i);
|
|
1174
1187
|
continue;
|
|
1175
1188
|
}
|
|
1176
1189
|
R(i, e), C(i, t, e);
|
|
1177
|
-
} else r.nodeType !== Node.TEXT_NODE &&
|
|
1190
|
+
} else r.nodeType !== Node.TEXT_NODE && n.removeChild(r);
|
|
1178
1191
|
}
|
|
1179
|
-
function R(
|
|
1180
|
-
const e =
|
|
1192
|
+
function R(n, t) {
|
|
1193
|
+
const e = n.tagName.toLowerCase(), o = Array.from(n.attributes), r = t[e] || [], i = t["*"] || [], a = [...r, ...i];
|
|
1181
1194
|
for (const s of o) {
|
|
1182
1195
|
const l = s.name.toLowerCase();
|
|
1183
1196
|
let c = !1;
|
|
1184
|
-
|
|
1185
|
-
for (const d of
|
|
1197
|
+
a.includes(l) && (c = !0);
|
|
1198
|
+
for (const d of a)
|
|
1186
1199
|
if (d.endsWith("*")) {
|
|
1187
1200
|
const g = d.slice(0, -1);
|
|
1188
1201
|
if (l.startsWith(g)) {
|
|
@@ -1190,15 +1203,15 @@ function R(a, t) {
|
|
|
1190
1203
|
break;
|
|
1191
1204
|
}
|
|
1192
1205
|
}
|
|
1193
|
-
(l.startsWith("on") || l === "javascript:" || l === "href" && s.value.trim().toLowerCase().startsWith("javascript:") || l === "src" && s.value.trim().toLowerCase().startsWith("javascript:")) && (c = !1), c ||
|
|
1206
|
+
(l.startsWith("on") || l === "javascript:" || l === "href" && s.value.trim().toLowerCase().startsWith("javascript:") || l === "src" && s.value.trim().toLowerCase().startsWith("javascript:")) && (c = !1), c || n.removeAttribute(s.name);
|
|
1194
1207
|
}
|
|
1195
|
-
|
|
1208
|
+
n.hasAttribute("href") && (n.getAttribute("href") || "").trim().toLowerCase().startsWith("javascript:") && n.removeAttribute("href"), n.hasAttribute("src") && (n.getAttribute("src") || "").trim().toLowerCase().startsWith("javascript:") && n.removeAttribute("src");
|
|
1196
1209
|
}
|
|
1197
|
-
function F(
|
|
1198
|
-
return (e == null ? void 0 : e.sanitizeOnPaste) === !1 ?
|
|
1210
|
+
function F(n, t, e) {
|
|
1211
|
+
return (e == null ? void 0 : e.sanitizeOnPaste) === !1 ? n : w(n, t);
|
|
1199
1212
|
}
|
|
1200
|
-
function $(
|
|
1201
|
-
return (e == null ? void 0 : e.sanitizeOnInput) === !1 ?
|
|
1213
|
+
function $(n, t, e) {
|
|
1214
|
+
return (e == null ? void 0 : e.sanitizeOnInput) === !1 ? n : w(n, t);
|
|
1202
1215
|
}
|
|
1203
1216
|
const k = class k {
|
|
1204
1217
|
/**
|
|
@@ -1218,12 +1231,12 @@ const k = class k {
|
|
|
1218
1231
|
static normalizeConfig(t) {
|
|
1219
1232
|
const e = { ...t };
|
|
1220
1233
|
if (e.toolbarFloating !== void 0 || e.toolbarSticky !== void 0) {
|
|
1221
|
-
const
|
|
1222
|
-
e.toolbarFloating !== void 0 && (
|
|
1234
|
+
const a = typeof e.toolbar == "object" && e.toolbar ? { ...e.toolbar } : typeof e.toolbar == "string" ? { items: e.toolbar } : {};
|
|
1235
|
+
e.toolbarFloating !== void 0 && (a.floating = !!e.toolbarFloating), e.toolbarSticky !== void 0 && (a.sticky = !!e.toolbarSticky), e.toolbar = a;
|
|
1223
1236
|
}
|
|
1224
1237
|
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) {
|
|
1225
|
-
const
|
|
1226
|
-
e.autosaveEnabled !== void 0 && (
|
|
1238
|
+
const a = typeof e.autosave == "object" && e.autosave ? { ...e.autosave } : {};
|
|
1239
|
+
e.autosaveEnabled !== void 0 && (a.enabled = !!e.autosaveEnabled), e.autosaveIntervalMs !== void 0 && (a.intervalMs = Number(e.autosaveIntervalMs)), e.autosaveStorageKey !== void 0 && (a.storageKey = e.autosaveStorageKey), e.autosaveProvider !== void 0 && (a.provider = e.autosaveProvider), e.autosaveApiUrl !== void 0 && (a.apiUrl = e.autosaveApiUrl), e.autosave = a;
|
|
1227
1240
|
}
|
|
1228
1241
|
const o = {
|
|
1229
1242
|
enabled: !1,
|
|
@@ -1238,16 +1251,16 @@ const k = class k {
|
|
|
1238
1251
|
enabled: e.autosave
|
|
1239
1252
|
};
|
|
1240
1253
|
else if (typeof e.autosave == "object" && e.autosave) {
|
|
1241
|
-
const
|
|
1254
|
+
const a = {
|
|
1242
1255
|
...o,
|
|
1243
1256
|
...e.autosave
|
|
1244
1257
|
};
|
|
1245
|
-
|
|
1258
|
+
a.intervalMs === void 0 && a.interval !== void 0 && (a.intervalMs = Number(a.interval)), a.enabled === void 0 && (a.enabled = !0), (!Number.isFinite(a.intervalMs) || a.intervalMs <= 0) && (a.intervalMs = o.intervalMs), e.autosave = a;
|
|
1246
1259
|
} else
|
|
1247
1260
|
e.autosave = o;
|
|
1248
1261
|
if (e.languageLocale !== void 0 || e.languageDirection !== void 0) {
|
|
1249
|
-
const
|
|
1250
|
-
e.languageLocale !== void 0 && (
|
|
1262
|
+
const a = typeof e.language == "object" && e.language ? { ...e.language } : {};
|
|
1263
|
+
e.languageLocale !== void 0 && (a.locale = e.languageLocale), e.languageDirection !== void 0 && (a.direction = e.languageDirection), e.language = a;
|
|
1251
1264
|
}
|
|
1252
1265
|
const r = { locale: "en", direction: "ltr" };
|
|
1253
1266
|
if (typeof e.language == "string" ? e.language = {
|
|
@@ -1257,8 +1270,8 @@ const k = class k {
|
|
|
1257
1270
|
...r,
|
|
1258
1271
|
...e.language
|
|
1259
1272
|
} : e.language = r, e.spellcheckEnabled !== void 0 || e.spellcheckProvider !== void 0 || e.spellcheckApiUrl !== void 0) {
|
|
1260
|
-
const
|
|
1261
|
-
e.spellcheckEnabled !== void 0 && (
|
|
1273
|
+
const a = typeof e.spellcheck == "object" && e.spellcheck ? { ...e.spellcheck } : {};
|
|
1274
|
+
e.spellcheckEnabled !== void 0 && (a.enabled = !!e.spellcheckEnabled), e.spellcheckProvider !== void 0 && (a.provider = e.spellcheckProvider), e.spellcheckApiUrl !== void 0 && (a.apiUrl = e.spellcheckApiUrl), e.spellcheck = a;
|
|
1262
1275
|
}
|
|
1263
1276
|
const i = {
|
|
1264
1277
|
enabled: !1,
|
|
@@ -1271,11 +1284,11 @@ const k = class k {
|
|
|
1271
1284
|
enabled: e.spellcheck
|
|
1272
1285
|
};
|
|
1273
1286
|
else if (typeof e.spellcheck == "object" && e.spellcheck) {
|
|
1274
|
-
const
|
|
1287
|
+
const a = {
|
|
1275
1288
|
...i,
|
|
1276
1289
|
...e.spellcheck
|
|
1277
1290
|
};
|
|
1278
|
-
!
|
|
1291
|
+
!a.provider && a.mode && (a.provider = a.mode === "local" ? "browser" : "api"), a.enabled === void 0 && (a.enabled = !!(a.mode || a.provider || a.apiUrl)), e.spellcheck = a;
|
|
1279
1292
|
} else
|
|
1280
1293
|
e.spellcheck = i;
|
|
1281
1294
|
return e.contextMenuEnabled !== void 0 && (e.contextMenu = {
|
|
@@ -1446,22 +1459,22 @@ let v = k;
|
|
|
1446
1459
|
const U = '.editora-editor{display:flex;flex-direction:column;border:1px solid #ddd;border-radius:4px;background:#fff;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen,Ubuntu,Cantarell,sans-serif;font-size:14px;overflow:hidden}.editora-editor *{box-sizing:border-box}.editora-theme-light{background:#fff;color:#333}.editora-theme-dark{--editora-dark-toolbar-bg-start: #353d48;--editora-dark-toolbar-bg-end: #2d3540;--editora-dark-button-bg-start: #46505f;--editora-dark-button-bg-end: #3b4553;--editora-dark-button-hover-start: #525d6d;--editora-dark-button-hover-end: #465262;--editora-dark-button-active-start: #5eaaf6;--editora-dark-button-active-end: #4a95de;--editora-dark-border: #475263;--editora-dark-border-strong: #566275;--editora-dark-text: #e1e9f5;--editora-dark-text-strong: #f3f7ff;--editora-dark-text-muted: #aeb9cc;--editora-dark-surface: #1d242d;--editora-dark-content: #1f2732;background:linear-gradient(180deg,#1b2330,#1c2430);color:var(--editora-dark-text);border-color:var(--editora-dark-border)}.editora-toolbar{display:flex;align-items:center;gap:4px;padding:8px;background:#f5f5f5;border-bottom:1px solid #ddd;flex-wrap:wrap}.editora-theme-dark .editora-toolbar{background:linear-gradient(180deg,var(--editora-dark-toolbar-bg-start) 0%,var(--editora-dark-toolbar-bg-end) 100%);border-bottom-color:var(--editora-dark-border);box-shadow:inset 0 1px #ffffff0d}.editora-toolbar-sticky{position:sticky;top:0;z-index:100;position:-webkit-sticky}.editora-toolbar-group{display:flex;align-items:center;gap:2px}.editora-toolbar-button{padding:6px 12px;border:1px solid #ccc;background:#fff;cursor:pointer;border-radius:3px;font-weight:600;font-size:14px;height:30px;display:flex;align-items:center;white-space:nowrap}.editora-toolbar-group-button{display:flex;align-items:center}.editora-toolbar-input.font-size{width:40px;padding:.25rem;text-align:center;font-size:14px;background:#fff;border:1px solid var(--rte-color-border-light);border-radius:var(--rte-radius-sm)}.editora-toolbar-group-items{display:flex;align-items:center;border:1px solid #ccc;.editora-toolbar-button{border:none;border-radius:0;&:first-child{border-right:1px solid #ccc;border-top-left-radius:3px;border-bottom-left-radius:3px}&:last-child{border-left:1px solid #ccc;border-top-right-radius:3px;border-bottom-right-radius:3px}}}.editora-theme-dark .editora-toolbar-button{background:linear-gradient(180deg,var(--editora-dark-button-bg-start) 0%,var(--editora-dark-button-bg-end) 100%);border-color:var(--editora-dark-border-strong);color:var(--editora-dark-text);box-shadow:inset 0 1px #ffffff14,0 1px 1px #00000059}.editora-theme-dark .editora-toolbar-group-items{border-color:var(--editora-dark-border-strong);background:linear-gradient(180deg,var(--editora-dark-button-bg-start) 0%,var(--editora-dark-button-bg-end) 100%)}.editora-theme-dark .editora-toolbar-group-items .editora-toolbar-button:first-child{border-right-color:#566275}.editora-theme-dark .editora-toolbar-group-items .editora-toolbar-button:last-child{border-left-color:#566275}.editora-theme-dark .editora-toolbar-input.font-size{background-color:#2e3642;color:var(--editora-dark-text-strong);border-color:var(--editora-dark-border-strong);caret-color:var(--editora-dark-text-strong)}.editora-theme-dark .editora-toolbar-input.font-size::placeholder{color:var(--editora-dark-text-strong);opacity:1}.editora-toolbar-button:hover{background:#e0e0e0;border-color:#ccc}.editora-theme-dark .editora-toolbar-button:hover{background:linear-gradient(180deg,var(--editora-dark-button-hover-start) 0%,var(--editora-dark-button-hover-end) 100%);border-color:#66748a;color:var(--editora-dark-text-strong)}.editora-toolbar-button:active,.editora-toolbar-button.active{background:#d0d0d0;border-color:#999}.editora-theme-dark .editora-toolbar-button:active,.editora-theme-dark .editora-toolbar-button.active{background:linear-gradient(180deg,var(--editora-dark-button-active-start) 0%,var(--editora-dark-button-active-end) 100%);border-color:#67adf4;color:#0f1b2a}.editora-theme-dark .editora-toolbar-button:disabled{background:#313946;border-color:#424d5e;color:#7f8ca1}.editora-theme-dark .editora-toolbar-button[data-command=insertTable],.editora-theme-dark .editora-toolbar-button[data-command=print],.editora-theme-dark .editora-toolbar-button[data-command=toggleSpellCheck],.editora-theme-dark .editora-toolbar-button[data-command=toggleA11yChecker],.editora-theme-dark .editora-toolbar-button[data-command=setDirectionLTR],.editora-theme-dark .editora-toolbar-button[data-command=setDirectionRTL]{color:#f1f6ff}.editora-toolbar-button:disabled{opacity:.5;cursor:not-allowed}.editora-toolbar-icon{display:inline-flex;align-items:center;justify-content:center;width:24px;height:24px;line-height:1}.editora-toolbar-button svg,.editora-toolbar-icon svg{width:20px;height:20px;display:block;color:currentColor;fill:currentColor}.editora-theme-dark .editora-toolbar-icon,.editora-theme-dark .editora-toolbar-icon *{color:inherit}.editora-theme-dark :is(.editora-toolbar-button,.editora-toolbar-icon) svg :is([stroke="#000" i],[stroke="#000000" i],[stroke=black i],[stroke="#0f0f0f" i],[stroke="#111111" i],[style*="stroke:#000" i],[style*="stroke: #000" i],[style*="stroke:black" i],[style*="stroke: black" i],[style*="stroke:#0f0f0f" i],[style*="stroke: #0f0f0f" i]){stroke:currentColor!important}.editora-theme-dark :is(.editora-toolbar-button,.editora-toolbar-icon) svg :is([fill="#000" i],[fill="#000000" i],[fill=black i],[fill="#0f0f0f" i],[fill="#111111" i],[style*="fill:#000" i],[style*="fill: #000" i],[style*="fill:black" i],[style*="fill: black" i],[style*="fill:#0f0f0f" i],[style*="fill: #0f0f0f" i]){fill:currentColor!important}.editora-toolbar-separator{width:1px;height:24px;background:#ddd;margin:0 4px}.editora-theme-dark .editora-toolbar-separator{background:#4d596b}.editora-toolbar-dropdown{position:relative}.editora-toolbar-dropdown-menu{position:absolute;top:100%;left:0;min-width:150px;margin-top:4px;padding:4px 0;background:#fff;border:1px solid #ddd;border-radius:4px;box-shadow:0 2px 8px #00000026;z-index:1000}.editora-theme-dark .editora-toolbar-dropdown-menu{background:#29323d;border-color:#4d596b;box-shadow:0 8px 20px #00000073}.editora-toolbar-dropdown-item{display:block;width:100%;padding:8px 12px;border:none;background:transparent;color:#333;text-align:left;cursor:pointer;font-size:13px;transition:background .15s ease}.editora-theme-dark .editora-toolbar-dropdown-item{color:#d7deea}.editora-toolbar-dropdown-item:hover{background:#f5f5f5}.editora-theme-dark .editora-toolbar-dropdown-item:hover{background:#3a4554;color:#f0f6ff}.editora-content{flex:1;min-height:200px;padding:16px;outline:none;overflow-y:auto;line-height:1.6}.editora-theme-dark .editora-content{color:#ecf3ff;background:linear-gradient(180deg,var(--editora-dark-content) 0%,#1c232e 100%)}.editora-content:empty:before{content:attr(data-placeholder);color:#999;pointer-events:none}.editora-theme-dark .editora-content:empty:before{color:#8f9bb0}.editora-content h1{font-size:2em;margin:.67em 0;font-weight:600}.editora-content h2{font-size:1.5em;margin:.75em 0;font-weight:600}.editora-content h3{font-size:1.17em;margin:.83em 0;font-weight:600}.editora-content p{margin:1em 0}.editora-content ul,.editora-content ol{margin:1em 0;padding-left:2em}.editora-content a{color:#06c;text-decoration:underline}.editora-theme-dark .editora-content a{color:#4db8ff}.editora-content code{padding:2px 4px;background:#f5f5f5;border-radius:3px;font-family:Monaco,Menlo,Consolas,monospace;font-size:.9em}.editora-theme-dark .editora-content code{background:#1e1e1e}.editora-content pre{padding:12px;background:#f5f5f5;border-radius:4px;overflow-x:auto;margin:1em 0}.editora-theme-dark .editora-content pre{background:#1e1e1e}.editora-theme-dark .rte-code-block{background:linear-gradient(180deg,#212a36,#1b2430)!important;border-color:#4f5b70!important;color:#e7effc!important}.editora-theme-dark .rte-code-block code{color:#e7effc!important}.editora-theme-dark .rte-code-block:before{background:#111927!important;color:#dce8ff!important}.editora-theme-dark .rte-code-block .rte-code-copy{background:#2b3441!important;border-color:#5a667b!important;color:#dce8ff!important}.editora-content blockquote{margin:1em 0;padding-left:1em;border-left:4px solid #ddd;color:#666}.editora-theme-dark .editora-content blockquote{border-left-color:#3c3c3c;color:#9a9a9a}.editora-floating-toolbar{position:absolute;padding:4px;background:#fff;border:1px solid #ddd;border-radius:4px;box-shadow:0 2px 8px #00000026;z-index:1000}.editora-theme-dark .editora-floating-toolbar{background:#29323d;border-color:#4d596b;box-shadow:0 8px 20px #00000073}.editora-statusbar-container{display:flex;flex-direction:column}.editora-statusbar-left{display:flex;align-items:center;gap:8px}.editora-statusbar-right{display:flex;align-items:center;gap:8px;margin-left:auto}.editora-statusbar{display:flex;align-items:center;gap:12px;padding:6px 12px;background:#f5f5f5;border-top:1px solid #ddd;font-size:12px;color:#666}.editora-theme-dark .editora-statusbar{background:linear-gradient(180deg,#2c3440,#252d37);border-top-color:#3f4a5b;color:#d7deea}.editora-statusbar-item{white-space:nowrap}.editora-statusbar-separator{color:#ddd}.editora-theme-dark .editora-statusbar-separator{color:#566275}.editora-editor[readonly] .editora-content{background:#fafafa;cursor:not-allowed}.editora-theme-dark.editora-editor[readonly] .editora-content{background:#1a1a1a}.editora-editor:focus-within{border-color:#06c;box-shadow:0 0 0 3px #0066cc1a}.editora-theme-dark.editora-editor:focus-within{border-color:#4db8ff;box-shadow:0 0 0 3px #4db8ff1a}.editora-editor[disabled]{opacity:.6;pointer-events:none}@media(max-width:768px){.editora-toolbar{padding:4px}.editora-toolbar-button{min-width:28px;min-height:28px;padding:4px 8px;font-size:12px}.editora-content{padding:12px}}.editora-content ::selection{background:#06c3}.editora-theme-dark .editora-content ::selection{background:#4db8ff33}.editora-content table{border-collapse:collapse;width:100%;margin:1em 0}.editora-content th,.editora-content td{border:1px solid #ddd;padding:8px 12px;text-align:left}.editora-theme-dark .editora-content th,.editora-theme-dark .editora-content td{border-color:#3c3c3c}.editora-content th{background:#f5f5f5;font-weight:600}.editora-theme-dark .editora-content th{background:#252526}.editora-content img{max-width:100%;height:auto;border-radius:4px;display:block}.editora-content video{max-width:100%;height:auto;border-radius:4px;display:block}.editora-editor.loading{opacity:.7;pointer-events:none}.editora-editor.loading:after{content:"";position:absolute;top:50%;left:50%;width:24px;height:24px;margin:-12px 0 0 -12px;border:3px solid #ddd;border-top-color:#06c;border-radius:50%;animation:editora-spin .8s linear infinite}@keyframes editora-spin{to{transform:rotate(360deg)}}.toolbar-container-wrapper{display:flex;align-items:center;background:#fff;border-bottom:1px solid #e0e0e0;padding:0;margin:0;width:100%;box-sizing:border-box;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,sans-serif;font-size:14px;line-height:1.5;position:relative}.toolbar-container-wrapper[data-toolbar-sticky=true]{position:sticky;top:0;z-index:999;box-shadow:0 2px 4px #0000001a}.toolbar-container-wrapper[data-toolbar-floating=true]{position:fixed;top:0;left:0;right:0;z-index:1000;box-shadow:0 4px 12px #00000026}.toolbar-container-wrapper[data-toolbar-position=bottom]{border-bottom:none;border-top:1px solid #e0e0e0}.toolbar-container-wrapper .toolbar-wrapper{display:flex;width:100%;padding:8px;gap:4px;flex-wrap:wrap;align-items:center}.toolbar-container-wrapper .toolbar{display:flex;width:100%;gap:4px;flex-wrap:wrap;align-items:center}.toolbar-container-wrapper .toolbar-container{display:flex;gap:4px;flex-wrap:wrap;align-items:center;flex:1;position:relative}.toolbar-container-wrapper .toolbar-item{display:flex;align-items:center;gap:2px}.toolbar-container-wrapper .toolbar-button{padding:6px 10px;border:1px solid #d1d5db;background:#fff;border-radius:4px;cursor:pointer;font-size:13px;display:flex;align-items:center;justify-content:center;gap:4px;transition:all .15s ease;min-height:32px;white-space:nowrap}.toolbar-container-wrapper .toolbar-button:hover{background-color:#f3f4f6;border-color:#9ca3af}.toolbar-container-wrapper .toolbar-button:active,.toolbar-container-wrapper .toolbar-button[data-active=true]{background-color:#06c;color:#fff;border-color:#0052a3;box-shadow:inset 0 1px 3px #0000001a}.toolbar-container-wrapper .toolbar-button:disabled{opacity:.5;cursor:not-allowed;background-color:#f9fafb}.toolbar-container-wrapper .toolbar-more-button{padding:6px 8px;font-size:16px;font-weight:500;line-height:1}.toolbar-container-wrapper .toolbar-separator{width:1px;height:24px;background-color:#d1d5db;margin:0 4px}.toolbar-container-wrapper .toolbar-icon{display:inline-flex;align-items:center;justify-content:center;width:18px;height:18px;flex-shrink:0}.toolbar-container-wrapper .toolbar-icon svg{width:100%;height:100%}.toolbar-container-wrapper .toolbar-dropdown{position:relative;display:flex;align-items:center}.toolbar-container-wrapper .toolbar-dropdown-arrow{font-size:10px;margin-left:2px;line-height:1}.toolbar-container-wrapper .toolbar-dropdown-menu{position:absolute;top:100%;left:0;background:#fff;border:1px solid #d1d5db;border-radius:6px;box-shadow:0 4px 12px #00000026;z-index:1000;min-width:160px;padding:4px 0;margin-top:4px;display:none}.toolbar-container-wrapper .toolbar-dropdown-menu.show{display:block}.toolbar-container-wrapper .toolbar-dropdown-item{display:block;width:100%;padding:8px 12px;border:none;background:transparent;text-align:left;cursor:pointer;font-size:13px;color:#1f2937;transition:background-color .15s ease;font-family:inherit}.toolbar-container-wrapper .toolbar-dropdown-item:hover{background-color:#f3f4f6}.toolbar-container-wrapper .toolbar-dropdown-item:active{background-color:#e5e7eb}.toolbar-container-wrapper .toolbar-input{padding:6px 8px;border:1px solid #d1d5db;border-radius:4px;font-size:13px;font-family:inherit;background-color:#fff;color:#1f2937;transition:all .15s ease}.toolbar-container-wrapper .toolbar-input:focus{outline:none;border-color:#06c;box-shadow:0 0 0 3px #0066cc1a;background-color:#fff}.toolbar-container-wrapper .toolbar-input::placeholder{color:#9ca3af}.toolbar-overflow-menu{animation:slideDown .2s ease-out}@keyframes slideDown{0%{opacity:0;transform:translateY(-8px)}to{opacity:1;transform:translateY(0)}}.toolbar-overflow-item{transition:background-color .15s ease}.floating-toolbar{user-select:none;-webkit-user-select:none;font-family:system-ui,-apple-system,sans-serif;font-size:14px;animation:fadeInUp .15s ease-out}@keyframes fadeInUp{0%{opacity:0;transform:translate(-50%) translateY(10px)}to{opacity:1;transform:translate(-50%) translateY(0)}}.floating-toolbar-btn{display:flex;align-items:center;justify-content:center;width:32px;height:32px;border:none;background:transparent;border-radius:4px;color:#495057;cursor:pointer;font-size:14px;font-weight:500;transition:all .15s ease;outline:none}.floating-toolbar-btn:hover{background:#f8f9fa;color:#212529}.floating-toolbar-btn:active{background:#e9ecef;transform:scale(.95)}.floating-toolbar-btn.floating-toolbar-toggle{color:#dc3545;font-weight:700}.floating-toolbar-btn.floating-toolbar-toggle:hover{background:#f8d7da;color:#721c24}.floating-toolbar-separator{width:1px;height:20px;background:#e1e5e9;margin:0 2px}@media(max-width:768px){.toolbar-container-wrapper .toolbar-button{padding:5px 8px;font-size:12px;min-height:28px}.toolbar-container-wrapper .toolbar-icon{width:16px;height:16px}.toolbar-container-wrapper .toolbar-dropdown-menu{min-width:140px}.toolbar-container-wrapper .toolbar-dropdown-item{padding:6px 10px;font-size:12px}.floating-toolbar{padding:4px;gap:2px}.floating-toolbar-btn{width:28px;height:28px;font-size:12px}}@media(max-width:480px){.toolbar-container-wrapper{padding:4px}.toolbar-container-wrapper .toolbar-wrapper{padding:4px;gap:2px}.toolbar-container-wrapper .toolbar-button{padding:4px 6px;font-size:11px;min-height:24px}.toolbar-container-wrapper .toolbar-icon{width:14px;height:14px}}.floating-toolbar{pointer-events:auto}.floating-toolbar{max-width:calc(100vw - 20px);overflow-x:auto}@media(prefers-color-scheme:dark){.floating-toolbar{background:#2d3748;border-color:#4a5568;color:#e2e8f0}.floating-toolbar-btn:hover{background:#4a5568;color:#f7fafc}.floating-toolbar-btn:active{background:#718096}.floating-toolbar-separator{background:#4a5568}}';
|
|
1447
1460
|
let m;
|
|
1448
1461
|
function W() {
|
|
1449
|
-
const
|
|
1450
|
-
if (!document.getElementById(
|
|
1462
|
+
const n = "editora-webcomponent-styles";
|
|
1463
|
+
if (!document.getElementById(n)) {
|
|
1451
1464
|
const t = document.createElement("style");
|
|
1452
|
-
t.id =
|
|
1465
|
+
t.id = n, t.textContent = U, document.head.appendChild(t);
|
|
1453
1466
|
}
|
|
1454
1467
|
}
|
|
1455
|
-
function
|
|
1468
|
+
function _() {
|
|
1456
1469
|
if (!m) {
|
|
1457
|
-
const
|
|
1458
|
-
|
|
1470
|
+
const n = p.__globalPluginLoader;
|
|
1471
|
+
n ? m = n : m = new x();
|
|
1459
1472
|
}
|
|
1460
1473
|
return m;
|
|
1461
1474
|
}
|
|
1462
1475
|
class p extends HTMLElement {
|
|
1463
1476
|
constructor() {
|
|
1464
|
-
if (super(), this.pluginLoader =
|
|
1477
|
+
if (super(), this.pluginLoader = _(), this.config = {}, this.isInitialized = !1, this.keyboardShortcutManager = new O(), this.lastAutosavedContent = "", this.loadedPlugins = [], W(), !this.hasAttribute("data-initial-content")) {
|
|
1465
1478
|
const t = this.innerHTML.trim();
|
|
1466
1479
|
t && this.setAttribute("data-initial-content", t);
|
|
1467
1480
|
}
|
|
@@ -1601,15 +1614,15 @@ class p extends HTMLElement {
|
|
|
1601
1614
|
if (typeof this.config.plugins == "string") {
|
|
1602
1615
|
const i = this.config.plugins.split(/\s+/).filter(Boolean);
|
|
1603
1616
|
r && !i.includes("a11yChecker") && i.push("a11yChecker");
|
|
1604
|
-
for (const
|
|
1605
|
-
const s = await this.pluginLoader.load(
|
|
1617
|
+
for (const a of i) {
|
|
1618
|
+
const s = await this.pluginLoader.load(a, this.getPluginLoadConfig(a));
|
|
1606
1619
|
s && t.push(s);
|
|
1607
1620
|
}
|
|
1608
1621
|
} else if (Array.isArray(this.config.plugins)) {
|
|
1609
1622
|
for (const i of this.config.plugins)
|
|
1610
1623
|
if (typeof i == "string") {
|
|
1611
|
-
const
|
|
1612
|
-
|
|
1624
|
+
const a = await this.pluginLoader.load(i, this.getPluginLoadConfig(i));
|
|
1625
|
+
a && t.push(a);
|
|
1613
1626
|
} else
|
|
1614
1627
|
t.push(i);
|
|
1615
1628
|
if (r && !t.some((i) => (i == null ? void 0 : i.name) === "a11yChecker")) {
|
|
@@ -1619,8 +1632,8 @@ class p extends HTMLElement {
|
|
|
1619
1632
|
}
|
|
1620
1633
|
} else {
|
|
1621
1634
|
const i = this.pluginLoader.getRegisteredPluginNames();
|
|
1622
|
-
for (const
|
|
1623
|
-
const s = await this.pluginLoader.load(
|
|
1635
|
+
for (const a of i) {
|
|
1636
|
+
const s = await this.pluginLoader.load(a, this.getPluginLoadConfig(a));
|
|
1624
1637
|
s && t.push(s);
|
|
1625
1638
|
}
|
|
1626
1639
|
}
|
|
@@ -1740,19 +1753,23 @@ class p extends HTMLElement {
|
|
|
1740
1753
|
this.contentElement.spellcheck = e, this.contentElement.setAttribute("spellcheck", e ? "true" : "false");
|
|
1741
1754
|
}
|
|
1742
1755
|
executeCommand(t, e) {
|
|
1743
|
-
var
|
|
1756
|
+
var i;
|
|
1744
1757
|
typeof window != "undefined" && (window.__editoraCommandEditorRoot = this);
|
|
1745
|
-
const o =
|
|
1746
|
-
|
|
1747
|
-
|
|
1748
|
-
|
|
1758
|
+
const o = {
|
|
1759
|
+
editorElement: this,
|
|
1760
|
+
contentElement: this.contentElement,
|
|
1761
|
+
toolbarElement: this.toolbarElement
|
|
1762
|
+
}, r = this.loadedPlugins.find((a) => a.commands && a.commands[t]);
|
|
1763
|
+
if (r && r.commands) {
|
|
1764
|
+
const a = r.commands[t];
|
|
1765
|
+
if (typeof a == "function")
|
|
1749
1766
|
try {
|
|
1750
|
-
return
|
|
1751
|
-
} catch (
|
|
1752
|
-
return console.error(`[RichTextEditor] Error executing native command ${t}:`,
|
|
1767
|
+
return a(t === "toggleFullscreen" ? this : e, o), !0;
|
|
1768
|
+
} catch (s) {
|
|
1769
|
+
return console.error(`[RichTextEditor] Error executing native command ${t}:`, s), !1;
|
|
1753
1770
|
}
|
|
1754
1771
|
}
|
|
1755
|
-
return ((
|
|
1772
|
+
return ((i = this.engine) == null ? void 0 : i.execCommand(t, e)) || !1;
|
|
1756
1773
|
}
|
|
1757
1774
|
getPluginLoadConfig(t) {
|
|
1758
1775
|
const e = this.config.pluginConfig;
|
|
@@ -1769,9 +1786,9 @@ class p extends HTMLElement {
|
|
|
1769
1786
|
...o[t] || []
|
|
1770
1787
|
];
|
|
1771
1788
|
for (const i of r) {
|
|
1772
|
-
const
|
|
1773
|
-
if (
|
|
1774
|
-
return
|
|
1789
|
+
const a = this.config[i];
|
|
1790
|
+
if (a && typeof a == "object" && !Array.isArray(a))
|
|
1791
|
+
return a;
|
|
1775
1792
|
}
|
|
1776
1793
|
}
|
|
1777
1794
|
getContentSanitizeConfig() {
|
|
@@ -1881,7 +1898,7 @@ class p extends HTMLElement {
|
|
|
1881
1898
|
t,
|
|
1882
1899
|
this.pluginLoader
|
|
1883
1900
|
// Pass plugin loader to get all registered plugins
|
|
1884
|
-
), this.toolbar.setCommandHandler((i,
|
|
1901
|
+
), this.toolbar.setCommandHandler((i, a) => {
|
|
1885
1902
|
var s;
|
|
1886
1903
|
if (this.contentElement) {
|
|
1887
1904
|
this.contentElement.focus();
|
|
@@ -1891,7 +1908,7 @@ class p extends HTMLElement {
|
|
|
1891
1908
|
d.nodeType === Node.TEXT_NODE ? c.setStart(d, ((s = d.textContent) == null ? void 0 : s.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);
|
|
1892
1909
|
}
|
|
1893
1910
|
}
|
|
1894
|
-
return this.executeCommand(i,
|
|
1911
|
+
return this.executeCommand(i, a);
|
|
1895
1912
|
}), 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);
|
|
1896
1913
|
try {
|
|
1897
1914
|
document.execCommand("defaultParagraphSeparator", !1, "p");
|
|
@@ -1923,9 +1940,9 @@ class p extends HTMLElement {
|
|
|
1923
1940
|
this.contentElement.addEventListener("input", () => {
|
|
1924
1941
|
if (!this.contentElement) return;
|
|
1925
1942
|
let o = this.contentElement.innerHTML;
|
|
1926
|
-
const r = this.getPerformanceConfig(), i = this.getContentSanitizeConfig(),
|
|
1927
|
-
if (
|
|
1928
|
-
const l = $(o, i,
|
|
1943
|
+
const r = this.getPerformanceConfig(), i = this.getContentSanitizeConfig(), a = this.getSecurityConfig();
|
|
1944
|
+
if (a.sanitizeOnInput !== !1 && i.sanitize !== !1) {
|
|
1945
|
+
const l = $(o, i, a);
|
|
1929
1946
|
if (l !== o) {
|
|
1930
1947
|
const c = window.getSelection(), d = c && c.rangeCount > 0 ? c.getRangeAt(0) : null;
|
|
1931
1948
|
if (this.contentElement.innerHTML = l, d && c)
|
|
@@ -1952,20 +1969,20 @@ class p extends HTMLElement {
|
|
|
1952
1969
|
o.preventDefault();
|
|
1953
1970
|
const r = this.config.paste || {};
|
|
1954
1971
|
let i = ((d = o.clipboardData) == null ? void 0 : d.getData("text/html")) || "";
|
|
1955
|
-
const
|
|
1956
|
-
if ((r.clean || !r.keepFormatting) &&
|
|
1957
|
-
document.execCommand("insertText", !1,
|
|
1972
|
+
const a = ((g = o.clipboardData) == null ? void 0 : g.getData("text/plain")) || "", s = this.getContentSanitizeConfig(), l = this.getSecurityConfig(), c = !!i && /class=["'][^"']*Mso|xmlns:w=|urn:schemas-microsoft-com:office/i.test(i);
|
|
1973
|
+
if ((r.clean || !r.keepFormatting) && a) {
|
|
1974
|
+
document.execCommand("insertText", !1, a);
|
|
1958
1975
|
return;
|
|
1959
1976
|
}
|
|
1960
|
-
if (r.convertWord === !1 && c &&
|
|
1961
|
-
document.execCommand("insertText", !1,
|
|
1977
|
+
if (r.convertWord === !1 && c && a) {
|
|
1978
|
+
document.execCommand("insertText", !1, a);
|
|
1962
1979
|
return;
|
|
1963
1980
|
}
|
|
1964
1981
|
if (i) {
|
|
1965
1982
|
l.sanitizeOnPaste !== !1 && s.sanitize !== !1 && (i = F(i, s, l)), this.insertHTMLAtSelection(i);
|
|
1966
1983
|
return;
|
|
1967
1984
|
}
|
|
1968
|
-
|
|
1985
|
+
a && document.execCommand("insertText", !1, a);
|
|
1969
1986
|
}), this.contentElement.addEventListener("focus", () => {
|
|
1970
1987
|
this.dispatchEvent(new Event("editor-focus", { bubbles: !0 })), this.updateStatusBar();
|
|
1971
1988
|
}), this.contentElement.addEventListener("blur", () => {
|
|
@@ -1974,8 +1991,8 @@ class p extends HTMLElement {
|
|
|
1974
1991
|
bubbles: !0
|
|
1975
1992
|
})), this.dispatchEvent(new Event("editor-blur", { bubbles: !0 })), this.updateFloatingToolbar(), this.updateStatusBar();
|
|
1976
1993
|
}), this.contentElement.addEventListener("keydown", (o) => {
|
|
1977
|
-
this.getAccessibilityConfig().keyboardNavigation && t.handleKeyDown(o, (i,
|
|
1978
|
-
this.executeCommand(i,
|
|
1994
|
+
this.getAccessibilityConfig().keyboardNavigation && t.handleKeyDown(o, (i, a) => {
|
|
1995
|
+
this.executeCommand(i, a);
|
|
1979
1996
|
});
|
|
1980
1997
|
});
|
|
1981
1998
|
const e = () => {
|
|
@@ -2047,13 +2064,13 @@ class p extends HTMLElement {
|
|
|
2047
2064
|
const t = this.getPerformanceConfig(), e = document.activeElement === this.contentElement || this.contentElement.contains(document.activeElement);
|
|
2048
2065
|
if (t.viewportOnlyScan && !this.isEditorInViewport() && !e)
|
|
2049
2066
|
return;
|
|
2050
|
-
const o = this.contentElement.textContent || "", { words: r, chars: i } = z(o),
|
|
2067
|
+
const o = this.contentElement.textContent || "", { words: r, chars: i } = z(o), a = N(this.contentElement);
|
|
2051
2068
|
let s, l;
|
|
2052
2069
|
const c = this.getSelectionRangeInEditor();
|
|
2053
2070
|
c && (s = P(this.contentElement, c), c.collapsed || (l = B(c, s), s = void 0)), this.statusBar.update({
|
|
2054
2071
|
wordCount: r,
|
|
2055
2072
|
charCount: i,
|
|
2056
|
-
lineCount:
|
|
2073
|
+
lineCount: a,
|
|
2057
2074
|
cursorPosition: s,
|
|
2058
2075
|
selectionInfo: l
|
|
2059
2076
|
});
|
|
@@ -2200,73 +2217,73 @@ class p extends HTMLElement {
|
|
|
2200
2217
|
}
|
|
2201
2218
|
const y = new x();
|
|
2202
2219
|
p.__globalPluginLoader = y;
|
|
2203
|
-
const
|
|
2220
|
+
const K = {
|
|
2204
2221
|
// Core editing plugins (always loaded)
|
|
2205
|
-
bold: () => import("./BoldPlugin.native-BAzzoqU5.mjs").then((
|
|
2206
|
-
italic: () => import("./ItalicPlugin.native-CQjjDyUL.mjs").then((
|
|
2207
|
-
underline: () => import("./UnderlinePlugin.native-QpIcK4L2.mjs").then((
|
|
2208
|
-
strikethrough: () => import("./StrikethroughPlugin.native-0Be7j49s.mjs").then((
|
|
2209
|
-
clearFormatting: () => import("./ClearFormattingPlugin.native-Bq_XcTh2.mjs").then((
|
|
2210
|
-
heading: () => import("./HeadingPlugin.native-DrLYwQnQ.mjs").then((
|
|
2211
|
-
blockquote: () => import("./BlockquotePlugin.native-JFmOLsxN.mjs").then((
|
|
2212
|
-
code: () => import("./CodePlugin.native-
|
|
2213
|
-
codeSample: () => import("./CodeSamplePlugin.native-CgGoH-X4.mjs").then((
|
|
2214
|
-
list: () => import("./ListPlugin.native-V7EZC1lM.mjs").then((
|
|
2215
|
-
checklist: () => import("./ChecklistPlugin.native-nuSSEFNI.mjs").then((
|
|
2216
|
-
textAlignment: () => import("./TextAlignmentPlugin.native-sM_1s00t.mjs").then((
|
|
2217
|
-
indent: () => import("./IndentPlugin.native-BHixp8sP.mjs").then((
|
|
2218
|
-
direction: () => import("./DirectionPlugin.native-CDnbdNyl.mjs").then((
|
|
2219
|
-
textColor: () => import("./TextColorPlugin.native-
|
|
2220
|
-
backgroundColor: () => import("./BackgroundColorPlugin.native-
|
|
2221
|
-
fontSize: () => import("./FontSizePlugin.native-B_jCh7dY.mjs").then((
|
|
2222
|
-
fontFamily: () => import("./FontFamilyPlugin.native-j8hMTbg4.mjs").then((
|
|
2223
|
-
lineHeight: () => import("./LineHeightPlugin.native-CM7iXdQj.mjs").then((
|
|
2224
|
-
capitalization: () => import("./CapitalizationPlugin.native-DOMsh5R7.mjs").then((
|
|
2225
|
-
history: () => import("./HistoryPlugin.native-TDnVMsEO.mjs").then((
|
|
2222
|
+
bold: () => import("./BoldPlugin.native-BAzzoqU5.mjs").then((n) => n.BoldPlugin()),
|
|
2223
|
+
italic: () => import("./ItalicPlugin.native-CQjjDyUL.mjs").then((n) => n.ItalicPlugin()),
|
|
2224
|
+
underline: () => import("./UnderlinePlugin.native-QpIcK4L2.mjs").then((n) => n.UnderlinePlugin()),
|
|
2225
|
+
strikethrough: () => import("./StrikethroughPlugin.native-0Be7j49s.mjs").then((n) => n.StrikethroughPlugin()),
|
|
2226
|
+
clearFormatting: () => import("./ClearFormattingPlugin.native-Bq_XcTh2.mjs").then((n) => n.ClearFormattingPlugin()),
|
|
2227
|
+
heading: () => import("./HeadingPlugin.native-DrLYwQnQ.mjs").then((n) => n.HeadingPlugin()),
|
|
2228
|
+
blockquote: () => import("./BlockquotePlugin.native-JFmOLsxN.mjs").then((n) => n.BlockquotePlugin()),
|
|
2229
|
+
code: () => import("./CodePlugin.native-DlpTPdkd.mjs").then((n) => n.CodePlugin()),
|
|
2230
|
+
codeSample: () => import("./CodeSamplePlugin.native-CgGoH-X4.mjs").then((n) => n.CodeSamplePlugin()),
|
|
2231
|
+
list: () => import("./ListPlugin.native-V7EZC1lM.mjs").then((n) => n.ListPlugin()),
|
|
2232
|
+
checklist: () => import("./ChecklistPlugin.native-nuSSEFNI.mjs").then((n) => n.ChecklistPlugin()),
|
|
2233
|
+
textAlignment: () => import("./TextAlignmentPlugin.native-sM_1s00t.mjs").then((n) => n.TextAlignmentPlugin()),
|
|
2234
|
+
indent: () => import("./IndentPlugin.native-BHixp8sP.mjs").then((n) => n.IndentPlugin()),
|
|
2235
|
+
direction: () => import("./DirectionPlugin.native-CDnbdNyl.mjs").then((n) => n.DirectionPlugin()),
|
|
2236
|
+
textColor: () => import("./TextColorPlugin.native-Bwl_bSmc.mjs").then((n) => n.TextColorPlugin()),
|
|
2237
|
+
backgroundColor: () => import("./BackgroundColorPlugin.native-50iAT9xU.mjs").then((n) => n.BackgroundColorPlugin()),
|
|
2238
|
+
fontSize: () => import("./FontSizePlugin.native-B_jCh7dY.mjs").then((n) => n.FontSizePlugin()),
|
|
2239
|
+
fontFamily: () => import("./FontFamilyPlugin.native-j8hMTbg4.mjs").then((n) => n.FontFamilyPlugin()),
|
|
2240
|
+
lineHeight: () => import("./LineHeightPlugin.native-CM7iXdQj.mjs").then((n) => n.LineHeightPlugin()),
|
|
2241
|
+
capitalization: () => import("./CapitalizationPlugin.native-DOMsh5R7.mjs").then((n) => n.CapitalizationPlugin()),
|
|
2242
|
+
history: () => import("./HistoryPlugin.native-TDnVMsEO.mjs").then((n) => n.HistoryPlugin()),
|
|
2226
2243
|
// Advanced plugins (lazy loaded)
|
|
2227
|
-
link: () => import("./LinkPlugin.native-
|
|
2228
|
-
table: () => import("./TablePlugin.native-DrHX-efe.mjs").then((
|
|
2229
|
-
anchor: () => import("./AnchorPlugin.native-
|
|
2230
|
-
embedIframe: () => import("./EmbedIframePlugin.native-
|
|
2231
|
-
math: () => import("./MathPlugin.native-
|
|
2232
|
-
image: () => import("./MediaManagerPlugin.native-
|
|
2233
|
-
mergeTag: () => import("./MergeTagPlugin.native-
|
|
2234
|
-
pageBreak: () => import("./PageBreakPlugin.native-
|
|
2235
|
-
print: () => import("./PrintPlugin.native-7qt5v7L5.mjs").then((
|
|
2236
|
-
preview: () => import("./PreviewPlugin.native-DBvfpmIv.mjs").then((
|
|
2237
|
-
specialCharacters: () => import("./SpecialCharactersPlugin.native-
|
|
2238
|
-
spellCheck: () => import("./SpellCheckPlugin.native-
|
|
2239
|
-
emojis: () => import("./EmojisPlugin.native-
|
|
2240
|
-
a11yChecker: () => import("./A11yCheckerPlugin.native-BRdGYMju.mjs").then((
|
|
2241
|
-
comments: () => import("./CommentsPlugin.native-
|
|
2242
|
-
"document-manager": () => import("./DocumentManagerPlugin.native-
|
|
2243
|
-
fullscreen: () => import("./FullscreenPlugin.native-ChXyxeNw.mjs").then((
|
|
2244
|
-
template: () => import("./TemplatePlugin.native-
|
|
2245
|
-
footnote: () => import("./FootnotePlugin.native-D730OGRm.mjs").then((
|
|
2244
|
+
link: () => import("./LinkPlugin.native-DYCIcdTm.mjs").then((n) => n.LinkPlugin()),
|
|
2245
|
+
table: () => import("./TablePlugin.native-DrHX-efe.mjs").then((n) => n.TablePlugin()),
|
|
2246
|
+
anchor: () => import("./AnchorPlugin.native-BcYGEtd9.mjs").then((n) => n.AnchorPlugin()),
|
|
2247
|
+
embedIframe: () => import("./EmbedIframePlugin.native-DKJx2OS7.mjs").then((n) => n.EmbedIframePlugin()),
|
|
2248
|
+
math: () => import("./MathPlugin.native-f_mDp8VL.mjs").then((n) => n.MathPlugin()),
|
|
2249
|
+
image: () => import("./MediaManagerPlugin.native-BiXiK8FC.mjs").then((n) => n.MediaManagerPlugin()),
|
|
2250
|
+
mergeTag: () => import("./MergeTagPlugin.native-C3eOfEgw.mjs").then((n) => n.MergeTagPlugin()),
|
|
2251
|
+
pageBreak: () => import("./PageBreakPlugin.native-CXdX5fAv.mjs").then((n) => n.PageBreakPlugin()),
|
|
2252
|
+
print: () => import("./PrintPlugin.native-7qt5v7L5.mjs").then((n) => n.PrintPlugin()),
|
|
2253
|
+
preview: () => import("./PreviewPlugin.native-DBvfpmIv.mjs").then((n) => n.PreviewPlugin()),
|
|
2254
|
+
specialCharacters: () => import("./SpecialCharactersPlugin.native-CZDato89.mjs").then((n) => n.SpecialCharactersPlugin()),
|
|
2255
|
+
spellCheck: () => import("./SpellCheckPlugin.native-BZB9AewP.mjs").then((n) => n.SpellCheckPlugin()),
|
|
2256
|
+
emojis: () => import("./EmojisPlugin.native-CitxxlWX.mjs").then((n) => n.EmojisPlugin()),
|
|
2257
|
+
a11yChecker: () => import("./A11yCheckerPlugin.native-BRdGYMju.mjs").then((n) => n.A11yCheckerPlugin()),
|
|
2258
|
+
comments: () => import("./CommentsPlugin.native-DPSqTkiv.mjs").then((n) => n.CommentsPlugin()),
|
|
2259
|
+
"document-manager": () => import("./DocumentManagerPlugin.native-C2cs_1w4.mjs").then((n) => n.DocumentManagerPlugin()),
|
|
2260
|
+
fullscreen: () => import("./FullscreenPlugin.native-ChXyxeNw.mjs").then((n) => n.FullscreenPlugin()),
|
|
2261
|
+
template: () => import("./TemplatePlugin.native-CrpfKRJ8.mjs").then((n) => n.TemplatePlugin()),
|
|
2262
|
+
footnote: () => import("./FootnotePlugin.native-D730OGRm.mjs").then((n) => n.FootnotePlugin())
|
|
2246
2263
|
};
|
|
2247
2264
|
async function q() {
|
|
2248
|
-
return Object.entries(
|
|
2249
|
-
y.register(
|
|
2265
|
+
return Object.entries(K).forEach(([n, t]) => {
|
|
2266
|
+
y.register(n, t);
|
|
2250
2267
|
}), y;
|
|
2251
2268
|
}
|
|
2252
|
-
typeof window != "undefined" && q().then((
|
|
2253
|
-
p.__globalPluginLoader =
|
|
2269
|
+
typeof window != "undefined" && q().then((n) => {
|
|
2270
|
+
p.__globalPluginLoader = n, customElements.get("editora-editor") || customElements.define("editora-editor", p);
|
|
2254
2271
|
const t = document.querySelectorAll("editora-editor:not([data-initial-content])"), e = [];
|
|
2255
2272
|
t.forEach((i) => {
|
|
2256
|
-
const
|
|
2257
|
-
e.push(
|
|
2273
|
+
const a = i.innerHTML.trim();
|
|
2274
|
+
e.push(a), a && i.setAttribute("data-initial-content", a);
|
|
2258
2275
|
});
|
|
2259
2276
|
const o = document.querySelectorAll("editora-editor");
|
|
2260
2277
|
Array.from(o).filter((i) => !i.hasAttribute("data-initial-content")).forEach((i) => {
|
|
2261
|
-
const
|
|
2262
|
-
e[
|
|
2278
|
+
const a = Array.from(o).indexOf(i);
|
|
2279
|
+
e[a] && i.setAttribute("data-initial-content", e[a]);
|
|
2263
2280
|
}), window.Editora = {
|
|
2264
2281
|
version: "1.0.0",
|
|
2265
2282
|
plugins: y.getRegisteredPluginNames(),
|
|
2266
2283
|
WebComponent: p,
|
|
2267
|
-
init: async (i,
|
|
2284
|
+
init: async (i, a) => {
|
|
2268
2285
|
const s = document.querySelector(i);
|
|
2269
|
-
return s instanceof p ? (
|
|
2286
|
+
return s instanceof p ? (a && await s.setConfig(a), s.getAPI()) : null;
|
|
2270
2287
|
}
|
|
2271
2288
|
};
|
|
2272
2289
|
});
|