@editora/core 1.0.15 → 1.0.16
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/{A11yCheckerPlugin.native-BRdGYMju.mjs → A11yCheckerPlugin.native-DIKuCeFw.mjs} +82 -79
- package/dist/{AnchorPlugin.native-BcYGEtd9.mjs → AnchorPlugin.native-DXZdK3zr.mjs} +72 -71
- package/dist/{ApprovalWorkflowPlugin.native-BZ6jO-Wj.mjs → ApprovalWorkflowPlugin.native-ZsS_2xmn.mjs} +239 -238
- package/dist/{BackgroundColorPlugin.native-50iAT9xU.mjs → BackgroundColorPlugin.native-H3XyYD7_.mjs} +2 -2
- package/dist/{BlocksLibraryPlugin.native-5sdsXsiE.mjs → BlocksLibraryPlugin.native-CownM6Rk.mjs} +140 -116
- package/dist/{CapitalizationPlugin.native-DLV4oPmB.mjs → CapitalizationPlugin.native-C-HRbXGh.mjs} +10 -5
- package/dist/{ChecklistPlugin.native-BS-kMz9O.mjs → ChecklistPlugin.native-NVrBUkaL.mjs} +141 -103
- package/dist/{CitationsPlugin.native-DQgoCd1B.mjs → CitationsPlugin.native-C_7wWQ-k.mjs} +441 -422
- package/dist/{ClearFormattingPlugin.native-B6ro3a1h.mjs → ClearFormattingPlugin.native-Pp0O-SBf.mjs} +24 -23
- package/dist/{CodePlugin.native-knhM8NNo.mjs → CodePlugin.native-BH-K4xmW.mjs} +474 -342
- package/dist/CodePlugin.native-hNgfXlfS.mjs +4767 -0
- package/dist/CodeSamplePlugin.native-svbAFWh_.mjs +501 -0
- package/dist/CollaborationPlugin.native-oSybCGPW.mjs +7468 -0
- package/dist/{CommentsPlugin.native-DPSqTkiv.mjs → CommentsPlugin.native-CLip9wAO.mjs} +233 -185
- package/dist/{ConditionalContentPlugin.native-CfhY46rU.mjs → ConditionalContentPlugin.native-Bf7XgRSW.mjs} +401 -351
- package/dist/{DataBindingPlugin.native-BoXwghTz.mjs → DataBindingPlugin.native-B7lpI_0c.mjs} +29 -28
- package/dist/{DocumentManagerPlugin.native-D1YHQ2NN.mjs → DocumentManagerPlugin.native-iFip6s4Q.mjs} +94 -45
- package/dist/{EmbedIframePlugin.native-BF_-LjTq.mjs → EmbedIframePlugin.native-BfZ_HGlV.mjs} +231 -186
- package/dist/{EmojisPlugin.native-CitxxlWX.mjs → EmojisPlugin.native-D92aaOKi.mjs} +288 -76
- package/dist/{FontFamilyPlugin.native-j8hMTbg4.mjs → FontFamilyPlugin.native-M3cNQ0KA.mjs} +57 -50
- package/dist/{FontSizePlugin.native-B_jCh7dY.mjs → FontSizePlugin.native-DsLrH8eq.mjs} +41 -34
- package/dist/{FormatPainterPlugin.native-CsMrKfFU.mjs → FormatPainterPlugin.native-BhjzsiVq.mjs} +3 -2
- package/dist/{HistoryPlugin.native-D2wl32jV.mjs → HistoryPlugin.native-DPvhks6h.mjs} +36 -32
- package/dist/LinkPlugin.native-BsQXYsK6.mjs +352 -0
- package/dist/{ListPlugin.native-V7EZC1lM.mjs → ListPlugin.native-Bt0LANbO.mjs} +68 -35
- package/dist/{MathPlugin.native-NwWPHVmj.mjs → MathPlugin.native-Byo3WL0f.mjs} +211 -115
- package/dist/{MediaManagerPlugin.native-eOsTJFpw.mjs → MediaManagerPlugin.native-BT1NZIJS.mjs} +139 -134
- package/dist/{MentionPlugin.native-BMDlOqur.mjs → MentionPlugin.native-S_lwGZQO.mjs} +23 -18
- package/dist/{MergeTagPlugin.native-BzRVoD9-.mjs → MergeTagPlugin.native-7-6F3S1Y.mjs} +44 -43
- package/dist/{PreviewPlugin.native-WuIwOAOR.mjs → PreviewPlugin.native-CiR51jql.mjs} +31 -28
- package/dist/{SlashCommandsPlugin.native-BiN6ODw5.mjs → SlashCommandsPlugin.native-BDIIwGNs.mjs} +90 -79
- package/dist/{SmartPastePlugin.native-CZAEHkyt.mjs → SmartPastePlugin.native-BATLCds5.mjs} +89 -85
- package/dist/{SpecialCharactersPlugin.native-DaG4b19I.mjs → SpecialCharactersPlugin.native-CdZoc1GB.mjs} +73 -26
- package/dist/SpellCheckPlugin.native-Bef2oTLB.mjs +10935 -0
- package/dist/TablePlugin.native-BjIxYZ2X.mjs +772 -0
- package/dist/{TemplatePlugin.native-DLjFUaPW.mjs → TemplatePlugin.native-D6n5RUnC.mjs} +288 -262
- package/dist/{TextColorPlugin.native-Bwl_bSmc.mjs → TextColorPlugin.native-KMZ2uzlq.mjs} +2 -2
- package/dist/{TranslationWorkflowPlugin.native-DdF16tgT.mjs → TranslationWorkflowPlugin.native-CZtG--06.mjs} +67 -65
- package/dist/{VersionDiffPlugin.native-Bvxgy--t.mjs → VersionDiffPlugin.native-Ca1fMWUJ.mjs} +42 -42
- package/dist/anchoredPopover-DJFD2oAP.mjs +116 -0
- package/dist/core.css +1 -1
- package/dist/dialogHelpers-DBf7WqYH.mjs +40 -0
- package/dist/editora.min.js +26 -24
- package/dist/editora.umd.js +26 -24
- package/dist/escapeHtml-CX8RelZ1.mjs +7 -0
- package/dist/historyHelpers-B0-4mq1E.mjs +15 -0
- package/dist/index-B1_vtXRz.mjs +3910 -0
- package/dist/index-C6BoNR2t.js +12 -0
- package/dist/index.cjs.js +3 -3
- package/dist/index.esm.js +17 -14
- package/dist/plugin-loader.js +53 -52
- package/dist/webcomponent-core.js +2039 -473
- package/dist/webcomponent-core.min.css +1 -1
- package/dist/webcomponent-core.min.js +96 -66
- package/dist/webcomponent.cjs.js +1 -1
- package/dist/webcomponent.esm.js +1 -1
- package/dist/webcomponent.js +2208 -641
- package/dist/webcomponent.min.css +1 -1
- package/dist/webcomponent.min.js +1564 -1198
- package/index.d.ts +32 -0
- package/package.json +10 -3
- package/dist/CodeSamplePlugin.native-CgGoH-X4.mjs +0 -384
- package/dist/LinkPlugin.native-DYCIcdTm.mjs +0 -283
- package/dist/SpellCheckPlugin.native-BZB9AewP.mjs +0 -1039
- package/dist/TablePlugin.native-DrHX-efe.mjs +0 -495
- package/dist/anchoredPopover-Bxds0VoB.mjs +0 -110
- package/dist/index-BLm1MtzH.js +0 -10
- package/dist/index-Cd9jEuZP.mjs +0 -2341
package/dist/{DataBindingPlugin.native-BoXwghTz.mjs → DataBindingPlugin.native-B7lpI_0c.mjs}
RENAMED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
|
|
1
|
+
import { i as yt } from "./dialogHelpers-DBf7WqYH.mjs";
|
|
2
|
+
const S = ".rte-content, .editora-content", P = '.rte-data-binding[data-binding="true"]', ot = "rte-data-binding-styles", p = "rte-data-binding-dialog-overlay", b = ':is([data-theme="dark"], .dark, .editora-theme-dark, .rte-theme-dark)', ht = {
|
|
2
3
|
dialogTitleInsert: "Insert Data Binding",
|
|
3
4
|
dialogTitleEdit: "Edit Data Binding",
|
|
4
5
|
keyLabel: "Data Key",
|
|
@@ -15,9 +16,9 @@ const S = ".rte-content, .editora-content", P = '.rte-data-binding[data-binding=
|
|
|
15
16
|
tokenAriaPrefix: "Data binding token"
|
|
16
17
|
}, v = /* @__PURE__ */ new WeakMap(), J = /* @__PURE__ */ new WeakMap(), g = /* @__PURE__ */ new WeakMap(), N = /* @__PURE__ */ new WeakMap(), I = /* @__PURE__ */ new WeakMap();
|
|
17
18
|
let R = null, k = null, z = 0, O = null, M = null, B = null, V = null;
|
|
18
|
-
function
|
|
19
|
+
function kt(t) {
|
|
19
20
|
return {
|
|
20
|
-
...
|
|
21
|
+
...ht,
|
|
21
22
|
...t || {}
|
|
22
23
|
};
|
|
23
24
|
}
|
|
@@ -29,7 +30,7 @@ function dt(t = {}) {
|
|
|
29
30
|
getData: t.getData,
|
|
30
31
|
api: t.api,
|
|
31
32
|
cacheTtlMs: Math.max(0, Number((e = t.cacheTtlMs) != null ? e : 3e4)),
|
|
32
|
-
labels:
|
|
33
|
+
labels: kt(t.labels),
|
|
33
34
|
defaultFormat: t.defaultFormat || "text",
|
|
34
35
|
defaultFallback: t.defaultFallback || "",
|
|
35
36
|
locale: a,
|
|
@@ -49,7 +50,7 @@ function q(t) {
|
|
|
49
50
|
function _(t) {
|
|
50
51
|
return t ? (t.getAttribute("data-theme") || t.getAttribute("theme") || "").toLowerCase() === "dark" ? !0 : t.classList.contains("dark") || t.classList.contains("editora-theme-dark") || t.classList.contains("rte-theme-dark") : !1;
|
|
51
52
|
}
|
|
52
|
-
function
|
|
53
|
+
function vt(t) {
|
|
53
54
|
const a = q(t);
|
|
54
55
|
if (_(a)) return !0;
|
|
55
56
|
const e = a.closest("[data-theme], [theme], .dark, .editora-theme-dark, .rte-theme-dark");
|
|
@@ -89,7 +90,7 @@ function ct(t, a) {
|
|
|
89
90
|
const e = window.getSelection();
|
|
90
91
|
e && (e.removeAllRanges(), e.addRange(a), t.focus({ preventScroll: !0 }));
|
|
91
92
|
}
|
|
92
|
-
function
|
|
93
|
+
function xt(t, a) {
|
|
93
94
|
const e = (a || "").trim();
|
|
94
95
|
if (e)
|
|
95
96
|
return e.split(".").filter(Boolean).reduce((r, n) => {
|
|
@@ -97,7 +98,7 @@ function vt(t, a) {
|
|
|
97
98
|
return r[n];
|
|
98
99
|
}, t);
|
|
99
100
|
}
|
|
100
|
-
function
|
|
101
|
+
function wt() {
|
|
101
102
|
if (typeof document == "undefined" || document.getElementById(ot)) return;
|
|
102
103
|
const t = document.createElement("style");
|
|
103
104
|
t.id = ot, t.textContent = `
|
|
@@ -458,7 +459,7 @@ function et(t, a, e) {
|
|
|
458
459
|
}
|
|
459
460
|
});
|
|
460
461
|
}
|
|
461
|
-
function
|
|
462
|
+
function Et(t, a, e) {
|
|
462
463
|
const r = a.format || "text";
|
|
463
464
|
if (t == null) return a.fallback || "";
|
|
464
465
|
if (r === "json") {
|
|
@@ -500,19 +501,19 @@ function C(t, a, e, r) {
|
|
|
500
501
|
t.textContent = ut(n), t.setAttribute("aria-label", `${a.labels.tokenAriaPrefix}: ${i}. Press Enter to edit.`);
|
|
501
502
|
return;
|
|
502
503
|
}
|
|
503
|
-
const o =
|
|
504
|
+
const o = xt(r, i), l = o == null, d = l ? n.fallback || "" : Et(o, n, a);
|
|
504
505
|
t.textContent = d || n.fallback || "", t.classList.add("rte-data-binding-preview"), l && !(n.fallback || "").trim() && t.classList.add("rte-data-binding-missing"), t.setAttribute("aria-label", `${a.labels.tokenAriaPrefix}: ${i} = ${t.textContent || ""}. Press Enter to edit.`);
|
|
505
506
|
}
|
|
506
507
|
function w(t) {
|
|
507
508
|
return typeof t == "object" && t !== null && !Array.isArray(t);
|
|
508
509
|
}
|
|
509
|
-
function
|
|
510
|
+
function Dt(t, a) {
|
|
510
511
|
return a ? a.split(".").filter(Boolean).reduce((e, r) => {
|
|
511
512
|
if (!(!w(e) && !Array.isArray(e)))
|
|
512
513
|
return e[r];
|
|
513
514
|
}, t) : t;
|
|
514
515
|
}
|
|
515
|
-
function
|
|
516
|
+
function At(t, a, e) {
|
|
516
517
|
const r = a.api, n = q(t), i = { editor: t, editorRoot: n, signal: e };
|
|
517
518
|
if (r.buildRequest) {
|
|
518
519
|
const m = r.buildRequest(i);
|
|
@@ -542,7 +543,7 @@ function Dt(t, a, e) {
|
|
|
542
543
|
}
|
|
543
544
|
return { url: u.toString(), init: s };
|
|
544
545
|
}
|
|
545
|
-
async function
|
|
546
|
+
async function St(t, a) {
|
|
546
547
|
var d, u;
|
|
547
548
|
const e = a.api;
|
|
548
549
|
if (!e) return {};
|
|
@@ -550,7 +551,7 @@ async function At(t, a) {
|
|
|
550
551
|
let l = null;
|
|
551
552
|
o > 0 && (l = window.setTimeout(() => r.abort(), o));
|
|
552
553
|
try {
|
|
553
|
-
const { url: s, init: m } =
|
|
554
|
+
const { url: s, init: m } = At(t, a, r.signal), f = await fetch(s, { ...m, signal: r.signal });
|
|
554
555
|
if (!f.ok)
|
|
555
556
|
throw new Error(`Data binding API request failed: ${f.status}`);
|
|
556
557
|
const $ = (e.responseType || "json") === "text" ? await f.text() : await f.json();
|
|
@@ -558,7 +559,7 @@ async function At(t, a) {
|
|
|
558
559
|
const F = e.transformResponse($, i);
|
|
559
560
|
return w(F) ? F : {};
|
|
560
561
|
}
|
|
561
|
-
const x =
|
|
562
|
+
const x = Dt($, e.responsePath);
|
|
562
563
|
return w(x) ? x : w($) ? $ : { value: x };
|
|
563
564
|
} catch (s) {
|
|
564
565
|
return (s == null ? void 0 : s.name) !== "AbortError" && ((u = e.onError) == null || u.call(e, s, i)), {};
|
|
@@ -581,7 +582,7 @@ async function U(t, a) {
|
|
|
581
582
|
if (w(d)) return d;
|
|
582
583
|
}
|
|
583
584
|
if (a.api) {
|
|
584
|
-
const d = await
|
|
585
|
+
const d = await St(t, a);
|
|
585
586
|
if (w(d)) return d;
|
|
586
587
|
}
|
|
587
588
|
if (typeof a.data == "function") {
|
|
@@ -617,18 +618,18 @@ function gt(t, a) {
|
|
|
617
618
|
function mt(t) {
|
|
618
619
|
return typeof t.key == "string" ? t.key.toLowerCase() : "";
|
|
619
620
|
}
|
|
620
|
-
function
|
|
621
|
+
function Tt(t) {
|
|
621
622
|
const a = t.metaKey || t.ctrlKey, e = mt(t), r = a && t.altKey && t.shiftKey && e === "d", n = !t.metaKey && !t.ctrlKey && !t.altKey && !t.shiftKey && e === "f7";
|
|
622
623
|
return r || n;
|
|
623
624
|
}
|
|
624
|
-
function
|
|
625
|
+
function $t(t) {
|
|
625
626
|
const a = t.metaKey || t.ctrlKey, e = mt(t), r = a && t.altKey && t.shiftKey && e === "b", n = !t.metaKey && !t.ctrlKey && !t.altKey && !t.shiftKey && e === "f8";
|
|
626
627
|
return r || n;
|
|
627
628
|
}
|
|
628
629
|
function L(t, a, e, r, n) {
|
|
629
630
|
bt();
|
|
630
631
|
const i = e === "insert" ? st(t) : null, o = a.labels, l = n ? W(n, a) : j(r || {}, a), d = document.createElement("div");
|
|
631
|
-
d.className = p,
|
|
632
|
+
yt(d), d.className = p, vt(t) && d.classList.add("rte-data-binding-theme-dark");
|
|
632
633
|
const u = document.createElement("section");
|
|
633
634
|
u.className = "rte-data-binding-dialog", u.setAttribute("role", "dialog"), u.setAttribute("aria-modal", "true"), u.setAttribute("aria-labelledby", "rte-data-binding-dialog-title"), u.innerHTML = `
|
|
634
635
|
<header class="rte-data-binding-header">
|
|
@@ -746,7 +747,7 @@ function L(t, a, e, r, n) {
|
|
|
746
747
|
}
|
|
747
748
|
}), d.addEventListener("click", nt), d.addEventListener("keydown", rt, !0), document.addEventListener("keydown", F, !0), R = { cleanup: x }, s == null || s.focus();
|
|
748
749
|
}
|
|
749
|
-
function
|
|
750
|
+
function Lt(t) {
|
|
750
751
|
V = t, M || (M = (a) => {
|
|
751
752
|
const e = a.target, r = e == null ? void 0 : e.closest(S);
|
|
752
753
|
if (!r) return;
|
|
@@ -766,13 +767,13 @@ function $t(t) {
|
|
|
766
767
|
a.preventDefault(), a.stopPropagation(), k = r, L(r, n, "edit", void 0, i);
|
|
767
768
|
return;
|
|
768
769
|
}
|
|
769
|
-
if (
|
|
770
|
+
if (Tt(a)) {
|
|
770
771
|
a.preventDefault(), a.stopPropagation();
|
|
771
772
|
const o = X(r);
|
|
772
773
|
o ? L(r, n, "edit", void 0, o) : L(r, n, "insert");
|
|
773
774
|
return;
|
|
774
775
|
}
|
|
775
|
-
if (
|
|
776
|
+
if ($t(a)) {
|
|
776
777
|
a.preventDefault(), a.stopPropagation();
|
|
777
778
|
const o = v.get(r) !== !0;
|
|
778
779
|
Z(r, n, o);
|
|
@@ -787,12 +788,12 @@ function $t(t) {
|
|
|
787
788
|
g.set(n, i), k = n, a.preventDefault(), a.stopPropagation(), r.focus({ preventScroll: !0 }), L(n, i, "edit", void 0, r);
|
|
788
789
|
}, document.addEventListener("click", B, !0));
|
|
789
790
|
}
|
|
790
|
-
function
|
|
791
|
+
function Ct() {
|
|
791
792
|
M && (document.removeEventListener("focusin", M, !0), M = null), O && (document.removeEventListener("keydown", O, !0), O = null), B && (document.removeEventListener("click", B, !0), B = null), V = null, k = null;
|
|
792
793
|
}
|
|
793
|
-
const
|
|
794
|
+
const Ot = (t = {}) => {
|
|
794
795
|
const a = dt(t);
|
|
795
|
-
return
|
|
796
|
+
return wt(), {
|
|
796
797
|
name: "dataBinding",
|
|
797
798
|
toolbar: [
|
|
798
799
|
{
|
|
@@ -898,7 +899,7 @@ const Ct = (t = {}) => {
|
|
|
898
899
|
init: function(r) {
|
|
899
900
|
z += 1;
|
|
900
901
|
const n = this && typeof this.__pluginConfig == "object" ? dt({ ...a, ...this.__pluginConfig }) : a;
|
|
901
|
-
|
|
902
|
+
Lt(n);
|
|
902
903
|
const i = A(
|
|
903
904
|
r && r.editorElement ? { editorElement: r.editorElement } : void 0,
|
|
904
905
|
!1
|
|
@@ -910,11 +911,11 @@ const Ct = (t = {}) => {
|
|
|
910
911
|
}
|
|
911
912
|
},
|
|
912
913
|
destroy: () => {
|
|
913
|
-
z = Math.max(0, z - 1), z === 0 && (bt(),
|
|
914
|
+
z = Math.max(0, z - 1), z === 0 && (bt(), Ct());
|
|
914
915
|
}
|
|
915
916
|
};
|
|
916
917
|
};
|
|
917
918
|
export {
|
|
918
|
-
|
|
919
|
+
Ot as DataBindingPlugin
|
|
919
920
|
};
|
|
920
|
-
//# sourceMappingURL=DataBindingPlugin.native-
|
|
921
|
+
//# sourceMappingURL=DataBindingPlugin.native-B7lpI_0c.mjs.map
|
package/dist/{DocumentManagerPlugin.native-D1YHQ2NN.mjs → DocumentManagerPlugin.native-iFip6s4Q.mjs}
RENAMED
|
@@ -1,4 +1,49 @@
|
|
|
1
|
-
const
|
|
1
|
+
const d = "rte-document-manager-styles", u = `
|
|
2
|
+
.rte-toolbar-button[data-busy="true"],
|
|
3
|
+
.rte-docmgr-toolbar-button[data-busy="true"] {
|
|
4
|
+
position: relative;
|
|
5
|
+
pointer-events: none;
|
|
6
|
+
cursor: wait;
|
|
7
|
+
}
|
|
8
|
+
.rte-toolbar-button[data-busy="true"] > *,
|
|
9
|
+
.rte-docmgr-toolbar-button[data-busy="true"] > * {
|
|
10
|
+
visibility: hidden;
|
|
11
|
+
}
|
|
12
|
+
.rte-toolbar-button[data-busy="true"]::after,
|
|
13
|
+
.rte-docmgr-toolbar-button[data-busy="true"]::after {
|
|
14
|
+
content: "";
|
|
15
|
+
position: absolute;
|
|
16
|
+
top: 50%;
|
|
17
|
+
left: 50%;
|
|
18
|
+
width: 14px;
|
|
19
|
+
height: 14px;
|
|
20
|
+
margin: -7px 0 0 -7px;
|
|
21
|
+
border: 2px solid currentColor;
|
|
22
|
+
border-right-color: transparent;
|
|
23
|
+
border-radius: 50%;
|
|
24
|
+
opacity: 0.7;
|
|
25
|
+
animation: rte-docmgr-spin 0.7s linear infinite;
|
|
26
|
+
}
|
|
27
|
+
@keyframes rte-docmgr-spin {
|
|
28
|
+
to { transform: rotate(360deg); }
|
|
29
|
+
}
|
|
30
|
+
`;
|
|
31
|
+
function s() {
|
|
32
|
+
if (typeof document == "undefined" || document.getElementById(d)) return;
|
|
33
|
+
const a = document.createElement("style");
|
|
34
|
+
a.id = d, a.textContent = u, document.head.appendChild(a);
|
|
35
|
+
}
|
|
36
|
+
async function l(a) {
|
|
37
|
+
s();
|
|
38
|
+
const t = typeof window != "undefined" ? window.__editoraLastCommandButton : null;
|
|
39
|
+
t && (t.disabled = !0, t.setAttribute("data-busy", "true"), t.setAttribute("aria-busy", "true"));
|
|
40
|
+
try {
|
|
41
|
+
return await a();
|
|
42
|
+
} finally {
|
|
43
|
+
t && (t.disabled = !1, t.removeAttribute("data-busy"), t.removeAttribute("aria-busy"));
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
const p = () => ({
|
|
2
47
|
name: "document-manager",
|
|
3
48
|
toolbar: [
|
|
4
49
|
{
|
|
@@ -22,42 +67,42 @@ const c = () => ({
|
|
|
22
67
|
],
|
|
23
68
|
commands: {
|
|
24
69
|
importWord: () => {
|
|
25
|
-
const
|
|
70
|
+
const a = () => {
|
|
26
71
|
const e = window.getSelection();
|
|
27
72
|
if (e && e.rangeCount > 0) {
|
|
28
|
-
let
|
|
29
|
-
for (;
|
|
30
|
-
if (
|
|
31
|
-
const
|
|
32
|
-
if (
|
|
33
|
-
return
|
|
73
|
+
let n = e.getRangeAt(0).startContainer;
|
|
74
|
+
for (; n && n !== document.body; ) {
|
|
75
|
+
if (n.nodeType === Node.ELEMENT_NODE) {
|
|
76
|
+
const i = n;
|
|
77
|
+
if (i.getAttribute("contenteditable") === "true")
|
|
78
|
+
return i;
|
|
34
79
|
}
|
|
35
|
-
|
|
80
|
+
n = n.parentNode;
|
|
36
81
|
}
|
|
37
82
|
}
|
|
38
|
-
const
|
|
39
|
-
if ((
|
|
40
|
-
return
|
|
41
|
-
const o =
|
|
83
|
+
const r = document.activeElement;
|
|
84
|
+
if ((r == null ? void 0 : r.getAttribute("contenteditable")) === "true")
|
|
85
|
+
return r;
|
|
86
|
+
const o = r == null ? void 0 : r.closest('[contenteditable="true"]');
|
|
42
87
|
return o || document.querySelector('[contenteditable="true"]');
|
|
43
88
|
}, t = document.createElement("input");
|
|
44
89
|
return t.type = "file", t.accept = ".docx", t.onchange = async (e) => {
|
|
45
90
|
var o;
|
|
46
|
-
const
|
|
47
|
-
if (
|
|
91
|
+
const r = (o = e.target.files) == null ? void 0 : o[0];
|
|
92
|
+
if (r)
|
|
48
93
|
try {
|
|
49
|
-
const
|
|
50
|
-
if (
|
|
51
|
-
const { importFromWord:
|
|
52
|
-
|
|
94
|
+
const n = a();
|
|
95
|
+
if (n) {
|
|
96
|
+
const { importFromWord: i } = await import("./documentManager-BcBIv5P-.mjs"), c = await i(r);
|
|
97
|
+
n.innerHTML = c, n.dispatchEvent(new Event("input", { bubbles: !0 }));
|
|
53
98
|
}
|
|
54
|
-
} catch (
|
|
55
|
-
console.error("Import failed:",
|
|
99
|
+
} catch (n) {
|
|
100
|
+
console.error("Import failed:", n), alert("Failed to import Word document. Please check the console for details.");
|
|
56
101
|
}
|
|
57
102
|
}, t.click(), !0;
|
|
58
103
|
},
|
|
59
104
|
exportWord: async () => {
|
|
60
|
-
const
|
|
105
|
+
const a = () => {
|
|
61
106
|
const t = window.getSelection();
|
|
62
107
|
if (t && t.rangeCount > 0) {
|
|
63
108
|
let o = t.getRangeAt(0).startContainer;
|
|
@@ -70,19 +115,21 @@ const c = () => ({
|
|
|
70
115
|
const e = document.activeElement;
|
|
71
116
|
return (e == null ? void 0 : e.getAttribute("contenteditable")) === "true" ? e : (e == null ? void 0 : e.closest('[contenteditable="true"]')) || document.querySelector('[contenteditable="true"]');
|
|
72
117
|
};
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
118
|
+
return l(async () => {
|
|
119
|
+
try {
|
|
120
|
+
const t = a();
|
|
121
|
+
if (t) {
|
|
122
|
+
const e = t.innerHTML, { exportToWord: r } = await import("./documentManager-BcBIv5P-.mjs");
|
|
123
|
+
await r(e, "document.docx");
|
|
124
|
+
}
|
|
125
|
+
return !0;
|
|
126
|
+
} catch (t) {
|
|
127
|
+
return console.error("Export failed:", t), alert("Failed to export to Word. Please check the console for details."), !1;
|
|
78
128
|
}
|
|
79
|
-
|
|
80
|
-
} catch (t) {
|
|
81
|
-
return console.error("Export failed:", t), alert("Failed to export to Word. Please check the console for details."), !1;
|
|
82
|
-
}
|
|
129
|
+
});
|
|
83
130
|
},
|
|
84
131
|
exportPdf: async () => {
|
|
85
|
-
const
|
|
132
|
+
const a = () => {
|
|
86
133
|
const t = window.getSelection();
|
|
87
134
|
if (t && t.rangeCount > 0) {
|
|
88
135
|
let o = t.getRangeAt(0).startContainer;
|
|
@@ -95,22 +142,24 @@ const c = () => ({
|
|
|
95
142
|
const e = document.activeElement;
|
|
96
143
|
return (e == null ? void 0 : e.getAttribute("contenteditable")) === "true" ? e : (e == null ? void 0 : e.closest('[contenteditable="true"]')) || document.querySelector('[contenteditable="true"]');
|
|
97
144
|
};
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
145
|
+
return l(async () => {
|
|
146
|
+
try {
|
|
147
|
+
const t = a();
|
|
148
|
+
if (t) {
|
|
149
|
+
const e = t.innerHTML, { exportToPdf: r } = await import("./documentManager-BcBIv5P-.mjs");
|
|
150
|
+
await r(e, "document.pdf", t);
|
|
151
|
+
} else
|
|
152
|
+
console.error("PDF Export: No editor element found"), alert("No active editor found. Please click in the editor area first.");
|
|
153
|
+
return !0;
|
|
154
|
+
} catch (t) {
|
|
155
|
+
return console.error("PDF Export: Export failed:", t), alert("Failed to export to PDF. Please check the console for details."), !1;
|
|
156
|
+
}
|
|
157
|
+
});
|
|
109
158
|
}
|
|
110
159
|
},
|
|
111
160
|
keymap: {}
|
|
112
161
|
});
|
|
113
162
|
export {
|
|
114
|
-
|
|
163
|
+
p as DocumentManagerPlugin
|
|
115
164
|
};
|
|
116
|
-
//# sourceMappingURL=DocumentManagerPlugin.native-
|
|
165
|
+
//# sourceMappingURL=DocumentManagerPlugin.native-iFip6s4Q.mjs.map
|