@harbour-enterprises/superdoc 0.11.31 → 0.11.33
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/chunks/{eventemitter3-CRfwKE7Z.es.js → eventemitter3-C9iBZY5R.es.js} +1 -1
- package/dist/chunks/{eventemitter3-D38HWRLP.cjs → eventemitter3-Cj9ZwxFw.cjs} +1 -1
- package/dist/chunks/{index-BXKGjuVW.cjs → index-71EH9929.cjs} +1 -1
- package/dist/chunks/{index-CqRwYOdx.cjs → index-DJ2cGnRl.cjs} +1 -1
- package/dist/chunks/{index-Y7BlAr93.es.js → index-DRzufgTV.es.js} +4 -4
- package/dist/chunks/{index-CPZ-IxHT.es.js → index-kAA2CRkl.es.js} +2 -2
- package/dist/chunks/{jszip-ChlzEvf9.cjs → jszip-D9YbjC4E.cjs} +1 -1
- package/dist/chunks/{jszip-DO3il9iI.es.js → jszip-OpmRHhd4.es.js} +1 -1
- package/dist/chunks/{super-editor.es-D8XdnWMu.es.js → super-editor.es-DUU_CN2L.es.js} +7470 -6973
- package/dist/chunks/super-editor.es-YK41JJFh.cjs +452 -0
- package/dist/chunks/{url-t15h9onH.es.js → url-BcsmChMq.es.js} +2 -2
- package/dist/chunks/{url-6Xu7gR4T.cjs → url-CHPOWQEe.cjs} +1 -1
- package/dist/chunks/vue-BQCc2YbW.cjs +13 -0
- package/dist/chunks/{vue-DXpzqXur.es.js → vue-DKS68Dra.es.js} +1159 -1140
- package/dist/chunks/{xml-js-kwrvzyhm.es.js → xml-js-CiXFCQBs.es.js} +367 -356
- package/dist/chunks/xml-js-jS9zLULc.cjs +10 -0
- package/dist/style.css +1 -1
- package/dist/super-editor/ai-writer.es.js +208 -121
- package/dist/super-editor/chunks/{converter-hZK1xKPW.js → converter-0l3CSdnn.js} +667 -637
- package/dist/super-editor/chunks/{docx-zipper-DMEmQVkt.js → docx-zipper-B-BWHBdZ.js} +1 -1
- package/dist/super-editor/chunks/{editor-GtdcYA5D.js → editor-CgA3W09D.js} +4080 -3857
- package/dist/super-editor/chunks/{toolbar-Bk4txCKp.js → toolbar-Dk5ck8s2.js} +2 -2
- package/dist/super-editor/components/toolbar/ai-helpers.d.ts +12 -0
- package/dist/super-editor/components/toolbar/ai-helpers.d.ts.map +1 -1
- package/dist/super-editor/components/toolbar/super-toolbar.d.ts +454 -83
- package/dist/super-editor/components/toolbar/super-toolbar.d.ts.map +1 -1
- package/dist/super-editor/converter.es.js +1 -1
- package/dist/super-editor/core/Editor.d.ts +470 -45
- package/dist/super-editor/core/Editor.d.ts.map +1 -1
- package/dist/super-editor/core/super-converter/exporter.d.ts.map +1 -1
- package/dist/super-editor/docx-zipper.es.js +2 -2
- package/dist/super-editor/editor.es.js +3 -3
- package/dist/super-editor/file-zipper.es.js +1 -1
- package/dist/super-editor/style.css +1 -1
- package/dist/super-editor/super-editor.es.js +287 -89
- package/dist/super-editor/toolbar.es.js +2 -2
- package/dist/super-editor.cjs +1 -1
- package/dist/super-editor.es.js +4 -4
- package/dist/superdoc.cjs +5 -5
- package/dist/superdoc.es.js +9 -9
- package/dist/superdoc.umd.js +6543 -6008
- package/dist/superdoc.umd.js.map +1 -1
- package/package.json +1 -1
- package/dist/chunks/super-editor.es-DkAuD0cl.cjs +0 -452
- package/dist/chunks/vue-Ckf0DkDN.cjs +0 -13
- package/dist/chunks/xml-js-zhwNEV5e.cjs +0 -10
|
@@ -6,14 +6,14 @@ var bt = (t, a, o) => a in t ? yt(t, a, { enumerable: !0, configurable: !0, writ
|
|
|
6
6
|
var Re = (t, a, o) => bt(t, typeof a != "symbol" ? a + "" : a, o), qe = (t, a, o) => a.has(t) || Ue("Cannot " + o);
|
|
7
7
|
var Ae = (t, a, o) => (qe(t, a, "read from private field"), o ? o.call(t) : a.get(t)), Oe = (t, a, o) => a.has(t) ? Ue("Cannot add the same private member more than once") : a instanceof WeakSet ? a.add(t) : a.set(t, o);
|
|
8
8
|
var z = (t, a, o) => (qe(t, a, "access private method"), o);
|
|
9
|
-
import { _ as q, a as Ze, b as wt, I as Ne, f as Ct, c as Ge, d as kt, i as _t, u as xt, r as
|
|
10
|
-
import { C as No, T as zo, l as Vo, n as Wo, k as Po, m as jo } from "./chunks/editor-
|
|
11
|
-
import { a1 as Dt, y as $t, a3 as Ht, T as Ye, a as Bt } from "./chunks/converter-
|
|
12
|
-
import { O as qo } from "./chunks/converter-
|
|
9
|
+
import { _ as q, a as Ze, b as wt, I as Ne, f as Ct, c as Ge, d as kt, i as _t, u as xt, r as St, E as ze, e as Et, P as At, h as Tt, M as Ft, j as It, A as Lt, N as Mt } from "./chunks/editor-CgA3W09D.js";
|
|
10
|
+
import { C as No, T as zo, l as Vo, n as Wo, k as Po, m as jo } from "./chunks/editor-CgA3W09D.js";
|
|
11
|
+
import { a1 as Dt, y as $t, a3 as Ht, T as Ye, a as Bt } from "./chunks/converter-0l3CSdnn.js";
|
|
12
|
+
import { O as qo } from "./chunks/converter-0l3CSdnn.js";
|
|
13
13
|
import { ref as f, createElementBlock as C, openBlock as w, createElementVNode as k, unref as D, getCurrentInstance as Rt, computed as j, watch as Ot, onMounted as ke, createCommentVNode as Q, withDirectives as Je, withKeys as Qe, normalizeClass as oe, withModifiers as ge, vModelText as et, createTextVNode as tt, toDisplayString as ie, Fragment as U, renderList as ee, normalizeStyle as J, createVNode as P, h as B, createApp as Nt, reactive as Ke, onUnmounted as zt, shallowRef as nt, onBeforeUnmount as ot, createBlock as Vt } from "vue";
|
|
14
|
-
import { t as X, s as Wt, T as Pt, N as Y } from "./chunks/toolbar-
|
|
14
|
+
import { t as X, s as Wt, T as Pt, N as Y } from "./chunks/toolbar-Dk5ck8s2.js";
|
|
15
15
|
import jt from "./ai-writer.es.js";
|
|
16
|
-
import { D as Ko } from "./chunks/docx-zipper-
|
|
16
|
+
import { D as Ko } from "./chunks/docx-zipper-B-BWHBdZ.js";
|
|
17
17
|
import { createZip as Zo } from "./file-zipper.es.js";
|
|
18
18
|
var it = { exports: {} };
|
|
19
19
|
(function(t) {
|
|
@@ -53,9 +53,9 @@ var it = { exports: {} };
|
|
|
53
53
|
var d = o ? o + c : c, u = this._events[d];
|
|
54
54
|
return u ? u.fn ? 1 : u.length : 0;
|
|
55
55
|
}, l.prototype.emit = function(c, d, u, b, v, y) {
|
|
56
|
-
var
|
|
57
|
-
if (!this._events[
|
|
58
|
-
var g = this._events[
|
|
56
|
+
var S = o ? o + c : c;
|
|
57
|
+
if (!this._events[S]) return !1;
|
|
58
|
+
var g = this._events[S], F = arguments.length, $, p;
|
|
59
59
|
if (g.fn) {
|
|
60
60
|
switch (g.once && this.removeListener(c, g.fn, void 0, !0), F) {
|
|
61
61
|
case 1:
|
|
@@ -110,8 +110,8 @@ var it = { exports: {} };
|
|
|
110
110
|
if (y.fn)
|
|
111
111
|
y.fn === d && (!b || y.once) && (!u || y.context === u) && r(this, v);
|
|
112
112
|
else {
|
|
113
|
-
for (var
|
|
114
|
-
(y[
|
|
113
|
+
for (var S = 0, g = [], F = y.length; S < F; S++)
|
|
114
|
+
(y[S].fn !== d || b && !y[S].once || u && y[S].context !== u) && g.push(y[S]);
|
|
115
115
|
g.length ? this._events[v] = g.length === 1 ? g[0] : g : r(this, v);
|
|
116
116
|
}
|
|
117
117
|
return this;
|
|
@@ -147,10 +147,10 @@ const x = (t) => {
|
|
|
147
147
|
throw new Error("Toolbar button item needs either icon or label - " + t.name);
|
|
148
148
|
if (!t.name)
|
|
149
149
|
throw new Error("Invalid toolbar item name - " + t.name);
|
|
150
|
-
const o = f($t()), n = t.type, e = f(t.name), i = t.command, r = t.noArgumentCommand, l = f(t.icon), s = f(t.group || "center"), c = f(t.allowWithoutEditor), d = f(t.attributes || {}), u = t.disabled || !1, b = f(t.disabled), v = f(!1), y = f(!1),
|
|
150
|
+
const o = f($t()), n = t.type, e = f(t.name), i = t.command, r = t.noArgumentCommand, l = f(t.icon), s = f(t.group || "center"), c = f(t.allowWithoutEditor), d = f(t.attributes || {}), u = t.disabled || !1, b = f(t.disabled), v = f(!1), y = f(!1), S = f(t.style), g = f(t.isNarrow), F = f(t.isWide), $ = f(t.minWidth), p = f(t.suppressActiveHighlight || !1), _ = f(t.argument), T = f(null), N = f(null), V = f(t.iconColor), te = f(t.hasCaret), ye = f(t.dropdownStyles), Z = f(t.tooltip), re = f(t.tooltipVisible), be = f(t.tooltipTimeout), I = f(t.defaultLabel), M = f(t.label), H = f(t.hideLabel), R = f(t.inlineTextInputVisible), G = f(t.hasInlineTextInput), K = f(t.markName), ce = f(t.labelAttr), ue = f(t.selectedValue), _e = f(t.dropdownValueKey), xe = f(t.inputRef || null), Se = f([]);
|
|
151
151
|
if (t.options) {
|
|
152
152
|
if (!Array.isArray(t.options)) throw new Error("Invalid toolbar item options - " + t.options);
|
|
153
|
-
|
|
153
|
+
Se.value.push(...t.options);
|
|
154
154
|
}
|
|
155
155
|
const Fe = (se) => {
|
|
156
156
|
we(se), !p.value && (v.value = !0);
|
|
@@ -178,8 +178,8 @@ const x = (t) => {
|
|
|
178
178
|
disabled: b,
|
|
179
179
|
active: v,
|
|
180
180
|
expand: y,
|
|
181
|
-
nestedOptions:
|
|
182
|
-
style:
|
|
181
|
+
nestedOptions: Se,
|
|
182
|
+
style: S,
|
|
183
183
|
isNarrow: g,
|
|
184
184
|
isWide: F,
|
|
185
185
|
minWidth: $,
|
|
@@ -296,7 +296,7 @@ const x = (t) => {
|
|
|
296
296
|
}, l = f(!1), s = f(n.initialText), c = f(n.href), d = j(() => c.value?.startsWith("http") ? c.value : "http://" + c.value), u = j(() => {
|
|
297
297
|
const p = d.value.split(".").filter(Boolean);
|
|
298
298
|
return d.value.includes(".") && p.length > 1;
|
|
299
|
-
}), b = j(() => y.value ? "Apply" : "Remove"), v = j(() => !u.value), y = j(() => !
|
|
299
|
+
}), b = j(() => y.value ? "Apply" : "Remove"), v = j(() => !u.value), y = j(() => !S.value), S = j(() => n.href && !c.value), g = j(() => n.href.startsWith("#")), F = () => {
|
|
300
300
|
window.open(d.value, "_blank");
|
|
301
301
|
};
|
|
302
302
|
Ot(
|
|
@@ -392,7 +392,7 @@ const x = (t) => {
|
|
|
392
392
|
], 10, yn))), 256))
|
|
393
393
|
]));
|
|
394
394
|
}
|
|
395
|
-
},
|
|
395
|
+
}, Sn = /* @__PURE__ */ q(xn, [["__scopeId", "data-v-f86e1477"]]), En = {
|
|
396
396
|
key: 0,
|
|
397
397
|
class: "linked-style-buttons"
|
|
398
398
|
}, An = ["onClick"], Tn = {
|
|
@@ -408,7 +408,7 @@ const x = (t) => {
|
|
|
408
408
|
const o = a, n = t, e = (i) => {
|
|
409
409
|
o("select", i);
|
|
410
410
|
};
|
|
411
|
-
return (i, r) => n.editor ? (w(), C("div",
|
|
411
|
+
return (i, r) => n.editor ? (w(), C("div", En, [
|
|
412
412
|
(w(!0), C(U, null, ee(D(Ze)(t.editor), (l) => (w(), C("div", {
|
|
413
413
|
class: "style-item",
|
|
414
414
|
onClick: (s) => e(l)
|
|
@@ -603,7 +603,7 @@ const x = (t) => {
|
|
|
603
603
|
h("#6CA0DC"),
|
|
604
604
|
h("#9DBFE8"),
|
|
605
605
|
h("#CEDFF3"),
|
|
606
|
-
h("#
|
|
606
|
+
h("#21c8ce")
|
|
607
607
|
],
|
|
608
608
|
[
|
|
609
609
|
h("#3E027A"),
|
|
@@ -625,8 +625,8 @@ const x = (t) => {
|
|
|
625
625
|
let u = [...s.parentElement.querySelectorAll("[data-item]")], b = parseInt(s.dataset.cols, 10), v = parseInt(s.dataset.rows, 10);
|
|
626
626
|
e.value = b, n.value = v;
|
|
627
627
|
for (let y = 0; y < u.length; y++) {
|
|
628
|
-
let
|
|
629
|
-
g <= b && F <= v ?
|
|
628
|
+
let S = u[y], g = parseInt(S.dataset.cols, 10), F = parseInt(S.dataset.rows, 10);
|
|
629
|
+
g <= b && F <= v ? S.classList.add("selected") : S.classList.remove("selected");
|
|
630
630
|
}
|
|
631
631
|
}, r = ({ cols: l, rows: s }) => {
|
|
632
632
|
o("select", { cols: l, rows: s });
|
|
@@ -848,8 +848,8 @@ const x = (t) => {
|
|
|
848
848
|
],
|
|
849
849
|
onActivate: ({ fontSize: m }) => {
|
|
850
850
|
if (!m) return s.label.value = s.defaultLabel.value;
|
|
851
|
-
let
|
|
852
|
-
|
|
851
|
+
let E = Wt(m, 12);
|
|
852
|
+
E < 8 && (E = 8), E > 96 && (E = 96), s.label.value = String(E);
|
|
853
853
|
},
|
|
854
854
|
onDeactivate: () => s.label.value = s.defaultLabel.value
|
|
855
855
|
}), c = x({
|
|
@@ -911,7 +911,7 @@ const x = (t) => {
|
|
|
911
911
|
v.iconColor.value = m;
|
|
912
912
|
},
|
|
913
913
|
onDeactivate: () => v.iconColor.value = "#000"
|
|
914
|
-
}), y = f(null),
|
|
914
|
+
}), y = f(null), S = x({
|
|
915
915
|
type: "dropdown",
|
|
916
916
|
name: "search",
|
|
917
917
|
icon: e.search,
|
|
@@ -927,8 +927,8 @@ const x = (t) => {
|
|
|
927
927
|
]
|
|
928
928
|
}), g = () => B("div", {}, [
|
|
929
929
|
B(so, {
|
|
930
|
-
onSubmit: ({ value:
|
|
931
|
-
t.activeEditor.commands.search(
|
|
930
|
+
onSubmit: ({ value: E }) => {
|
|
931
|
+
t.activeEditor.commands.search(E);
|
|
932
932
|
},
|
|
933
933
|
searchRef: y
|
|
934
934
|
})
|
|
@@ -1083,9 +1083,9 @@ const x = (t) => {
|
|
|
1083
1083
|
function ye(m) {
|
|
1084
1084
|
return B(Qn, {
|
|
1085
1085
|
options: te,
|
|
1086
|
-
onSelect: (
|
|
1086
|
+
onSelect: (E) => {
|
|
1087
1087
|
ae(m);
|
|
1088
|
-
const { command: A } =
|
|
1088
|
+
const { command: A } = E;
|
|
1089
1089
|
t.emitCommand({ item: m, argument: { command: A } });
|
|
1090
1090
|
}
|
|
1091
1091
|
});
|
|
@@ -1105,10 +1105,10 @@ const x = (t) => {
|
|
|
1105
1105
|
type: "render",
|
|
1106
1106
|
render: () => B("div", {}, [
|
|
1107
1107
|
B(tn, {
|
|
1108
|
-
onSelect: (
|
|
1108
|
+
onSelect: (E) => {
|
|
1109
1109
|
ae(Z);
|
|
1110
1110
|
const A = { ...Z, command: "setTextAlign" };
|
|
1111
|
-
A.command = "setTextAlign", t.emitCommand({ item: A, argument:
|
|
1111
|
+
A.command = "setTextAlign", t.emitCommand({ item: A, argument: E }), re(Z, E);
|
|
1112
1112
|
}
|
|
1113
1113
|
})
|
|
1114
1114
|
]),
|
|
@@ -1121,8 +1121,8 @@ const x = (t) => {
|
|
|
1121
1121
|
onDeactivate: () => {
|
|
1122
1122
|
re(Z, "left");
|
|
1123
1123
|
}
|
|
1124
|
-
}), re = (m,
|
|
1125
|
-
let A =
|
|
1124
|
+
}), re = (m, E) => {
|
|
1125
|
+
let A = E === "both" ? "justify" : E, W = {
|
|
1126
1126
|
left: e.alignLeft,
|
|
1127
1127
|
right: e.alignRight,
|
|
1128
1128
|
center: e.alignCenter,
|
|
@@ -1231,7 +1231,7 @@ const x = (t) => {
|
|
|
1231
1231
|
command: "rejectTrackedChangeOnSelection",
|
|
1232
1232
|
icon: e.trackChangesReject,
|
|
1233
1233
|
group: "left"
|
|
1234
|
-
}),
|
|
1234
|
+
}), Se = x({
|
|
1235
1235
|
type: "button",
|
|
1236
1236
|
disabled: !1,
|
|
1237
1237
|
name: "toggleTrackChangesShowOriginal",
|
|
@@ -1260,7 +1260,7 @@ const x = (t) => {
|
|
|
1260
1260
|
u,
|
|
1261
1261
|
H,
|
|
1262
1262
|
M,
|
|
1263
|
-
|
|
1263
|
+
S,
|
|
1264
1264
|
R
|
|
1265
1265
|
].map((m) => m.name);
|
|
1266
1266
|
const Le = x({
|
|
@@ -1269,7 +1269,7 @@ const x = (t) => {
|
|
|
1269
1269
|
tooltip: "Format painter",
|
|
1270
1270
|
icon: e.copyFormat,
|
|
1271
1271
|
command: "copyFormat"
|
|
1272
|
-
}), Me = (m,
|
|
1272
|
+
}), Me = (m, E) => m === "editor" ? E : m === "suggester" ? E.filter((A) => A.value === "suggesting") : E.filter((A) => A.value === "viewing"), we = (m) => m === "editor" ? "Editing" : m === "suggester" ? "Suggesting" : "Viewing", ne = x({
|
|
1273
1273
|
type: "dropdown",
|
|
1274
1274
|
name: "documentMode",
|
|
1275
1275
|
command: "setDocumentMode",
|
|
@@ -1315,9 +1315,9 @@ const x = (t) => {
|
|
|
1315
1315
|
}
|
|
1316
1316
|
];
|
|
1317
1317
|
function me(m) {
|
|
1318
|
-
const
|
|
1319
|
-
return B(
|
|
1320
|
-
options:
|
|
1318
|
+
const E = Me(n, De);
|
|
1319
|
+
return B(Sn, {
|
|
1320
|
+
options: E,
|
|
1321
1321
|
onSelect: (A) => {
|
|
1322
1322
|
ae(m);
|
|
1323
1323
|
const { label: W, icon: le } = A;
|
|
@@ -1367,10 +1367,10 @@ const x = (t) => {
|
|
|
1367
1367
|
type: "render",
|
|
1368
1368
|
key: "linkedStyle",
|
|
1369
1369
|
render: () => {
|
|
1370
|
-
const m = (
|
|
1370
|
+
const m = (E) => {
|
|
1371
1371
|
ae(Ce);
|
|
1372
1372
|
const A = { ...Ce, command: "setLinkedStyle" };
|
|
1373
|
-
t.emitCommand({ item: A, argument:
|
|
1373
|
+
t.emitCommand({ item: A, argument: E });
|
|
1374
1374
|
};
|
|
1375
1375
|
return B("div", {}, [
|
|
1376
1376
|
B(Fn, {
|
|
@@ -1387,8 +1387,8 @@ const x = (t) => {
|
|
|
1387
1387
|
onDeactivate: () => {
|
|
1388
1388
|
Ce.disabled.value = !0;
|
|
1389
1389
|
}
|
|
1390
|
-
}), he = (m,
|
|
1391
|
-
if (
|
|
1390
|
+
}), he = (m, E) => {
|
|
1391
|
+
if (E.value.toString() === m)
|
|
1392
1392
|
return B("div", { innerHTML: eo, class: "dropdown-select-icon" });
|
|
1393
1393
|
}, de = x({
|
|
1394
1394
|
type: "dropdown",
|
|
@@ -1461,34 +1461,34 @@ const x = (t) => {
|
|
|
1461
1461
|
if (t.config?.superdoc?.config?.modules?.ai || (O = O.filter((m) => m.name.value !== "ai")), o <= $e.md && (O = O.filter((m) => m.type !== "separator")), t.config.pagination || (O = O.filter((m) => m.name.value !== "pageBreakTool")), t.config.mode !== "docx") {
|
|
1462
1462
|
const m = O.findIndex((A) => A.name.value === "linkedStyles");
|
|
1463
1463
|
O.splice(m - 1, 2);
|
|
1464
|
-
const
|
|
1465
|
-
O = O.filter((A) => !
|
|
1464
|
+
const E = ["ruler", "zoom", "undo", "redo"];
|
|
1465
|
+
O = O.filter((A) => !E.includes(A.name.value));
|
|
1466
1466
|
}
|
|
1467
|
-
const je = [ue,
|
|
1467
|
+
const je = [ue, Se, Fe];
|
|
1468
1468
|
a || (n === "viewer" && je.push(_e, xe), O = O.filter((m) => !je.includes(m)));
|
|
1469
|
-
const ft = [
|
|
1469
|
+
const ft = [S, K, R, ne].map((m) => m.name), vt = (m) => ft.includes(m.name), Ee = [], He = [];
|
|
1470
1470
|
let Be = mt + ut;
|
|
1471
1471
|
return O.forEach((m) => {
|
|
1472
|
-
const
|
|
1472
|
+
const E = pe.get(m.name.value) || pe.get("default");
|
|
1473
1473
|
if (o < $e.xl && pt.includes(m.name.value)) {
|
|
1474
|
-
if (
|
|
1474
|
+
if (Ee.push(m), m.name.value === "linkedStyles") {
|
|
1475
1475
|
const A = O.findIndex((W) => W.name.value === "linkedStyles");
|
|
1476
1476
|
O.splice(A + 1, 1);
|
|
1477
1477
|
}
|
|
1478
1478
|
return;
|
|
1479
1479
|
}
|
|
1480
1480
|
if (o < $e.sm && ht.includes(m.name.value)) {
|
|
1481
|
-
|
|
1481
|
+
Ee.push(m);
|
|
1482
1482
|
return;
|
|
1483
1483
|
}
|
|
1484
1484
|
if (vt(m)) {
|
|
1485
|
-
He.push(m), Be +=
|
|
1485
|
+
He.push(m), Be += E;
|
|
1486
1486
|
return;
|
|
1487
1487
|
}
|
|
1488
|
-
Be < o ? (He.push(m), Be +=
|
|
1488
|
+
Be < o ? (He.push(m), Be += E) : Ee.push(m);
|
|
1489
1489
|
}), {
|
|
1490
1490
|
defaultItems: He,
|
|
1491
|
-
overflowItems:
|
|
1491
|
+
overflowItems: Ee.filter((m) => m.type !== "separator")
|
|
1492
1492
|
};
|
|
1493
1493
|
}, ao = [".jpg", ".jpeg", ".png", "image/jpeg", "image/png"], ro = () => {
|
|
1494
1494
|
let t = document.createElement("input");
|
|
@@ -1557,11 +1557,11 @@ const x = (t) => {
|
|
|
1557
1557
|
let b = o.name.replace(" ", "_"), v = Ct(a.state, l);
|
|
1558
1558
|
if (v == null)
|
|
1559
1559
|
return;
|
|
1560
|
-
let y = { type: "remove", id: l },
|
|
1561
|
-
src:
|
|
1560
|
+
let y = { type: "remove", id: l }, S = `word/media/${b}`, g = c.nodes.image.create({
|
|
1561
|
+
src: S,
|
|
1562
1562
|
size: { width: i, height: r }
|
|
1563
1563
|
});
|
|
1564
|
-
t.storage.image.media = Object.assign(t.storage.image.media, { [
|
|
1564
|
+
t.storage.image.media = Object.assign(t.storage.image.media, { [S]: u }), t.options.ydoc && t.commands.addImageToCollaboration({ mediaPath: S, fileData: u }), a.dispatch(
|
|
1565
1565
|
a.state.tr.replaceWith(v, v, g).setMeta(Ne, y)
|
|
1566
1566
|
);
|
|
1567
1567
|
},
|
|
@@ -1573,9 +1573,18 @@ const x = (t) => {
|
|
|
1573
1573
|
};
|
|
1574
1574
|
var L, lt, ve, We, at, rt, Pe, ct, fe;
|
|
1575
1575
|
class Mo extends qt {
|
|
1576
|
+
/**
|
|
1577
|
+
* Creates a new SuperToolbar instance
|
|
1578
|
+
* @param {ToolbarConfig} config - The configuration for the toolbar
|
|
1579
|
+
* @returns {void}
|
|
1580
|
+
*/
|
|
1576
1581
|
constructor(o) {
|
|
1577
1582
|
super();
|
|
1578
1583
|
Oe(this, L);
|
|
1584
|
+
/**
|
|
1585
|
+
* Default configuration for the toolbar
|
|
1586
|
+
* @type {ToolbarConfig}
|
|
1587
|
+
*/
|
|
1579
1588
|
Re(this, "config", {
|
|
1580
1589
|
selector: null,
|
|
1581
1590
|
toolbarGroups: ["left", "center", "right"],
|
|
@@ -1589,7 +1598,19 @@ class Mo extends qt {
|
|
|
1589
1598
|
aiApiKey: null,
|
|
1590
1599
|
aiEndpoint: null
|
|
1591
1600
|
});
|
|
1601
|
+
/**
|
|
1602
|
+
* Custom commands that override default behavior
|
|
1603
|
+
* @private
|
|
1604
|
+
* @type {Object.<string, function(CommandItem): void>}
|
|
1605
|
+
*/
|
|
1592
1606
|
Oe(this, ve, {
|
|
1607
|
+
/**
|
|
1608
|
+
* Handles zoom level changes
|
|
1609
|
+
* @param {Object} params - Command parameters
|
|
1610
|
+
* @param {CommandItem} params.item - The command item
|
|
1611
|
+
* @param {string|number} params.argument - The zoom level (percentage)
|
|
1612
|
+
* @returns {void}
|
|
1613
|
+
*/
|
|
1593
1614
|
setZoom: ({ item: o, argument: n }) => {
|
|
1594
1615
|
if (!n) return;
|
|
1595
1616
|
o.onActivate({ zoom: n }), this.emit("superdoc-command", { item: o, argument: n });
|
|
@@ -1598,65 +1619,153 @@ class Mo extends qt {
|
|
|
1598
1619
|
const i = typeof screen.orientation < "u", r = window.matchMedia("(max-width: 834px)").matches;
|
|
1599
1620
|
i && r ? (e.style.transformOrigin = "0 0", e.style.transform = `scale(${parseInt(n) / 100})`) : e.style.zoom = parseInt(n) / 100, this.superdoc.superdocStore.activeZoom = parseInt(n);
|
|
1600
1621
|
},
|
|
1622
|
+
/**
|
|
1623
|
+
* Sets the document mode
|
|
1624
|
+
* @param {Object} params - Command parameters
|
|
1625
|
+
* @param {CommandItem} params.item - The command item
|
|
1626
|
+
* @param {string} params.argument - The document mode to set
|
|
1627
|
+
* @returns {void}
|
|
1628
|
+
*/
|
|
1601
1629
|
setDocumentMode: ({ item: o, argument: n }) => {
|
|
1602
1630
|
n && this.emit("superdoc-command", { item: o, argument: n });
|
|
1603
1631
|
},
|
|
1632
|
+
/**
|
|
1633
|
+
* Sets the font size for text
|
|
1634
|
+
* @param {Object} params - Command parameters
|
|
1635
|
+
* @param {CommandItem} params.item - The command item
|
|
1636
|
+
* @param {string|number} params.argument - The font size to set
|
|
1637
|
+
* @returns {void}
|
|
1638
|
+
*/
|
|
1604
1639
|
setFontSize: ({ item: o, argument: n }) => {
|
|
1605
1640
|
z(this, L, fe).call(this, { item: o, argument: n }, () => {
|
|
1606
1641
|
this.activeEditor?.commands.setFieldAnnotationsFontSize(n, !0);
|
|
1607
1642
|
});
|
|
1608
1643
|
},
|
|
1644
|
+
/**
|
|
1645
|
+
* Sets the font family for text
|
|
1646
|
+
* @param {Object} params - Command parameters
|
|
1647
|
+
* @param {CommandItem} params.item - The command item
|
|
1648
|
+
* @param {string} params.argument - The font family to set
|
|
1649
|
+
* @returns {void}
|
|
1650
|
+
*/
|
|
1609
1651
|
setFontFamily: ({ item: o, argument: n }) => {
|
|
1610
1652
|
z(this, L, fe).call(this, { item: o, argument: n }, () => {
|
|
1611
1653
|
this.activeEditor?.commands.setFieldAnnotationsFontFamily(n, !0);
|
|
1612
1654
|
});
|
|
1613
1655
|
},
|
|
1656
|
+
/**
|
|
1657
|
+
* Sets the text color
|
|
1658
|
+
* @param {Object} params - Command parameters
|
|
1659
|
+
* @param {CommandItem} params.item - The command item
|
|
1660
|
+
* @param {string} params.argument - The color to set
|
|
1661
|
+
* @returns {void}
|
|
1662
|
+
*/
|
|
1614
1663
|
setColor: ({ item: o, argument: n }) => {
|
|
1615
1664
|
z(this, L, fe).call(this, { item: o, argument: n }, () => {
|
|
1616
1665
|
this.activeEditor?.commands.setFieldAnnotationsTextColor(n, !0);
|
|
1617
1666
|
});
|
|
1618
1667
|
},
|
|
1668
|
+
/**
|
|
1669
|
+
* Sets the highlight color for text
|
|
1670
|
+
* @param {Object} params - Command parameters
|
|
1671
|
+
* @param {CommandItem} params.item - The command item
|
|
1672
|
+
* @param {string} params.argument - The highlight color to set
|
|
1673
|
+
* @returns {void}
|
|
1674
|
+
*/
|
|
1619
1675
|
setHighlight: ({ item: o, argument: n }) => {
|
|
1620
1676
|
z(this, L, fe).call(this, { item: o, argument: n, noArgumentCallback: !0 }, () => {
|
|
1621
1677
|
let e = n !== "none" ? n : null;
|
|
1622
1678
|
this.activeEditor?.commands.setFieldAnnotationsTextHighlight(e, !0), this.activeEditor?.commands.setCellBackground(e);
|
|
1623
1679
|
});
|
|
1624
1680
|
},
|
|
1625
|
-
|
|
1681
|
+
/**
|
|
1682
|
+
* Toggles the ruler visibility
|
|
1683
|
+
* @param {Object} [_params=null] - Command parameters (not used)
|
|
1684
|
+
* @returns {void}
|
|
1685
|
+
*/
|
|
1686
|
+
toggleRuler: (o = null) => {
|
|
1626
1687
|
this.superdoc.toggleRuler();
|
|
1627
1688
|
},
|
|
1628
|
-
|
|
1629
|
-
|
|
1630
|
-
|
|
1689
|
+
/**
|
|
1690
|
+
* Initiates the image upload process
|
|
1691
|
+
* @async
|
|
1692
|
+
* @param {Object} [_params=null - Command parameters (not used)
|
|
1693
|
+
* @returns {Promise<void>}
|
|
1694
|
+
*/
|
|
1695
|
+
startImageUpload: async (o = null) => {
|
|
1696
|
+
let e = await ro()();
|
|
1697
|
+
e?.file && po({
|
|
1631
1698
|
editor: this.activeEditor,
|
|
1632
1699
|
view: this.activeEditor.view,
|
|
1633
|
-
file:
|
|
1700
|
+
file: e.file
|
|
1634
1701
|
});
|
|
1635
1702
|
},
|
|
1703
|
+
/**
|
|
1704
|
+
* Increases text indentation or list level
|
|
1705
|
+
* @param {Object} params - Command parameters
|
|
1706
|
+
* @param {CommandItem} params.item - The command item
|
|
1707
|
+
* @param {*} params.argument - Command arguments
|
|
1708
|
+
* @returns {void}
|
|
1709
|
+
*/
|
|
1636
1710
|
increaseTextIndent: ({ item: o, argument: n }) => {
|
|
1637
1711
|
let e = o.command, { state: i } = this.activeEditor;
|
|
1638
1712
|
if (Ge((l) => l.type.name === "listItem")(i.selection))
|
|
1639
1713
|
return this.activeEditor.commands.increaseListIndent();
|
|
1640
1714
|
e in this.activeEditor.commands && this.activeEditor.commands[e](n);
|
|
1641
1715
|
},
|
|
1716
|
+
/**
|
|
1717
|
+
* Decreases text indentation or list level
|
|
1718
|
+
* @param {Object} params - Command parameters
|
|
1719
|
+
* @param {CommandItem} params.item - The command item
|
|
1720
|
+
* @param {*} params.argument - Command arguments
|
|
1721
|
+
* @returns {boolean}
|
|
1722
|
+
*/
|
|
1642
1723
|
decreaseTextIndent: ({ item: o, argument: n }) => {
|
|
1643
1724
|
let e = o.command, { state: i } = this.activeEditor;
|
|
1644
1725
|
if (Ge((l) => l.type.name === "listItem")(i.selection))
|
|
1645
1726
|
return this.activeEditor.commands.decreaseListIndent();
|
|
1646
1727
|
e in this.activeEditor.commands && this.activeEditor.commands[e](n);
|
|
1647
1728
|
},
|
|
1729
|
+
/**
|
|
1730
|
+
* Toggles bold formatting for text
|
|
1731
|
+
* @param {Object} params - Command parameters
|
|
1732
|
+
* @param {CommandItem} params.item - The command item
|
|
1733
|
+
* @param {*} params.argument - Command arguments
|
|
1734
|
+
* @returns {void}
|
|
1735
|
+
*/
|
|
1648
1736
|
toggleBold: ({ item: o, argument: n }) => {
|
|
1649
1737
|
let e = o.command;
|
|
1650
1738
|
e in this.activeEditor.commands && (this.activeEditor.commands[e](n), this.activeEditor.commands.toggleFieldAnnotationsFormat("bold", !0)), this.updateToolbarState();
|
|
1651
1739
|
},
|
|
1740
|
+
/**
|
|
1741
|
+
* Toggles italic formatting for text
|
|
1742
|
+
* @param {Object} params - Command parameters
|
|
1743
|
+
* @param {CommandItem} params.item - The command item
|
|
1744
|
+
* @param {*} params.argument - Command arguments
|
|
1745
|
+
* @returns {void}
|
|
1746
|
+
*/
|
|
1652
1747
|
toggleItalic: ({ item: o, argument: n }) => {
|
|
1653
1748
|
let e = o.command;
|
|
1654
1749
|
e in this.activeEditor.commands && (this.activeEditor.commands[e](n), this.activeEditor.commands.toggleFieldAnnotationsFormat("italic", !0)), this.updateToolbarState();
|
|
1655
1750
|
},
|
|
1751
|
+
/**
|
|
1752
|
+
* Toggles underline formatting for text
|
|
1753
|
+
* @param {Object} params - Command parameters
|
|
1754
|
+
* @param {CommandItem} params.item - The command item
|
|
1755
|
+
* @param {*} params.argument - Command arguments
|
|
1756
|
+
* @returns {void}
|
|
1757
|
+
*/
|
|
1656
1758
|
toggleUnderline: ({ item: o, argument: n }) => {
|
|
1657
1759
|
let e = o.command;
|
|
1658
1760
|
e in this.activeEditor.commands && (this.activeEditor.commands[e](n), this.activeEditor.commands.toggleFieldAnnotationsFormat("underline", !0)), this.updateToolbarState();
|
|
1659
1761
|
},
|
|
1762
|
+
/**
|
|
1763
|
+
* Toggles link formatting and updates cursor position
|
|
1764
|
+
* @param {Object} params - Command parameters
|
|
1765
|
+
* @param {CommandItem} params.item - The command item
|
|
1766
|
+
* @param {*} params.argument - Command arguments
|
|
1767
|
+
* @returns {void}
|
|
1768
|
+
*/
|
|
1660
1769
|
toggleLink: ({ item: o, argument: n }) => {
|
|
1661
1770
|
let e = o.command;
|
|
1662
1771
|
if (e in this.activeEditor.commands) {
|
|
@@ -1668,15 +1777,34 @@ class Mo extends qt {
|
|
|
1668
1777
|
}
|
|
1669
1778
|
this.updateToolbarState();
|
|
1670
1779
|
},
|
|
1780
|
+
/**
|
|
1781
|
+
* Inserts a table into the document
|
|
1782
|
+
* @param {Object} params - Command parameters
|
|
1783
|
+
* @param {CommandItem} params.item - The command item
|
|
1784
|
+
* @param {Object} params.argument - Table configuration
|
|
1785
|
+
* @returns {void}
|
|
1786
|
+
*/
|
|
1671
1787
|
insertTable: ({ item: o, argument: n }) => {
|
|
1672
1788
|
z(this, L, fe).call(this, { item: o, argument: n });
|
|
1673
1789
|
},
|
|
1790
|
+
/**
|
|
1791
|
+
* Executes a table-related command
|
|
1792
|
+
* @param {Object} params - Command parameters
|
|
1793
|
+
* @param {CommandItem} params.item - The command item
|
|
1794
|
+
* @param {Object} params.argument - The table command and its parameters
|
|
1795
|
+
* @param {string} params.argument.command - The specific table command to execute
|
|
1796
|
+
* @returns {void}
|
|
1797
|
+
*/
|
|
1674
1798
|
executeTableCommand: ({ item: o, argument: n }) => {
|
|
1675
1799
|
if (!n) return;
|
|
1676
1800
|
let e = n.command;
|
|
1677
1801
|
e in this.activeEditor.commands && this.activeEditor.commands[e](n), this.updateToolbarState();
|
|
1678
1802
|
}
|
|
1679
1803
|
});
|
|
1804
|
+
/**
|
|
1805
|
+
* Handler for toolbar resize events
|
|
1806
|
+
* @returns {void}
|
|
1807
|
+
*/
|
|
1680
1808
|
Re(this, "onToolbarResize", () => {
|
|
1681
1809
|
z(this, L, We).call(this, this, this.config.icons, this.isDev), this.role === "viewer" && z(this, L, Pe).call(this);
|
|
1682
1810
|
});
|
|
@@ -1691,29 +1819,51 @@ class Mo extends qt {
|
|
|
1691
1819
|
}
|
|
1692
1820
|
this.app = Nt(Pt), this.app.directive("click-outside", Ht), this.app.config.globalProperties.$toolbar = this, n && (this.toolbar = this.app.mount(n)), this.activeEditor = o.editor || null, this.updateToolbarState();
|
|
1693
1821
|
}
|
|
1822
|
+
/**
|
|
1823
|
+
* Log debug information to the console
|
|
1824
|
+
* @param {...*} args - Arguments to log
|
|
1825
|
+
* @returns {void}
|
|
1826
|
+
*/
|
|
1694
1827
|
log(...o) {
|
|
1695
1828
|
console.debug("[🎨 super-toolbar]", ...o);
|
|
1696
1829
|
}
|
|
1830
|
+
/**
|
|
1831
|
+
* Set the zoom level
|
|
1832
|
+
* @param {number} percent_int - The zoom percentage as an integer
|
|
1833
|
+
* @returns {void}
|
|
1834
|
+
*/
|
|
1697
1835
|
setZoom(o) {
|
|
1698
1836
|
const e = [...this.toolbarItems, ...this.overflowItems].find((i) => i.name.value === "zoom");
|
|
1699
1837
|
Ae(this, ve).setZoom({ item: e, argument: o });
|
|
1700
1838
|
}
|
|
1701
1839
|
/**
|
|
1702
1840
|
* The toolbar expects an active Super Editor instance.
|
|
1703
|
-
* @param {
|
|
1841
|
+
* @param {Object} editor - The editor instance to attach to the toolbar
|
|
1842
|
+
* @returns {void}
|
|
1704
1843
|
*/
|
|
1705
1844
|
setActiveEditor(o) {
|
|
1706
1845
|
this.activeEditor = o, this.activeEditor.on("transaction", this.onEditorTransaction.bind(this));
|
|
1707
1846
|
}
|
|
1847
|
+
/**
|
|
1848
|
+
* Get toolbar items by group name
|
|
1849
|
+
* @param {string} groupName - The name of the group
|
|
1850
|
+
* @returns {ToolbarItem[]} An array of toolbar items in the specified group
|
|
1851
|
+
*/
|
|
1708
1852
|
getToolbarItemByGroup(o) {
|
|
1709
1853
|
return this.toolbarItems.filter((n) => n.group.value === o);
|
|
1710
1854
|
}
|
|
1855
|
+
/**
|
|
1856
|
+
* Get a toolbar item by name
|
|
1857
|
+
* @param {string} name - The name of the toolbar item
|
|
1858
|
+
* @returns {ToolbarItem|undefined} The toolbar item with the specified name or undefined if not found
|
|
1859
|
+
*/
|
|
1711
1860
|
getToolbarItemByName(o) {
|
|
1712
1861
|
return this.toolbarItems.find((n) => n.name.value === o);
|
|
1713
1862
|
}
|
|
1714
1863
|
/**
|
|
1715
|
-
* Update the toolbar state
|
|
1716
|
-
*
|
|
1864
|
+
* Update the toolbar state based on the current editor state
|
|
1865
|
+
* Updates active/inactive state of all toolbar items
|
|
1866
|
+
* @returns {void}
|
|
1717
1867
|
*/
|
|
1718
1868
|
updateToolbarState() {
|
|
1719
1869
|
if (z(this, L, ct).call(this), z(this, L, at).call(this), z(this, L, rt).call(this), !this.activeEditor || this.documentMode === "viewing") {
|
|
@@ -1747,16 +1897,21 @@ class Mo extends qt {
|
|
|
1747
1897
|
}
|
|
1748
1898
|
/**
|
|
1749
1899
|
* React to editor transactions. Might want to debounce this.
|
|
1900
|
+
* @param {Object} params - Transaction parameters
|
|
1901
|
+
* @param {Object} params.editor - The editor instance (not used)
|
|
1902
|
+
* @param {Object} params.transaction - The transaction object
|
|
1903
|
+
* @returns {void}
|
|
1750
1904
|
*/
|
|
1751
1905
|
onEditorTransaction({ editor: o, transaction: n }) {
|
|
1752
1906
|
!n.docChanged && !n.selectionSet || this.updateToolbarState();
|
|
1753
1907
|
}
|
|
1754
1908
|
/**
|
|
1755
|
-
* Main handler for toolbar commands
|
|
1756
|
-
*
|
|
1757
|
-
* @param {
|
|
1758
|
-
* @param {
|
|
1759
|
-
|
|
1909
|
+
* Main handler for toolbar commands
|
|
1910
|
+
* @param {CommandItem} params - Command parameters
|
|
1911
|
+
* @param {ToolbarItem} params.item - An instance of the useToolbarItem composable
|
|
1912
|
+
* @param {*} [params.argument] - The argument passed to the command
|
|
1913
|
+
* @returns {*} The result of the executed command, undefined if no result is returned
|
|
1914
|
+
*/
|
|
1760
1915
|
emitCommand({ item: o, argument: n }) {
|
|
1761
1916
|
this.activeEditor?.focus();
|
|
1762
1917
|
const { command: e } = o;
|
|
@@ -1770,9 +1925,22 @@ class Mo extends qt {
|
|
|
1770
1925
|
}
|
|
1771
1926
|
}
|
|
1772
1927
|
}
|
|
1773
|
-
L = new WeakSet(),
|
|
1928
|
+
L = new WeakSet(), /**
|
|
1929
|
+
* Initiate toolbar groups
|
|
1930
|
+
* @private
|
|
1931
|
+
* @returns {void}
|
|
1932
|
+
*/
|
|
1933
|
+
lt = function() {
|
|
1774
1934
|
this.config.groups && !Array.isArray(this.config.groups) && Object.keys(this.config.groups).length && (this.config.toolbarGroups = Object.keys(this.config.groups));
|
|
1775
|
-
}, ve = new WeakMap(),
|
|
1935
|
+
}, ve = new WeakMap(), /**
|
|
1936
|
+
* Create toolbar items based on configuration
|
|
1937
|
+
* @private
|
|
1938
|
+
* @param {SuperToolbar} superToolbar - The toolbar instance
|
|
1939
|
+
* @param {Object} icons - Icons to use for toolbar items
|
|
1940
|
+
* @param {boolean} [isDev=false] - Whether in development mode
|
|
1941
|
+
* @returns {void}
|
|
1942
|
+
*/
|
|
1943
|
+
We = function(o, n, e = !1) {
|
|
1776
1944
|
const i = document.documentElement.clientWidth, { defaultItems: r, overflowItems: l } = lo(o, e, i, this.role, n);
|
|
1777
1945
|
let s = [
|
|
1778
1946
|
...r.map((d) => d.name.value),
|
|
@@ -1781,13 +1949,23 @@ L = new WeakSet(), lt = function() {
|
|
|
1781
1949
|
this.config.groups && (s = Object.values(this.config.groups).flatMap((d) => d));
|
|
1782
1950
|
const c = r.filter((d) => s.includes(d.name.value)).filter((d) => !this.config.excludeItems.includes(d.name.value));
|
|
1783
1951
|
this.toolbarItems = c, this.overflowItems = l.filter((d) => s.includes(d.name.value));
|
|
1784
|
-
},
|
|
1952
|
+
}, /**
|
|
1953
|
+
* Initialize default fonts from the editor
|
|
1954
|
+
* @private
|
|
1955
|
+
* @returns {void}
|
|
1956
|
+
*/
|
|
1957
|
+
at = function() {
|
|
1785
1958
|
if (!this.activeEditor || !this.activeEditor.converter) return;
|
|
1786
1959
|
const { typeface: o = "Arial", fontSizePt: n = 12 } = this.activeEditor.converter.getDocumentDefaultStyles() ?? {}, e = this.toolbarItems.find((r) => r.name.value === "fontSize");
|
|
1787
1960
|
e && (e.defaultLabel.value = n);
|
|
1788
1961
|
const i = this.toolbarItems.find((r) => r.name.value === "fontFamily");
|
|
1789
1962
|
i && (i.defaultLabel.value = o);
|
|
1790
|
-
},
|
|
1963
|
+
}, /**
|
|
1964
|
+
* Update highlight color options based on document colors
|
|
1965
|
+
* @private
|
|
1966
|
+
* @returns {void}
|
|
1967
|
+
*/
|
|
1968
|
+
rt = function() {
|
|
1791
1969
|
if (!this.activeEditor || !this.activeEditor.converter || !this.activeEditor.converter.docHiglightColors.size) return;
|
|
1792
1970
|
const o = this.toolbarItems.find((l) => l.name.value === "highlight"), n = Vn(), e = 7, i = Array.from(this.activeEditor.converter.docHiglightColors).reduce((l, s, c) => {
|
|
1793
1971
|
const d = Math.floor(c / e);
|
|
@@ -1798,14 +1976,34 @@ L = new WeakSet(), lt = function() {
|
|
|
1798
1976
|
render: () => Ve(this, o, i, !0)
|
|
1799
1977
|
};
|
|
1800
1978
|
o.nestedOptions.value = [r];
|
|
1801
|
-
},
|
|
1979
|
+
}, /**
|
|
1980
|
+
* Deactivate all toolbar items
|
|
1981
|
+
* @private
|
|
1982
|
+
* @returns {void}
|
|
1983
|
+
*/
|
|
1984
|
+
Pe = function() {
|
|
1802
1985
|
this.activeEditor = null, this.toolbarItems.forEach((o) => {
|
|
1803
1986
|
const { allowWithoutEditor: n } = o;
|
|
1804
1987
|
n.value || o.setDisabled(!0);
|
|
1805
1988
|
});
|
|
1806
|
-
},
|
|
1807
|
-
|
|
1808
|
-
|
|
1989
|
+
}, /**
|
|
1990
|
+
* Update undo/redo history state in the toolbar
|
|
1991
|
+
* @private
|
|
1992
|
+
* @returns {void}
|
|
1993
|
+
*/
|
|
1994
|
+
ct = function() {
|
|
1995
|
+
this.activeEditor && (this.undoDepth = xt(this.activeEditor.state), this.redoDepth = St(this.activeEditor.state));
|
|
1996
|
+
}, /**
|
|
1997
|
+
* Run a command that requires an argument
|
|
1998
|
+
* @private
|
|
1999
|
+
* @param {CommandItem} params - Command parameters
|
|
2000
|
+
* @param {ToolbarItem} params.item - The toolbar item
|
|
2001
|
+
* @param {*} params.argument - The argument for the command
|
|
2002
|
+
* @param {boolean} params.noArgumentCallback - Whether to call callback even if argument === 'none'
|
|
2003
|
+
* @param {Function} [callback] - Optional callback to run after the command
|
|
2004
|
+
* @returns {void}
|
|
2005
|
+
*/
|
|
2006
|
+
fe = function({ item: o, argument: n, noArgumentCallback: e = !1 }, i) {
|
|
1809
2007
|
if (!n || !this.activeEditor) return;
|
|
1810
2008
|
let r = o.command;
|
|
1811
2009
|
const l = o.noArgumentCommand;
|
|
@@ -1838,8 +2036,8 @@ const fo = (t, a) => {
|
|
|
1838
2036
|
if (s) {
|
|
1839
2037
|
let c = s;
|
|
1840
2038
|
if (l) {
|
|
1841
|
-
const b = e.state.doc.resolve(s).textOffset, v = e.state.doc.nodeAt(s),
|
|
1842
|
-
c = v?.isText &&
|
|
2039
|
+
const b = e.state.doc.resolve(s).textOffset, v = e.state.doc.nodeAt(s), S = v?.text?.charAt(b);
|
|
2040
|
+
c = v?.isText && S !== " " ? s - 1 : s;
|
|
1843
2041
|
}
|
|
1844
2042
|
const d = e.state.tr.setSelection(
|
|
1845
2043
|
Ye.create(e.state.doc, c)
|
|
@@ -1864,7 +2062,7 @@ const fo = (t, a) => {
|
|
|
1864
2062
|
},
|
|
1865
2063
|
emits: ["margin-change"],
|
|
1866
2064
|
setup(t, { emit: a }) {
|
|
1867
|
-
const o = a, n = t, e = f(null), i = f([]), r = f("#CCCCCC"), l = f("#2563EB66"), s = f(null), c = f(null), d = f(!1), u = f(null), b = Ke({ side: "left", x: 0 }), v = Ke({ side: "right", x: 0 }), y = f(!1),
|
|
2065
|
+
const o = a, n = t, e = f(null), i = f([]), r = f("#CCCCCC"), l = f("#2563EB66"), s = f(null), c = f(null), d = f(!1), u = f(null), b = Ke({ side: "left", x: 0 }), v = Ke({ side: "right", x: 0 }), y = f(!1), S = f(0);
|
|
1868
2066
|
let g = 0;
|
|
1869
2067
|
const F = () => {
|
|
1870
2068
|
if (n.editor.options.mode !== "docx") return;
|
|
@@ -1903,13 +2101,13 @@ const fo = (t, a) => {
|
|
|
1903
2101
|
}), N = (I) => {
|
|
1904
2102
|
d.value = !0, ye();
|
|
1905
2103
|
const M = I.currentTarget.id;
|
|
1906
|
-
u.value = M === "left-margin-handle" ? b : v,
|
|
2104
|
+
u.value = M === "left-margin-handle" ? b : v, S.value = u.value.x, g = I.clientX - u.value.x, y.value = !0;
|
|
1907
2105
|
}, V = (I) => {
|
|
1908
2106
|
if (!d.value) return;
|
|
1909
2107
|
const M = I.clientX - g;
|
|
1910
2108
|
u.value.x = M, u.value.side === "left" ? M <= 0 ? u.value.x = 0 : M >= v.x - Te && (u.value.x = v.x - Te) : M >= s.value.width * 96 ? u.value.x = s.value.width * 96 : M <= b.x + Te && (u.value.x = b.x + Te);
|
|
1911
2109
|
}, te = () => {
|
|
1912
|
-
if (d.value = !1, y.value = !1, Z(), u.value && u.value.x !==
|
|
2110
|
+
if (d.value = !1, y.value = !1, Z(), u.value && u.value.x !== S.value) {
|
|
1913
2111
|
const I = re();
|
|
1914
2112
|
o("margin-change", {
|
|
1915
2113
|
side: u.value.side,
|
|
@@ -2031,7 +2229,7 @@ const fo = (t, a) => {
|
|
|
2031
2229
|
_.on("synced", T);
|
|
2032
2230
|
}
|
|
2033
2231
|
}, v = () => {
|
|
2034
|
-
const p =
|
|
2232
|
+
const p = Et();
|
|
2035
2233
|
return n.options.pagination ? p : p.filter((_) => _.name !== "pagination");
|
|
2036
2234
|
}, y = async ({ content: p, media: _ = {}, mediaFiles: T = {}, fonts: N = {} } = {}) => {
|
|
2037
2235
|
i.value = new ze({
|
|
@@ -2053,7 +2251,7 @@ const fo = (t, a) => {
|
|
|
2053
2251
|
e.value = !0;
|
|
2054
2252
|
}, 150);
|
|
2055
2253
|
});
|
|
2056
|
-
},
|
|
2254
|
+
}, S = (p) => {
|
|
2057
2255
|
o("editor-keydown", { editor: i.value });
|
|
2058
2256
|
}, g = (p) => {
|
|
2059
2257
|
o("editor-click", { editor: i.value });
|
|
@@ -2085,7 +2283,7 @@ const fo = (t, a) => {
|
|
|
2085
2283
|
class: "super-editor",
|
|
2086
2284
|
ref_key: "editorWrapper",
|
|
2087
2285
|
ref: r,
|
|
2088
|
-
onKeydown:
|
|
2286
|
+
onKeydown: S,
|
|
2089
2287
|
onClick: g,
|
|
2090
2288
|
onMousedown: F
|
|
2091
2289
|
}, [
|
|
@@ -2158,7 +2356,7 @@ const fo = (t, a) => {
|
|
|
2158
2356
|
}, null, 32)
|
|
2159
2357
|
]));
|
|
2160
2358
|
}
|
|
2161
|
-
}, xo = ["innerHTML"],
|
|
2359
|
+
}, xo = ["innerHTML"], So = {
|
|
2162
2360
|
__name: "SuperInput",
|
|
2163
2361
|
props: {
|
|
2164
2362
|
modelValue: {
|
|
@@ -2183,8 +2381,8 @@ const fo = (t, a) => {
|
|
|
2183
2381
|
emits: ["update:modelValue", "focus", "blur"],
|
|
2184
2382
|
setup(t, { emit: a }) {
|
|
2185
2383
|
const o = a, n = t, e = nt(), i = f(null), r = f(!1), l = ({ editor: v, transaction: y }) => {
|
|
2186
|
-
const
|
|
2187
|
-
o("update:modelValue",
|
|
2384
|
+
const S = v.getHTML();
|
|
2385
|
+
o("update:modelValue", S);
|
|
2188
2386
|
}, s = ({ editor: v, transaction: y }) => {
|
|
2189
2387
|
r.value = !0, b(), o("focus", { editor: v, transaction: y });
|
|
2190
2388
|
}, c = ({ editor: v, transaction: y }) => {
|
|
@@ -2223,7 +2421,7 @@ const fo = (t, a) => {
|
|
|
2223
2421
|
}, null, 512)
|
|
2224
2422
|
], 2));
|
|
2225
2423
|
}
|
|
2226
|
-
}, Ho = /* @__PURE__ */ q(
|
|
2424
|
+
}, Ho = /* @__PURE__ */ q(So, [["__scopeId", "data-v-4d5cff52"]]), Bo = {
|
|
2227
2425
|
Node: Mt,
|
|
2228
2426
|
Attribute: Lt,
|
|
2229
2427
|
Extension: It,
|
|
@@ -2249,7 +2447,7 @@ export {
|
|
|
2249
2447
|
mo as getAllowedImageDimensions,
|
|
2250
2448
|
Wo as getMarksFromSelection,
|
|
2251
2449
|
Tt as getRichTextExtensions,
|
|
2252
|
-
|
|
2450
|
+
Et as getStarterExtensions,
|
|
2253
2451
|
Po as helpers,
|
|
2254
2452
|
jo as trackChangesHelpers
|
|
2255
2453
|
};
|