@editora/plugins 1.0.2 → 1.0.4
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/README.md +30 -5
- package/dist/a11y-checker.cjs.js +109 -0
- package/dist/a11y-checker.esm.js +509 -0
- package/dist/anchor.cjs.js +176 -0
- package/dist/anchor.esm.js +400 -0
- package/dist/background-color.cjs.js +218 -0
- package/dist/background-color.esm.js +482 -0
- package/dist/blockquote.cjs.js +1 -0
- package/dist/blockquote.esm.js +47 -0
- package/dist/bold.cjs.js +1 -0
- package/dist/bold.esm.js +44 -0
- package/dist/capitalization.cjs.js +1 -0
- package/dist/capitalization.esm.js +78 -0
- package/dist/checklist.cjs.js +1 -0
- package/dist/checklist.esm.js +305 -0
- package/dist/clear-formatting.cjs.js +1 -0
- package/dist/clear-formatting.esm.js +138 -0
- package/dist/code-sample.cjs.js +161 -0
- package/dist/code-sample.esm.js +381 -0
- package/dist/code.cjs.js +598 -0
- package/dist/code.esm.js +2034 -0
- package/dist/colorSelectionApply-C0iOfMWb.js +1 -0
- package/dist/colorSelectionApply-D8r_gV32.mjs +63 -0
- package/dist/comments.cjs.js +354 -0
- package/dist/comments.esm.js +692 -0
- package/dist/direction.cjs.js +1 -0
- package/dist/direction.esm.js +129 -0
- package/dist/document-manager.cjs.js +1 -0
- package/dist/document-manager.esm.js +6 -0
- package/dist/{documentManager-CYC9totK.mjs → documentManager-DRUc1-Cs.mjs} +3 -3
- package/dist/{documentManager-BGlu3WRB.js → documentManager-_tQQfQi9.js} +3 -3
- package/dist/editorContainerHelpers-C7kdWnS0.mjs +26 -0
- package/dist/editorContainerHelpers-CFbfiOJI.js +1 -0
- package/dist/embed-iframe.cjs.js +361 -0
- package/dist/embed-iframe.esm.js +556 -0
- package/dist/emojis.cjs.js +284 -0
- package/dist/emojis.esm.js +1080 -0
- package/dist/font-family.cjs.js +1 -0
- package/dist/font-family.esm.js +152 -0
- package/dist/font-size.cjs.js +1 -0
- package/dist/font-size.esm.js +278 -0
- package/dist/footnote.cjs.js +85 -0
- package/dist/footnote.esm.js +397 -0
- package/dist/fullscreen.cjs.js +1 -0
- package/dist/fullscreen.esm.js +73 -0
- package/dist/heading.cjs.js +1 -0
- package/dist/heading.esm.js +63 -0
- package/dist/history.cjs.js +1 -0
- package/dist/history.esm.js +246 -0
- package/dist/indent.cjs.js +1 -0
- package/dist/indent.esm.js +146 -0
- package/dist/index-Bskk414V.mjs +145 -0
- package/dist/index-D3pJyAsj.js +1 -0
- package/dist/index.cjs.js +1 -1
- package/dist/{index.es-B-to-4j4.js → index.es-Cz1qItab.js} +1 -1
- package/dist/{index.es-BbXJ7tyO.mjs → index.es-DEcRmSTY.mjs} +1 -1
- package/dist/index.esm.js +89 -49
- package/dist/italic.cjs.js +1 -0
- package/dist/italic.esm.js +40 -0
- package/dist/line-height.cjs.js +1 -0
- package/dist/line-height.esm.js +145 -0
- package/dist/link.cjs.js +138 -0
- package/dist/link.esm.js +276 -0
- package/dist/list.cjs.js +1 -0
- package/dist/list.esm.js +102 -0
- package/dist/lite.cjs.js +1 -0
- package/dist/lite.esm.js +61 -0
- package/dist/math.cjs.js +45 -0
- package/dist/math.esm.js +249 -0
- package/dist/media-manager.cjs.js +619 -0
- package/dist/media-manager.esm.js +994 -0
- package/dist/merge-tag.cjs.js +93 -0
- package/dist/merge-tag.esm.js +412 -0
- package/dist/page-break.cjs.js +72 -0
- package/dist/page-break.esm.js +295 -0
- package/dist/plugins.css +1 -1
- package/dist/preview.cjs.js +230 -0
- package/dist/preview.esm.js +321 -0
- package/dist/print.cjs.js +254 -0
- package/dist/print.esm.js +309 -0
- package/dist/purify.es-DHhaBdbu.mjs +470 -0
- package/dist/purify.es-T2a3nLiC.js +3 -0
- package/dist/shared-config.cjs.js +1 -0
- package/dist/shared-config.esm.js +30 -0
- package/dist/special-characters.cjs.js +257 -0
- package/dist/special-characters.esm.js +772 -0
- package/dist/spell-check.cjs.js +512 -0
- package/dist/spell-check.esm.js +1013 -0
- package/dist/strikethrough.cjs.js +1 -0
- package/dist/strikethrough.esm.js +71 -0
- package/dist/table.cjs.js +35 -0
- package/dist/table.esm.js +477 -0
- package/dist/template.cjs.js +356 -0
- package/dist/template.esm.js +560 -0
- package/dist/text-alignment.cjs.js +1 -0
- package/dist/text-alignment.esm.js +105 -0
- package/dist/text-color.cjs.js +300 -0
- package/dist/text-color.esm.js +507 -0
- package/dist/underline.cjs.js +1 -0
- package/dist/underline.esm.js +34 -0
- package/index.d.ts +62 -0
- package/package.json +218 -6
- package/LICENSE +0 -21
- package/dist/index-BbORIHoM.mjs +0 -11763
- package/dist/index-C-OCBS_6.js +0 -3753
|
@@ -0,0 +1,246 @@
|
|
|
1
|
+
const S = ".rte-content, .editora-content";
|
|
2
|
+
const T = "__editoraCommandEditorRoot", d = /* @__PURE__ */ new Map(), E = {};
|
|
3
|
+
let g = !1, c = null;
|
|
4
|
+
function I(t) {
|
|
5
|
+
if (!t) return null;
|
|
6
|
+
const e = t.querySelector('[contenteditable="true"]');
|
|
7
|
+
return e instanceof HTMLElement ? e : null;
|
|
8
|
+
}
|
|
9
|
+
function N() {
|
|
10
|
+
if (typeof window > "u") return null;
|
|
11
|
+
const t = window[T];
|
|
12
|
+
if (!(t instanceof HTMLElement)) return null;
|
|
13
|
+
window[T] = null;
|
|
14
|
+
const e = t.closest("[data-editora-editor], .rte-editor, .editora-editor, editora-editor") || (t.matches("[data-editora-editor], .rte-editor, .editora-editor, editora-editor") ? t : null);
|
|
15
|
+
if (e) {
|
|
16
|
+
const o = I(e);
|
|
17
|
+
if (o) return o;
|
|
18
|
+
if (e.getAttribute("contenteditable") === "true") return e;
|
|
19
|
+
}
|
|
20
|
+
if (t.getAttribute("contenteditable") === "true")
|
|
21
|
+
return t;
|
|
22
|
+
const n = t.closest('[contenteditable="true"]');
|
|
23
|
+
return n instanceof HTMLElement ? n : null;
|
|
24
|
+
}
|
|
25
|
+
function z(t) {
|
|
26
|
+
return t ? t.nodeType === Node.ELEMENT_NODE ? t : t.parentElement : null;
|
|
27
|
+
}
|
|
28
|
+
function a(t) {
|
|
29
|
+
const e = z(t);
|
|
30
|
+
if (!e) return null;
|
|
31
|
+
const n = e.closest(S);
|
|
32
|
+
if (n) return n;
|
|
33
|
+
const o = e.closest('[contenteditable="true"]');
|
|
34
|
+
if (!o) return null;
|
|
35
|
+
let r = o, i = r.parentElement;
|
|
36
|
+
for (; i; )
|
|
37
|
+
i.getAttribute("contenteditable") === "true" && (r = i), i = i.parentElement;
|
|
38
|
+
return r;
|
|
39
|
+
}
|
|
40
|
+
function l() {
|
|
41
|
+
const t = N();
|
|
42
|
+
if (t && document.contains(t))
|
|
43
|
+
return t;
|
|
44
|
+
const e = window.getSelection();
|
|
45
|
+
if (e && e.rangeCount > 0) {
|
|
46
|
+
const i = a(e.getRangeAt(0).startContainer);
|
|
47
|
+
if (i) return i;
|
|
48
|
+
}
|
|
49
|
+
const n = document.activeElement;
|
|
50
|
+
if (n) {
|
|
51
|
+
const i = a(n);
|
|
52
|
+
if (i) return i;
|
|
53
|
+
}
|
|
54
|
+
if (c?.isConnected) return c;
|
|
55
|
+
const o = Array.from(d.keys()).find((i) => i.isConnected);
|
|
56
|
+
if (o) return o;
|
|
57
|
+
const r = document.querySelector(S);
|
|
58
|
+
return r || document.querySelector('[contenteditable="true"]');
|
|
59
|
+
}
|
|
60
|
+
function A() {
|
|
61
|
+
for (const t of d.keys())
|
|
62
|
+
t.isConnected || (d.delete(t), c === t && (c = null));
|
|
63
|
+
}
|
|
64
|
+
function C(t) {
|
|
65
|
+
A();
|
|
66
|
+
let e = d.get(t);
|
|
67
|
+
return e || (e = { undoStack: [], redoStack: [] }, d.set(t, e)), e;
|
|
68
|
+
}
|
|
69
|
+
function s(t) {
|
|
70
|
+
t && t.dispatchEvent(new Event("input", { bubbles: !0 }));
|
|
71
|
+
}
|
|
72
|
+
function h(t) {
|
|
73
|
+
return t ? t.innerHTML : "";
|
|
74
|
+
}
|
|
75
|
+
function m(t, e) {
|
|
76
|
+
if (!t) return;
|
|
77
|
+
const n = C(t);
|
|
78
|
+
n.undoStack.push(e), n.redoStack.length = 0, n.undoStack.length > 100 && n.undoStack.splice(0, n.undoStack.length - 100), c = t;
|
|
79
|
+
}
|
|
80
|
+
function v(t, e = "undo") {
|
|
81
|
+
if (A(), t?.isConnected)
|
|
82
|
+
return t;
|
|
83
|
+
const n = l();
|
|
84
|
+
if (n?.isConnected)
|
|
85
|
+
return n;
|
|
86
|
+
if (c?.isConnected)
|
|
87
|
+
return c;
|
|
88
|
+
const o = (r) => e === "undo" ? r.undoStack.length > 0 : r.redoStack.length > 0;
|
|
89
|
+
for (const [r, i] of d.entries())
|
|
90
|
+
if (r.isConnected && o(i))
|
|
91
|
+
return r;
|
|
92
|
+
return null;
|
|
93
|
+
}
|
|
94
|
+
function y(t) {
|
|
95
|
+
const e = {};
|
|
96
|
+
for (const r of t.getAttributeNames()) {
|
|
97
|
+
const i = t.getAttribute(r);
|
|
98
|
+
i !== null && (e[r] = i);
|
|
99
|
+
}
|
|
100
|
+
const n = t instanceof HTMLInputElement || t instanceof HTMLTextAreaElement || t instanceof HTMLSelectElement, o = t instanceof HTMLInputElement;
|
|
101
|
+
return {
|
|
102
|
+
attributes: e,
|
|
103
|
+
innerHTML: t.innerHTML,
|
|
104
|
+
value: n ? t.value : null,
|
|
105
|
+
checked: o ? t.checked : null
|
|
106
|
+
};
|
|
107
|
+
}
|
|
108
|
+
function H(t, e) {
|
|
109
|
+
const n = new Set(t.getAttributeNames());
|
|
110
|
+
Object.keys(e.attributes).forEach((o) => n.delete(o)), n.forEach((o) => t.removeAttribute(o)), Object.entries(e.attributes).forEach(([o, r]) => {
|
|
111
|
+
t.setAttribute(o, r);
|
|
112
|
+
}), t.innerHTML !== e.innerHTML && (t.innerHTML = e.innerHTML), e.value !== null && (t instanceof HTMLInputElement || t instanceof HTMLTextAreaElement || t instanceof HTMLSelectElement) && (t.value = e.value), e.checked !== null && t instanceof HTMLInputElement && (t.checked = e.checked);
|
|
113
|
+
}
|
|
114
|
+
function u(t, e) {
|
|
115
|
+
if (E[t] = e, typeof window > "u") return;
|
|
116
|
+
const n = window.registerEditorCommand;
|
|
117
|
+
typeof n == "function" ? n(t, e) : (window.registerEditorCommand = (o, r) => {
|
|
118
|
+
E[o] = r;
|
|
119
|
+
}, window.registerEditorCommand(t, e));
|
|
120
|
+
}
|
|
121
|
+
const w = (t, ...e) => {
|
|
122
|
+
const n = E[t];
|
|
123
|
+
return n ? n(...e) : !1;
|
|
124
|
+
};
|
|
125
|
+
function p() {
|
|
126
|
+
g || typeof window > "u" || (g = !0, window.execEditorCommand || (window.execEditorCommand = w), window.executeEditorCommand || (window.executeEditorCommand = w), u("undo", x), u("redo", k), u("setAttribute", O), u("setText", D), u("autoFixA11y", _), u("recordDomTransaction", R), u("undoDom", M), u("redoDom", b));
|
|
127
|
+
}
|
|
128
|
+
function L(t, e) {
|
|
129
|
+
const n = e || l(), o = h(n);
|
|
130
|
+
n?.focus({ preventScroll: !0 });
|
|
131
|
+
let r = !1;
|
|
132
|
+
try {
|
|
133
|
+
r = !!document.execCommand(t, !1);
|
|
134
|
+
} catch {
|
|
135
|
+
r = !1;
|
|
136
|
+
}
|
|
137
|
+
const i = h(n), f = o !== i;
|
|
138
|
+
return f && s(n), { executed: r, changed: f };
|
|
139
|
+
}
|
|
140
|
+
const x = () => {
|
|
141
|
+
const t = l();
|
|
142
|
+
return L("undo", t).changed ? !0 : M(t);
|
|
143
|
+
}, k = () => {
|
|
144
|
+
const t = l();
|
|
145
|
+
return L("redo", t).changed ? !0 : b(t);
|
|
146
|
+
}, O = (t, e, n) => {
|
|
147
|
+
if (!(t instanceof HTMLElement)) return;
|
|
148
|
+
const o = a(t), r = t.hasAttribute(e), i = t.getAttribute(e);
|
|
149
|
+
t.setAttribute(e, n), m(o, {
|
|
150
|
+
undo: () => {
|
|
151
|
+
t.isConnected && (r && i !== null ? t.setAttribute(e, i) : t.removeAttribute(e));
|
|
152
|
+
},
|
|
153
|
+
redo: () => {
|
|
154
|
+
t.isConnected && t.setAttribute(e, n);
|
|
155
|
+
}
|
|
156
|
+
}), s(o);
|
|
157
|
+
}, D = (t, e) => {
|
|
158
|
+
if (!(t instanceof HTMLElement)) return;
|
|
159
|
+
const n = a(t), o = t.textContent ?? "";
|
|
160
|
+
t.textContent = e, m(n, {
|
|
161
|
+
undo: () => {
|
|
162
|
+
t.isConnected && (t.textContent = o);
|
|
163
|
+
},
|
|
164
|
+
redo: () => {
|
|
165
|
+
t.isConnected && (t.textContent = e);
|
|
166
|
+
}
|
|
167
|
+
}), s(n);
|
|
168
|
+
}, _ = (t) => {
|
|
169
|
+
const e = t?.element;
|
|
170
|
+
if (!(e instanceof HTMLElement)) return;
|
|
171
|
+
const n = a(e), o = window.a11yRuleRegistry?.find((f) => f.id === t.rule);
|
|
172
|
+
if (!o || typeof o.fix != "function") return;
|
|
173
|
+
const r = y(e);
|
|
174
|
+
o.fix(t);
|
|
175
|
+
const i = y(e);
|
|
176
|
+
m(n, {
|
|
177
|
+
undo: () => {
|
|
178
|
+
e.isConnected && H(e, r);
|
|
179
|
+
},
|
|
180
|
+
redo: () => {
|
|
181
|
+
e.isConnected && H(e, i);
|
|
182
|
+
}
|
|
183
|
+
}), s(n);
|
|
184
|
+
}, R = (t, e, n) => {
|
|
185
|
+
if (!(t instanceof HTMLElement)) return !1;
|
|
186
|
+
const o = typeof n == "string" ? n : t.innerHTML;
|
|
187
|
+
return e === o ? !1 : (m(t, {
|
|
188
|
+
undo: () => {
|
|
189
|
+
t.isConnected && (t.innerHTML = e);
|
|
190
|
+
},
|
|
191
|
+
redo: () => {
|
|
192
|
+
t.isConnected && (t.innerHTML = o);
|
|
193
|
+
}
|
|
194
|
+
}), !0);
|
|
195
|
+
}, M = (t) => {
|
|
196
|
+
const e = v(t, "undo");
|
|
197
|
+
if (!e) return !1;
|
|
198
|
+
const n = C(e), o = n.undoStack.pop();
|
|
199
|
+
return o ? (o.undo(), n.redoStack.push(o), c = e, s(e), !0) : !1;
|
|
200
|
+
}, b = (t) => {
|
|
201
|
+
const e = v(t, "redo");
|
|
202
|
+
if (!e) return !1;
|
|
203
|
+
const n = C(e), o = n.redoStack.pop();
|
|
204
|
+
return o ? (o.redo(), n.undoStack.push(o), c = e, s(e), !0) : !1;
|
|
205
|
+
};
|
|
206
|
+
typeof window < "u" && (document.readyState === "loading" ? document.addEventListener("DOMContentLoaded", p, { once: !0 }) : p());
|
|
207
|
+
const F = () => (p(), {
|
|
208
|
+
name: "history",
|
|
209
|
+
toolbar: [
|
|
210
|
+
{
|
|
211
|
+
label: "Undo",
|
|
212
|
+
command: "undo",
|
|
213
|
+
type: "button",
|
|
214
|
+
icon: '<svg width="24" height="24" focusable="false"><path d="M6.4 8H12c3.7 0 6.2 2 6.8 5.1.6 2.7-.4 5.6-2.3 6.8a1 1 0 0 1-1-1.8c1.1-.6 1.8-2.7 1.4-4.6-.5-2.1-2.1-3.5-4.9-3.5H6.4l3.3 3.3a1 1 0 1 1-1.4 1.4l-5-5a1 1 0 0 1 0-1.4l5-5a1 1 0 0 1 1.4 1.4L6.4 8Z" fill-rule="nonzero"></path></svg>',
|
|
215
|
+
shortcut: "Mod-z"
|
|
216
|
+
},
|
|
217
|
+
{
|
|
218
|
+
label: "Redo",
|
|
219
|
+
command: "redo",
|
|
220
|
+
type: "button",
|
|
221
|
+
icon: '<svg width="24" height="24" focusable="false"><path d="M17.6 10H12c-2.8 0-4.4 1.4-4.9 3.5-.4 2 .3 4 1.4 4.6a1 1 0 1 1-1 1.8c-2-1.2-2.9-4.1-2.3-6.8.6-3 3-5.1 6.8-5.1h5.6l-3.3-3.3a1 1 0 1 1 1.4-1.4l5 5a1 1 0 0 1 0 1.4l-5 5a1 1 0 0 1-1.4-1.4l3.3-3.3Z" fill-rule="nonzero"></path></svg>',
|
|
222
|
+
shortcut: "Mod-y"
|
|
223
|
+
}
|
|
224
|
+
],
|
|
225
|
+
commands: {
|
|
226
|
+
undo: x,
|
|
227
|
+
redo: k,
|
|
228
|
+
setAttribute: O,
|
|
229
|
+
setText: D,
|
|
230
|
+
autoFixA11y: _,
|
|
231
|
+
recordDomTransaction: R,
|
|
232
|
+
undoDom: M,
|
|
233
|
+
redoDom: b
|
|
234
|
+
},
|
|
235
|
+
keymap: {
|
|
236
|
+
"Mod-z": "undo",
|
|
237
|
+
"Mod-Z": "undo",
|
|
238
|
+
"Mod-y": "redo",
|
|
239
|
+
"Mod-Y": "redo",
|
|
240
|
+
"Mod-Shift-z": "redo",
|
|
241
|
+
"Mod-Shift-Z": "redo"
|
|
242
|
+
}
|
|
243
|
+
});
|
|
244
|
+
export {
|
|
245
|
+
F as HistoryPlugin
|
|
246
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const m=40,s=e=>["P","DIV","H1","H2","H3","H4","H5","H6","LI","BLOCKQUOTE","PRE"].includes(e.tagName)&&e.getAttribute("contenteditable")!=="true",E=()=>{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){const o=t;if(o.getAttribute("contenteditable")==="true")return o}t=t.parentNode}}const n=document.activeElement;if(n){if(n.getAttribute("contenteditable")==="true")return n;const t=n.closest('[contenteditable="true"]');if(t)return t}return document.querySelector('[contenteditable="true"]')},l=e=>{let n=e;if(n.nodeType===Node.ELEMENT_NODE){const t=n;if(s(t))return t}for(;n;){if(n.nodeType===Node.ELEMENT_NODE){const t=n;if(s(t))return t;if(t.getAttribute("contenteditable")==="true")break}n=n.parentNode}return null},p=(e,n)=>{const t=[],o=new Set,c=r=>{!r||o.has(r)||n.contains(r)&&s(r)&&(o.add(r),t.push(r))};if(e.collapsed)return c(l(e.startContainer)),t;const i=document.createTreeWalker(n,NodeFilter.SHOW_ELEMENT,{acceptNode:r=>{const a=r;if(!s(a))return NodeFilter.FILTER_SKIP;if(typeof e.intersectsNode=="function")return e.intersectsNode(a)?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP;const u=document.createRange();return u.selectNodeContents(a),e.compareBoundaryPoints(Range.END_TO_START,u)>0&&e.compareBoundaryPoints(Range.START_TO_END,u)<0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});let d=i.nextNode();for(;d;)c(d),d=i.nextNode();return t.length===0&&c(l(e.commonAncestorContainer)),t},h=e=>{const n=window.getComputedStyle(e),t=n.paddingLeft;if(t.endsWith("px"))return parseFloat(t);if(t.endsWith("em")){const o=parseFloat(n.fontSize);return parseFloat(t)*o}return 0},T=(e,n)=>{if(n===e.innerHTML)return;const t=window.execEditorCommand||window.executeEditorCommand;if(typeof t=="function")try{t("recordDomTransaction",e,n,e.innerHTML)}catch{}},b=()=>{const e=E();if(!e)return!1;const n=window.getSelection();if(!n||n.rangeCount===0)return!1;const t=n.getRangeAt(0);if(!e.contains(t.commonAncestorContainer))return!1;const o=p(t,e);if(o.length===0)return!1;const c=e.innerHTML;return o.forEach(i=>{const r=h(i)+m;i.style.paddingLeft=`${r}px`}),T(e,c),e.dispatchEvent(new Event("input",{bubbles:!0})),!0},w=()=>{const e=E();if(!e)return!1;const n=window.getSelection();if(!n||n.rangeCount===0)return!1;const t=n.getRangeAt(0);if(!e.contains(t.commonAncestorContainer))return!1;const o=p(t,e);if(o.length===0)return!1;const c=e.innerHTML;return o.forEach(i=>{const d=h(i),r=Math.max(0,d-m);i.style.paddingLeft=`${r}px`}),T(e,c),e.dispatchEvent(new Event("input",{bubbles:!0})),!0},f=(e,n)=>{typeof window<"u"&&window.registerEditorCommand?.(e,n)},g=()=>{f("increaseIndent",b),f("decreaseIndent",w)};typeof window<"u"&&(document.readyState==="loading"?document.addEventListener("DOMContentLoaded",g):g());const v=()=>({name:"indent",toolbar:[{label:"Increase Indent",command:"increaseIndent",type:"button",icon:'<svg width="24" height="24" viewBox="0 0 24 24" fill="currentColor"><path d="M3 4h18v2H3V4zm0 14h18v2H3v-2zm8-7h10v2H11v-2zm0 4h10v2H11v-2zM3 8l4 4-4 4V8z"/></svg>',shortcut:"Mod-]"},{label:"Decrease Indent",command:"decreaseIndent",type:"button",icon:'<svg width="24" height="24" viewBox="0 0 24 24" fill="currentColor"><path d="M3 4h18v2H3V4zm0 14h18v2H3v-2zm8-7h10v2H11v-2zm0 4h10v2H11v-2zM7 8v8l-4-4 4-4z"/></svg>',shortcut:"Mod-["}],commands:{increaseIndent:b,decreaseIndent:w},keymap:{"Mod-]":"increaseIndent","Mod-[":"decreaseIndent",Tab:"increaseIndent","Shift-Tab":"decreaseIndent"}});exports.IndentPlugin=v;
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
const s = (e) => ["P", "DIV", "H1", "H2", "H3", "H4", "H5", "H6", "LI", "BLOCKQUOTE", "PRE"].includes(e.tagName) && e.getAttribute("contenteditable") !== "true", m = () => {
|
|
2
|
+
const e = window.getSelection();
|
|
3
|
+
if (e && e.rangeCount > 0) {
|
|
4
|
+
let t = e.getRangeAt(0).startContainer;
|
|
5
|
+
for (; t && t !== document.body; ) {
|
|
6
|
+
if (t.nodeType === Node.ELEMENT_NODE) {
|
|
7
|
+
const o = t;
|
|
8
|
+
if (o.getAttribute("contenteditable") === "true")
|
|
9
|
+
return o;
|
|
10
|
+
}
|
|
11
|
+
t = t.parentNode;
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
const n = document.activeElement;
|
|
15
|
+
if (n) {
|
|
16
|
+
if (n.getAttribute("contenteditable") === "true")
|
|
17
|
+
return n;
|
|
18
|
+
const t = n.closest('[contenteditable="true"]');
|
|
19
|
+
if (t) return t;
|
|
20
|
+
}
|
|
21
|
+
return document.querySelector('[contenteditable="true"]');
|
|
22
|
+
}, l = (e) => {
|
|
23
|
+
let n = e;
|
|
24
|
+
if (n.nodeType === Node.ELEMENT_NODE) {
|
|
25
|
+
const t = n;
|
|
26
|
+
if (s(t))
|
|
27
|
+
return t;
|
|
28
|
+
}
|
|
29
|
+
for (; n; ) {
|
|
30
|
+
if (n.nodeType === Node.ELEMENT_NODE) {
|
|
31
|
+
const t = n;
|
|
32
|
+
if (s(t))
|
|
33
|
+
return t;
|
|
34
|
+
if (t.getAttribute("contenteditable") === "true")
|
|
35
|
+
break;
|
|
36
|
+
}
|
|
37
|
+
n = n.parentNode;
|
|
38
|
+
}
|
|
39
|
+
return null;
|
|
40
|
+
}, E = (e, n) => {
|
|
41
|
+
const t = [], o = /* @__PURE__ */ new Set(), c = (r) => {
|
|
42
|
+
!r || o.has(r) || n.contains(r) && s(r) && (o.add(r), t.push(r));
|
|
43
|
+
};
|
|
44
|
+
if (e.collapsed)
|
|
45
|
+
return c(l(e.startContainer)), t;
|
|
46
|
+
const i = document.createTreeWalker(
|
|
47
|
+
n,
|
|
48
|
+
NodeFilter.SHOW_ELEMENT,
|
|
49
|
+
{
|
|
50
|
+
acceptNode: (r) => {
|
|
51
|
+
const a = r;
|
|
52
|
+
if (!s(a)) return NodeFilter.FILTER_SKIP;
|
|
53
|
+
if (typeof e.intersectsNode == "function")
|
|
54
|
+
return e.intersectsNode(a) ? NodeFilter.FILTER_ACCEPT : NodeFilter.FILTER_SKIP;
|
|
55
|
+
const u = document.createRange();
|
|
56
|
+
return u.selectNodeContents(a), e.compareBoundaryPoints(Range.END_TO_START, u) > 0 && e.compareBoundaryPoints(Range.START_TO_END, u) < 0 ? NodeFilter.FILTER_ACCEPT : NodeFilter.FILTER_SKIP;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
);
|
|
60
|
+
let d = i.nextNode();
|
|
61
|
+
for (; d; )
|
|
62
|
+
c(d), d = i.nextNode();
|
|
63
|
+
return t.length === 0 && c(l(e.commonAncestorContainer)), t;
|
|
64
|
+
}, T = (e) => {
|
|
65
|
+
const n = window.getComputedStyle(e), t = n.paddingLeft;
|
|
66
|
+
if (t.endsWith("px"))
|
|
67
|
+
return parseFloat(t);
|
|
68
|
+
if (t.endsWith("em")) {
|
|
69
|
+
const o = parseFloat(n.fontSize);
|
|
70
|
+
return parseFloat(t) * o;
|
|
71
|
+
}
|
|
72
|
+
return 0;
|
|
73
|
+
}, p = (e, n) => {
|
|
74
|
+
if (n === e.innerHTML) return;
|
|
75
|
+
const t = window.execEditorCommand || window.executeEditorCommand;
|
|
76
|
+
if (typeof t == "function")
|
|
77
|
+
try {
|
|
78
|
+
t("recordDomTransaction", e, n, e.innerHTML);
|
|
79
|
+
} catch {
|
|
80
|
+
}
|
|
81
|
+
}, h = () => {
|
|
82
|
+
const e = m();
|
|
83
|
+
if (!e) return !1;
|
|
84
|
+
const n = window.getSelection();
|
|
85
|
+
if (!n || n.rangeCount === 0) return !1;
|
|
86
|
+
const t = n.getRangeAt(0);
|
|
87
|
+
if (!e.contains(t.commonAncestorContainer)) return !1;
|
|
88
|
+
const o = E(t, e);
|
|
89
|
+
if (o.length === 0) return !1;
|
|
90
|
+
const c = e.innerHTML;
|
|
91
|
+
return o.forEach((i) => {
|
|
92
|
+
const r = T(i) + 40;
|
|
93
|
+
i.style.paddingLeft = `${r}px`;
|
|
94
|
+
}), p(e, c), e.dispatchEvent(new Event("input", { bubbles: !0 })), !0;
|
|
95
|
+
}, N = () => {
|
|
96
|
+
const e = m();
|
|
97
|
+
if (!e) return !1;
|
|
98
|
+
const n = window.getSelection();
|
|
99
|
+
if (!n || n.rangeCount === 0) return !1;
|
|
100
|
+
const t = n.getRangeAt(0);
|
|
101
|
+
if (!e.contains(t.commonAncestorContainer)) return !1;
|
|
102
|
+
const o = E(t, e);
|
|
103
|
+
if (o.length === 0) return !1;
|
|
104
|
+
const c = e.innerHTML;
|
|
105
|
+
return o.forEach((i) => {
|
|
106
|
+
const d = T(i), r = Math.max(0, d - 40);
|
|
107
|
+
i.style.paddingLeft = `${r}px`;
|
|
108
|
+
}), p(e, c), e.dispatchEvent(new Event("input", { bubbles: !0 })), !0;
|
|
109
|
+
}, f = (e, n) => {
|
|
110
|
+
typeof window < "u" && window.registerEditorCommand?.(e, n);
|
|
111
|
+
}, g = () => {
|
|
112
|
+
f("increaseIndent", h), f("decreaseIndent", N);
|
|
113
|
+
};
|
|
114
|
+
typeof window < "u" && (document.readyState === "loading" ? document.addEventListener("DOMContentLoaded", g) : g());
|
|
115
|
+
const b = () => ({
|
|
116
|
+
name: "indent",
|
|
117
|
+
toolbar: [
|
|
118
|
+
{
|
|
119
|
+
label: "Increase Indent",
|
|
120
|
+
command: "increaseIndent",
|
|
121
|
+
type: "button",
|
|
122
|
+
icon: '<svg width="24" height="24" viewBox="0 0 24 24" fill="currentColor"><path d="M3 4h18v2H3V4zm0 14h18v2H3v-2zm8-7h10v2H11v-2zm0 4h10v2H11v-2zM3 8l4 4-4 4V8z"/></svg>',
|
|
123
|
+
shortcut: "Mod-]"
|
|
124
|
+
},
|
|
125
|
+
{
|
|
126
|
+
label: "Decrease Indent",
|
|
127
|
+
command: "decreaseIndent",
|
|
128
|
+
type: "button",
|
|
129
|
+
icon: '<svg width="24" height="24" viewBox="0 0 24 24" fill="currentColor"><path d="M3 4h18v2H3V4zm0 14h18v2H3v-2zm8-7h10v2H11v-2zm0 4h10v2H11v-2zM7 8v8l-4-4 4-4z"/></svg>',
|
|
130
|
+
shortcut: "Mod-["
|
|
131
|
+
}
|
|
132
|
+
],
|
|
133
|
+
commands: {
|
|
134
|
+
increaseIndent: h,
|
|
135
|
+
decreaseIndent: N
|
|
136
|
+
},
|
|
137
|
+
keymap: {
|
|
138
|
+
"Mod-]": "increaseIndent",
|
|
139
|
+
"Mod-[": "decreaseIndent",
|
|
140
|
+
Tab: "increaseIndent",
|
|
141
|
+
"Shift-Tab": "decreaseIndent"
|
|
142
|
+
}
|
|
143
|
+
});
|
|
144
|
+
export {
|
|
145
|
+
b as IndentPlugin
|
|
146
|
+
};
|
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
import { getGlobalApiConfig as s, buildApiUrl as u, getGlobalApiHeaders as p } from "./shared-config.esm.js";
|
|
2
|
+
const f = () => ({
|
|
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 e = n?.closest('[contenteditable="true"]');
|
|
43
|
+
return e || document.querySelector('[contenteditable="true"]');
|
|
44
|
+
}, t = document.createElement("input");
|
|
45
|
+
return t.type = "file", t.accept = ".docx", t.onchange = async (o) => {
|
|
46
|
+
const n = o.target.files?.[0];
|
|
47
|
+
if (n)
|
|
48
|
+
try {
|
|
49
|
+
const e = r();
|
|
50
|
+
if (e) {
|
|
51
|
+
const { importFromWord: a } = await import("./documentManager-DRUc1-Cs.mjs").then((d) => d.d), i = await a(n);
|
|
52
|
+
e.innerHTML = i, e.dispatchEvent(new Event("input", { bubbles: !0 }));
|
|
53
|
+
}
|
|
54
|
+
} catch (e) {
|
|
55
|
+
console.error("Import failed:", e), alert("Failed to import Word document. Please check the console for details.");
|
|
56
|
+
}
|
|
57
|
+
}, t.click(), !0;
|
|
58
|
+
},
|
|
59
|
+
exportWord: async () => {
|
|
60
|
+
const r = () => {
|
|
61
|
+
const t = window.getSelection();
|
|
62
|
+
if (t && t.rangeCount > 0) {
|
|
63
|
+
let e = t.getRangeAt(0).startContainer;
|
|
64
|
+
for (; e && e !== document.body; ) {
|
|
65
|
+
if (e.nodeType === Node.ELEMENT_NODE && e.getAttribute("contenteditable") === "true")
|
|
66
|
+
return e;
|
|
67
|
+
e = e.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 t = r();
|
|
75
|
+
if (t) {
|
|
76
|
+
const o = t.innerHTML, { exportToWord: n } = await import("./documentManager-DRUc1-Cs.mjs").then((e) => e.d);
|
|
77
|
+
await n(o, "document.docx");
|
|
78
|
+
}
|
|
79
|
+
return !0;
|
|
80
|
+
} catch (t) {
|
|
81
|
+
return console.error("Export failed:", t), alert("Failed to export to Word. Please check the console for details."), !1;
|
|
82
|
+
}
|
|
83
|
+
},
|
|
84
|
+
exportPdf: async () => {
|
|
85
|
+
const r = () => {
|
|
86
|
+
const t = window.getSelection();
|
|
87
|
+
if (t && t.rangeCount > 0) {
|
|
88
|
+
let e = t.getRangeAt(0).startContainer;
|
|
89
|
+
for (; e && e !== document.body; ) {
|
|
90
|
+
if (e.nodeType === Node.ELEMENT_NODE && e.getAttribute("contenteditable") === "true")
|
|
91
|
+
return e;
|
|
92
|
+
e = e.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 t = r();
|
|
100
|
+
if (t) {
|
|
101
|
+
const o = t.innerHTML, { exportToPdf: n } = await import("./documentManager-DRUc1-Cs.mjs").then((e) => e.d);
|
|
102
|
+
await n(o, "document.pdf", t);
|
|
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 (t) {
|
|
107
|
+
return console.error("PDF Export: Export failed:", t), alert("Failed to export to PDF. Please check the console for details."), !1;
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
},
|
|
111
|
+
keymap: {}
|
|
112
|
+
}), h = {
|
|
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 = { ...h };
|
|
125
|
+
function v(r) {
|
|
126
|
+
l = { ...l, ...r };
|
|
127
|
+
}
|
|
128
|
+
function c() {
|
|
129
|
+
return { ...l };
|
|
130
|
+
}
|
|
131
|
+
function g(r) {
|
|
132
|
+
const t = c(), o = s(), n = t.apiUrl || o.apiUrl;
|
|
133
|
+
return u(n, t.apiEndpoints[r]);
|
|
134
|
+
}
|
|
135
|
+
function b() {
|
|
136
|
+
const r = p(), o = c().headers || {};
|
|
137
|
+
return { ...r, ...o };
|
|
138
|
+
}
|
|
139
|
+
export {
|
|
140
|
+
f as D,
|
|
141
|
+
g as a,
|
|
142
|
+
b,
|
|
143
|
+
c as g,
|
|
144
|
+
v as s
|
|
145
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const l=require("./shared-config.cjs.js"),s=()=>({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 a=i;if(a.getAttribute("contenteditable")==="true")return a}i=i.parentNode}}const n=document.activeElement;if(n?.getAttribute("contenteditable")==="true")return n;const e=n?.closest('[contenteditable="true"]');return e||document.querySelector('[contenteditable="true"]')},t=document.createElement("input");return t.type="file",t.accept=".docx",t.onchange=async o=>{const n=o.target.files?.[0];if(n)try{const e=r();if(e){const{importFromWord:i}=await Promise.resolve().then(()=>require("./documentManager-_tQQfQi9.js")).then(u=>u.documentManager),a=await i(n);e.innerHTML=a,e.dispatchEvent(new Event("input",{bubbles:!0}))}}catch(e){console.error("Import failed:",e),alert("Failed to import Word document. Please check the console for details.")}},t.click(),!0},exportWord:async()=>{const r=()=>{const t=window.getSelection();if(t&&t.rangeCount>0){let e=t.getRangeAt(0).startContainer;for(;e&&e!==document.body;){if(e.nodeType===Node.ELEMENT_NODE&&e.getAttribute("contenteditable")==="true")return e;e=e.parentNode}}const o=document.activeElement;return o?.getAttribute("contenteditable")==="true"?o:o?.closest('[contenteditable="true"]')||document.querySelector('[contenteditable="true"]')};try{const t=r();if(t){const o=t.innerHTML,{exportToWord:n}=await Promise.resolve().then(()=>require("./documentManager-_tQQfQi9.js")).then(e=>e.documentManager);await n(o,"document.docx")}return!0}catch(t){return console.error("Export failed:",t),alert("Failed to export to Word. Please check the console for details."),!1}},exportPdf:async()=>{const r=()=>{const t=window.getSelection();if(t&&t.rangeCount>0){let e=t.getRangeAt(0).startContainer;for(;e&&e!==document.body;){if(e.nodeType===Node.ELEMENT_NODE&&e.getAttribute("contenteditable")==="true")return e;e=e.parentNode}}const o=document.activeElement;return o?.getAttribute("contenteditable")==="true"?o:o?.closest('[contenteditable="true"]')||document.querySelector('[contenteditable="true"]')};try{const t=r();if(t){const o=t.innerHTML,{exportToPdf:n}=await Promise.resolve().then(()=>require("./documentManager-_tQQfQi9.js")).then(e=>e.documentManager);await n(o,"document.pdf",t)}else console.error("PDF Export: No editor element found"),alert("No active editor found. Please click in the editor area first.");return!0}catch(t){return console.error("PDF Export: Export failed:",t),alert("Failed to export to PDF. Please check the console for details."),!1}}},keymap:{}}),p={apiEndpoints:{exportWord:"/documents/export-word"},headers:{},useClientSideFallback:!0};let c={...p};function h(r){c={...c,...r}}function d(){return{...c}}function g(r){const t=d(),o=l.getGlobalApiConfig(),n=t.apiUrl||o.apiUrl;return l.buildApiUrl(n,t.apiEndpoints[r])}function m(){const r=l.getGlobalApiHeaders(),o=d().headers||{};return{...r,...o}}exports.DocumentManagerPlugin=s;exports.getApiHeaders=m;exports.getApiUrl=g;exports.getDocumentManagerConfig=d;exports.setDocumentManagerConfig=h;
|
package/dist/index.cjs.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("./index-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("./heading.cjs.js"),l=require("./bold.cjs.js"),t=require("./italic.cjs.js"),u=require("./underline.cjs.js"),g=require("./strikethrough.cjs.js"),o=require("./list.cjs.js"),a=require("./checklist.cjs.js"),c=require("./history.cjs.js"),P=require("./link.cjs.js"),s=require("./blockquote.cjs.js"),q=require("./clear-formatting.cjs.js"),m=require("./code.cjs.js"),d=require("./table.cjs.js"),C=require("./font-size.cjs.js"),h=require("./font-family.cjs.js"),p=require("./text-alignment.cjs.js"),M=require("./text-color.cjs.js"),k=require("./background-color.cjs.js"),f=require("./line-height.cjs.js"),b=require("./indent.cjs.js"),A=require("./direction.cjs.js"),F=require("./capitalization.cjs.js"),S=require("./math.cjs.js"),T=require("./special-characters.cjs.js"),y=require("./emojis.cjs.js"),B=require("./embed-iframe.cjs.js"),H=require("./anchor.cjs.js"),i=require("./media-manager.cjs.js"),n=require("./index-D3pJyAsj.js"),D=require("./preview.cjs.js"),I=require("./fullscreen.cjs.js"),x=require("./print.cjs.js"),z=require("./page-break.cjs.js"),G=require("./footnote.cjs.js"),L=require("./code-sample.cjs.js"),j=require("./merge-tag.cjs.js"),v=require("./template.cjs.js"),E=require("./comments.cjs.js"),U=require("./spell-check.cjs.js"),w=require("./a11y-checker.cjs.js"),e=require("./shared-config.cjs.js");exports.HeadingPlugin=r.HeadingPlugin;exports.BoldPlugin=l.BoldPlugin;exports.ItalicPlugin=t.ItalicPlugin;exports.UnderlinePlugin=u.UnderlinePlugin;exports.StrikethroughPlugin=g.StrikethroughPlugin;exports.ListPlugin=o.ListPlugin;exports.ChecklistPlugin=a.ChecklistPlugin;exports.HistoryPlugin=c.HistoryPlugin;exports.LinkPlugin=P.LinkPlugin;exports.BlockquotePlugin=s.BlockquotePlugin;exports.ClearFormattingPlugin=q.ClearFormattingPlugin;exports.CodePlugin=m.CodePlugin;exports.TablePlugin=d.TablePlugin;exports.FontSizePlugin=C.FontSizePlugin;exports.FontFamilyPlugin=h.FontFamilyPlugin;exports.TextAlignmentPlugin=p.TextAlignmentPlugin;exports.TextColorPlugin=M.TextColorPlugin;exports.BackgroundColorPlugin=k.BackgroundColorPlugin;exports.LineHeightPlugin=f.LineHeightPlugin;exports.IndentPlugin=b.IndentPlugin;exports.DirectionPlugin=A.DirectionPlugin;exports.CapitalizationPlugin=F.CapitalizationPlugin;exports.MathPlugin=S.MathPlugin;exports.SpecialCharactersPlugin=T.SpecialCharactersPlugin;exports.EmojisPlugin=y.EmojisPlugin;exports.EmbedIframePlugin=B.EmbedIframePlugin;exports.AnchorPlugin=H.AnchorPlugin;exports.MediaManagerPlugin=i.MediaManagerPlugin;exports.getMediaManagerConfig=i.getMediaManagerConfig;exports.setMediaManagerConfig=i.setMediaManagerConfig;exports.DocumentManagerPlugin=n.DocumentManagerPlugin;exports.getDocumentManagerConfig=n.getDocumentManagerConfig;exports.setDocumentManagerConfig=n.setDocumentManagerConfig;exports.PreviewPlugin=D.PreviewPlugin;exports.FullscreenPlugin=I.FullscreenPlugin;exports.PrintPlugin=x.PrintPlugin;exports.PageBreakPlugin=z.PageBreakPlugin;exports.FootnotePlugin=G.FootnotePlugin;exports.CodeSamplePlugin=L.CodeSamplePlugin;exports.MergeTagPlugin=j.MergeTagPlugin;exports.TemplatePlugin=v.TemplatePlugin;exports.CommentsPlugin=E.CommentsPlugin;exports.SpellCheckPlugin=U.SpellCheckPlugin;exports.A11yCheckerPlugin=w.A11yCheckerPlugin;exports.buildApiUrl=e.buildApiUrl;exports.getGlobalApiConfig=e.getGlobalApiConfig;exports.getGlobalApiHeaders=e.getGlobalApiHeaders;exports.setGlobalApiConfig=e.setGlobalApiConfig;
|