@editora/plugins 1.0.17 → 1.0.18
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/{CodePlugin.native-Cqi46sxh.js → CodePlugin.native-Bwf25lLX.js} +6 -6
- package/dist/{CodePlugin.native-CmnEFfJi.mjs → CodePlugin.native-Cpp4u3Jl.mjs} +23 -21
- package/dist/a11y-checker.cjs.js +16 -16
- package/dist/a11y-checker.esm.js +79 -75
- package/dist/anchor.cjs.js +9 -9
- package/dist/anchor.esm.js +61 -60
- package/dist/anchoredPopover-Bg-ey7Yo.js +1 -0
- package/dist/anchoredPopover-D_JbjvdA.mjs +111 -0
- package/dist/approval-workflow.cjs.js +5 -5
- package/dist/approval-workflow.esm.js +105 -104
- package/dist/background-color.cjs.js +1 -1
- package/dist/background-color.esm.js +1 -1
- package/dist/blocks-library.cjs.js +6 -6
- package/dist/blocks-library.esm.js +226 -202
- package/dist/capitalization.cjs.js +1 -1
- package/dist/capitalization.esm.js +9 -4
- package/dist/checklist.cjs.js +1 -1
- package/dist/checklist.esm.js +154 -116
- package/dist/citations.cjs.js +43 -18
- package/dist/citations.esm.js +465 -446
- package/dist/clear-formatting.cjs.js +1 -1
- package/dist/clear-formatting.esm.js +21 -20
- package/dist/code-sample.cjs.js +85 -66
- package/dist/code-sample.esm.js +301 -190
- package/dist/code.cjs.js +1 -1
- package/dist/code.esm.js +1 -1
- package/dist/collaboration.cjs.js +68 -0
- package/dist/collaboration.esm.js +7428 -0
- package/dist/comments.cjs.js +11 -11
- package/dist/comments.esm.js +284 -237
- package/dist/conditional-content.cjs.js +67 -60
- package/dist/conditional-content.esm.js +270 -220
- package/dist/data-binding.cjs.js +3 -3
- package/dist/data-binding.esm.js +28 -27
- package/dist/dialogHelpers-5d5BuOCW.mjs +39 -0
- package/dist/dialogHelpers-zU6zpMIA.js +12 -0
- package/dist/document-manager.cjs.js +1 -1
- package/dist/document-manager.esm.js +1 -1
- package/dist/{documentManager-3nPkITwx.js → documentManager-BDz6tovy.js} +1 -1
- package/dist/{documentManager-CRumGpCT.mjs → documentManager-yjRBab4v.mjs} +1 -1
- package/dist/embed-iframe.cjs.js +37 -17
- package/dist/embed-iframe.esm.js +188 -143
- package/dist/emojis.cjs.js +13 -10
- package/dist/emojis.esm.js +288 -76
- package/dist/enterprise.cjs.js +1 -1
- package/dist/enterprise.esm.js +9 -7
- package/dist/escapeHtml-D2Zh82pD.js +1 -0
- package/dist/escapeHtml-DyksyvcZ.mjs +6 -0
- package/dist/font-family.cjs.js +1 -1
- package/dist/font-family.esm.js +48 -41
- package/dist/font-size.cjs.js +1 -1
- package/dist/font-size.esm.js +67 -60
- package/dist/format-painter.cjs.js +1 -1
- package/dist/format-painter.esm.js +2 -1
- package/dist/history.cjs.js +1 -1
- package/dist/history.esm.js +40 -36
- package/dist/historyHelpers-BEKwNOtA.mjs +14 -0
- package/dist/historyHelpers-Cu8Pk7m1.js +1 -0
- package/dist/index-Bm1eqYHh.mjs +194 -0
- package/dist/index-CoflqYuK.js +30 -0
- package/dist/index.cjs.js +1 -1
- package/dist/index.esm.js +17 -15
- package/dist/link.cjs.js +17 -13
- package/dist/link.esm.js +138 -69
- package/dist/list.cjs.js +1 -1
- package/dist/list.esm.js +66 -33
- package/dist/math.cjs.js +22 -22
- package/dist/math.esm.js +221 -126
- package/dist/media-manager.cjs.js +12 -12
- package/dist/media-manager.esm.js +55 -50
- package/dist/mentions.cjs.js +2 -2
- package/dist/mentions.esm.js +17 -12
- package/dist/merge-tag.cjs.js +2 -2
- package/dist/merge-tag.esm.js +43 -42
- package/dist/plugins.css +1 -1
- package/dist/preview.cjs.js +3 -3
- package/dist/preview.esm.js +30 -27
- package/dist/slash-commands.cjs.js +13 -7
- package/dist/slash-commands.esm.js +90 -79
- package/dist/smart-paste.cjs.js +5 -5
- package/dist/smart-paste.esm.js +85 -81
- package/dist/special-characters.cjs.js +6 -3
- package/dist/special-characters.esm.js +72 -25
- package/dist/spell-check.cjs.js +8 -8
- package/dist/spell-check.esm.js +10189 -295
- package/dist/table.cjs.js +166 -13
- package/dist/table.esm.js +543 -266
- package/dist/template.cjs.js +11 -11
- package/dist/template.esm.js +290 -264
- package/dist/text-color.cjs.js +1 -1
- package/dist/text-color.esm.js +1 -1
- package/dist/translation-workflow.cjs.js +4 -4
- package/dist/translation-workflow.esm.js +33 -31
- package/dist/version-diff.cjs.js +6 -6
- package/dist/version-diff.esm.js +40 -40
- package/package.json +11 -5
- package/dist/anchoredPopover-BzqGPOAE.js +0 -1
- package/dist/anchoredPopover-Dts0IrgU.mjs +0 -106
- package/dist/index-CJ90EVWy.mjs +0 -145
- package/dist/index-DTkvH8gX.js +0 -1
package/dist/version-diff.esm.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
|
|
1
|
+
import { i as ae } from "./dialogHelpers-5d5BuOCW.mjs";
|
|
2
|
+
const $ = ".rte-content, .editora-content", d = '[data-theme="dark"], .dark, .editora-theme-dark, .rte-theme-dark', l = "rte-version-diff-overlay", U = "rte-version-diff-styles", le = {
|
|
2
3
|
title: "Version Diff",
|
|
3
4
|
baseline: "Baseline",
|
|
4
5
|
current: "Current",
|
|
@@ -17,9 +18,9 @@ let j = 0, H = null, z = null, V = null, S = null, M = null, D = null;
|
|
|
17
18
|
function u(e) {
|
|
18
19
|
return e.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'");
|
|
19
20
|
}
|
|
20
|
-
function
|
|
21
|
+
function fe(e) {
|
|
21
22
|
return {
|
|
22
|
-
...
|
|
23
|
+
...le,
|
|
23
24
|
...e || {}
|
|
24
25
|
};
|
|
25
26
|
}
|
|
@@ -60,13 +61,13 @@ function Y(e) {
|
|
|
60
61
|
const n = i.closest("[data-theme], [theme], .dark, .editora-theme-dark, .rte-theme-dark");
|
|
61
62
|
return !!(P(n) || P(document.documentElement) || P(document.body));
|
|
62
63
|
}
|
|
63
|
-
function
|
|
64
|
+
function de(e) {
|
|
64
65
|
const i = document.createElement("textarea");
|
|
65
66
|
return i.innerHTML = e, i.value;
|
|
66
67
|
}
|
|
67
68
|
function W(e) {
|
|
68
69
|
const n = O(e).getAttribute("data-initial-content");
|
|
69
|
-
return n ?
|
|
70
|
+
return n ? de(n) : e.innerHTML;
|
|
70
71
|
}
|
|
71
72
|
function Z(e) {
|
|
72
73
|
return e.replace(/\r\n?/g, `
|
|
@@ -100,7 +101,7 @@ function Q(e, i, n) {
|
|
|
100
101
|
`);
|
|
101
102
|
}), t;
|
|
102
103
|
}
|
|
103
|
-
function
|
|
104
|
+
function ce(e, i, n) {
|
|
104
105
|
if (e.length === 0) return "";
|
|
105
106
|
if (i === "line") return e.join(`
|
|
106
107
|
`);
|
|
@@ -119,7 +120,7 @@ function de(e, i, n) {
|
|
|
119
120
|
}
|
|
120
121
|
return r;
|
|
121
122
|
}
|
|
122
|
-
function
|
|
123
|
+
function ue(e, i, n) {
|
|
123
124
|
const r = [];
|
|
124
125
|
return e.forEach((t) => {
|
|
125
126
|
const o = r[r.length - 1];
|
|
@@ -130,11 +131,11 @@ function ce(e, i, n) {
|
|
|
130
131
|
r.push({ type: t.type, tokens: [t.token] });
|
|
131
132
|
}), r.map((t) => ({
|
|
132
133
|
type: t.type,
|
|
133
|
-
value:
|
|
134
|
+
value: ce(t.tokens, i, n),
|
|
134
135
|
count: t.tokens.length
|
|
135
136
|
}));
|
|
136
137
|
}
|
|
137
|
-
function
|
|
138
|
+
function pe(e, i) {
|
|
138
139
|
let n = 0;
|
|
139
140
|
for (; n < e.length && n < i.length && e[n] === i[n]; )
|
|
140
141
|
n += 1;
|
|
@@ -144,11 +145,10 @@ function ue(e, i) {
|
|
|
144
145
|
const o = e.slice(0, n), f = r < e.length - 1 ? e.slice(r + 1) : [], g = n <= r ? e.slice(n, r + 1) : [], c = n <= t ? i.slice(n, t + 1) : [];
|
|
145
146
|
return { prefix: o, suffix: f, aMiddle: g, bMiddle: c };
|
|
146
147
|
}
|
|
147
|
-
function
|
|
148
|
+
function be(e, i, n, r, t, o) {
|
|
148
149
|
if (e.length === 0 && i.length === 0)
|
|
149
150
|
return { segments: [], insertedCount: 0, deletedCount: 0, equalCount: 0, usedFallback: !1 };
|
|
150
|
-
const { prefix: f, suffix: g, aMiddle: c, bMiddle: b } =
|
|
151
|
-
let v = [];
|
|
151
|
+
const { prefix: f, suffix: g, aMiddle: c, bMiddle: b } = pe(e, i), v = [];
|
|
152
152
|
f.forEach((a) => v.push({ type: "equal", token: a }));
|
|
153
153
|
const F = c.length * b.length, T = c.length > o || b.length > o || F > t;
|
|
154
154
|
if (T)
|
|
@@ -169,7 +169,7 @@ function pe(e, i, n, r, t, o) {
|
|
|
169
169
|
v.push({ type: "insert", token: b[p] }), p += 1;
|
|
170
170
|
}
|
|
171
171
|
g.forEach((a) => v.push({ type: "equal", token: a }));
|
|
172
|
-
const q =
|
|
172
|
+
const q = ue(v, n, r);
|
|
173
173
|
let A = 0, L = 0, K = 0;
|
|
174
174
|
return q.forEach((a) => {
|
|
175
175
|
a.type === "insert" && (A += a.count), a.type === "delete" && (L += a.count), a.type === "equal" && (K += a.count);
|
|
@@ -185,10 +185,10 @@ function ee(e) {
|
|
|
185
185
|
return u(e.value).replace(/\n/g, `
|
|
186
186
|
`);
|
|
187
187
|
}
|
|
188
|
-
function
|
|
188
|
+
function he(e, i) {
|
|
189
189
|
return e.length === 0 ? `<p class="rte-version-diff-empty">${u(i.noChanges)}</p>` : e.map((n) => `<span class="${n.type === "equal" ? "rte-version-diff-equal" : n.type === "insert" ? "rte-version-diff-insert" : "rte-version-diff-delete"}">${ee(n)}</span>`).join("");
|
|
190
190
|
}
|
|
191
|
-
function
|
|
191
|
+
function me(e, i) {
|
|
192
192
|
if (e.length === 0) {
|
|
193
193
|
const t = `<p class="rte-version-diff-empty">${u(i.noChanges)}</p>`;
|
|
194
194
|
return { baselineHtml: t, currentHtml: t };
|
|
@@ -210,11 +210,11 @@ function he(e, i) {
|
|
|
210
210
|
currentHtml: r.join("")
|
|
211
211
|
};
|
|
212
212
|
}
|
|
213
|
-
function
|
|
213
|
+
function ve(e) {
|
|
214
214
|
const i = e.metaKey || e.ctrlKey, r = (typeof e.key == "string" ? e.key : "").toLowerCase(), t = typeof e.code == "string" ? e.code.toLowerCase() : "", o = i && e.altKey && !e.shiftKey && (r === "d" || t === "keyd"), f = !e.metaKey && !e.ctrlKey && !e.altKey && !e.shiftKey && (r === "f8" || t === "f8");
|
|
215
215
|
return o || f;
|
|
216
216
|
}
|
|
217
|
-
function
|
|
217
|
+
function ge() {
|
|
218
218
|
if (typeof document > "u" || document.getElementById(U)) return;
|
|
219
219
|
const e = document.createElement("style");
|
|
220
220
|
e.id = U, e.textContent = `
|
|
@@ -516,7 +516,7 @@ function ve() {
|
|
|
516
516
|
}
|
|
517
517
|
`, document.head.appendChild(e);
|
|
518
518
|
}
|
|
519
|
-
async function
|
|
519
|
+
async function ye(e, i, n) {
|
|
520
520
|
if (n != null) return n;
|
|
521
521
|
if (typeof i.getBaselineHtml == "function") {
|
|
522
522
|
const o = O(e), f = await Promise.resolve(i.getBaselineHtml({ editor: e, editorRoot: o }));
|
|
@@ -528,12 +528,12 @@ async function ge(e, i, n) {
|
|
|
528
528
|
const t = W(e);
|
|
529
529
|
return w.set(e, t), t;
|
|
530
530
|
}
|
|
531
|
-
function
|
|
531
|
+
function xe(e) {
|
|
532
532
|
e.querySelector(
|
|
533
533
|
'button:not([disabled]), select:not([disabled]), input:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])'
|
|
534
534
|
)?.focus();
|
|
535
535
|
}
|
|
536
|
-
function
|
|
536
|
+
function ke(e, i) {
|
|
537
537
|
if (e.key !== "Tab") return;
|
|
538
538
|
const n = Array.from(i.querySelectorAll(
|
|
539
539
|
'button:not([disabled]), select:not([disabled]), input:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])'
|
|
@@ -548,7 +548,7 @@ function te() {
|
|
|
548
548
|
function X(e) {
|
|
549
549
|
!e || w.has(e) || w.set(e, W(e));
|
|
550
550
|
}
|
|
551
|
-
function
|
|
551
|
+
function $e(e) {
|
|
552
552
|
return {
|
|
553
553
|
baselineHtml: e.baselineHtml,
|
|
554
554
|
getBaselineHtml: e.getBaselineHtml,
|
|
@@ -556,13 +556,13 @@ function ke(e) {
|
|
|
556
556
|
ignoreWhitespace: e.ignoreWhitespace !== !1,
|
|
557
557
|
maxTokens: Math.max(200, e.maxTokens ?? 1200),
|
|
558
558
|
maxMatrixSize: Math.max(5e4, e.maxMatrixSize ?? 1e6),
|
|
559
|
-
labels:
|
|
559
|
+
labels: fe(e.labels)
|
|
560
560
|
};
|
|
561
561
|
}
|
|
562
562
|
function re(e, i, n) {
|
|
563
563
|
te(), D = e, R.set(e, i);
|
|
564
564
|
const r = document.createElement("div");
|
|
565
|
-
r.className = l, Y(e) && r.classList.add("rte-version-diff-theme-dark");
|
|
565
|
+
ae(r), r.className = l, Y(e) && r.classList.add("rte-version-diff-theme-dark");
|
|
566
566
|
const t = document.createElement("section");
|
|
567
567
|
t.className = "rte-version-diff-dialog", t.setAttribute("role", "dialog"), t.setAttribute("aria-modal", "true"), t.setAttribute("aria-labelledby", "rte-version-diff-title");
|
|
568
568
|
const o = i.labels;
|
|
@@ -631,20 +631,20 @@ function re(e, i, n) {
|
|
|
631
631
|
const k = e.innerHTML;
|
|
632
632
|
let E = "";
|
|
633
633
|
try {
|
|
634
|
-
E = await
|
|
634
|
+
E = await ye(e, i, s ?? n?.baselineHtml);
|
|
635
635
|
} catch {
|
|
636
636
|
E = w.get(e) ?? W(e);
|
|
637
637
|
}
|
|
638
638
|
if (m !== L || !r.isConnected) return;
|
|
639
|
-
const ne = J(E), ie = J(k), oe = Q(ne, f, g), se = Q(ie, f, g), C =
|
|
639
|
+
const ne = J(E), ie = J(k), oe = Q(ne, f, g), se = Q(ie, f, g), C = be(
|
|
640
640
|
oe,
|
|
641
641
|
se,
|
|
642
642
|
f,
|
|
643
643
|
g,
|
|
644
644
|
i.maxMatrixSize,
|
|
645
645
|
i.maxTokens
|
|
646
|
-
), _ =
|
|
647
|
-
T.innerHTML =
|
|
646
|
+
), _ = me(C.segments, o);
|
|
647
|
+
T.innerHTML = he(C.segments, o), q.innerHTML = _.baselineHtml, A.innerHTML = _.currentHtml;
|
|
648
648
|
const G = [
|
|
649
649
|
`+${C.insertedCount} inserted`,
|
|
650
650
|
`-${C.deletedCount} deleted`,
|
|
@@ -669,7 +669,7 @@ function re(e, i, n) {
|
|
|
669
669
|
s.preventDefault(), p();
|
|
670
670
|
return;
|
|
671
671
|
}
|
|
672
|
-
if (
|
|
672
|
+
if (ke(s, t), s.target && s.target.classList.contains("rte-version-diff-tab") && (s.key === "ArrowRight" || s.key === "ArrowLeft")) {
|
|
673
673
|
s.preventDefault();
|
|
674
674
|
const m = c === "inline" ? "side" : "inline";
|
|
675
675
|
h(m), t.querySelector(`.rte-version-diff-tab[data-tab="${m}"]`)?.focus();
|
|
@@ -693,11 +693,11 @@ function re(e, i, n) {
|
|
|
693
693
|
g = v.checked, a();
|
|
694
694
|
}), t.querySelector(".rte-version-diff-set-baseline").addEventListener("click", () => {
|
|
695
695
|
w.set(e, e.innerHTML), a(e.innerHTML);
|
|
696
|
-
}), r.addEventListener("keydown", I, !0), r.addEventListener("click", B), document.addEventListener("keydown", y, !0), z = p,
|
|
696
|
+
}), r.addEventListener("keydown", I, !0), r.addEventListener("click", B), document.addEventListener("keydown", y, !0), z = p, xe(t), a();
|
|
697
697
|
}
|
|
698
|
-
function
|
|
698
|
+
function Ee(e) {
|
|
699
699
|
V = e, !H && (H = (i) => {
|
|
700
|
-
if (!
|
|
700
|
+
if (!ve(i)) return;
|
|
701
701
|
if (document.querySelector(`.${l}`)) {
|
|
702
702
|
i.preventDefault();
|
|
703
703
|
return;
|
|
@@ -710,10 +710,10 @@ function $e(e) {
|
|
|
710
710
|
re(t, o);
|
|
711
711
|
}, document.addEventListener("keydown", H, !0));
|
|
712
712
|
}
|
|
713
|
-
function
|
|
713
|
+
function we() {
|
|
714
714
|
H && (document.removeEventListener("keydown", H, !0), H = null, V = null);
|
|
715
715
|
}
|
|
716
|
-
function
|
|
716
|
+
function Le() {
|
|
717
717
|
S || (S = (e) => {
|
|
718
718
|
const n = e.target?.closest($);
|
|
719
719
|
n && (D = n, X(n));
|
|
@@ -722,12 +722,12 @@ function we() {
|
|
|
722
722
|
r && r.getAttribute("contenteditable") !== "false" && (D = r, X(r));
|
|
723
723
|
}, document.addEventListener("beforeinput", M, !0));
|
|
724
724
|
}
|
|
725
|
-
function
|
|
725
|
+
function Ce() {
|
|
726
726
|
S && (document.removeEventListener("focusin", S, !0), S = null), M && (document.removeEventListener("beforeinput", M, !0), M = null);
|
|
727
727
|
}
|
|
728
|
-
const
|
|
729
|
-
const i =
|
|
730
|
-
return
|
|
728
|
+
const Se = (e = {}) => {
|
|
729
|
+
const i = $e(e);
|
|
730
|
+
return ge(), {
|
|
731
731
|
name: "versionDiff",
|
|
732
732
|
toolbar: [
|
|
733
733
|
{
|
|
@@ -756,13 +756,13 @@ const Ce = (e = {}) => {
|
|
|
756
756
|
F8: "openVersionDiff"
|
|
757
757
|
},
|
|
758
758
|
init: () => {
|
|
759
|
-
j += 1,
|
|
759
|
+
j += 1, Ee(i), Le();
|
|
760
760
|
},
|
|
761
761
|
destroy: () => {
|
|
762
|
-
j = Math.max(0, j - 1), j === 0 && (te(),
|
|
762
|
+
j = Math.max(0, j - 1), j === 0 && (te(), we(), Ce());
|
|
763
763
|
}
|
|
764
764
|
};
|
|
765
765
|
};
|
|
766
766
|
export {
|
|
767
|
-
|
|
767
|
+
Se as VersionDiffPlugin
|
|
768
768
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@editora/plugins",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.18",
|
|
4
4
|
"description": "Enterprise plugin suite for Editora rich text editor in React and web apps, including tables, media, workflow, and compliance tooling.",
|
|
5
5
|
"author": "Ajay Kumar <ajaykr089@gmail.com>",
|
|
6
6
|
"license": "MIT",
|
|
@@ -192,6 +192,12 @@
|
|
|
192
192
|
"require": "./dist/code-sample.cjs.js",
|
|
193
193
|
"default": "./dist/code-sample.esm.js"
|
|
194
194
|
},
|
|
195
|
+
"./collaboration": {
|
|
196
|
+
"types": "./index.d.ts",
|
|
197
|
+
"import": "./dist/collaboration.esm.js",
|
|
198
|
+
"require": "./dist/collaboration.cjs.js",
|
|
199
|
+
"default": "./dist/collaboration.esm.js"
|
|
200
|
+
},
|
|
195
201
|
"./comments": {
|
|
196
202
|
"types": "./index.d.ts",
|
|
197
203
|
"import": "./dist/comments.esm.js",
|
|
@@ -429,20 +435,20 @@
|
|
|
429
435
|
"verify:citations": "npm run typecheck:build && npm run test:citations && npm run test:content-rules && npm run test:approval-workflow && npm run test:pii-redaction && npm run test:smart-paste && npm run test:blocks-library && npm run test:doc-schema && npm run test:translation-workflow && npm run test:format-painter && npm run build"
|
|
430
436
|
},
|
|
431
437
|
"peerDependencies": {
|
|
432
|
-
"@editora/core": "^1.0.
|
|
438
|
+
"@editora/core": "^1.0.16"
|
|
433
439
|
},
|
|
434
440
|
"dependencies": {
|
|
435
441
|
"katex": "^0.16.27",
|
|
436
442
|
"mathjax": "^3.2.2"
|
|
437
443
|
},
|
|
438
444
|
"devDependencies": {
|
|
439
|
-
"@editora/core": "^1.0.
|
|
445
|
+
"@editora/core": "^1.0.16",
|
|
440
446
|
"@types/katex": "^0.16.8",
|
|
441
447
|
"typescript": "^5.0.0",
|
|
442
|
-
"vite": "^
|
|
448
|
+
"vite": "^7.3.1"
|
|
443
449
|
},
|
|
444
450
|
"publishConfig": {
|
|
445
451
|
"access": "public"
|
|
446
452
|
},
|
|
447
|
-
"gitHead": "
|
|
453
|
+
"gitHead": "7883627e823aa99dd5ecb66a5201116df972f88b"
|
|
448
454
|
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";const b="p,div,li,ul,ol,table,thead,tbody,tfoot,tr,td,th,h1,h2,h3,h4,h5,h6,blockquote,pre";function p(e){return!!e.cloneContents().querySelector(b)}function v(e,t){return(e?.nodeType===Node.ELEMENT_NODE?e:e?.parentElement??null)?.closest('[contenteditable="true"]')||t()?.querySelector('[contenteditable="true"]')||document.querySelector('[contenteditable="true"]')}function C(e,t){const n=v(e,t);n&&n.dispatchEvent(new Event("input",{bubbles:!0}))}function A(e,t){let r=e.startContainer.nodeType===Node.TEXT_NODE?e.startContainer.parentElement:e.startContainer;for(;r&&r!==document.body;){if(r.classList.contains(t)){const c=document.createRange();if(c.selectNodeContents(r),c.compareBoundaryPoints(Range.START_TO_START,e)<=0&&c.compareBoundaryPoints(Range.END_TO_END,e)>=0)return r}r=r.parentElement}return null}function S(e){try{if(e.savedRange){const o=window.getSelection();o&&(o.removeAllRanges(),o.addRange(e.savedRange.cloneRange()))}const t=window.getSelection();if(!t||t.rangeCount===0||t.isCollapsed)return!1;const n=t.getRangeAt(0);if(n.collapsed)return!1;const r=A(n,e.className);if(r)return e.styleProperty==="backgroundColor"?r.style.backgroundColor=e.color:r.style.color=e.color,C(r,e.getActiveEditorRoot),!0;v(n.commonAncestorContainer,e.getActiveEditorRoot)?.focus({preventScroll:!0});try{document.execCommand("styleWithCSS",!1,"true")}catch{}let l=!1;if(e.commands.forEach(o=>{l||(l=document.execCommand(o,!1,e.color))}),!l&&!p(n)){const o=document.createElement("span");e.styleProperty==="backgroundColor"?o.style.backgroundColor=e.color:o.style.color=e.color,o.className=e.className;const a=n.extractContents();o.appendChild(a),n.insertNode(o),n.setStartAfter(o),n.collapse(!0),t.removeAllRanges(),t.addRange(n),l=!0}return l?(C(n.commonAncestorContainer,e.getActiveEditorRoot),!0):(e.warnMessage&&console.warn(e.warnMessage),!1)}catch(t){return e.warnMessage?console.error(e.warnMessage,t):console.error("[ColorApply] Failed to apply color",t),!1}}function T({popover:e,anchor:t,onClose:n,gap:r=6,margin:c=8,zIndex:l=1e4}){e.style.position="fixed",e.style.zIndex=`${l}`,e.style.visibility="hidden";const o=()=>{if(!e.isConnected||!t.isConnected){n();return}const s=t.getBoundingClientRect();if(s.width===0&&s.height===0){n();return}const i=e.getBoundingClientRect(),y=i.width||e.offsetWidth||220,f=i.height||e.offsetHeight||260,w=window.innerWidth,E=window.innerHeight;let u=s.left,d=s.bottom+r;if(u+y>w-c&&(u=w-y-c),u=Math.max(c,u),d+f>E-c){const g=s.top-f-r;g>=c?d=g:d=Math.max(c,E-f-c)}d<c&&(d=c),e.style.left=`${Math.round(u)}px`,e.style.top=`${Math.round(d)}px`,e.style.visibility="visible"},a=()=>{o()},m=s=>{const i=s.target;i&&(e.contains(i)||t.contains(i)||n())},h=s=>{s.key==="Escape"&&n()};window.addEventListener("resize",a),window.addEventListener("scroll",a,!0),document.addEventListener("keydown",h);const R=window.requestAnimationFrame(()=>{document.addEventListener("mousedown",m,!0)});return o(),{reposition:o,destroy:()=>{window.cancelAnimationFrame(R),window.removeEventListener("resize",a),window.removeEventListener("scroll",a,!0),document.removeEventListener("keydown",h),document.removeEventListener("mousedown",m,!0)}}}exports.applyColorToSelection=S;exports.attachAnchoredPopover=T;
|
|
@@ -1,106 +0,0 @@
|
|
|
1
|
-
const b = "p,div,li,ul,ol,table,thead,tbody,tfoot,tr,td,th,h1,h2,h3,h4,h5,h6,blockquote,pre";
|
|
2
|
-
function p(e) {
|
|
3
|
-
return !!e.cloneContents().querySelector(b);
|
|
4
|
-
}
|
|
5
|
-
function v(e, t) {
|
|
6
|
-
return (e?.nodeType === Node.ELEMENT_NODE ? e : e?.parentElement ?? null)?.closest('[contenteditable="true"]') || t()?.querySelector('[contenteditable="true"]') || document.querySelector('[contenteditable="true"]');
|
|
7
|
-
}
|
|
8
|
-
function C(e, t) {
|
|
9
|
-
const n = v(e, t);
|
|
10
|
-
n && n.dispatchEvent(new Event("input", { bubbles: !0 }));
|
|
11
|
-
}
|
|
12
|
-
function A(e, t) {
|
|
13
|
-
let r = e.startContainer.nodeType === Node.TEXT_NODE ? e.startContainer.parentElement : e.startContainer;
|
|
14
|
-
for (; r && r !== document.body; ) {
|
|
15
|
-
if (r.classList.contains(t)) {
|
|
16
|
-
const c = document.createRange();
|
|
17
|
-
if (c.selectNodeContents(r), c.compareBoundaryPoints(Range.START_TO_START, e) <= 0 && c.compareBoundaryPoints(Range.END_TO_END, e) >= 0)
|
|
18
|
-
return r;
|
|
19
|
-
}
|
|
20
|
-
r = r.parentElement;
|
|
21
|
-
}
|
|
22
|
-
return null;
|
|
23
|
-
}
|
|
24
|
-
function N(e) {
|
|
25
|
-
try {
|
|
26
|
-
if (e.savedRange) {
|
|
27
|
-
const o = window.getSelection();
|
|
28
|
-
o && (o.removeAllRanges(), o.addRange(e.savedRange.cloneRange()));
|
|
29
|
-
}
|
|
30
|
-
const t = window.getSelection();
|
|
31
|
-
if (!t || t.rangeCount === 0 || t.isCollapsed)
|
|
32
|
-
return !1;
|
|
33
|
-
const n = t.getRangeAt(0);
|
|
34
|
-
if (n.collapsed)
|
|
35
|
-
return !1;
|
|
36
|
-
const r = A(n, e.className);
|
|
37
|
-
if (r)
|
|
38
|
-
return e.styleProperty === "backgroundColor" ? r.style.backgroundColor = e.color : r.style.color = e.color, C(r, e.getActiveEditorRoot), !0;
|
|
39
|
-
v(
|
|
40
|
-
n.commonAncestorContainer,
|
|
41
|
-
e.getActiveEditorRoot
|
|
42
|
-
)?.focus({ preventScroll: !0 });
|
|
43
|
-
try {
|
|
44
|
-
document.execCommand("styleWithCSS", !1, "true");
|
|
45
|
-
} catch {
|
|
46
|
-
}
|
|
47
|
-
let l = !1;
|
|
48
|
-
if (e.commands.forEach((o) => {
|
|
49
|
-
l || (l = document.execCommand(o, !1, e.color));
|
|
50
|
-
}), !l && !p(n)) {
|
|
51
|
-
const o = document.createElement("span");
|
|
52
|
-
e.styleProperty === "backgroundColor" ? o.style.backgroundColor = e.color : o.style.color = e.color, o.className = e.className;
|
|
53
|
-
const a = n.extractContents();
|
|
54
|
-
o.appendChild(a), n.insertNode(o), n.setStartAfter(o), n.collapse(!0), t.removeAllRanges(), t.addRange(n), l = !0;
|
|
55
|
-
}
|
|
56
|
-
return l ? (C(n.commonAncestorContainer, e.getActiveEditorRoot), !0) : (e.warnMessage && console.warn(e.warnMessage), !1);
|
|
57
|
-
} catch (t) {
|
|
58
|
-
return e.warnMessage ? console.error(e.warnMessage, t) : console.error("[ColorApply] Failed to apply color", t), !1;
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
function T({
|
|
62
|
-
popover: e,
|
|
63
|
-
anchor: t,
|
|
64
|
-
onClose: n,
|
|
65
|
-
gap: r = 6,
|
|
66
|
-
margin: c = 8,
|
|
67
|
-
zIndex: l = 1e4
|
|
68
|
-
}) {
|
|
69
|
-
e.style.position = "fixed", e.style.zIndex = `${l}`, e.style.visibility = "hidden";
|
|
70
|
-
const o = () => {
|
|
71
|
-
if (!e.isConnected || !t.isConnected) {
|
|
72
|
-
n();
|
|
73
|
-
return;
|
|
74
|
-
}
|
|
75
|
-
const s = t.getBoundingClientRect();
|
|
76
|
-
if (s.width === 0 && s.height === 0) {
|
|
77
|
-
n();
|
|
78
|
-
return;
|
|
79
|
-
}
|
|
80
|
-
const i = e.getBoundingClientRect(), w = i.width || e.offsetWidth || 220, f = i.height || e.offsetHeight || 260, y = window.innerWidth, E = window.innerHeight;
|
|
81
|
-
let u = s.left, d = s.bottom + r;
|
|
82
|
-
if (u + w > y - c && (u = y - w - c), u = Math.max(c, u), d + f > E - c) {
|
|
83
|
-
const g = s.top - f - r;
|
|
84
|
-
g >= c ? d = g : d = Math.max(c, E - f - c);
|
|
85
|
-
}
|
|
86
|
-
d < c && (d = c), e.style.left = `${Math.round(u)}px`, e.style.top = `${Math.round(d)}px`, e.style.visibility = "visible";
|
|
87
|
-
}, a = () => {
|
|
88
|
-
o();
|
|
89
|
-
}, m = (s) => {
|
|
90
|
-
const i = s.target;
|
|
91
|
-
i && (e.contains(i) || t.contains(i) || n());
|
|
92
|
-
}, h = (s) => {
|
|
93
|
-
s.key === "Escape" && n();
|
|
94
|
-
};
|
|
95
|
-
window.addEventListener("resize", a), window.addEventListener("scroll", a, !0), document.addEventListener("keydown", h);
|
|
96
|
-
const R = window.requestAnimationFrame(() => {
|
|
97
|
-
document.addEventListener("mousedown", m, !0);
|
|
98
|
-
});
|
|
99
|
-
return o(), { reposition: o, destroy: () => {
|
|
100
|
-
window.cancelAnimationFrame(R), window.removeEventListener("resize", a), window.removeEventListener("scroll", a, !0), document.removeEventListener("keydown", h), document.removeEventListener("mousedown", m, !0);
|
|
101
|
-
} };
|
|
102
|
-
}
|
|
103
|
-
export {
|
|
104
|
-
N as a,
|
|
105
|
-
T as b
|
|
106
|
-
};
|
package/dist/index-CJ90EVWy.mjs
DELETED
|
@@ -1,145 +0,0 @@
|
|
|
1
|
-
import { getGlobalApiConfig as d, buildApiUrl as s, getGlobalApiHeaders as u } from "./shared-config.esm.js";
|
|
2
|
-
const m = () => ({
|
|
3
|
-
name: "document-manager",
|
|
4
|
-
toolbar: [
|
|
5
|
-
{
|
|
6
|
-
label: "Import Word",
|
|
7
|
-
command: "importWord",
|
|
8
|
-
icon: '<svg width="24" height="24" focusable="false"><path fill-rule="evenodd" clip-rule="evenodd" d="M7 3h7.4L19 7.6V15h-2V9h-4V5H5c0-1.1.9-2 2-2Z"></path><path d="M9.5 7A1.5 1.5 0 0 1 11 8.4v7.1A1.5 1.5 0 0 1 9.6 17H2.5A1.5 1.5 0 0 1 1 15.6V8.5A1.5 1.5 0 0 1 2.4 7h7.1Zm-1 2.8-1 2.6-1-2.5v-.1a.6.6 0 0 0-1 0l-.1.1-.9 2.5-1-2.5v-.1a.6.6 0 0 0-1 .4v.1l1.5 4v.1a.6.6 0 0 0 1 0v-.1l1-2.5.9 2.5v.1a.6.6 0 0 0 1 0H8l1.6-4v-.2a.6.6 0 0 0-1.1-.4Z"></path><path fill-rule="evenodd" clip-rule="evenodd" d="M11.4 18.2a1 1 0 0 0 1.2 1.6l1.4-1V22a1 1 0 1 0 2 0v-3.1l1.4 1a1 1 0 0 0 1.2-1.7L15 15.8l-3.6 2.4Z"></path></svg>',
|
|
9
|
-
type: "button"
|
|
10
|
-
},
|
|
11
|
-
{
|
|
12
|
-
label: "Export Word",
|
|
13
|
-
command: "exportWord",
|
|
14
|
-
icon: '<svg width="24" height="24" focusable="false"><path d="M9.5 7A1.5 1.5 0 0 1 11 8.4v7.1A1.5 1.5 0 0 1 9.6 17H2.5A1.5 1.5 0 0 1 1 15.6V8.5A1.5 1.5 0 0 1 2.4 7h7.1Zm-1 2.8-1 2.6-1-2.5v-.1a.6.6 0 0 0-1 0l-.1.1-.9 2.5-1-2.5v-.1a.6.6 0 0 0-1 .4v.1l1.5 4v.1a.6.6 0 0 0 1 0v-.1l1-2.5.9 2.5v.1a.6.6 0 0 0 1 0H8l1.6-4v-.2a.6.6 0 0 0-1.1-.4Z"></path><path fill-rule="evenodd" clip-rule="evenodd" d="M7 3h7.4L19 7.6V17h-2V9h-4V5H7v3H5V5c0-1.1.9-2 2-2ZM15 17a1 1 0 1 0-2 0v3.1l-1.4-1a1 1 0 1 0-1.2 1.7l3.6 2.4 3.6-2.4a1 1 0 0 0-1.2-1.6l-1.4 1V17Z"></path></svg>',
|
|
15
|
-
type: "button"
|
|
16
|
-
},
|
|
17
|
-
{
|
|
18
|
-
label: "Export PDF",
|
|
19
|
-
command: "exportPdf",
|
|
20
|
-
icon: '<svg width="24" height="24" focusable="false"><path fill-rule="evenodd" clip-rule="evenodd" d="M7 3h7.4L19 7.6V17h-2V9h-4V5H7v3H5V5c0-1.1.9-2 2-2Z"></path><path d="M2.6 15.2v-1.9h1c.6 0 1-.2 1.4-.5.3-.3.5-.7.5-1.2s-.2-.9-.5-1.2a2 2 0 0 0-1.3-.4H1v5.2h1.6Zm.4-3h-.4v-1.1h.5l.6.1.2.5c0 .1 0 .3-.2.4l-.7.1Zm5.7 3 1-.1c.3 0 .5-.2.7-.4l.5-.8c.2-.3.2-.7.2-1.3v-1l-.5-.8c-.2-.3-.4-.5-.7-.6L8.7 10H6.3v5.2h2.4Zm-.4-1.1H8v-3h.4c.5 0 .8.2 1 .4l.2 1.1-.1 1-.3.3-.8.2Zm5.3 1.2V13h2v-1h-2v-1H16V10h-4v5.2h1.6Z"></path><path fill-rule="evenodd" clip-rule="evenodd" d="M15 17a1 1 0 1 0-2 0v3.1l-1.4-1a1 1 0 1 0-1.2 1.7l3.6 2.4 3.6-2.4a1 1 0 0 0-1.2-1.6l-1.4 1V17Z"></path></svg>',
|
|
21
|
-
type: "button"
|
|
22
|
-
}
|
|
23
|
-
],
|
|
24
|
-
commands: {
|
|
25
|
-
importWord: () => {
|
|
26
|
-
const r = () => {
|
|
27
|
-
const o = window.getSelection();
|
|
28
|
-
if (o && o.rangeCount > 0) {
|
|
29
|
-
let a = o.getRangeAt(0).startContainer;
|
|
30
|
-
for (; a && a !== document.body; ) {
|
|
31
|
-
if (a.nodeType === Node.ELEMENT_NODE) {
|
|
32
|
-
const i = a;
|
|
33
|
-
if (i.getAttribute("contenteditable") === "true")
|
|
34
|
-
return i;
|
|
35
|
-
}
|
|
36
|
-
a = a.parentNode;
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
const n = document.activeElement;
|
|
40
|
-
if (n?.getAttribute("contenteditable") === "true")
|
|
41
|
-
return n;
|
|
42
|
-
const t = n?.closest('[contenteditable="true"]');
|
|
43
|
-
return t || document.querySelector('[contenteditable="true"]');
|
|
44
|
-
}, e = document.createElement("input");
|
|
45
|
-
return e.type = "file", e.accept = ".docx", e.onchange = async (o) => {
|
|
46
|
-
const n = o.target.files?.[0];
|
|
47
|
-
if (n)
|
|
48
|
-
try {
|
|
49
|
-
const t = r();
|
|
50
|
-
if (t) {
|
|
51
|
-
const { importFromWord: a } = await import("./documentManager-CRumGpCT.mjs"), i = await a(n);
|
|
52
|
-
t.innerHTML = i, t.dispatchEvent(new Event("input", { bubbles: !0 }));
|
|
53
|
-
}
|
|
54
|
-
} catch (t) {
|
|
55
|
-
console.error("Import failed:", t), alert("Failed to import Word document. Please check the console for details.");
|
|
56
|
-
}
|
|
57
|
-
}, e.click(), !0;
|
|
58
|
-
},
|
|
59
|
-
exportWord: async () => {
|
|
60
|
-
const r = () => {
|
|
61
|
-
const e = window.getSelection();
|
|
62
|
-
if (e && e.rangeCount > 0) {
|
|
63
|
-
let t = e.getRangeAt(0).startContainer;
|
|
64
|
-
for (; t && t !== document.body; ) {
|
|
65
|
-
if (t.nodeType === Node.ELEMENT_NODE && t.getAttribute("contenteditable") === "true")
|
|
66
|
-
return t;
|
|
67
|
-
t = t.parentNode;
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
const o = document.activeElement;
|
|
71
|
-
return o?.getAttribute("contenteditable") === "true" ? o : o?.closest('[contenteditable="true"]') || document.querySelector('[contenteditable="true"]');
|
|
72
|
-
};
|
|
73
|
-
try {
|
|
74
|
-
const e = r();
|
|
75
|
-
if (e) {
|
|
76
|
-
const o = e.innerHTML, { exportToWord: n } = await import("./documentManager-CRumGpCT.mjs");
|
|
77
|
-
await n(o, "document.docx");
|
|
78
|
-
}
|
|
79
|
-
return !0;
|
|
80
|
-
} catch (e) {
|
|
81
|
-
return console.error("Export failed:", e), alert("Failed to export to Word. Please check the console for details."), !1;
|
|
82
|
-
}
|
|
83
|
-
},
|
|
84
|
-
exportPdf: async () => {
|
|
85
|
-
const r = () => {
|
|
86
|
-
const e = window.getSelection();
|
|
87
|
-
if (e && e.rangeCount > 0) {
|
|
88
|
-
let t = e.getRangeAt(0).startContainer;
|
|
89
|
-
for (; t && t !== document.body; ) {
|
|
90
|
-
if (t.nodeType === Node.ELEMENT_NODE && t.getAttribute("contenteditable") === "true")
|
|
91
|
-
return t;
|
|
92
|
-
t = t.parentNode;
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
const o = document.activeElement;
|
|
96
|
-
return o?.getAttribute("contenteditable") === "true" ? o : o?.closest('[contenteditable="true"]') || document.querySelector('[contenteditable="true"]');
|
|
97
|
-
};
|
|
98
|
-
try {
|
|
99
|
-
const e = r();
|
|
100
|
-
if (e) {
|
|
101
|
-
const o = e.innerHTML, { exportToPdf: n } = await import("./documentManager-CRumGpCT.mjs");
|
|
102
|
-
await n(o, "document.pdf", e);
|
|
103
|
-
} else
|
|
104
|
-
console.error("PDF Export: No editor element found"), alert("No active editor found. Please click in the editor area first.");
|
|
105
|
-
return !0;
|
|
106
|
-
} catch (e) {
|
|
107
|
-
return console.error("PDF Export: Export failed:", e), alert("Failed to export to PDF. Please check the console for details."), !1;
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
},
|
|
111
|
-
keymap: {}
|
|
112
|
-
}), p = {
|
|
113
|
-
apiEndpoints: {
|
|
114
|
-
exportWord: "/documents/export-word"
|
|
115
|
-
},
|
|
116
|
-
headers: {
|
|
117
|
-
// Add default headers if needed (e.g., API key)
|
|
118
|
-
// 'Authorization': 'Bearer YOUR_API_KEY',
|
|
119
|
-
// 'X-API-Key': 'YOUR_API_KEY'
|
|
120
|
-
},
|
|
121
|
-
useClientSideFallback: !0
|
|
122
|
-
// Enable fallback by default
|
|
123
|
-
};
|
|
124
|
-
let l = { ...p };
|
|
125
|
-
function f(r) {
|
|
126
|
-
l = { ...l, ...r };
|
|
127
|
-
}
|
|
128
|
-
function c() {
|
|
129
|
-
return { ...l };
|
|
130
|
-
}
|
|
131
|
-
function v(r) {
|
|
132
|
-
const e = c(), o = d(), n = e.apiUrl || o.apiUrl;
|
|
133
|
-
return s(n, e.apiEndpoints[r]);
|
|
134
|
-
}
|
|
135
|
-
function g() {
|
|
136
|
-
const r = u(), o = c().headers || {};
|
|
137
|
-
return { ...r, ...o };
|
|
138
|
-
}
|
|
139
|
-
export {
|
|
140
|
-
m as D,
|
|
141
|
-
v as a,
|
|
142
|
-
g as b,
|
|
143
|
-
c as g,
|
|
144
|
-
f as s
|
|
145
|
-
};
|
package/dist/index-DTkvH8gX.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";const a=require("./shared-config.cjs.js"),u=()=>({name:"document-manager",toolbar:[{label:"Import Word",command:"importWord",icon:'<svg width="24" height="24" focusable="false"><path fill-rule="evenodd" clip-rule="evenodd" d="M7 3h7.4L19 7.6V15h-2V9h-4V5H5c0-1.1.9-2 2-2Z"></path><path d="M9.5 7A1.5 1.5 0 0 1 11 8.4v7.1A1.5 1.5 0 0 1 9.6 17H2.5A1.5 1.5 0 0 1 1 15.6V8.5A1.5 1.5 0 0 1 2.4 7h7.1Zm-1 2.8-1 2.6-1-2.5v-.1a.6.6 0 0 0-1 0l-.1.1-.9 2.5-1-2.5v-.1a.6.6 0 0 0-1 .4v.1l1.5 4v.1a.6.6 0 0 0 1 0v-.1l1-2.5.9 2.5v.1a.6.6 0 0 0 1 0H8l1.6-4v-.2a.6.6 0 0 0-1.1-.4Z"></path><path fill-rule="evenodd" clip-rule="evenodd" d="M11.4 18.2a1 1 0 0 0 1.2 1.6l1.4-1V22a1 1 0 1 0 2 0v-3.1l1.4 1a1 1 0 0 0 1.2-1.7L15 15.8l-3.6 2.4Z"></path></svg>',type:"button"},{label:"Export Word",command:"exportWord",icon:'<svg width="24" height="24" focusable="false"><path d="M9.5 7A1.5 1.5 0 0 1 11 8.4v7.1A1.5 1.5 0 0 1 9.6 17H2.5A1.5 1.5 0 0 1 1 15.6V8.5A1.5 1.5 0 0 1 2.4 7h7.1Zm-1 2.8-1 2.6-1-2.5v-.1a.6.6 0 0 0-1 0l-.1.1-.9 2.5-1-2.5v-.1a.6.6 0 0 0-1 .4v.1l1.5 4v.1a.6.6 0 0 0 1 0v-.1l1-2.5.9 2.5v.1a.6.6 0 0 0 1 0H8l1.6-4v-.2a.6.6 0 0 0-1.1-.4Z"></path><path fill-rule="evenodd" clip-rule="evenodd" d="M7 3h7.4L19 7.6V17h-2V9h-4V5H7v3H5V5c0-1.1.9-2 2-2ZM15 17a1 1 0 1 0-2 0v3.1l-1.4-1a1 1 0 1 0-1.2 1.7l3.6 2.4 3.6-2.4a1 1 0 0 0-1.2-1.6l-1.4 1V17Z"></path></svg>',type:"button"},{label:"Export PDF",command:"exportPdf",icon:'<svg width="24" height="24" focusable="false"><path fill-rule="evenodd" clip-rule="evenodd" d="M7 3h7.4L19 7.6V17h-2V9h-4V5H7v3H5V5c0-1.1.9-2 2-2Z"></path><path d="M2.6 15.2v-1.9h1c.6 0 1-.2 1.4-.5.3-.3.5-.7.5-1.2s-.2-.9-.5-1.2a2 2 0 0 0-1.3-.4H1v5.2h1.6Zm.4-3h-.4v-1.1h.5l.6.1.2.5c0 .1 0 .3-.2.4l-.7.1Zm5.7 3 1-.1c.3 0 .5-.2.7-.4l.5-.8c.2-.3.2-.7.2-1.3v-1l-.5-.8c-.2-.3-.4-.5-.7-.6L8.7 10H6.3v5.2h2.4Zm-.4-1.1H8v-3h.4c.5 0 .8.2 1 .4l.2 1.1-.1 1-.3.3-.8.2Zm5.3 1.2V13h2v-1h-2v-1H16V10h-4v5.2h1.6Z"></path><path fill-rule="evenodd" clip-rule="evenodd" d="M15 17a1 1 0 1 0-2 0v3.1l-1.4-1a1 1 0 1 0-1.2 1.7l3.6 2.4 3.6-2.4a1 1 0 0 0-1.2-1.6l-1.4 1V17Z"></path></svg>',type:"button"}],commands:{importWord:()=>{const r=()=>{const o=window.getSelection();if(o&&o.rangeCount>0){let i=o.getRangeAt(0).startContainer;for(;i&&i!==document.body;){if(i.nodeType===Node.ELEMENT_NODE){const l=i;if(l.getAttribute("contenteditable")==="true")return l}i=i.parentNode}}const n=document.activeElement;if(n?.getAttribute("contenteditable")==="true")return n;const t=n?.closest('[contenteditable="true"]');return t||document.querySelector('[contenteditable="true"]')},e=document.createElement("input");return e.type="file",e.accept=".docx",e.onchange=async o=>{const n=o.target.files?.[0];if(n)try{const t=r();if(t){const{importFromWord:i}=await Promise.resolve().then(()=>require("./documentManager-3nPkITwx.js")),l=await i(n);t.innerHTML=l,t.dispatchEvent(new Event("input",{bubbles:!0}))}}catch(t){console.error("Import failed:",t),alert("Failed to import Word document. Please check the console for details.")}},e.click(),!0},exportWord:async()=>{const r=()=>{const e=window.getSelection();if(e&&e.rangeCount>0){let t=e.getRangeAt(0).startContainer;for(;t&&t!==document.body;){if(t.nodeType===Node.ELEMENT_NODE&&t.getAttribute("contenteditable")==="true")return t;t=t.parentNode}}const o=document.activeElement;return o?.getAttribute("contenteditable")==="true"?o:o?.closest('[contenteditable="true"]')||document.querySelector('[contenteditable="true"]')};try{const e=r();if(e){const o=e.innerHTML,{exportToWord:n}=await Promise.resolve().then(()=>require("./documentManager-3nPkITwx.js"));await n(o,"document.docx")}return!0}catch(e){return console.error("Export failed:",e),alert("Failed to export to Word. Please check the console for details."),!1}},exportPdf:async()=>{const r=()=>{const e=window.getSelection();if(e&&e.rangeCount>0){let t=e.getRangeAt(0).startContainer;for(;t&&t!==document.body;){if(t.nodeType===Node.ELEMENT_NODE&&t.getAttribute("contenteditable")==="true")return t;t=t.parentNode}}const o=document.activeElement;return o?.getAttribute("contenteditable")==="true"?o:o?.closest('[contenteditable="true"]')||document.querySelector('[contenteditable="true"]')};try{const e=r();if(e){const o=e.innerHTML,{exportToPdf:n}=await Promise.resolve().then(()=>require("./documentManager-3nPkITwx.js"));await n(o,"document.pdf",e)}else console.error("PDF Export: No editor element found"),alert("No active editor found. Please click in the editor area first.");return!0}catch(e){return console.error("PDF Export: Export failed:",e),alert("Failed to export to PDF. Please check the console for details."),!1}}},keymap:{}}),s={apiEndpoints:{exportWord:"/documents/export-word"},headers:{},useClientSideFallback:!0};let c={...s};function p(r){c={...c,...r}}function d(){return{...c}}function h(r){const e=d(),o=a.getGlobalApiConfig(),n=e.apiUrl||o.apiUrl;return a.buildApiUrl(n,e.apiEndpoints[r])}function g(){const r=a.getGlobalApiHeaders(),o=d().headers||{};return{...r,...o}}exports.DocumentManagerPlugin=u;exports.getApiHeaders=g;exports.getApiUrl=h;exports.getDocumentManagerConfig=d;exports.setDocumentManagerConfig=p;
|