@editora/core 1.0.6 → 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 +1 -1
- 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
|
@@ -76,9 +76,9 @@ class E {
|
|
|
76
76
|
const r = this.getPlugin(t);
|
|
77
77
|
if (!r)
|
|
78
78
|
throw new Error(`Plugin not found: ${t}`);
|
|
79
|
-
const i = this.getPluginConfig(t) || r.config || {},
|
|
79
|
+
const i = this.getPluginConfig(t) || r.config || {}, n = i.mode || "local";
|
|
80
80
|
try {
|
|
81
|
-
switch (
|
|
81
|
+
switch (n) {
|
|
82
82
|
case "local":
|
|
83
83
|
return r.executeLocal ? r.executeLocal(e, ...o) : null;
|
|
84
84
|
case "api":
|
|
@@ -91,17 +91,17 @@ class E {
|
|
|
91
91
|
try {
|
|
92
92
|
if (r.executeAPI)
|
|
93
93
|
return await r.executeAPI(e, ...o);
|
|
94
|
-
} catch (
|
|
95
|
-
if (console.warn(`API execution failed for ${t}, falling back to local`,
|
|
94
|
+
} catch (a) {
|
|
95
|
+
if (console.warn(`API execution failed for ${t}, falling back to local`, a), r.executeLocal && i.fallbackToLocal !== !1)
|
|
96
96
|
return r.executeLocal(e, ...o);
|
|
97
|
-
throw
|
|
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: ${n}`);
|
|
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
|
/**
|
|
@@ -435,9 +435,9 @@ class S {
|
|
|
435
435
|
return e.forEach((r, i) => {
|
|
436
436
|
o += `## ${i}
|
|
437
437
|
|
|
438
|
-
`, r.forEach((
|
|
439
|
-
const
|
|
440
|
-
o += `- **${
|
|
438
|
+
`, r.forEach((n) => {
|
|
439
|
+
const a = this.getShortcutDescription(n);
|
|
440
|
+
o += `- **${a}**: ${n.description || n.command}
|
|
441
441
|
`;
|
|
442
442
|
}), o += `
|
|
443
443
|
`;
|
|
@@ -578,6 +578,11 @@ class A {
|
|
|
578
578
|
}
|
|
579
579
|
class L {
|
|
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
|
-
r.forEach((
|
|
596
|
-
|
|
599
|
+
const e = [], o = t.split("|").map((a) => a.trim()), r = this.getAvailableToolbarItems(), i = /* @__PURE__ */ new Map();
|
|
600
|
+
r.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 n = {
|
|
599
604
|
bold: "toggleBold",
|
|
600
605
|
italic: "toggleItalic",
|
|
601
606
|
underline: "toggleUnderline",
|
|
@@ -646,19 +651,19 @@ class L {
|
|
|
646
651
|
insertVideo: "insertVideo",
|
|
647
652
|
codeBlock: "insertCodeBlock"
|
|
648
653
|
};
|
|
649
|
-
return o.forEach((
|
|
650
|
-
const
|
|
651
|
-
|
|
654
|
+
return o.forEach((a) => {
|
|
655
|
+
const s = [];
|
|
656
|
+
a.split(/\s+/).filter(Boolean).forEach((d) => {
|
|
652
657
|
if (d === "direction") {
|
|
653
658
|
const u = i.get("setDirectionLTR"), h = i.get("setDirectionRTL");
|
|
654
|
-
u &&
|
|
659
|
+
u && s.push({
|
|
655
660
|
id: "directionLTR",
|
|
656
661
|
label: u.label,
|
|
657
662
|
command: u.command,
|
|
658
663
|
icon: u.icon,
|
|
659
664
|
type: u.type || "button",
|
|
660
665
|
options: u.options
|
|
661
|
-
}), h &&
|
|
666
|
+
}), h && s.push({
|
|
662
667
|
id: "directionRTL",
|
|
663
668
|
label: h.label,
|
|
664
669
|
command: h.command,
|
|
@@ -670,14 +675,14 @@ class L {
|
|
|
670
675
|
}
|
|
671
676
|
if (d === "comments") {
|
|
672
677
|
const u = i.get("addComment"), h = i.get("toggleComments");
|
|
673
|
-
u &&
|
|
678
|
+
u && s.push({
|
|
674
679
|
id: "addComment",
|
|
675
680
|
label: u.label,
|
|
676
681
|
command: u.command,
|
|
677
682
|
icon: u.icon,
|
|
678
683
|
type: u.type || "button",
|
|
679
684
|
options: u.options
|
|
680
|
-
}), h &&
|
|
685
|
+
}), h && s.push({
|
|
681
686
|
id: "toggleComments",
|
|
682
687
|
label: h.label,
|
|
683
688
|
command: h.command,
|
|
@@ -687,9 +692,9 @@ class L {
|
|
|
687
692
|
});
|
|
688
693
|
return;
|
|
689
694
|
}
|
|
690
|
-
const f =
|
|
695
|
+
const f = n[d] || d;
|
|
691
696
|
let p = i.get(f);
|
|
692
|
-
p || (p = i.get(d)), p &&
|
|
697
|
+
p || (p = i.get(d)), p && s.push({
|
|
693
698
|
id: d,
|
|
694
699
|
label: p.label,
|
|
695
700
|
command: p.command,
|
|
@@ -698,7 +703,7 @@ class L {
|
|
|
698
703
|
options: p.options,
|
|
699
704
|
items: p.items
|
|
700
705
|
});
|
|
701
|
-
}),
|
|
706
|
+
}), s.length > 0 && e.push(s);
|
|
702
707
|
}), e;
|
|
703
708
|
}
|
|
704
709
|
/**
|
|
@@ -714,12 +719,12 @@ class L {
|
|
|
714
719
|
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
720
|
const e = this.config.items || this.getDefaultToolbarString(), o = this.parseToolbarString(e);
|
|
716
721
|
o.forEach((r, i) => {
|
|
717
|
-
const
|
|
718
|
-
if (
|
|
719
|
-
this.appendToolbarButton(
|
|
720
|
-
}), t.appendChild(
|
|
721
|
-
const
|
|
722
|
-
|
|
722
|
+
const n = document.createElement("div");
|
|
723
|
+
if (n.className = "editora-toolbar-group", r.forEach((a) => {
|
|
724
|
+
this.appendToolbarButton(n, a);
|
|
725
|
+
}), t.appendChild(n), i < o.length - 1) {
|
|
726
|
+
const a = document.createElement("div");
|
|
727
|
+
a.className = "editora-toolbar-separator", t.appendChild(a);
|
|
723
728
|
}
|
|
724
729
|
});
|
|
725
730
|
}
|
|
@@ -772,7 +777,7 @@ class L {
|
|
|
772
777
|
createInput(t) {
|
|
773
778
|
const e = document.createElement("input");
|
|
774
779
|
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);
|
|
780
|
+
o.preventDefault(), this.setLastCommandTrigger(e, t.command), this.commandHandler && t.command && this.commandHandler(t.command);
|
|
776
781
|
}), e;
|
|
777
782
|
}
|
|
778
783
|
/**
|
|
@@ -802,20 +807,22 @@ class L {
|
|
|
802
807
|
o.className = "editora-toolbar-button editora-toolbar-dropdown-trigger", o.type = "button", o.textContent = t.label;
|
|
803
808
|
const r = document.createElement("div");
|
|
804
809
|
r.className = "editora-toolbar-dropdown-menu", r.style.display = "none", t.options && t.options.forEach((a) => {
|
|
805
|
-
const
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
}), r.appendChild(
|
|
810
|
+
const s = document.createElement("button");
|
|
811
|
+
s.className = "editora-toolbar-dropdown-item", s.type = "button", s.textContent = a.label, s.setAttribute("data-value", a.value), s.addEventListener("click", (c) => {
|
|
812
|
+
c.preventDefault(), this.setLastCommandTrigger(o, t.command), this.commandHandler && t.command && this.commandHandler(t.command, a.value), r.style.display = "none";
|
|
813
|
+
}), r.appendChild(s);
|
|
809
814
|
}), o.addEventListener("click", (a) => {
|
|
810
|
-
a.preventDefault(), a.stopPropagation();
|
|
811
|
-
const
|
|
812
|
-
r.style.display =
|
|
815
|
+
a.preventDefault(), a.stopPropagation(), this.setLastCommandTrigger(o, t.command);
|
|
816
|
+
const s = r.style.display === "block";
|
|
817
|
+
r.style.display = s ? "none" : "block";
|
|
813
818
|
});
|
|
814
819
|
const i = (a) => {
|
|
815
820
|
e.contains(a.target) || (r.style.display = "none");
|
|
821
|
+
}, n = (a) => {
|
|
822
|
+
a.key === "Escape" && (r.style.display = "none");
|
|
816
823
|
};
|
|
817
|
-
return document.addEventListener("
|
|
818
|
-
document.removeEventListener("
|
|
824
|
+
return document.addEventListener("mousedown", i, !0), document.addEventListener("keydown", n), e._cleanupDropdown = () => {
|
|
825
|
+
document.removeEventListener("mousedown", i, !0), document.removeEventListener("keydown", n);
|
|
819
826
|
}, e.appendChild(o), e.appendChild(r), e;
|
|
820
827
|
}
|
|
821
828
|
/**
|
|
@@ -827,30 +834,36 @@ class L {
|
|
|
827
834
|
const o = document.createElement("button");
|
|
828
835
|
if (o.className = "editora-toolbar-button", o.type = "button", o.title = t.label, t.icon)
|
|
829
836
|
if (t.icon.startsWith("<svg") && t.icon.endsWith("</svg>")) {
|
|
830
|
-
const
|
|
831
|
-
|
|
837
|
+
const a = document.createElement("span");
|
|
838
|
+
a.className = "editora-toolbar-icon", a.innerHTML = t.icon, o.appendChild(a);
|
|
832
839
|
} else
|
|
833
840
|
o.innerHTML = t.icon;
|
|
834
841
|
else
|
|
835
842
|
o.textContent = t.label;
|
|
836
843
|
const r = document.createElement("div");
|
|
837
|
-
|
|
838
|
-
const
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
}), r.appendChild(
|
|
842
|
-
}), o.addEventListener("click", (
|
|
843
|
-
var
|
|
844
|
-
|
|
845
|
-
const
|
|
844
|
+
r.className = "editora-toolbar-dropdown-menu", r.style.display = "none", t.options && t.options.forEach((a) => {
|
|
845
|
+
const s = document.createElement("button");
|
|
846
|
+
s.className = "editora-toolbar-dropdown-item", s.type = "button", s.textContent = a.label, s.setAttribute("data-value", a.value), s.addEventListener("click", (c) => {
|
|
847
|
+
c.preventDefault(), c.stopPropagation(), this.setLastCommandTrigger(o, t.command), this.commandHandler && t.command && this.commandHandler(t.command, a.value), r.style.display = "none";
|
|
848
|
+
}), r.appendChild(s);
|
|
849
|
+
}), o.addEventListener("click", (a) => {
|
|
850
|
+
var c;
|
|
851
|
+
a.preventDefault(), a.stopPropagation(), this.setLastCommandTrigger(o, t.command);
|
|
852
|
+
const s = (c = this.container) == null ? void 0 : c.querySelectorAll(
|
|
846
853
|
".editora-toolbar-dropdown-menu"
|
|
847
854
|
);
|
|
848
|
-
|
|
849
|
-
|
|
855
|
+
s == null || s.forEach((d) => {
|
|
856
|
+
d !== r && (d.style.display = "none");
|
|
850
857
|
}), r.style.display = r.style.display === "none" ? "block" : "none";
|
|
851
|
-
})
|
|
852
|
-
|
|
853
|
-
|
|
858
|
+
});
|
|
859
|
+
const i = (a) => {
|
|
860
|
+
e.contains(a.target) || (r.style.display = "none");
|
|
861
|
+
}, n = (a) => {
|
|
862
|
+
a.key === "Escape" && (r.style.display = "none");
|
|
863
|
+
};
|
|
864
|
+
return document.addEventListener("mousedown", i, !0), document.addEventListener("keydown", n), e._cleanupDropdown = () => {
|
|
865
|
+
document.removeEventListener("mousedown", i, !0), document.removeEventListener("keydown", n);
|
|
866
|
+
}, e.appendChild(o), e.appendChild(r), e;
|
|
854
867
|
}
|
|
855
868
|
/**
|
|
856
869
|
* Get default toolbar string if none provided
|
|
@@ -957,19 +970,19 @@ class I {
|
|
|
957
970
|
}
|
|
958
971
|
this.statusInfo.language && o.push(this.statusInfo.language);
|
|
959
972
|
const r = [];
|
|
960
|
-
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,
|
|
961
|
-
r.push(`${i}: ${
|
|
962
|
-
}), o.forEach((i,
|
|
963
|
-
const
|
|
964
|
-
if (
|
|
965
|
-
const
|
|
966
|
-
|
|
973
|
+
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, n]) => {
|
|
974
|
+
r.push(`${i}: ${n}`);
|
|
975
|
+
}), o.forEach((i, n) => {
|
|
976
|
+
const a = document.createElement("span");
|
|
977
|
+
if (a.className = "editora-statusbar-item", a.textContent = i, t.appendChild(a), n < o.length - 1) {
|
|
978
|
+
const s = document.createElement("span");
|
|
979
|
+
s.className = "editora-statusbar-separator", s.textContent = "|", t.appendChild(s);
|
|
967
980
|
}
|
|
968
|
-
}), r.forEach((i,
|
|
969
|
-
const
|
|
970
|
-
if (
|
|
971
|
-
const
|
|
972
|
-
|
|
981
|
+
}), r.forEach((i, n) => {
|
|
982
|
+
const a = document.createElement("span");
|
|
983
|
+
if (a.className = "editora-statusbar-item", a.textContent = i, e.appendChild(a), n < r.length - 1) {
|
|
984
|
+
const s = document.createElement("span");
|
|
985
|
+
s.className = "editora-statusbar-separator", s.textContent = "|", e.appendChild(s);
|
|
973
986
|
}
|
|
974
987
|
}), this.container.appendChild(t), this.container.appendChild(e);
|
|
975
988
|
}
|
|
@@ -980,16 +993,16 @@ class I {
|
|
|
980
993
|
this.container && this.container.parentNode && this.container.parentNode.removeChild(this.container), this.container = void 0;
|
|
981
994
|
}
|
|
982
995
|
}
|
|
983
|
-
function D(
|
|
984
|
-
const e =
|
|
985
|
-
`),
|
|
986
|
-
return { line:
|
|
996
|
+
function D(l, t) {
|
|
997
|
+
const e = l.textContent || "", o = P(l, t.startContainer, t.startOffset), i = e.substring(0, o).split(`
|
|
998
|
+
`), n = i.length, a = i[i.length - 1].length + 1;
|
|
999
|
+
return { line: n, column: a };
|
|
987
1000
|
}
|
|
988
|
-
function P(
|
|
989
|
-
var
|
|
1001
|
+
function P(l, t, e) {
|
|
1002
|
+
var n;
|
|
990
1003
|
let o = 0;
|
|
991
1004
|
const r = document.createTreeWalker(
|
|
992
|
-
|
|
1005
|
+
l,
|
|
993
1006
|
NodeFilter.SHOW_TEXT,
|
|
994
1007
|
null
|
|
995
1008
|
);
|
|
@@ -998,32 +1011,32 @@ function P(s, t, e) {
|
|
|
998
1011
|
if (i === t) {
|
|
999
1012
|
o += e;
|
|
1000
1013
|
break;
|
|
1001
|
-
} else i.nodeType === Node.TEXT_NODE && (o += ((
|
|
1014
|
+
} else i.nodeType === Node.TEXT_NODE && (o += ((n = i.textContent) == null ? void 0 : n.length) || 0);
|
|
1002
1015
|
i = r.nextNode();
|
|
1003
1016
|
}
|
|
1004
1017
|
return o;
|
|
1005
1018
|
}
|
|
1006
|
-
function N(
|
|
1019
|
+
function N(l) {
|
|
1007
1020
|
var o, r;
|
|
1008
|
-
const t =
|
|
1021
|
+
const t = l.querySelectorAll("div, p, br, h1, h2, h3, h4, h5, h6, blockquote, li, pre");
|
|
1009
1022
|
let e = 1;
|
|
1010
1023
|
if (t.length > 0) {
|
|
1011
1024
|
e = t.length;
|
|
1012
1025
|
const i = t[t.length - 1];
|
|
1013
1026
|
(i.tagName === "BR" || ((o = i.innerHTML) == null ? void 0 : o.trim()) === "" || ((r = i.textContent) == null ? void 0 : r.trim()) === "") && e++;
|
|
1014
1027
|
} else {
|
|
1015
|
-
const
|
|
1028
|
+
const n = (l.textContent || "").split(`
|
|
1016
1029
|
`).length;
|
|
1017
|
-
e = Math.max(1,
|
|
1030
|
+
e = Math.max(1, n);
|
|
1018
1031
|
}
|
|
1019
1032
|
return e;
|
|
1020
1033
|
}
|
|
1021
|
-
function z(
|
|
1022
|
-
const t =
|
|
1034
|
+
function z(l) {
|
|
1035
|
+
const t = l.trim() ? l.trim().split(/\s+/).length : 0, e = l.length;
|
|
1023
1036
|
return { words: t, chars: e };
|
|
1024
1037
|
}
|
|
1025
|
-
function
|
|
1026
|
-
const e =
|
|
1038
|
+
function O(l, t) {
|
|
1039
|
+
const e = l.toString();
|
|
1027
1040
|
return {
|
|
1028
1041
|
startLine: t.line,
|
|
1029
1042
|
startColumn: t.column,
|
|
@@ -1052,12 +1065,12 @@ const v = class v {
|
|
|
1052
1065
|
static normalizeConfig(t) {
|
|
1053
1066
|
const e = { ...t };
|
|
1054
1067
|
if (e.toolbarFloating !== void 0 || e.toolbarSticky !== void 0) {
|
|
1055
|
-
const
|
|
1056
|
-
e.toolbarFloating !== void 0 && (
|
|
1068
|
+
const n = typeof e.toolbar == "object" && e.toolbar ? { ...e.toolbar } : typeof e.toolbar == "string" ? { items: e.toolbar } : {};
|
|
1069
|
+
e.toolbarFloating !== void 0 && (n.floating = !!e.toolbarFloating), e.toolbarSticky !== void 0 && (n.sticky = !!e.toolbarSticky), e.toolbar = n;
|
|
1057
1070
|
}
|
|
1058
1071
|
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 && (
|
|
1072
|
+
const n = typeof e.autosave == "object" && e.autosave ? { ...e.autosave } : {};
|
|
1073
|
+
e.autosaveEnabled !== void 0 && (n.enabled = !!e.autosaveEnabled), e.autosaveIntervalMs !== void 0 && (n.intervalMs = Number(e.autosaveIntervalMs)), e.autosaveStorageKey !== void 0 && (n.storageKey = e.autosaveStorageKey), e.autosaveProvider !== void 0 && (n.provider = e.autosaveProvider), e.autosaveApiUrl !== void 0 && (n.apiUrl = e.autosaveApiUrl), e.autosave = n;
|
|
1061
1074
|
}
|
|
1062
1075
|
const o = {
|
|
1063
1076
|
enabled: !1,
|
|
@@ -1072,16 +1085,16 @@ const v = class v {
|
|
|
1072
1085
|
enabled: e.autosave
|
|
1073
1086
|
};
|
|
1074
1087
|
else if (typeof e.autosave == "object" && e.autosave) {
|
|
1075
|
-
const
|
|
1088
|
+
const n = {
|
|
1076
1089
|
...o,
|
|
1077
1090
|
...e.autosave
|
|
1078
1091
|
};
|
|
1079
|
-
|
|
1092
|
+
n.intervalMs === void 0 && n.interval !== void 0 && (n.intervalMs = Number(n.interval)), n.enabled === void 0 && (n.enabled = !0), (!Number.isFinite(n.intervalMs) || n.intervalMs <= 0) && (n.intervalMs = o.intervalMs), e.autosave = n;
|
|
1080
1093
|
} else
|
|
1081
1094
|
e.autosave = o;
|
|
1082
1095
|
if (e.languageLocale !== void 0 || e.languageDirection !== void 0) {
|
|
1083
|
-
const
|
|
1084
|
-
e.languageLocale !== void 0 && (
|
|
1096
|
+
const n = typeof e.language == "object" && e.language ? { ...e.language } : {};
|
|
1097
|
+
e.languageLocale !== void 0 && (n.locale = e.languageLocale), e.languageDirection !== void 0 && (n.direction = e.languageDirection), e.language = n;
|
|
1085
1098
|
}
|
|
1086
1099
|
const r = { locale: "en", direction: "ltr" };
|
|
1087
1100
|
if (typeof e.language == "string" ? e.language = {
|
|
@@ -1091,8 +1104,8 @@ const v = class v {
|
|
|
1091
1104
|
...r,
|
|
1092
1105
|
...e.language
|
|
1093
1106
|
} : e.language = r, e.spellcheckEnabled !== void 0 || e.spellcheckProvider !== void 0 || e.spellcheckApiUrl !== void 0) {
|
|
1094
|
-
const
|
|
1095
|
-
e.spellcheckEnabled !== void 0 && (
|
|
1107
|
+
const n = typeof e.spellcheck == "object" && e.spellcheck ? { ...e.spellcheck } : {};
|
|
1108
|
+
e.spellcheckEnabled !== void 0 && (n.enabled = !!e.spellcheckEnabled), e.spellcheckProvider !== void 0 && (n.provider = e.spellcheckProvider), e.spellcheckApiUrl !== void 0 && (n.apiUrl = e.spellcheckApiUrl), e.spellcheck = n;
|
|
1096
1109
|
}
|
|
1097
1110
|
const i = {
|
|
1098
1111
|
enabled: !1,
|
|
@@ -1105,11 +1118,11 @@ const v = class v {
|
|
|
1105
1118
|
enabled: e.spellcheck
|
|
1106
1119
|
};
|
|
1107
1120
|
else if (typeof e.spellcheck == "object" && e.spellcheck) {
|
|
1108
|
-
const
|
|
1121
|
+
const n = {
|
|
1109
1122
|
...i,
|
|
1110
1123
|
...e.spellcheck
|
|
1111
1124
|
};
|
|
1112
|
-
!
|
|
1125
|
+
!n.provider && n.mode && (n.provider = n.mode === "local" ? "browser" : "api"), n.enabled === void 0 && (n.enabled = !!(n.mode || n.provider || n.apiUrl)), e.spellcheck = n;
|
|
1113
1126
|
} else
|
|
1114
1127
|
e.spellcheck = i;
|
|
1115
1128
|
return e.contextMenuEnabled !== void 0 && (e.contextMenu = {
|
|
@@ -1277,7 +1290,7 @@ v.EDITOR_DEFAULTS = {
|
|
|
1277
1290
|
statusbar: !1
|
|
1278
1291
|
};
|
|
1279
1292
|
let y = v;
|
|
1280
|
-
class
|
|
1293
|
+
class B {
|
|
1281
1294
|
constructor() {
|
|
1282
1295
|
this.loadedPlugins = /* @__PURE__ */ new Map(), this.pluginRegistry = /* @__PURE__ */ new Map();
|
|
1283
1296
|
}
|
|
@@ -1399,69 +1412,69 @@ const j = [
|
|
|
1399
1412
|
td: ["colspan", "rowspan", "align", "valign"],
|
|
1400
1413
|
th: ["colspan", "rowspan", "align", "valign"]
|
|
1401
1414
|
};
|
|
1402
|
-
function k(
|
|
1415
|
+
function k(l, t, e) {
|
|
1403
1416
|
if ((t == null ? void 0 : t.sanitize) === !1)
|
|
1404
|
-
return
|
|
1405
|
-
const o = t != null && t.allowedTags && t.allowedTags.length > 0 ? t.allowedTags : j, i = !!(t != null && t.allowedAttributes) && Object.keys(t.allowedAttributes).length > 0 ? t.allowedAttributes : H,
|
|
1406
|
-
return
|
|
1417
|
+
return l;
|
|
1418
|
+
const o = t != null && t.allowedTags && t.allowedTags.length > 0 ? t.allowedTags : j, i = !!(t != null && t.allowedAttributes) && Object.keys(t.allowedAttributes).length > 0 ? t.allowedAttributes : H, n = document.createElement("div");
|
|
1419
|
+
return n.innerHTML = l, x(n, o, i), n.innerHTML;
|
|
1407
1420
|
}
|
|
1408
|
-
function x(
|
|
1409
|
-
const o = Array.from(
|
|
1421
|
+
function x(l, t, e) {
|
|
1422
|
+
const o = Array.from(l.childNodes);
|
|
1410
1423
|
for (const r of o)
|
|
1411
1424
|
if (r.nodeType === Node.ELEMENT_NODE) {
|
|
1412
|
-
const i = r,
|
|
1413
|
-
if (!t.includes(
|
|
1425
|
+
const i = r, n = i.tagName.toLowerCase();
|
|
1426
|
+
if (!t.includes(n)) {
|
|
1414
1427
|
for (; i.firstChild; )
|
|
1415
|
-
|
|
1416
|
-
|
|
1428
|
+
l.insertBefore(i.firstChild, i);
|
|
1429
|
+
l.removeChild(i);
|
|
1417
1430
|
continue;
|
|
1418
1431
|
}
|
|
1419
1432
|
R(i, e), x(i, t, e);
|
|
1420
|
-
} else r.nodeType !== Node.TEXT_NODE &&
|
|
1433
|
+
} else r.nodeType !== Node.TEXT_NODE && l.removeChild(r);
|
|
1421
1434
|
}
|
|
1422
|
-
function R(
|
|
1423
|
-
const e =
|
|
1424
|
-
for (const
|
|
1425
|
-
const
|
|
1435
|
+
function R(l, t) {
|
|
1436
|
+
const e = l.tagName.toLowerCase(), o = Array.from(l.attributes), r = t[e] || [], i = t["*"] || [], n = [...r, ...i];
|
|
1437
|
+
for (const a of o) {
|
|
1438
|
+
const s = a.name.toLowerCase();
|
|
1426
1439
|
let c = !1;
|
|
1427
|
-
|
|
1428
|
-
for (const d of
|
|
1440
|
+
n.includes(s) && (c = !0);
|
|
1441
|
+
for (const d of n)
|
|
1429
1442
|
if (d.endsWith("*")) {
|
|
1430
1443
|
const f = d.slice(0, -1);
|
|
1431
|
-
if (
|
|
1444
|
+
if (s.startsWith(f)) {
|
|
1432
1445
|
c = !0;
|
|
1433
1446
|
break;
|
|
1434
1447
|
}
|
|
1435
1448
|
}
|
|
1436
|
-
(
|
|
1449
|
+
(s.startsWith("on") || s === "javascript:" || s === "href" && a.value.trim().toLowerCase().startsWith("javascript:") || s === "src" && a.value.trim().toLowerCase().startsWith("javascript:")) && (c = !1), c || l.removeAttribute(a.name);
|
|
1437
1450
|
}
|
|
1438
|
-
|
|
1451
|
+
l.hasAttribute("href") && (l.getAttribute("href") || "").trim().toLowerCase().startsWith("javascript:") && l.removeAttribute("href"), l.hasAttribute("src") && (l.getAttribute("src") || "").trim().toLowerCase().startsWith("javascript:") && l.removeAttribute("src");
|
|
1439
1452
|
}
|
|
1440
|
-
function F(
|
|
1441
|
-
return (e == null ? void 0 : e.sanitizeOnPaste) === !1 ?
|
|
1453
|
+
function F(l, t, e) {
|
|
1454
|
+
return (e == null ? void 0 : e.sanitizeOnPaste) === !1 ? l : k(l, t);
|
|
1442
1455
|
}
|
|
1443
|
-
function $(
|
|
1444
|
-
return (e == null ? void 0 : e.sanitizeOnInput) === !1 ?
|
|
1456
|
+
function $(l, t, e) {
|
|
1457
|
+
return (e == null ? void 0 : e.sanitizeOnInput) === !1 ? l : k(l, t);
|
|
1445
1458
|
}
|
|
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 l = "editora-webcomponent-styles";
|
|
1463
|
+
if (!document.getElementById(l)) {
|
|
1451
1464
|
const t = document.createElement("style");
|
|
1452
|
-
t.id =
|
|
1465
|
+
t.id = l, t.textContent = U, document.head.appendChild(t);
|
|
1453
1466
|
}
|
|
1454
1467
|
}
|
|
1455
1468
|
function w() {
|
|
1456
1469
|
if (!m) {
|
|
1457
|
-
const
|
|
1458
|
-
|
|
1470
|
+
const l = g.__globalPluginLoader;
|
|
1471
|
+
l ? m = l : m = new B();
|
|
1459
1472
|
}
|
|
1460
1473
|
return m;
|
|
1461
1474
|
}
|
|
1462
|
-
function K(
|
|
1475
|
+
function K(l) {
|
|
1463
1476
|
const t = w();
|
|
1464
|
-
Object.entries(
|
|
1477
|
+
Object.entries(l).forEach(([e, o]) => {
|
|
1465
1478
|
t.register(e, o);
|
|
1466
1479
|
});
|
|
1467
1480
|
}
|
|
@@ -1607,15 +1620,15 @@ class g extends HTMLElement {
|
|
|
1607
1620
|
if (typeof this.config.plugins == "string") {
|
|
1608
1621
|
const i = this.config.plugins.split(/\s+/).filter(Boolean);
|
|
1609
1622
|
r && !i.includes("a11yChecker") && i.push("a11yChecker");
|
|
1610
|
-
for (const
|
|
1611
|
-
const
|
|
1612
|
-
|
|
1623
|
+
for (const n of i) {
|
|
1624
|
+
const a = await this.pluginLoader.load(n, this.getPluginLoadConfig(n));
|
|
1625
|
+
a && t.push(a);
|
|
1613
1626
|
}
|
|
1614
1627
|
} else if (Array.isArray(this.config.plugins)) {
|
|
1615
1628
|
for (const i of this.config.plugins)
|
|
1616
1629
|
if (typeof i == "string") {
|
|
1617
|
-
const
|
|
1618
|
-
|
|
1630
|
+
const n = await this.pluginLoader.load(i, this.getPluginLoadConfig(i));
|
|
1631
|
+
n && t.push(n);
|
|
1619
1632
|
} else
|
|
1620
1633
|
t.push(i);
|
|
1621
1634
|
if (r && !t.some((i) => (i == null ? void 0 : i.name) === "a11yChecker")) {
|
|
@@ -1625,9 +1638,9 @@ class g extends HTMLElement {
|
|
|
1625
1638
|
}
|
|
1626
1639
|
} else {
|
|
1627
1640
|
const i = this.pluginLoader.getRegisteredPluginNames();
|
|
1628
|
-
for (const
|
|
1629
|
-
const
|
|
1630
|
-
|
|
1641
|
+
for (const n of i) {
|
|
1642
|
+
const a = await this.pluginLoader.load(n, this.getPluginLoadConfig(n));
|
|
1643
|
+
a && t.push(a);
|
|
1631
1644
|
}
|
|
1632
1645
|
}
|
|
1633
1646
|
return t;
|
|
@@ -1746,19 +1759,23 @@ class g extends HTMLElement {
|
|
|
1746
1759
|
this.contentElement.spellcheck = e, this.contentElement.setAttribute("spellcheck", e ? "true" : "false");
|
|
1747
1760
|
}
|
|
1748
1761
|
executeCommand(t, e) {
|
|
1749
|
-
var
|
|
1762
|
+
var i;
|
|
1750
1763
|
typeof window != "undefined" && (window.__editoraCommandEditorRoot = this);
|
|
1751
|
-
const o =
|
|
1752
|
-
|
|
1753
|
-
|
|
1754
|
-
|
|
1764
|
+
const o = {
|
|
1765
|
+
editorElement: this,
|
|
1766
|
+
contentElement: this.contentElement,
|
|
1767
|
+
toolbarElement: this.toolbarElement
|
|
1768
|
+
}, r = this.loadedPlugins.find((n) => n.commands && n.commands[t]);
|
|
1769
|
+
if (r && r.commands) {
|
|
1770
|
+
const n = r.commands[t];
|
|
1771
|
+
if (typeof n == "function")
|
|
1755
1772
|
try {
|
|
1756
|
-
return
|
|
1773
|
+
return n(t === "toggleFullscreen" ? this : e, o), !0;
|
|
1757
1774
|
} catch (a) {
|
|
1758
1775
|
return console.error(`[RichTextEditor] Error executing native command ${t}:`, a), !1;
|
|
1759
1776
|
}
|
|
1760
1777
|
}
|
|
1761
|
-
return ((
|
|
1778
|
+
return ((i = this.engine) == null ? void 0 : i.execCommand(t, e)) || !1;
|
|
1762
1779
|
}
|
|
1763
1780
|
getPluginLoadConfig(t) {
|
|
1764
1781
|
const e = this.config.pluginConfig;
|
|
@@ -1775,9 +1792,9 @@ class g extends HTMLElement {
|
|
|
1775
1792
|
...o[t] || []
|
|
1776
1793
|
];
|
|
1777
1794
|
for (const i of r) {
|
|
1778
|
-
const
|
|
1779
|
-
if (
|
|
1780
|
-
return
|
|
1795
|
+
const n = this.config[i];
|
|
1796
|
+
if (n && typeof n == "object" && !Array.isArray(n))
|
|
1797
|
+
return n;
|
|
1781
1798
|
}
|
|
1782
1799
|
}
|
|
1783
1800
|
getContentSanitizeConfig() {
|
|
@@ -1887,17 +1904,17 @@ class g extends HTMLElement {
|
|
|
1887
1904
|
t,
|
|
1888
1905
|
this.pluginLoader
|
|
1889
1906
|
// Pass plugin loader to get all registered plugins
|
|
1890
|
-
), this.toolbar.setCommandHandler((i,
|
|
1891
|
-
var
|
|
1907
|
+
), this.toolbar.setCommandHandler((i, n) => {
|
|
1908
|
+
var a;
|
|
1892
1909
|
if (this.contentElement) {
|
|
1893
1910
|
this.contentElement.focus();
|
|
1894
|
-
const
|
|
1895
|
-
if (!
|
|
1911
|
+
const s = window.getSelection();
|
|
1912
|
+
if (!s || s.rangeCount === 0 || !this.contentElement.contains(s.anchorNode)) {
|
|
1896
1913
|
const c = document.createRange(), d = this.contentElement.lastChild || this.contentElement;
|
|
1897
|
-
d.nodeType === Node.TEXT_NODE ? c.setStart(d, ((
|
|
1914
|
+
d.nodeType === Node.TEXT_NODE ? c.setStart(d, ((a = d.textContent) == null ? void 0 : a.length) || 0) : d.nodeType === Node.ELEMENT_NODE ? (c.selectNodeContents(d), c.collapse(!1)) : c.setStart(this.contentElement, 0), c.collapse(!0), s == null || s.removeAllRanges(), s == null || s.addRange(c);
|
|
1898
1915
|
}
|
|
1899
1916
|
}
|
|
1900
|
-
return this.executeCommand(i,
|
|
1917
|
+
return this.executeCommand(i, n);
|
|
1901
1918
|
}), 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
1919
|
try {
|
|
1903
1920
|
document.execCommand("defaultParagraphSeparator", !1, "p");
|
|
@@ -1906,10 +1923,10 @@ class g extends HTMLElement {
|
|
|
1906
1923
|
}
|
|
1907
1924
|
if (e) {
|
|
1908
1925
|
const i = document.createElement("div");
|
|
1909
|
-
i.innerHTML = e.trim(), !Array.from(i.childNodes).some((
|
|
1910
|
-
if (
|
|
1911
|
-
const
|
|
1912
|
-
return ["P", "DIV", "H1", "H2", "H3", "H4", "H5", "H6", "UL", "OL", "BLOCKQUOTE", "PRE"].includes(
|
|
1926
|
+
i.innerHTML = e.trim(), !Array.from(i.childNodes).some((a) => {
|
|
1927
|
+
if (a.nodeType === Node.ELEMENT_NODE) {
|
|
1928
|
+
const s = a.tagName;
|
|
1929
|
+
return ["P", "DIV", "H1", "H2", "H3", "H4", "H5", "H6", "UL", "OL", "BLOCKQUOTE", "PRE"].includes(s);
|
|
1913
1930
|
}
|
|
1914
1931
|
return !1;
|
|
1915
1932
|
}) && e.trim() ? this.contentElement.innerHTML = `<p>${e.trim()}</p>` : this.contentElement.innerHTML = e;
|
|
@@ -1929,27 +1946,27 @@ class g extends HTMLElement {
|
|
|
1929
1946
|
this.contentElement.addEventListener("input", () => {
|
|
1930
1947
|
if (!this.contentElement) return;
|
|
1931
1948
|
let o = this.contentElement.innerHTML;
|
|
1932
|
-
const r = this.getPerformanceConfig(), i = this.getContentSanitizeConfig(),
|
|
1933
|
-
if (
|
|
1934
|
-
const
|
|
1935
|
-
if (
|
|
1949
|
+
const r = this.getPerformanceConfig(), i = this.getContentSanitizeConfig(), n = this.getSecurityConfig();
|
|
1950
|
+
if (n.sanitizeOnInput !== !1 && i.sanitize !== !1) {
|
|
1951
|
+
const s = $(o, i, n);
|
|
1952
|
+
if (s !== o) {
|
|
1936
1953
|
const c = window.getSelection(), d = c && c.rangeCount > 0 ? c.getRangeAt(0) : null;
|
|
1937
|
-
if (this.contentElement.innerHTML =
|
|
1954
|
+
if (this.contentElement.innerHTML = s, d && c)
|
|
1938
1955
|
try {
|
|
1939
1956
|
c.removeAllRanges(), c.addRange(d);
|
|
1940
1957
|
} catch (f) {
|
|
1941
1958
|
}
|
|
1942
|
-
o =
|
|
1959
|
+
o = s;
|
|
1943
1960
|
}
|
|
1944
1961
|
}
|
|
1945
1962
|
this.contentChangeDebounceTimer && clearTimeout(this.contentChangeDebounceTimer);
|
|
1946
|
-
const
|
|
1963
|
+
const a = () => {
|
|
1947
1964
|
this.dispatchEvent(new CustomEvent("content-change", {
|
|
1948
1965
|
detail: { html: o },
|
|
1949
1966
|
bubbles: !0
|
|
1950
1967
|
}));
|
|
1951
1968
|
};
|
|
1952
|
-
r.debounceInputMs > 0 ? this.contentChangeDebounceTimer = setTimeout(
|
|
1969
|
+
r.debounceInputMs > 0 ? this.contentChangeDebounceTimer = setTimeout(a, r.debounceInputMs) : a(), this.updateStatusBar();
|
|
1953
1970
|
}), this.contentElement.addEventListener("contextmenu", (o) => {
|
|
1954
1971
|
const r = this.config.contextMenu;
|
|
1955
1972
|
(r === !1 || typeof r == "object" && r !== null && r.enabled === !1) && o.preventDefault();
|
|
@@ -1958,20 +1975,20 @@ class g extends HTMLElement {
|
|
|
1958
1975
|
o.preventDefault();
|
|
1959
1976
|
const r = this.config.paste || {};
|
|
1960
1977
|
let i = ((d = o.clipboardData) == null ? void 0 : d.getData("text/html")) || "";
|
|
1961
|
-
const
|
|
1962
|
-
if ((r.clean || !r.keepFormatting) &&
|
|
1963
|
-
document.execCommand("insertText", !1,
|
|
1978
|
+
const n = ((f = o.clipboardData) == null ? void 0 : f.getData("text/plain")) || "", a = this.getContentSanitizeConfig(), s = this.getSecurityConfig(), c = !!i && /class=["'][^"']*Mso|xmlns:w=|urn:schemas-microsoft-com:office/i.test(i);
|
|
1979
|
+
if ((r.clean || !r.keepFormatting) && n) {
|
|
1980
|
+
document.execCommand("insertText", !1, n);
|
|
1964
1981
|
return;
|
|
1965
1982
|
}
|
|
1966
|
-
if (r.convertWord === !1 && c &&
|
|
1967
|
-
document.execCommand("insertText", !1,
|
|
1983
|
+
if (r.convertWord === !1 && c && n) {
|
|
1984
|
+
document.execCommand("insertText", !1, n);
|
|
1968
1985
|
return;
|
|
1969
1986
|
}
|
|
1970
1987
|
if (i) {
|
|
1971
|
-
|
|
1988
|
+
s.sanitizeOnPaste !== !1 && a.sanitize !== !1 && (i = F(i, a, s)), this.insertHTMLAtSelection(i);
|
|
1972
1989
|
return;
|
|
1973
1990
|
}
|
|
1974
|
-
|
|
1991
|
+
n && document.execCommand("insertText", !1, n);
|
|
1975
1992
|
}), this.contentElement.addEventListener("focus", () => {
|
|
1976
1993
|
this.dispatchEvent(new Event("editor-focus", { bubbles: !0 })), this.updateStatusBar();
|
|
1977
1994
|
}), this.contentElement.addEventListener("blur", () => {
|
|
@@ -1980,8 +1997,8 @@ class g extends HTMLElement {
|
|
|
1980
1997
|
bubbles: !0
|
|
1981
1998
|
})), this.dispatchEvent(new Event("editor-blur", { bubbles: !0 })), this.updateFloatingToolbar(), this.updateStatusBar();
|
|
1982
1999
|
}), this.contentElement.addEventListener("keydown", (o) => {
|
|
1983
|
-
this.getAccessibilityConfig().keyboardNavigation && t.handleKeyDown(o, (i,
|
|
1984
|
-
this.executeCommand(i,
|
|
2000
|
+
this.getAccessibilityConfig().keyboardNavigation && t.handleKeyDown(o, (i, n) => {
|
|
2001
|
+
this.executeCommand(i, n);
|
|
1985
2002
|
});
|
|
1986
2003
|
});
|
|
1987
2004
|
const e = () => {
|
|
@@ -2053,15 +2070,15 @@ class g extends HTMLElement {
|
|
|
2053
2070
|
const t = this.getPerformanceConfig(), e = document.activeElement === this.contentElement || this.contentElement.contains(document.activeElement);
|
|
2054
2071
|
if (t.viewportOnlyScan && !this.isEditorInViewport() && !e)
|
|
2055
2072
|
return;
|
|
2056
|
-
const o = this.contentElement.textContent || "", { words: r, chars: i } = z(o),
|
|
2057
|
-
let
|
|
2073
|
+
const o = this.contentElement.textContent || "", { words: r, chars: i } = z(o), n = N(this.contentElement);
|
|
2074
|
+
let a, s;
|
|
2058
2075
|
const c = this.getSelectionRangeInEditor();
|
|
2059
|
-
c && (
|
|
2076
|
+
c && (a = D(this.contentElement, c), c.collapsed || (s = O(c, a), a = void 0)), this.statusBar.update({
|
|
2060
2077
|
wordCount: r,
|
|
2061
2078
|
charCount: i,
|
|
2062
|
-
lineCount:
|
|
2063
|
-
cursorPosition:
|
|
2064
|
-
selectionInfo:
|
|
2079
|
+
lineCount: n,
|
|
2080
|
+
cursorPosition: a,
|
|
2081
|
+
selectionInfo: s
|
|
2065
2082
|
});
|
|
2066
2083
|
}
|
|
2067
2084
|
/**
|
|
@@ -2218,10 +2235,10 @@ export {
|
|
|
2218
2235
|
P as c,
|
|
2219
2236
|
N as d,
|
|
2220
2237
|
z as e,
|
|
2221
|
-
|
|
2238
|
+
O as f,
|
|
2222
2239
|
D as g,
|
|
2223
2240
|
y as h,
|
|
2224
|
-
|
|
2241
|
+
B as i,
|
|
2225
2242
|
K as j
|
|
2226
2243
|
};
|
|
2227
|
-
//# sourceMappingURL=index-
|
|
2244
|
+
//# sourceMappingURL=index-yzU4NdPT.mjs.map
|