@harbour-enterprises/superdoc 0.11.39 → 0.11.41
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/{super-editor.es-CfOoZR7Y.es.js → super-editor.es-CB8oMoK8.es.js} +33 -25
- package/dist/chunks/{super-editor.es-Oav3pft6.cjs → super-editor.es-DbnymxHg.cjs} +46 -43
- package/dist/style.css +1 -1
- package/dist/super-editor/ai-writer.es.js +2 -2
- package/dist/super-editor/chunks/{converter-BaPyRYsP.js → converter-CPwMfRm-.js} +2 -2
- package/dist/super-editor/chunks/{docx-zipper-DWp5ugUc.js → docx-zipper-CMhBN08Z.js} +1 -1
- package/dist/super-editor/chunks/{editor-C80oU8zg.js → editor-DlsyBRx7.js} +3 -3
- package/dist/super-editor/chunks/{toolbar-BfR55xSN.js → toolbar-V1sdjscj.js} +132 -132
- package/dist/super-editor/components/toolbar/super-toolbar.d.ts +6 -1
- 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/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 +459 -451
- package/dist/super-editor/toolbar.es.js +2 -2
- package/dist/super-editor.cjs +1 -1
- package/dist/super-editor.es.js +1 -1
- package/dist/superdoc.cjs +2 -2
- package/dist/superdoc.es.js +3 -3
- package/dist/superdoc.umd.js +1244 -1236
- package/dist/superdoc.umd.js.map +1 -1
- package/package.json +1 -1
|
@@ -2,93 +2,93 @@ var yt = Object.defineProperty;
|
|
|
2
2
|
var Ue = (t) => {
|
|
3
3
|
throw TypeError(t);
|
|
4
4
|
};
|
|
5
|
-
var bt = (t,
|
|
6
|
-
var Re = (t,
|
|
7
|
-
var Ae = (t,
|
|
8
|
-
var z = (t,
|
|
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 Et, E as ze, e as St, P as At, h as Tt, M as Ft, j as It, A as Lt, N as Mt } from "./chunks/editor-
|
|
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, E as $t, a3 as Ht, T as Ye, a as Bt } from "./chunks/converter-
|
|
12
|
-
import { O as qo } from "./chunks/converter-
|
|
5
|
+
var bt = (t, r, o) => r in t ? yt(t, r, { enumerable: !0, configurable: !0, writable: !0, value: o }) : t[r] = o;
|
|
6
|
+
var Re = (t, r, o) => bt(t, typeof r != "symbol" ? r + "" : r, o), qe = (t, r, o) => r.has(t) || Ue("Cannot " + o);
|
|
7
|
+
var Ae = (t, r, o) => (qe(t, r, "read from private field"), o ? o.call(t) : r.get(t)), Oe = (t, r, o) => r.has(t) ? Ue("Cannot add the same private member more than once") : r instanceof WeakSet ? r.add(t) : r.set(t, o);
|
|
8
|
+
var z = (t, r, o) => (qe(t, r, "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 Et, E as ze, e as St, P as At, h as Tt, M as Ft, j as It, A as Lt, N as Mt } from "./chunks/editor-DlsyBRx7.js";
|
|
10
|
+
import { C as No, T as zo, l as Vo, n as Wo, k as Po, m as jo } from "./chunks/editor-DlsyBRx7.js";
|
|
11
|
+
import { a1 as Dt, E as $t, a3 as Ht, T as Ye, a as Bt } from "./chunks/converter-CPwMfRm-.js";
|
|
12
|
+
import { O as qo } from "./chunks/converter-CPwMfRm-.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-V1sdjscj.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-CMhBN08Z.js";
|
|
17
17
|
import { createZip as Zo } from "./file-zipper.es.js";
|
|
18
18
|
var it = { exports: {} };
|
|
19
19
|
(function(t) {
|
|
20
|
-
var
|
|
20
|
+
var r = Object.prototype.hasOwnProperty, o = "~";
|
|
21
21
|
function n() {
|
|
22
22
|
}
|
|
23
23
|
Object.create && (n.prototype = /* @__PURE__ */ Object.create(null), new n().__proto__ || (o = !1));
|
|
24
|
-
function e(
|
|
25
|
-
this.fn =
|
|
24
|
+
function e(l, d, m) {
|
|
25
|
+
this.fn = l, this.context = d, this.once = m || !1;
|
|
26
26
|
}
|
|
27
|
-
function i(
|
|
28
|
-
if (typeof
|
|
27
|
+
function i(l, d, m, s, b) {
|
|
28
|
+
if (typeof m != "function")
|
|
29
29
|
throw new TypeError("The listener must be a function");
|
|
30
|
-
var v = new e(
|
|
31
|
-
return
|
|
30
|
+
var v = new e(m, s || l, b), y = o ? o + d : d;
|
|
31
|
+
return l._events[y] ? l._events[y].fn ? l._events[y] = [l._events[y], v] : l._events[y].push(v) : (l._events[y] = v, l._eventsCount++), l;
|
|
32
32
|
}
|
|
33
|
-
function
|
|
34
|
-
--
|
|
33
|
+
function c(l, d) {
|
|
34
|
+
--l._eventsCount === 0 ? l._events = new n() : delete l._events[d];
|
|
35
35
|
}
|
|
36
|
-
function
|
|
36
|
+
function a() {
|
|
37
37
|
this._events = new n(), this._eventsCount = 0;
|
|
38
38
|
}
|
|
39
|
-
|
|
40
|
-
var
|
|
41
|
-
if (this._eventsCount === 0) return
|
|
42
|
-
for (
|
|
43
|
-
|
|
44
|
-
return Object.getOwnPropertySymbols ?
|
|
45
|
-
},
|
|
46
|
-
var
|
|
47
|
-
if (!
|
|
48
|
-
if (
|
|
49
|
-
for (var b = 0, v =
|
|
50
|
-
y[b] =
|
|
39
|
+
a.prototype.eventNames = function() {
|
|
40
|
+
var d = [], m, s;
|
|
41
|
+
if (this._eventsCount === 0) return d;
|
|
42
|
+
for (s in m = this._events)
|
|
43
|
+
r.call(m, s) && d.push(o ? s.slice(1) : s);
|
|
44
|
+
return Object.getOwnPropertySymbols ? d.concat(Object.getOwnPropertySymbols(m)) : d;
|
|
45
|
+
}, a.prototype.listeners = function(d) {
|
|
46
|
+
var m = o ? o + d : d, s = this._events[m];
|
|
47
|
+
if (!s) return [];
|
|
48
|
+
if (s.fn) return [s.fn];
|
|
49
|
+
for (var b = 0, v = s.length, y = new Array(v); b < v; b++)
|
|
50
|
+
y[b] = s[b].fn;
|
|
51
51
|
return y;
|
|
52
|
-
},
|
|
53
|
-
var
|
|
54
|
-
return
|
|
55
|
-
},
|
|
56
|
-
var E = o ? o +
|
|
52
|
+
}, a.prototype.listenerCount = function(d) {
|
|
53
|
+
var m = o ? o + d : d, s = this._events[m];
|
|
54
|
+
return s ? s.fn ? 1 : s.length : 0;
|
|
55
|
+
}, a.prototype.emit = function(d, m, s, b, v, y) {
|
|
56
|
+
var E = o ? o + d : d;
|
|
57
57
|
if (!this._events[E]) return !1;
|
|
58
58
|
var g = this._events[E], F = arguments.length, $, p;
|
|
59
59
|
if (g.fn) {
|
|
60
|
-
switch (g.once && this.removeListener(
|
|
60
|
+
switch (g.once && this.removeListener(d, g.fn, void 0, !0), F) {
|
|
61
61
|
case 1:
|
|
62
62
|
return g.fn.call(g.context), !0;
|
|
63
63
|
case 2:
|
|
64
|
-
return g.fn.call(g.context,
|
|
64
|
+
return g.fn.call(g.context, m), !0;
|
|
65
65
|
case 3:
|
|
66
|
-
return g.fn.call(g.context,
|
|
66
|
+
return g.fn.call(g.context, m, s), !0;
|
|
67
67
|
case 4:
|
|
68
|
-
return g.fn.call(g.context,
|
|
68
|
+
return g.fn.call(g.context, m, s, b), !0;
|
|
69
69
|
case 5:
|
|
70
|
-
return g.fn.call(g.context,
|
|
70
|
+
return g.fn.call(g.context, m, s, b, v), !0;
|
|
71
71
|
case 6:
|
|
72
|
-
return g.fn.call(g.context,
|
|
72
|
+
return g.fn.call(g.context, m, s, b, v, y), !0;
|
|
73
73
|
}
|
|
74
74
|
for (p = 1, $ = new Array(F - 1); p < F; p++)
|
|
75
75
|
$[p - 1] = arguments[p];
|
|
76
76
|
g.fn.apply(g.context, $);
|
|
77
77
|
} else {
|
|
78
|
-
var
|
|
79
|
-
for (p = 0; p <
|
|
80
|
-
switch (g[p].once && this.removeListener(
|
|
78
|
+
var x = g.length, T;
|
|
79
|
+
for (p = 0; p < x; p++)
|
|
80
|
+
switch (g[p].once && this.removeListener(d, g[p].fn, void 0, !0), F) {
|
|
81
81
|
case 1:
|
|
82
82
|
g[p].fn.call(g[p].context);
|
|
83
83
|
break;
|
|
84
84
|
case 2:
|
|
85
|
-
g[p].fn.call(g[p].context,
|
|
85
|
+
g[p].fn.call(g[p].context, m);
|
|
86
86
|
break;
|
|
87
87
|
case 3:
|
|
88
|
-
g[p].fn.call(g[p].context,
|
|
88
|
+
g[p].fn.call(g[p].context, m, s);
|
|
89
89
|
break;
|
|
90
90
|
case 4:
|
|
91
|
-
g[p].fn.call(g[p].context,
|
|
91
|
+
g[p].fn.call(g[p].context, m, s, b);
|
|
92
92
|
break;
|
|
93
93
|
default:
|
|
94
94
|
if (!$) for (T = 1, $ = new Array(F - 1); T < F; T++)
|
|
@@ -97,57 +97,57 @@ var it = { exports: {} };
|
|
|
97
97
|
}
|
|
98
98
|
}
|
|
99
99
|
return !0;
|
|
100
|
-
},
|
|
101
|
-
return i(this,
|
|
102
|
-
},
|
|
103
|
-
return i(this,
|
|
104
|
-
},
|
|
105
|
-
var v = o ? o +
|
|
100
|
+
}, a.prototype.on = function(d, m, s) {
|
|
101
|
+
return i(this, d, m, s, !1);
|
|
102
|
+
}, a.prototype.once = function(d, m, s) {
|
|
103
|
+
return i(this, d, m, s, !0);
|
|
104
|
+
}, a.prototype.removeListener = function(d, m, s, b) {
|
|
105
|
+
var v = o ? o + d : d;
|
|
106
106
|
if (!this._events[v]) return this;
|
|
107
|
-
if (!
|
|
108
|
-
return
|
|
107
|
+
if (!m)
|
|
108
|
+
return c(this, v), this;
|
|
109
109
|
var y = this._events[v];
|
|
110
110
|
if (y.fn)
|
|
111
|
-
y.fn ===
|
|
111
|
+
y.fn === m && (!b || y.once) && (!s || y.context === s) && c(this, v);
|
|
112
112
|
else {
|
|
113
113
|
for (var E = 0, g = [], F = y.length; E < F; E++)
|
|
114
|
-
(y[E].fn !==
|
|
115
|
-
g.length ? this._events[v] = g.length === 1 ? g[0] : g :
|
|
114
|
+
(y[E].fn !== m || b && !y[E].once || s && y[E].context !== s) && g.push(y[E]);
|
|
115
|
+
g.length ? this._events[v] = g.length === 1 ? g[0] : g : c(this, v);
|
|
116
116
|
}
|
|
117
117
|
return this;
|
|
118
|
-
},
|
|
119
|
-
var
|
|
120
|
-
return
|
|
121
|
-
},
|
|
118
|
+
}, a.prototype.removeAllListeners = function(d) {
|
|
119
|
+
var m;
|
|
120
|
+
return d ? (m = o ? o + d : d, this._events[m] && c(this, m)) : (this._events = new n(), this._eventsCount = 0), this;
|
|
121
|
+
}, a.prototype.off = a.prototype.removeListener, a.prototype.addListener = a.prototype.on, a.prefixed = o, a.EventEmitter = a, t.exports = a;
|
|
122
122
|
})(it);
|
|
123
123
|
var Ut = it.exports;
|
|
124
124
|
const qt = /* @__PURE__ */ Dt(Ut);
|
|
125
125
|
function Gt(t) {
|
|
126
|
-
let
|
|
127
|
-
for (;
|
|
128
|
-
const o = window.getComputedStyle(
|
|
129
|
-
if (/(auto|scroll)/.test(o) &&
|
|
130
|
-
return
|
|
131
|
-
|
|
126
|
+
let r = t;
|
|
127
|
+
for (; r; ) {
|
|
128
|
+
const o = window.getComputedStyle(r).overflowY;
|
|
129
|
+
if (/(auto|scroll)/.test(o) && r.scrollHeight > r.clientHeight)
|
|
130
|
+
return r;
|
|
131
|
+
r = r.parentElement;
|
|
132
132
|
}
|
|
133
133
|
return document.scrollingElement || document.documentElement;
|
|
134
134
|
}
|
|
135
|
-
function Kt(t,
|
|
135
|
+
function Kt(t, r = { behavior: "smooth", block: "start" }) {
|
|
136
136
|
if (!t) return;
|
|
137
137
|
const o = Gt(t), n = o.getBoundingClientRect(), i = t.getBoundingClientRect().top - n.top + o.scrollTop;
|
|
138
138
|
o.scrollTo({
|
|
139
|
-
top:
|
|
140
|
-
behavior:
|
|
139
|
+
top: r.block === "start" ? i : i - o.clientHeight + t.offsetHeight,
|
|
140
|
+
behavior: r.behavior
|
|
141
141
|
});
|
|
142
142
|
}
|
|
143
|
-
const
|
|
143
|
+
const _ = (t) => {
|
|
144
144
|
if (!["button", "options", "separator", "dropdown", "overflow"].includes(t.type))
|
|
145
145
|
throw new Error("Invalid toolbar item type - " + t.type);
|
|
146
146
|
if (t.type === "button" && !t.defaultLabel && !t.icon)
|
|
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,
|
|
150
|
+
const o = f($t()), n = t.type, e = f(t.name), i = t.command, c = t.noArgumentCommand, a = f(t.icon), l = f(t.group || "center"), d = f(t.allowWithoutEditor), m = f(t.attributes || {}), s = t.disabled || !1, b = f(t.disabled), v = f(!1), y = f(!1), E = f(t.style), g = f(t.isNarrow), F = f(t.isWide), $ = f(t.minWidth), p = f(t.suppressActiveHighlight || !1), x = 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), Ee = f([]);
|
|
151
151
|
if (t.options) {
|
|
152
152
|
if (!Array.isArray(t.options)) throw new Error("Invalid toolbar item options - " + t.options);
|
|
153
153
|
Ee.value.push(...t.options);
|
|
@@ -159,7 +159,7 @@ const x = (t) => {
|
|
|
159
159
|
}, Le = (se) => {
|
|
160
160
|
b.value = se;
|
|
161
161
|
}, Me = () => {
|
|
162
|
-
b.value =
|
|
162
|
+
b.value = s;
|
|
163
163
|
}, we = t.onActivate || (() => null), ne = t.onDeactivate || (() => null), De = () => {
|
|
164
164
|
const se = {};
|
|
165
165
|
return Object.keys(me).forEach((pe) => {
|
|
@@ -170,11 +170,11 @@ const x = (t) => {
|
|
|
170
170
|
name: e,
|
|
171
171
|
type: n,
|
|
172
172
|
command: i,
|
|
173
|
-
noArgumentCommand:
|
|
174
|
-
icon:
|
|
173
|
+
noArgumentCommand: c,
|
|
174
|
+
icon: a,
|
|
175
175
|
tooltip: Z,
|
|
176
|
-
group:
|
|
177
|
-
attributes:
|
|
176
|
+
group: l,
|
|
177
|
+
attributes: m,
|
|
178
178
|
disabled: b,
|
|
179
179
|
active: v,
|
|
180
180
|
expand: y,
|
|
@@ -183,7 +183,7 @@ const x = (t) => {
|
|
|
183
183
|
isNarrow: g,
|
|
184
184
|
isWide: F,
|
|
185
185
|
minWidth: $,
|
|
186
|
-
argument:
|
|
186
|
+
argument: x,
|
|
187
187
|
parentItem: N,
|
|
188
188
|
iconColor: V,
|
|
189
189
|
hasCaret: te,
|
|
@@ -198,7 +198,7 @@ const x = (t) => {
|
|
|
198
198
|
markName: K,
|
|
199
199
|
labelAttr: ce,
|
|
200
200
|
childItem: T,
|
|
201
|
-
allowWithoutEditor:
|
|
201
|
+
allowWithoutEditor: d,
|
|
202
202
|
dropdownValueKey: _e,
|
|
203
203
|
selectedValue: ue,
|
|
204
204
|
inputRef: xe
|
|
@@ -216,29 +216,29 @@ const x = (t) => {
|
|
|
216
216
|
}, Xt = { class: "alignment-buttons" }, Zt = ["innerHTML"], Yt = ["innerHTML"], Jt = ["innerHTML"], Qt = ["innerHTML"], en = {
|
|
217
217
|
__name: "AlignmentButtons",
|
|
218
218
|
emits: ["select"],
|
|
219
|
-
setup(t, { emit:
|
|
220
|
-
const o =
|
|
219
|
+
setup(t, { emit: r }) {
|
|
220
|
+
const o = r, n = (e) => {
|
|
221
221
|
o("select", e);
|
|
222
222
|
};
|
|
223
223
|
return (e, i) => (w(), C("div", Xt, [
|
|
224
224
|
k("div", {
|
|
225
225
|
class: "button-icon",
|
|
226
|
-
onClick: i[0] || (i[0] = (
|
|
226
|
+
onClick: i[0] || (i[0] = (c) => n("left")),
|
|
227
227
|
innerHTML: D(X).alignLeft
|
|
228
228
|
}, null, 8, Zt),
|
|
229
229
|
k("div", {
|
|
230
230
|
class: "button-icon",
|
|
231
|
-
onClick: i[1] || (i[1] = (
|
|
231
|
+
onClick: i[1] || (i[1] = (c) => n("center")),
|
|
232
232
|
innerHTML: D(X).alignCenter
|
|
233
233
|
}, null, 8, Yt),
|
|
234
234
|
k("div", {
|
|
235
235
|
class: "button-icon",
|
|
236
|
-
onClick: i[2] || (i[2] = (
|
|
236
|
+
onClick: i[2] || (i[2] = (c) => n("right")),
|
|
237
237
|
innerHTML: D(X).alignRight
|
|
238
238
|
}, null, 8, Jt),
|
|
239
239
|
k("div", {
|
|
240
240
|
class: "button-icon",
|
|
241
|
-
onClick: i[3] || (i[3] = (
|
|
241
|
+
onClick: i[3] || (i[3] = (c) => n("justify")),
|
|
242
242
|
innerHTML: D(X).alignJustify
|
|
243
243
|
}, null, 8, Qt)
|
|
244
244
|
]));
|
|
@@ -281,28 +281,28 @@ const x = (t) => {
|
|
|
281
281
|
}
|
|
282
282
|
},
|
|
283
283
|
emits: ["submit", "cancel"],
|
|
284
|
-
setup(t, { emit:
|
|
285
|
-
const o =
|
|
286
|
-
if (e?.$submit instanceof Function && e.$submit(),
|
|
287
|
-
o("submit", { text:
|
|
284
|
+
setup(t, { emit: r }) {
|
|
285
|
+
const o = r, n = t, { proxy: e } = Rt(), i = () => {
|
|
286
|
+
if (e?.$submit instanceof Function && e.$submit(), d.value && s.value) {
|
|
287
|
+
o("submit", { text: l.value, href: m.value });
|
|
288
288
|
return;
|
|
289
|
-
} else if (!
|
|
290
|
-
o("submit", { text:
|
|
289
|
+
} else if (!d.value) {
|
|
290
|
+
o("submit", { text: l.value, href: null });
|
|
291
291
|
return;
|
|
292
292
|
}
|
|
293
|
-
console.debug("[LinkInput] Invalid URL in handleSubmit"),
|
|
294
|
-
},
|
|
295
|
-
o("submit", { text:
|
|
296
|
-
},
|
|
297
|
-
const p =
|
|
298
|
-
return
|
|
299
|
-
}), b = j(() => y.value ? "Apply" : "Remove"), v = j(() => !
|
|
300
|
-
window.open(
|
|
293
|
+
console.debug("[LinkInput] Invalid URL in handleSubmit"), a.value = !0;
|
|
294
|
+
}, c = () => {
|
|
295
|
+
o("submit", { text: l.value, href: null });
|
|
296
|
+
}, a = f(!1), l = f(n.initialText), d = f(n.href), m = j(() => d.value?.startsWith("http") ? d.value : "http://" + d.value), s = j(() => {
|
|
297
|
+
const p = m.value.split(".").filter(Boolean);
|
|
298
|
+
return m.value.includes(".") && p.length > 1;
|
|
299
|
+
}), b = j(() => y.value ? "Apply" : "Remove"), v = j(() => !s.value), y = j(() => !E.value), E = j(() => n.href && !d.value), g = j(() => n.href.startsWith("#")), F = () => {
|
|
300
|
+
window.open(m.value, "_blank");
|
|
301
301
|
};
|
|
302
302
|
Ot(
|
|
303
303
|
() => n.href,
|
|
304
304
|
(p) => {
|
|
305
|
-
|
|
305
|
+
d.value = p;
|
|
306
306
|
}
|
|
307
307
|
);
|
|
308
308
|
const $ = () => {
|
|
@@ -311,7 +311,7 @@ const x = (t) => {
|
|
|
311
311
|
};
|
|
312
312
|
return ke(() => {
|
|
313
313
|
n.showInput && $();
|
|
314
|
-
}), (p,
|
|
314
|
+
}), (p, x) => (w(), C("div", nn, [
|
|
315
315
|
t.href ? g.value ? (w(), C("div", sn, "Page anchor")) : (w(), C("div", ln, "Edit link")) : (w(), C("div", on, "Add link")),
|
|
316
316
|
t.showInput && !g.value ? (w(), C("div", an, [
|
|
317
317
|
k("div", rn, [
|
|
@@ -322,17 +322,17 @@ const x = (t) => {
|
|
|
322
322
|
Je(k("input", {
|
|
323
323
|
type: "text",
|
|
324
324
|
placeholder: "Type or paste a link",
|
|
325
|
-
class: oe({ error:
|
|
326
|
-
"onUpdate:modelValue":
|
|
325
|
+
class: oe({ error: a.value }),
|
|
326
|
+
"onUpdate:modelValue": x[0] || (x[0] = (T) => d.value = T),
|
|
327
327
|
onKeydown: [
|
|
328
328
|
Qe(ge(i, ["stop", "prevent"]), ["enter"]),
|
|
329
|
-
|
|
329
|
+
x[1] || (x[1] = (T) => a.value = !1)
|
|
330
330
|
]
|
|
331
331
|
}, null, 42, dn), [
|
|
332
|
-
[et,
|
|
332
|
+
[et, d.value]
|
|
333
333
|
]),
|
|
334
334
|
k("div", {
|
|
335
|
-
class: oe(["open-link-icon", { disabled: !
|
|
335
|
+
class: oe(["open-link-icon", { disabled: !s.value }]),
|
|
336
336
|
innerHTML: D(X).openLink,
|
|
337
337
|
onClick: F
|
|
338
338
|
}, null, 10, un)
|
|
@@ -341,13 +341,13 @@ const x = (t) => {
|
|
|
341
341
|
t.href ? (w(), C("button", {
|
|
342
342
|
key: 0,
|
|
343
343
|
class: "remove-btn",
|
|
344
|
-
onClick:
|
|
344
|
+
onClick: c
|
|
345
345
|
}, [
|
|
346
346
|
k("div", {
|
|
347
347
|
class: "remove-btn__icon",
|
|
348
348
|
innerHTML: D(X).removeLink
|
|
349
349
|
}, null, 8, pn),
|
|
350
|
-
|
|
350
|
+
x[3] || (x[3] = tt(" Remove "))
|
|
351
351
|
])) : Q("", !0),
|
|
352
352
|
y.value ? (w(), C("button", {
|
|
353
353
|
key: 1,
|
|
@@ -357,7 +357,7 @@ const x = (t) => {
|
|
|
357
357
|
])
|
|
358
358
|
])) : g.value ? (w(), C("div", hn, [
|
|
359
359
|
k("a", {
|
|
360
|
-
onClick:
|
|
360
|
+
onClick: x[2] || (x[2] = ge((...T) => t.goToAnchor && t.goToAnchor(...T), ["stop", "prevent"]))
|
|
361
361
|
}, "Go to " + ie(t.href.startsWith("#_") ? t.href.substring(2) : t.href), 1)
|
|
362
362
|
])) : Q("", !0)
|
|
363
363
|
]));
|
|
@@ -370,24 +370,24 @@ const x = (t) => {
|
|
|
370
370
|
}
|
|
371
371
|
},
|
|
372
372
|
emits: ["select"],
|
|
373
|
-
setup(t, { emit:
|
|
374
|
-
const o =
|
|
373
|
+
setup(t, { emit: r }) {
|
|
374
|
+
const o = r, n = (e) => {
|
|
375
375
|
o("select", e);
|
|
376
376
|
};
|
|
377
377
|
return (e, i) => (w(), C("div", gn, [
|
|
378
|
-
(w(!0), C(U, null, ee(t.options, (
|
|
379
|
-
class: oe(["option-item", { disabled:
|
|
380
|
-
onClick: (
|
|
378
|
+
(w(!0), C(U, null, ee(t.options, (c) => (w(), C("div", {
|
|
379
|
+
class: oe(["option-item", { disabled: c.disabled }]),
|
|
380
|
+
onClick: (a) => n(c)
|
|
381
381
|
}, [
|
|
382
382
|
k("div", bn, [
|
|
383
383
|
k("div", {
|
|
384
384
|
class: "icon-column__icon",
|
|
385
|
-
innerHTML:
|
|
385
|
+
innerHTML: c.icon
|
|
386
386
|
}, null, 8, wn)
|
|
387
387
|
]),
|
|
388
388
|
k("div", Cn, [
|
|
389
|
-
k("div", kn, ie(
|
|
390
|
-
k("div", _n, ie(
|
|
389
|
+
k("div", kn, ie(c.label), 1),
|
|
390
|
+
k("div", _n, ie(c.description), 1)
|
|
391
391
|
])
|
|
392
392
|
], 10, yn))), 256))
|
|
393
393
|
]));
|
|
@@ -404,19 +404,19 @@ const x = (t) => {
|
|
|
404
404
|
}
|
|
405
405
|
},
|
|
406
406
|
emits: ["select"],
|
|
407
|
-
setup(t, { emit:
|
|
408
|
-
const o =
|
|
407
|
+
setup(t, { emit: r }) {
|
|
408
|
+
const o = r, n = t, e = (i) => {
|
|
409
409
|
o("select", i);
|
|
410
410
|
};
|
|
411
|
-
return (i,
|
|
412
|
-
(w(!0), C(U, null, ee(D(Ze)(t.editor), (
|
|
411
|
+
return (i, c) => n.editor ? (w(), C("div", Sn, [
|
|
412
|
+
(w(!0), C(U, null, ee(D(Ze)(t.editor), (a) => (w(), C("div", {
|
|
413
413
|
class: "style-item",
|
|
414
|
-
onClick: (
|
|
414
|
+
onClick: (l) => e(a)
|
|
415
415
|
}, [
|
|
416
416
|
k("div", {
|
|
417
417
|
class: "style-name",
|
|
418
|
-
style: J(D(wt)(
|
|
419
|
-
}, ie(
|
|
418
|
+
style: J(D(wt)(a, null, !1))
|
|
419
|
+
}, ie(a.definition.attrs.name), 5)
|
|
420
420
|
], 8, An))), 256))
|
|
421
421
|
])) : Q("", !0);
|
|
422
422
|
}
|
|
@@ -433,31 +433,31 @@ const x = (t) => {
|
|
|
433
433
|
}
|
|
434
434
|
},
|
|
435
435
|
emits: ["select"],
|
|
436
|
-
setup(t, { emit:
|
|
437
|
-
const o =
|
|
438
|
-
o("select",
|
|
436
|
+
setup(t, { emit: r }) {
|
|
437
|
+
const o = r, n = t, e = j(() => (a) => n.activeColor.value ? n.activeColor.value.toUpperCase() === a.value : !1), i = (a, l) => l === 5 || ["#FFFFFF", "#FAFF09"].includes(a) ? { color: "#000" } : { color: "#FFF" }, c = (a) => {
|
|
438
|
+
o("select", a.value);
|
|
439
439
|
};
|
|
440
440
|
return ke(() => {
|
|
441
|
-
if (!n.icons.every((
|
|
442
|
-
}), (
|
|
441
|
+
if (!n.icons.every((l) => Array.isArray(l))) throw new Error("icon props must be 2d array");
|
|
442
|
+
}), (a, l) => (w(!0), C(U, null, ee(t.icons, (d, m) => (w(), C("div", {
|
|
443
443
|
class: "option-row",
|
|
444
|
-
key:
|
|
444
|
+
key: m
|
|
445
445
|
}, [
|
|
446
|
-
(w(!0), C(U, null, ee(
|
|
446
|
+
(w(!0), C(U, null, ee(d, (s, b) => (w(), C("div", {
|
|
447
447
|
class: "option",
|
|
448
448
|
key: b,
|
|
449
|
-
onClick: ge((v) =>
|
|
449
|
+
onClick: ge((v) => c(s), ["stop", "prevent"])
|
|
450
450
|
}, [
|
|
451
451
|
k("div", {
|
|
452
452
|
class: "option__icon",
|
|
453
|
-
innerHTML:
|
|
454
|
-
style: J(
|
|
453
|
+
innerHTML: s.icon,
|
|
454
|
+
style: J(s.style)
|
|
455
455
|
}, null, 12, Ln),
|
|
456
|
-
e.value(
|
|
456
|
+
e.value(s) ? (w(), C("div", {
|
|
457
457
|
key: 0,
|
|
458
458
|
class: "option__check",
|
|
459
459
|
innerHTML: D(X).colorOptionCheck,
|
|
460
|
-
style: J(i(
|
|
460
|
+
style: J(i(s.value, b))
|
|
461
461
|
}, null, 12, Mn)) : Q("", !0)
|
|
462
462
|
], 8, In))), 128))
|
|
463
463
|
]))), 128));
|
|
@@ -484,15 +484,15 @@ const x = (t) => {
|
|
|
484
484
|
}
|
|
485
485
|
},
|
|
486
486
|
emits: ["select", "clickoutside"],
|
|
487
|
-
setup(t, { emit:
|
|
488
|
-
const o =
|
|
487
|
+
setup(t, { emit: r }) {
|
|
488
|
+
const o = r, n = (e) => {
|
|
489
489
|
o("select", e);
|
|
490
490
|
};
|
|
491
491
|
return (e, i) => (w(), C("div", Hn, [
|
|
492
492
|
t.hasNoneIcon ? (w(), C("div", {
|
|
493
493
|
key: 0,
|
|
494
494
|
class: "none-option",
|
|
495
|
-
onClick: i[0] || (i[0] = (
|
|
495
|
+
onClick: i[0] || (i[0] = (c) => n("none"))
|
|
496
496
|
}, [
|
|
497
497
|
k("span", {
|
|
498
498
|
innerHTML: D($n),
|
|
@@ -519,8 +519,8 @@ const x = (t) => {
|
|
|
519
519
|
}
|
|
520
520
|
}, Nn = /* @__PURE__ */ q(On, [["__scopeId", "data-v-47b783db"]]), zn = (t) => {
|
|
521
521
|
t.expand.value = !1;
|
|
522
|
-
}, h = (t,
|
|
523
|
-
label:
|
|
522
|
+
}, h = (t, r = null) => ({
|
|
523
|
+
label: r,
|
|
524
524
|
icon: X.colorOption,
|
|
525
525
|
value: t,
|
|
526
526
|
style: {
|
|
@@ -528,15 +528,15 @@ const x = (t) => {
|
|
|
528
528
|
boxShadow: "0 0 5px 1px rgba(0, 0, 0, 0.1)",
|
|
529
529
|
borderRadius: "50%"
|
|
530
530
|
}
|
|
531
|
-
}), Ve = (t,
|
|
531
|
+
}), Ve = (t, r, o = [], n = !1) => {
|
|
532
532
|
const e = (i) => {
|
|
533
|
-
|
|
533
|
+
r.iconColor.value = i, t.emitCommand({ item: r, argument: i }), zn(r);
|
|
534
534
|
};
|
|
535
535
|
return B("div", {}, [
|
|
536
536
|
B(Nn, {
|
|
537
537
|
icons: st,
|
|
538
538
|
customIcons: o,
|
|
539
|
-
activeColor:
|
|
539
|
+
activeColor: r.iconColor,
|
|
540
540
|
hasNoneIcon: n,
|
|
541
541
|
onSelect: e
|
|
542
542
|
})
|
|
@@ -617,34 +617,34 @@ const x = (t) => {
|
|
|
617
617
|
], Vn = () => st.flat().map((t) => t.value), Wn = { class: "toolbar-table-grid-wrapper" }, Pn = ["data-cols", "data-rows", "onClick"], jn = { class: "toolbar-table-grid-value" }, Un = {
|
|
618
618
|
__name: "TableGrid",
|
|
619
619
|
emits: ["select", "clickoutside"],
|
|
620
|
-
setup(t, { emit:
|
|
621
|
-
const o =
|
|
622
|
-
let
|
|
623
|
-
if (!!
|
|
620
|
+
setup(t, { emit: r }) {
|
|
621
|
+
const o = r, n = f(0), e = f(0), i = (a) => {
|
|
622
|
+
let l = a.target;
|
|
623
|
+
if (!!l.dataset.grid)
|
|
624
624
|
return;
|
|
625
|
-
let
|
|
625
|
+
let s = [...l.parentElement.querySelectorAll("[data-item]")], b = parseInt(l.dataset.cols, 10), v = parseInt(l.dataset.rows, 10);
|
|
626
626
|
e.value = b, n.value = v;
|
|
627
|
-
for (let y = 0; y <
|
|
628
|
-
let E =
|
|
627
|
+
for (let y = 0; y < s.length; y++) {
|
|
628
|
+
let E = s[y], g = parseInt(E.dataset.cols, 10), F = parseInt(E.dataset.rows, 10);
|
|
629
629
|
g <= b && F <= v ? E.classList.add("selected") : E.classList.remove("selected");
|
|
630
630
|
}
|
|
631
|
-
},
|
|
632
|
-
o("select", { cols:
|
|
631
|
+
}, c = ({ cols: a, rows: l }) => {
|
|
632
|
+
o("select", { cols: a, rows: l });
|
|
633
633
|
};
|
|
634
|
-
return (
|
|
634
|
+
return (a, l) => (w(), C("div", Wn, [
|
|
635
635
|
k("div", {
|
|
636
636
|
class: "toolbar-table-grid",
|
|
637
637
|
onMouseover: i,
|
|
638
638
|
"data-grid": "true"
|
|
639
639
|
}, [
|
|
640
|
-
(w(), C(U, null, ee(5, (
|
|
641
|
-
(w(), C(U, null, ee(5, (
|
|
640
|
+
(w(), C(U, null, ee(5, (d) => (w(), C(U, { key: d }, [
|
|
641
|
+
(w(), C(U, null, ee(5, (m) => k("div", {
|
|
642
642
|
class: "toolbar-table-grid__item",
|
|
643
|
-
key: `${
|
|
644
|
-
"data-cols":
|
|
645
|
-
"data-rows":
|
|
643
|
+
key: `${d}_${m}`,
|
|
644
|
+
"data-cols": m,
|
|
645
|
+
"data-rows": d,
|
|
646
646
|
"data-item": "true",
|
|
647
|
-
onClick: ge((
|
|
647
|
+
onClick: ge((s) => c({ cols: m, rows: d }), ["stop", "prevent"])
|
|
648
648
|
}, null, 8, Pn)), 64))
|
|
649
649
|
], 64))), 64))
|
|
650
650
|
], 32),
|
|
@@ -659,22 +659,22 @@ const x = (t) => {
|
|
|
659
659
|
}
|
|
660
660
|
},
|
|
661
661
|
emits: ["select"],
|
|
662
|
-
setup(t, { emit:
|
|
663
|
-
const o =
|
|
662
|
+
setup(t, { emit: r }) {
|
|
663
|
+
const o = r, n = (e) => {
|
|
664
664
|
o("select", { command: e.command });
|
|
665
665
|
};
|
|
666
666
|
return (e, i) => (w(), C("div", Gn, [
|
|
667
|
-
(w(!0), C(U, null, ee(t.options, (
|
|
668
|
-
class: oe(["toolbar-table-actions__item", { "toolbar-table-actions__item--border":
|
|
669
|
-
onClick: (
|
|
667
|
+
(w(!0), C(U, null, ee(t.options, (c) => (w(), C("div", {
|
|
668
|
+
class: oe(["toolbar-table-actions__item", { "toolbar-table-actions__item--border": c.bottomBorder }]),
|
|
669
|
+
onClick: (a) => n(c)
|
|
670
670
|
}, [
|
|
671
671
|
k("div", Xn, [
|
|
672
672
|
k("div", {
|
|
673
673
|
class: "toolbar-table-actions__icon-wrapper",
|
|
674
|
-
innerHTML:
|
|
674
|
+
innerHTML: c.icon
|
|
675
675
|
}, null, 8, Zn)
|
|
676
676
|
]),
|
|
677
|
-
k("div", Yn, ie(
|
|
677
|
+
k("div", Yn, ie(c.label), 1)
|
|
678
678
|
], 10, Kn))), 256))
|
|
679
679
|
]));
|
|
680
680
|
}
|
|
@@ -687,15 +687,15 @@ const x = (t) => {
|
|
|
687
687
|
}
|
|
688
688
|
},
|
|
689
689
|
emits: ["submit"],
|
|
690
|
-
setup(t, { emit:
|
|
691
|
-
const o = f(""), n =
|
|
690
|
+
setup(t, { emit: r }) {
|
|
691
|
+
const o = f(""), n = r, e = () => {
|
|
692
692
|
n("submit", { value: o.value });
|
|
693
693
|
};
|
|
694
|
-
return (i,
|
|
694
|
+
return (i, c) => (w(), C("div", to, [
|
|
695
695
|
k("div", no, [
|
|
696
696
|
Je(k("input", {
|
|
697
697
|
ref: t.searchRef,
|
|
698
|
-
"onUpdate:modelValue":
|
|
698
|
+
"onUpdate:modelValue": c[0] || (c[0] = (a) => o.value = a),
|
|
699
699
|
class: "search-input",
|
|
700
700
|
type: "text",
|
|
701
701
|
name: "search",
|
|
@@ -715,14 +715,14 @@ const x = (t) => {
|
|
|
715
715
|
}
|
|
716
716
|
}, so = /* @__PURE__ */ q(io, [["__scopeId", "data-v-af870fbd"]]), ae = (t) => {
|
|
717
717
|
t.expand.value = !1;
|
|
718
|
-
}, lo = (t,
|
|
719
|
-
const i =
|
|
718
|
+
}, lo = (t, r = !1, o, n, e) => {
|
|
719
|
+
const i = _({
|
|
720
720
|
type: "button",
|
|
721
721
|
name: "bold",
|
|
722
722
|
command: "toggleBold",
|
|
723
723
|
icon: e.bold,
|
|
724
724
|
tooltip: "Bold"
|
|
725
|
-
}),
|
|
725
|
+
}), c = _({
|
|
726
726
|
type: "dropdown",
|
|
727
727
|
name: "fontFamily",
|
|
728
728
|
tooltip: "Font",
|
|
@@ -769,11 +769,11 @@ const x = (t) => {
|
|
|
769
769
|
}
|
|
770
770
|
}
|
|
771
771
|
],
|
|
772
|
-
onActivate: ({ fontFamily:
|
|
773
|
-
|
|
772
|
+
onActivate: ({ fontFamily: u }) => {
|
|
773
|
+
u && (c.label.value = u);
|
|
774
774
|
},
|
|
775
|
-
onDeactivate: () =>
|
|
776
|
-
}),
|
|
775
|
+
onDeactivate: () => c.label.value = c.defaultLabel.value
|
|
776
|
+
}), a = _({
|
|
777
777
|
type: "dropdown",
|
|
778
778
|
dropdownStyles: {
|
|
779
779
|
padding: 0,
|
|
@@ -791,10 +791,10 @@ const x = (t) => {
|
|
|
791
791
|
type: "render",
|
|
792
792
|
key: "ai",
|
|
793
793
|
render: () => {
|
|
794
|
-
let
|
|
794
|
+
let u = "";
|
|
795
795
|
if (t.activeEditor) {
|
|
796
796
|
const { state: A } = t.activeEditor, { from: W, to: le, empty: gt } = A.selection;
|
|
797
|
-
|
|
797
|
+
u = gt ? "" : A.doc.textBetween(W, le);
|
|
798
798
|
}
|
|
799
799
|
return B(
|
|
800
800
|
"div",
|
|
@@ -802,9 +802,9 @@ const x = (t) => {
|
|
|
802
802
|
[
|
|
803
803
|
B(jt, {
|
|
804
804
|
handleClose: () => {
|
|
805
|
-
ae(
|
|
805
|
+
ae(a);
|
|
806
806
|
},
|
|
807
|
-
selectedText:
|
|
807
|
+
selectedText: u,
|
|
808
808
|
editor: t.activeEditor,
|
|
809
809
|
apiKey: t.config.aiApiKey,
|
|
810
810
|
endpoint: t.config.aiEndpoint,
|
|
@@ -815,7 +815,7 @@ const x = (t) => {
|
|
|
815
815
|
}
|
|
816
816
|
}
|
|
817
817
|
]
|
|
818
|
-
}),
|
|
818
|
+
}), l = _({
|
|
819
819
|
type: "dropdown",
|
|
820
820
|
name: "fontSize",
|
|
821
821
|
defaultLabel: "12",
|
|
@@ -846,29 +846,29 @@ const x = (t) => {
|
|
|
846
846
|
{ label: "72", key: "72pt" },
|
|
847
847
|
{ label: "96", key: "96pt" }
|
|
848
848
|
],
|
|
849
|
-
onActivate: ({ fontSize:
|
|
850
|
-
if (!
|
|
851
|
-
let S = Wt(
|
|
852
|
-
S < 8 && (S = 8), S > 96 && (S = 96),
|
|
849
|
+
onActivate: ({ fontSize: u }) => {
|
|
850
|
+
if (!u) return l.label.value = l.defaultLabel.value;
|
|
851
|
+
let S = Wt(u, 12);
|
|
852
|
+
S < 8 && (S = 8), S > 96 && (S = 96), l.label.value = String(S);
|
|
853
853
|
},
|
|
854
|
-
onDeactivate: () =>
|
|
855
|
-
}),
|
|
854
|
+
onDeactivate: () => l.label.value = l.defaultLabel.value
|
|
855
|
+
}), d = _({
|
|
856
856
|
type: "separator",
|
|
857
857
|
name: "separator",
|
|
858
858
|
isNarrow: !0
|
|
859
|
-
}),
|
|
859
|
+
}), m = _({
|
|
860
860
|
type: "button",
|
|
861
861
|
name: "italic",
|
|
862
862
|
command: "toggleItalic",
|
|
863
863
|
icon: e.italic,
|
|
864
864
|
tooltip: "Italic"
|
|
865
|
-
}),
|
|
865
|
+
}), s = _({
|
|
866
866
|
type: "button",
|
|
867
867
|
name: "underline",
|
|
868
868
|
command: "toggleUnderline",
|
|
869
869
|
icon: e.underline,
|
|
870
870
|
tooltip: "Underline"
|
|
871
|
-
}), b =
|
|
871
|
+
}), b = _({
|
|
872
872
|
type: "dropdown",
|
|
873
873
|
name: "highlight",
|
|
874
874
|
icon: e.highlight,
|
|
@@ -886,11 +886,11 @@ const x = (t) => {
|
|
|
886
886
|
render: () => Ve(t, b, [], !0)
|
|
887
887
|
}
|
|
888
888
|
],
|
|
889
|
-
onActivate: ({ color:
|
|
890
|
-
b.iconColor.value =
|
|
889
|
+
onActivate: ({ color: u }) => {
|
|
890
|
+
b.iconColor.value = u || "";
|
|
891
891
|
},
|
|
892
892
|
onDeactivate: () => b.iconColor.value = ""
|
|
893
|
-
}), v =
|
|
893
|
+
}), v = _({
|
|
894
894
|
type: "dropdown",
|
|
895
895
|
name: "color",
|
|
896
896
|
icon: e.color,
|
|
@@ -907,11 +907,11 @@ const x = (t) => {
|
|
|
907
907
|
render: () => Ve(t, v)
|
|
908
908
|
}
|
|
909
909
|
],
|
|
910
|
-
onActivate: ({ color:
|
|
911
|
-
v.iconColor.value =
|
|
910
|
+
onActivate: ({ color: u }) => {
|
|
911
|
+
v.iconColor.value = u;
|
|
912
912
|
},
|
|
913
913
|
onDeactivate: () => v.iconColor.value = "#000"
|
|
914
|
-
}), y = f(null), E =
|
|
914
|
+
}), y = f(null), E = _({
|
|
915
915
|
type: "dropdown",
|
|
916
916
|
name: "search",
|
|
917
917
|
icon: e.search,
|
|
@@ -932,7 +932,7 @@ const x = (t) => {
|
|
|
932
932
|
},
|
|
933
933
|
searchRef: y
|
|
934
934
|
})
|
|
935
|
-
]), F =
|
|
935
|
+
]), F = _({
|
|
936
936
|
type: "dropdown",
|
|
937
937
|
name: "link",
|
|
938
938
|
markName: "link",
|
|
@@ -945,44 +945,44 @@ const x = (t) => {
|
|
|
945
945
|
render: () => $(F)
|
|
946
946
|
}
|
|
947
947
|
],
|
|
948
|
-
onActivate: ({ href:
|
|
949
|
-
|
|
948
|
+
onActivate: ({ href: u }) => {
|
|
949
|
+
u ? F.attributes.value = { href: u } : F.attributes.value = {}, F.expand.value = !0;
|
|
950
950
|
},
|
|
951
951
|
onDeactivate: () => {
|
|
952
952
|
F.attributes.value = {}, F.expand.value = !1;
|
|
953
953
|
}
|
|
954
954
|
});
|
|
955
|
-
function $(
|
|
955
|
+
function $(u) {
|
|
956
956
|
return B("div", {}, [
|
|
957
957
|
B(vn, {
|
|
958
958
|
onSubmit: ({ href: A }) => {
|
|
959
|
-
ae(
|
|
960
|
-
const W = { ...
|
|
961
|
-
t.emitCommand({ item: W, argument: { href: A, text: "" } }), A || (
|
|
959
|
+
ae(u), u.attributes.value.link = { href: A };
|
|
960
|
+
const W = { ...u, command: "toggleLink" };
|
|
961
|
+
t.emitCommand({ item: W, argument: { href: A, text: "" } }), A || (u.active.value = !1);
|
|
962
962
|
},
|
|
963
|
-
href:
|
|
963
|
+
href: u.attributes.value.href,
|
|
964
964
|
goToAnchor: () => {
|
|
965
|
-
if (ae(
|
|
966
|
-
const A =
|
|
965
|
+
if (ae(u), !t.activeEditor || !u.attributes.value?.href) return;
|
|
966
|
+
const A = u.attributes.value?.href?.slice(1), le = t.activeEditor.element.querySelector(`a[name='${A}']`);
|
|
967
967
|
le && Kt(le);
|
|
968
968
|
}
|
|
969
969
|
})
|
|
970
970
|
]);
|
|
971
971
|
}
|
|
972
|
-
const p =
|
|
972
|
+
const p = _({
|
|
973
973
|
type: "options",
|
|
974
974
|
name: "linkInput",
|
|
975
975
|
command: "toggleLink"
|
|
976
976
|
});
|
|
977
977
|
F.childItem = p, p.parentItem = F;
|
|
978
|
-
const
|
|
978
|
+
const x = _({
|
|
979
979
|
type: "button",
|
|
980
980
|
name: "image",
|
|
981
981
|
command: "startImageUpload",
|
|
982
982
|
icon: e.image,
|
|
983
983
|
tooltip: "Image",
|
|
984
984
|
disabled: !1
|
|
985
|
-
}), T =
|
|
985
|
+
}), T = _({
|
|
986
986
|
type: "dropdown",
|
|
987
987
|
name: "table",
|
|
988
988
|
icon: e.table,
|
|
@@ -999,16 +999,16 @@ const x = (t) => {
|
|
|
999
999
|
}
|
|
1000
1000
|
]
|
|
1001
1001
|
});
|
|
1002
|
-
function N(
|
|
1002
|
+
function N(u) {
|
|
1003
1003
|
return B("div", {}, [
|
|
1004
1004
|
B(qn, {
|
|
1005
1005
|
onSelect: (A) => {
|
|
1006
|
-
t.emitCommand({ item:
|
|
1006
|
+
t.emitCommand({ item: u, argument: A }), ae(u);
|
|
1007
1007
|
}
|
|
1008
1008
|
})
|
|
1009
1009
|
]);
|
|
1010
1010
|
}
|
|
1011
|
-
const V =
|
|
1011
|
+
const V = _({
|
|
1012
1012
|
type: "dropdown",
|
|
1013
1013
|
name: "tableActions",
|
|
1014
1014
|
command: "executeTableCommand",
|
|
@@ -1080,17 +1080,17 @@ const x = (t) => {
|
|
|
1080
1080
|
icon: e.fixTables
|
|
1081
1081
|
}
|
|
1082
1082
|
];
|
|
1083
|
-
function ye(
|
|
1083
|
+
function ye(u) {
|
|
1084
1084
|
return B(Qn, {
|
|
1085
1085
|
options: te,
|
|
1086
1086
|
onSelect: (S) => {
|
|
1087
|
-
ae(
|
|
1087
|
+
ae(u);
|
|
1088
1088
|
const { command: A } = S;
|
|
1089
|
-
t.emitCommand({ item:
|
|
1089
|
+
t.emitCommand({ item: u, argument: { command: A } });
|
|
1090
1090
|
}
|
|
1091
1091
|
});
|
|
1092
1092
|
}
|
|
1093
|
-
const Z =
|
|
1093
|
+
const Z = _({
|
|
1094
1094
|
type: "dropdown",
|
|
1095
1095
|
name: "textAlign",
|
|
1096
1096
|
tooltip: "Alignment",
|
|
@@ -1115,53 +1115,53 @@ const x = (t) => {
|
|
|
1115
1115
|
key: "alignment"
|
|
1116
1116
|
}
|
|
1117
1117
|
],
|
|
1118
|
-
onActivate: ({ textAlign:
|
|
1119
|
-
re(Z,
|
|
1118
|
+
onActivate: ({ textAlign: u }) => {
|
|
1119
|
+
re(Z, u);
|
|
1120
1120
|
},
|
|
1121
1121
|
onDeactivate: () => {
|
|
1122
1122
|
re(Z, "left");
|
|
1123
1123
|
}
|
|
1124
|
-
}), re = (
|
|
1124
|
+
}), re = (u, S) => {
|
|
1125
1125
|
let A = S === "both" ? "justify" : S, W = {
|
|
1126
1126
|
left: e.alignLeft,
|
|
1127
1127
|
right: e.alignRight,
|
|
1128
1128
|
center: e.alignCenter,
|
|
1129
1129
|
justify: e.alignJustify
|
|
1130
1130
|
}, le = W[A] ?? W.left;
|
|
1131
|
-
|
|
1132
|
-
}, be =
|
|
1131
|
+
u.icon.value = le;
|
|
1132
|
+
}, be = _({
|
|
1133
1133
|
type: "button",
|
|
1134
1134
|
name: "list",
|
|
1135
1135
|
command: "toggleBulletList",
|
|
1136
1136
|
icon: e.bulletList,
|
|
1137
1137
|
tooltip: "Bullet list"
|
|
1138
|
-
}), I =
|
|
1138
|
+
}), I = _({
|
|
1139
1139
|
type: "button",
|
|
1140
1140
|
name: "numberedlist",
|
|
1141
1141
|
command: "toggleOrderedList",
|
|
1142
1142
|
icon: e.numberedList,
|
|
1143
1143
|
tooltip: "Numbered list"
|
|
1144
|
-
}), M =
|
|
1144
|
+
}), M = _({
|
|
1145
1145
|
type: "button",
|
|
1146
1146
|
name: "indentleft",
|
|
1147
1147
|
command: "decreaseTextIndent",
|
|
1148
1148
|
icon: e.indentLeft,
|
|
1149
1149
|
tooltip: "Left indent",
|
|
1150
1150
|
disabled: !1
|
|
1151
|
-
}), H =
|
|
1151
|
+
}), H = _({
|
|
1152
1152
|
type: "button",
|
|
1153
1153
|
name: "indentright",
|
|
1154
1154
|
command: "increaseTextIndent",
|
|
1155
1155
|
icon: e.indentRight,
|
|
1156
1156
|
tooltip: "Right indent",
|
|
1157
1157
|
disabled: !1
|
|
1158
|
-
}), R =
|
|
1158
|
+
}), R = _({
|
|
1159
1159
|
type: "overflow",
|
|
1160
1160
|
name: "overflow",
|
|
1161
1161
|
command: "toggleOverflow",
|
|
1162
1162
|
icon: e.overflow,
|
|
1163
1163
|
disabled: !1
|
|
1164
|
-
}), G =
|
|
1164
|
+
}), G = _({
|
|
1165
1165
|
type: "dropdown",
|
|
1166
1166
|
name: "zoom",
|
|
1167
1167
|
allowWithoutEditor: !0,
|
|
@@ -1182,10 +1182,10 @@ const x = (t) => {
|
|
|
1182
1182
|
{ label: "150%", key: 1.5 },
|
|
1183
1183
|
{ label: "200%", key: 2 }
|
|
1184
1184
|
],
|
|
1185
|
-
onActivate: ({ zoom:
|
|
1186
|
-
|
|
1185
|
+
onActivate: ({ zoom: u }) => {
|
|
1186
|
+
u && (G.label.value = u);
|
|
1187
1187
|
}
|
|
1188
|
-
}), K =
|
|
1188
|
+
}), K = _({
|
|
1189
1189
|
type: "button",
|
|
1190
1190
|
name: "undo",
|
|
1191
1191
|
disabled: !0,
|
|
@@ -1196,7 +1196,7 @@ const x = (t) => {
|
|
|
1196
1196
|
onDeactivate: () => {
|
|
1197
1197
|
K.disabled.value = !t.undoDepth;
|
|
1198
1198
|
}
|
|
1199
|
-
}), ce =
|
|
1199
|
+
}), ce = _({
|
|
1200
1200
|
type: "button",
|
|
1201
1201
|
disabled: !0,
|
|
1202
1202
|
name: "redo",
|
|
@@ -1207,7 +1207,7 @@ const x = (t) => {
|
|
|
1207
1207
|
onDeactivate: () => {
|
|
1208
1208
|
ce.disabled.value = !t.redoDepth;
|
|
1209
1209
|
}
|
|
1210
|
-
}), ue =
|
|
1210
|
+
}), ue = _({
|
|
1211
1211
|
type: "button",
|
|
1212
1212
|
disabled: !1,
|
|
1213
1213
|
name: "toggleTrackChanges",
|
|
@@ -1215,7 +1215,7 @@ const x = (t) => {
|
|
|
1215
1215
|
command: "toggleTrackChanges",
|
|
1216
1216
|
icon: e.trackChanges,
|
|
1217
1217
|
group: "left"
|
|
1218
|
-
}), _e =
|
|
1218
|
+
}), _e = _({
|
|
1219
1219
|
type: "button",
|
|
1220
1220
|
disabled: !1,
|
|
1221
1221
|
name: "acceptTrackedChangeBySelection",
|
|
@@ -1223,7 +1223,7 @@ const x = (t) => {
|
|
|
1223
1223
|
command: "acceptTrackedChangeBySelection",
|
|
1224
1224
|
icon: e.trackChangesAccept,
|
|
1225
1225
|
group: "left"
|
|
1226
|
-
}), xe =
|
|
1226
|
+
}), xe = _({
|
|
1227
1227
|
type: "button",
|
|
1228
1228
|
disabled: !1,
|
|
1229
1229
|
name: "rejectTrackedChangeOnSelection",
|
|
@@ -1231,7 +1231,7 @@ const x = (t) => {
|
|
|
1231
1231
|
command: "rejectTrackedChangeOnSelection",
|
|
1232
1232
|
icon: e.trackChangesReject,
|
|
1233
1233
|
group: "left"
|
|
1234
|
-
}), Ee =
|
|
1234
|
+
}), Ee = _({
|
|
1235
1235
|
type: "button",
|
|
1236
1236
|
disabled: !1,
|
|
1237
1237
|
name: "toggleTrackChangesShowOriginal",
|
|
@@ -1239,7 +1239,7 @@ const x = (t) => {
|
|
|
1239
1239
|
command: "toggleTrackChangesShowOriginal",
|
|
1240
1240
|
icon: e.trackChangesOriginal,
|
|
1241
1241
|
group: "left"
|
|
1242
|
-
}), Fe =
|
|
1242
|
+
}), Fe = _({
|
|
1243
1243
|
type: "button",
|
|
1244
1244
|
disabled: !1,
|
|
1245
1245
|
name: "toggleTrackChangesShowFinal",
|
|
@@ -1247,7 +1247,7 @@ const x = (t) => {
|
|
|
1247
1247
|
command: "toggleTrackChangesShowFinal",
|
|
1248
1248
|
icon: e.trackChangesFinal,
|
|
1249
1249
|
group: "left"
|
|
1250
|
-
}), Ie =
|
|
1250
|
+
}), Ie = _({
|
|
1251
1251
|
type: "button",
|
|
1252
1252
|
name: "clearFormatting",
|
|
1253
1253
|
command: "clearFormat",
|
|
@@ -1256,20 +1256,20 @@ const x = (t) => {
|
|
|
1256
1256
|
});
|
|
1257
1257
|
[
|
|
1258
1258
|
i,
|
|
1259
|
-
|
|
1260
|
-
|
|
1259
|
+
m,
|
|
1260
|
+
s,
|
|
1261
1261
|
H,
|
|
1262
1262
|
M,
|
|
1263
1263
|
E,
|
|
1264
1264
|
R
|
|
1265
|
-
].map((
|
|
1266
|
-
const Le =
|
|
1265
|
+
].map((u) => u.name);
|
|
1266
|
+
const Le = _({
|
|
1267
1267
|
type: "button",
|
|
1268
1268
|
name: "copyFormat",
|
|
1269
1269
|
tooltip: "Format painter",
|
|
1270
1270
|
icon: e.copyFormat,
|
|
1271
1271
|
command: "copyFormat"
|
|
1272
|
-
}), Me = (
|
|
1272
|
+
}), Me = (u, S) => u === "editor" ? S : u === "suggester" ? S.filter((A) => A.value === "suggesting") : S.filter((A) => A.value === "viewing"), we = (u) => u === "editor" ? "Editing" : u === "suggester" ? "Suggesting" : "Viewing", ne = _({
|
|
1273
1273
|
type: "dropdown",
|
|
1274
1274
|
name: "documentMode",
|
|
1275
1275
|
command: "setDocumentMode",
|
|
@@ -1314,18 +1314,18 @@ const x = (t) => {
|
|
|
1314
1314
|
description: "View clean version of document only"
|
|
1315
1315
|
}
|
|
1316
1316
|
];
|
|
1317
|
-
function me(
|
|
1317
|
+
function me(u) {
|
|
1318
1318
|
const S = Me(n, De);
|
|
1319
1319
|
return B(En, {
|
|
1320
1320
|
options: S,
|
|
1321
1321
|
onSelect: (A) => {
|
|
1322
|
-
ae(
|
|
1322
|
+
ae(u);
|
|
1323
1323
|
const { label: W, icon: le } = A;
|
|
1324
1324
|
ne.label.value = W, ne.icon.value = le, t.emitCommand({ item: ne, argument: W });
|
|
1325
1325
|
}
|
|
1326
1326
|
});
|
|
1327
1327
|
}
|
|
1328
|
-
const se =
|
|
1328
|
+
const se = _({
|
|
1329
1329
|
type: "button",
|
|
1330
1330
|
name: "pageBreakTool",
|
|
1331
1331
|
command: "insertPageBreak",
|
|
@@ -1341,13 +1341,13 @@ const x = (t) => {
|
|
|
1341
1341
|
["documentMode", 47],
|
|
1342
1342
|
["ai", 32],
|
|
1343
1343
|
["default", 32]
|
|
1344
|
-
]), dt =
|
|
1344
|
+
]), dt = _({
|
|
1345
1345
|
type: "button",
|
|
1346
1346
|
name: "ruler",
|
|
1347
1347
|
command: "toggleRuler",
|
|
1348
1348
|
icon: e.ruler,
|
|
1349
1349
|
tooltip: "Show or hide ruler"
|
|
1350
|
-
}), Ce =
|
|
1350
|
+
}), Ce = _({
|
|
1351
1351
|
type: "dropdown",
|
|
1352
1352
|
name: "linkedStyles",
|
|
1353
1353
|
command: "setLinkedStyle",
|
|
@@ -1367,7 +1367,7 @@ const x = (t) => {
|
|
|
1367
1367
|
type: "render",
|
|
1368
1368
|
key: "linkedStyle",
|
|
1369
1369
|
render: () => {
|
|
1370
|
-
const
|
|
1370
|
+
const u = (S) => {
|
|
1371
1371
|
ae(Ce);
|
|
1372
1372
|
const A = { ...Ce, command: "setLinkedStyle" };
|
|
1373
1373
|
t.emitCommand({ item: A, argument: S });
|
|
@@ -1375,7 +1375,7 @@ const x = (t) => {
|
|
|
1375
1375
|
return B("div", {}, [
|
|
1376
1376
|
B(Fn, {
|
|
1377
1377
|
editor: t.activeEditor,
|
|
1378
|
-
onSelect:
|
|
1378
|
+
onSelect: u
|
|
1379
1379
|
})
|
|
1380
1380
|
]);
|
|
1381
1381
|
}
|
|
@@ -1387,10 +1387,10 @@ const x = (t) => {
|
|
|
1387
1387
|
onDeactivate: () => {
|
|
1388
1388
|
Ce.disabled.value = !0;
|
|
1389
1389
|
}
|
|
1390
|
-
}), he = (
|
|
1391
|
-
if (S.value.toString() ===
|
|
1390
|
+
}), he = (u, S) => {
|
|
1391
|
+
if (S.value.toString() === u)
|
|
1392
1392
|
return B("div", { innerHTML: eo, class: "dropdown-select-icon" });
|
|
1393
|
-
}, de =
|
|
1393
|
+
}, de = _({
|
|
1394
1394
|
type: "dropdown",
|
|
1395
1395
|
name: "lineHeight",
|
|
1396
1396
|
tooltip: "Line height",
|
|
@@ -1426,148 +1426,148 @@ const x = (t) => {
|
|
|
1426
1426
|
// toggleTrackChangesOriginal,
|
|
1427
1427
|
// toggleTrackChangesFinal,
|
|
1428
1428
|
G,
|
|
1429
|
-
r,
|
|
1430
1429
|
c,
|
|
1431
|
-
s,
|
|
1432
|
-
c,
|
|
1433
|
-
i,
|
|
1434
1430
|
d,
|
|
1435
|
-
|
|
1431
|
+
l,
|
|
1432
|
+
d,
|
|
1433
|
+
i,
|
|
1434
|
+
m,
|
|
1435
|
+
s,
|
|
1436
1436
|
v,
|
|
1437
1437
|
b,
|
|
1438
|
-
|
|
1438
|
+
d,
|
|
1439
1439
|
F,
|
|
1440
|
-
|
|
1440
|
+
x,
|
|
1441
1441
|
T,
|
|
1442
1442
|
V,
|
|
1443
|
-
|
|
1443
|
+
d,
|
|
1444
1444
|
Z,
|
|
1445
1445
|
be,
|
|
1446
1446
|
I,
|
|
1447
1447
|
M,
|
|
1448
1448
|
H,
|
|
1449
1449
|
de,
|
|
1450
|
-
|
|
1450
|
+
d,
|
|
1451
1451
|
Ce,
|
|
1452
|
-
|
|
1452
|
+
d,
|
|
1453
1453
|
dt,
|
|
1454
1454
|
se,
|
|
1455
1455
|
Le,
|
|
1456
1456
|
Ie,
|
|
1457
|
-
|
|
1457
|
+
a,
|
|
1458
1458
|
R,
|
|
1459
1459
|
ne
|
|
1460
1460
|
];
|
|
1461
|
-
if (t.config?.superdoc?.config?.modules?.ai || (O = O.filter((
|
|
1462
|
-
const
|
|
1463
|
-
O.splice(
|
|
1461
|
+
if (t.config?.superdoc?.config?.modules?.ai || (O = O.filter((u) => u.name.value !== "ai")), o <= $e.md && (O = O.filter((u) => u.type !== "separator")), t.config.pagination || (O = O.filter((u) => u.name.value !== "pageBreakTool")), t.config.mode !== "docx") {
|
|
1462
|
+
const u = O.findIndex((A) => A.name.value === "linkedStyles");
|
|
1463
|
+
O.splice(u - 1, 2);
|
|
1464
1464
|
const S = ["ruler", "zoom", "undo", "redo"];
|
|
1465
1465
|
O = O.filter((A) => !S.includes(A.name.value));
|
|
1466
1466
|
}
|
|
1467
1467
|
const je = [ue, Ee, Fe];
|
|
1468
|
-
|
|
1469
|
-
const ft = [E, K, R, ne].map((
|
|
1468
|
+
r || (n === "viewer" && je.push(_e, xe), O = O.filter((u) => !je.includes(u)));
|
|
1469
|
+
const ft = [E, K, R, ne].map((u) => u.name), vt = (u) => ft.includes(u.name), Se = [], He = [];
|
|
1470
1470
|
let Be = mt + ut;
|
|
1471
|
-
return O.forEach((
|
|
1472
|
-
const S = pe.get(
|
|
1473
|
-
if (o < $e.xl && pt.includes(
|
|
1474
|
-
if (Se.push(
|
|
1471
|
+
return O.forEach((u) => {
|
|
1472
|
+
const S = pe.get(u.name.value) || pe.get("default");
|
|
1473
|
+
if (o < $e.xl && pt.includes(u.name.value)) {
|
|
1474
|
+
if (Se.push(u), u.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
|
-
if (o < $e.sm && ht.includes(
|
|
1481
|
-
Se.push(
|
|
1480
|
+
if (o < $e.sm && ht.includes(u.name.value)) {
|
|
1481
|
+
Se.push(u);
|
|
1482
1482
|
return;
|
|
1483
1483
|
}
|
|
1484
|
-
if (vt(
|
|
1485
|
-
He.push(
|
|
1484
|
+
if (vt(u)) {
|
|
1485
|
+
He.push(u), Be += S;
|
|
1486
1486
|
return;
|
|
1487
1487
|
}
|
|
1488
|
-
Be < o ? (He.push(
|
|
1488
|
+
Be < o ? (He.push(u), Be += S) : Se.push(u);
|
|
1489
1489
|
}), {
|
|
1490
1490
|
defaultItems: He,
|
|
1491
|
-
overflowItems: Se.filter((
|
|
1491
|
+
overflowItems: Se.filter((u) => u.type !== "separator")
|
|
1492
1492
|
};
|
|
1493
1493
|
}, ao = [".jpg", ".jpeg", ".png", "image/jpeg", "image/png"], ro = () => {
|
|
1494
1494
|
let t = document.createElement("input");
|
|
1495
1495
|
t.type = "file";
|
|
1496
|
-
let
|
|
1497
|
-
return t.accept =
|
|
1496
|
+
let r = ao;
|
|
1497
|
+
return t.accept = r.join(","), () => new Promise((n, e) => {
|
|
1498
1498
|
t.onchange = async () => {
|
|
1499
1499
|
const i = t.files;
|
|
1500
1500
|
if (!i) return n(null);
|
|
1501
|
-
const
|
|
1502
|
-
return n(
|
|
1501
|
+
const c = i.item(0);
|
|
1502
|
+
return n(c ? { file: c } : null);
|
|
1503
1503
|
}, t.oncancel = () => n(null), t.onerror = e, t.click();
|
|
1504
1504
|
});
|
|
1505
|
-
}, co = (t) => new Promise((
|
|
1505
|
+
}, co = (t) => new Promise((r, o) => {
|
|
1506
1506
|
let n = new FileReader();
|
|
1507
|
-
n.onload = (e) =>
|
|
1508
|
-
}), uo = (t,
|
|
1507
|
+
n.onload = (e) => r(e.target.result), n.onerror = o, setTimeout(() => n.readAsDataURL(t), 250);
|
|
1508
|
+
}), uo = (t, r) => new Promise((o, n) => {
|
|
1509
1509
|
const e = new window.Image();
|
|
1510
1510
|
e.onload = () => {
|
|
1511
|
-
const i = document.createElement("canvas"), { width:
|
|
1511
|
+
const i = document.createElement("canvas"), { width: c, height: a } = mo(
|
|
1512
1512
|
e.width,
|
|
1513
1513
|
e.height,
|
|
1514
|
-
|
|
1514
|
+
r
|
|
1515
1515
|
);
|
|
1516
|
-
if (i.width =
|
|
1517
|
-
const
|
|
1518
|
-
o(
|
|
1516
|
+
if (i.width = c, i.height = a, i.getContext("2d").drawImage(e, 0, 0, c, a), typeof t == "string") {
|
|
1517
|
+
const d = i.toDataURL();
|
|
1518
|
+
o(d);
|
|
1519
1519
|
} else
|
|
1520
|
-
i.toBlob((
|
|
1521
|
-
const
|
|
1520
|
+
i.toBlob((d) => {
|
|
1521
|
+
const m = new File([d], t.name, {
|
|
1522
1522
|
type: t.type,
|
|
1523
1523
|
lastModified: Date.now()
|
|
1524
1524
|
});
|
|
1525
|
-
o({ file:
|
|
1525
|
+
o({ file: m, width: c, height: a });
|
|
1526
1526
|
});
|
|
1527
1527
|
}, e.onerror = (i) => n(i), e.src = typeof t == "string" ? t : URL.createObjectURL(t);
|
|
1528
|
-
}), mo = (t,
|
|
1528
|
+
}), mo = (t, r, o) => {
|
|
1529
1529
|
const { width: n, height: e } = o.getMaxContentSize();
|
|
1530
|
-
if (!n || !e) return { width: t, height:
|
|
1531
|
-
let i = t,
|
|
1532
|
-
const
|
|
1533
|
-
return
|
|
1534
|
-
}, po = async ({ editor: t, view:
|
|
1530
|
+
if (!n || !e) return { width: t, height: r };
|
|
1531
|
+
let i = t, c = r;
|
|
1532
|
+
const a = t / r;
|
|
1533
|
+
return r > e && (c = e, i = Math.round(e * a)), i > n && (i = n, c = Math.round(n / a)), { width: i, height: c };
|
|
1534
|
+
}, po = async ({ editor: t, view: r, file: o }) => {
|
|
1535
1535
|
let n = typeof t.options.handleImageUpload == "function" ? t.options.handleImageUpload : co;
|
|
1536
1536
|
if ((o.size / (1024 * 1024)).toFixed(4) > 5) {
|
|
1537
1537
|
window.alert("Image size must be less than 5MB");
|
|
1538
1538
|
return;
|
|
1539
1539
|
}
|
|
1540
|
-
let i,
|
|
1540
|
+
let i, c;
|
|
1541
1541
|
try {
|
|
1542
|
-
const
|
|
1543
|
-
i =
|
|
1544
|
-
} catch (
|
|
1545
|
-
console.warn("Error processing image:",
|
|
1542
|
+
const s = await uo(o, t);
|
|
1543
|
+
i = s.width, c = s.height, o = s.file;
|
|
1544
|
+
} catch (s) {
|
|
1545
|
+
console.warn("Error processing image:", s);
|
|
1546
1546
|
return;
|
|
1547
1547
|
}
|
|
1548
|
-
let
|
|
1549
|
-
|
|
1550
|
-
let
|
|
1548
|
+
let a = {}, { tr: l, schema: d } = r.state;
|
|
1549
|
+
l.selection.empty || l.deleteSelection();
|
|
1550
|
+
let m = {
|
|
1551
1551
|
type: "add",
|
|
1552
|
-
pos:
|
|
1553
|
-
id:
|
|
1552
|
+
pos: l.selection.from,
|
|
1553
|
+
id: a
|
|
1554
1554
|
};
|
|
1555
|
-
|
|
1556
|
-
(
|
|
1557
|
-
let b = o.name.replace(" ", "_"), v = Ct(
|
|
1555
|
+
l.setMeta(Ne, m), r.dispatch(l), n(o).then(
|
|
1556
|
+
(s) => {
|
|
1557
|
+
let b = o.name.replace(" ", "_"), v = Ct(r.state, a);
|
|
1558
1558
|
if (v == null)
|
|
1559
1559
|
return;
|
|
1560
|
-
let y = { type: "remove", id:
|
|
1560
|
+
let y = { type: "remove", id: a }, E = `word/media/${b}`, g = d.nodes.image.create({
|
|
1561
1561
|
src: E,
|
|
1562
|
-
size: { width: i, height:
|
|
1562
|
+
size: { width: i, height: c }
|
|
1563
1563
|
});
|
|
1564
|
-
t.storage.image.media = Object.assign(t.storage.image.media, { [E]:
|
|
1565
|
-
|
|
1564
|
+
t.storage.image.media = Object.assign(t.storage.image.media, { [E]: s }), t.options.ydoc && t.commands.addImageToCollaboration({ mediaPath: E, fileData: s }), r.dispatch(
|
|
1565
|
+
r.state.tr.replaceWith(v, v, g).setMeta(Ne, y)
|
|
1566
1566
|
);
|
|
1567
1567
|
},
|
|
1568
1568
|
() => {
|
|
1569
|
-
let
|
|
1570
|
-
|
|
1569
|
+
let s = { type: "remove", id: a };
|
|
1570
|
+
r.dispatch(l.setMeta(Ne, s));
|
|
1571
1571
|
}
|
|
1572
1572
|
);
|
|
1573
1573
|
};
|
|
@@ -1596,7 +1596,8 @@ class Mo extends qt {
|
|
|
1596
1596
|
groups: null,
|
|
1597
1597
|
editor: null,
|
|
1598
1598
|
aiApiKey: null,
|
|
1599
|
-
aiEndpoint: null
|
|
1599
|
+
aiEndpoint: null,
|
|
1600
|
+
customButtons: []
|
|
1600
1601
|
});
|
|
1601
1602
|
/**
|
|
1602
1603
|
* Custom commands that override default behavior
|
|
@@ -1616,8 +1617,8 @@ class Mo extends qt {
|
|
|
1616
1617
|
o.onActivate({ zoom: n }), this.emit("superdoc-command", { item: o, argument: n });
|
|
1617
1618
|
const e = document.querySelector(this.superdoc.config.selector)?.querySelector(".layers");
|
|
1618
1619
|
if (!e) return;
|
|
1619
|
-
const i = typeof screen.orientation < "u",
|
|
1620
|
-
i &&
|
|
1620
|
+
const i = typeof screen.orientation < "u", c = window.matchMedia("(max-width: 834px)").matches;
|
|
1621
|
+
i && c ? (e.style.transformOrigin = "0 0", e.style.transform = `scale(${parseInt(n) / 100})`) : e.style.zoom = parseInt(n) / 100, this.superdoc.superdocStore.activeZoom = parseInt(n);
|
|
1621
1622
|
},
|
|
1622
1623
|
/**
|
|
1623
1624
|
* Sets the document mode
|
|
@@ -1709,7 +1710,7 @@ class Mo extends qt {
|
|
|
1709
1710
|
*/
|
|
1710
1711
|
increaseTextIndent: ({ item: o, argument: n }) => {
|
|
1711
1712
|
let e = o.command, { state: i } = this.activeEditor;
|
|
1712
|
-
if (Ge((
|
|
1713
|
+
if (Ge((a) => a.type.name === "listItem")(i.selection))
|
|
1713
1714
|
return this.activeEditor.commands.increaseListIndent();
|
|
1714
1715
|
e in this.activeEditor.commands && this.activeEditor.commands[e](n);
|
|
1715
1716
|
},
|
|
@@ -1722,7 +1723,7 @@ class Mo extends qt {
|
|
|
1722
1723
|
*/
|
|
1723
1724
|
decreaseTextIndent: ({ item: o, argument: n }) => {
|
|
1724
1725
|
let e = o.command, { state: i } = this.activeEditor;
|
|
1725
|
-
if (Ge((
|
|
1726
|
+
if (Ge((a) => a.type.name === "listItem")(i.selection))
|
|
1726
1727
|
return this.activeEditor.commands.decreaseListIndent();
|
|
1727
1728
|
e in this.activeEditor.commands && this.activeEditor.commands[e](n);
|
|
1728
1729
|
},
|
|
@@ -1770,8 +1771,8 @@ class Mo extends qt {
|
|
|
1770
1771
|
let e = o.command;
|
|
1771
1772
|
if (e in this.activeEditor.commands) {
|
|
1772
1773
|
this.activeEditor.commands[e](n);
|
|
1773
|
-
const { view: i } = this.activeEditor,
|
|
1774
|
-
i.updateState(
|
|
1774
|
+
const { view: i } = this.activeEditor, c = i.state.selection.$to.pos, a = new Ye(i.state.doc.resolve(c)), l = i.state.tr.setSelection(a), d = i.state.apply(l);
|
|
1775
|
+
i.updateState(d), setTimeout(() => {
|
|
1775
1776
|
i.focus();
|
|
1776
1777
|
}, 100);
|
|
1777
1778
|
}
|
|
@@ -1850,7 +1851,7 @@ class Mo extends qt {
|
|
|
1850
1851
|
* @returns {ToolbarItem[]} An array of toolbar items in the specified group
|
|
1851
1852
|
*/
|
|
1852
1853
|
getToolbarItemByGroup(o) {
|
|
1853
|
-
return this.toolbarItems.filter((n) => n.group
|
|
1854
|
+
return this.toolbarItems.filter((n) => (n.group?.value || "center") === o);
|
|
1854
1855
|
}
|
|
1855
1856
|
/**
|
|
1856
1857
|
* Get a toolbar item by name
|
|
@@ -1874,25 +1875,25 @@ class Mo extends qt {
|
|
|
1874
1875
|
this.toolbarItems.forEach((e) => {
|
|
1875
1876
|
if (e.resetDisabled(), e.name.value === "linkedStyles")
|
|
1876
1877
|
return this.activeEditor && !Ze(this.activeEditor).length ? e.deactivate() : e.activate();
|
|
1877
|
-
const i = o.find((
|
|
1878
|
+
const i = o.find((l) => l.name === e.name.value);
|
|
1878
1879
|
i ? e.activate(i.attrs) : e.deactivate();
|
|
1879
|
-
const
|
|
1880
|
-
if (
|
|
1881
|
-
const
|
|
1880
|
+
const c = o.find((l) => l.name === "styleId");
|
|
1881
|
+
if (c?.attrs.styleId) {
|
|
1882
|
+
const l = {
|
|
1882
1883
|
fontSize: "font-size",
|
|
1883
1884
|
fontFamily: "font-family",
|
|
1884
1885
|
bold: "bold",
|
|
1885
1886
|
textAlign: "textAlign"
|
|
1886
|
-
},
|
|
1887
|
-
if (
|
|
1888
|
-
const
|
|
1889
|
-
[e.name.value]:
|
|
1887
|
+
}, d = this.activeEditor.converter?.linkedStyles.find((m) => m.id === c.attrs.styleId);
|
|
1888
|
+
if (l[e.name.value] in d?.definition.styles) {
|
|
1889
|
+
const m = {
|
|
1890
|
+
[e.name.value]: d?.definition.styles[l[e.name.value]]
|
|
1890
1891
|
};
|
|
1891
|
-
e.activate(
|
|
1892
|
+
e.activate(m);
|
|
1892
1893
|
}
|
|
1893
1894
|
}
|
|
1894
|
-
const
|
|
1895
|
-
e.name.value === "lineHeight" && (i?.attrs?.lineHeight ||
|
|
1895
|
+
const a = o.find((l) => l.name === "spacing");
|
|
1896
|
+
e.name.value === "lineHeight" && (i?.attrs?.lineHeight || a) && (e.selectedValue.value = i?.attrs?.lineHeight || a.attrs?.spacing?.line || ""), e.name.value === "tableActions" && (e.disabled.value = !n);
|
|
1896
1897
|
});
|
|
1897
1898
|
}
|
|
1898
1899
|
/**
|
|
@@ -1912,16 +1913,22 @@ class Mo extends qt {
|
|
|
1912
1913
|
* @param {*} [params.argument] - The argument passed to the command
|
|
1913
1914
|
* @returns {*} The result of the executed command, undefined if no result is returned
|
|
1914
1915
|
*/
|
|
1915
|
-
emitCommand({ item: o, argument: n }) {
|
|
1916
|
+
emitCommand({ item: o, argument: n, option: e }) {
|
|
1916
1917
|
this.activeEditor?.focus();
|
|
1917
|
-
const { command:
|
|
1918
|
-
if (
|
|
1919
|
-
if (this.log("(emmitCommand) Command:",
|
|
1920
|
-
|
|
1921
|
-
|
|
1922
|
-
|
|
1918
|
+
const { command: i } = o;
|
|
1919
|
+
if (i) {
|
|
1920
|
+
if (this.log("(emmitCommand) Command:", i, `
|
|
1921
|
+
item:`, o, `
|
|
1922
|
+
argument:`, n, `
|
|
1923
|
+
option:`, e), i in Ae(this, ve))
|
|
1924
|
+
return Ae(this, ve)[i]({ item: o, argument: n });
|
|
1925
|
+
if (i in this.activeEditor?.commands)
|
|
1926
|
+
this.activeEditor.commands[i](n);
|
|
1927
|
+
else if (typeof i == "function")
|
|
1928
|
+
i({ item: o, argument: n, option: e });
|
|
1923
1929
|
else
|
|
1924
|
-
throw new Error(`[super-toolbar 🎨] Command not found: ${
|
|
1930
|
+
throw new Error(`[super-toolbar 🎨] Command not found: ${i}`);
|
|
1931
|
+
this.updateToolbarState();
|
|
1925
1932
|
}
|
|
1926
1933
|
}
|
|
1927
1934
|
}
|
|
@@ -1941,14 +1948,15 @@ lt = function() {
|
|
|
1941
1948
|
* @returns {void}
|
|
1942
1949
|
*/
|
|
1943
1950
|
We = function(o, n, e = !1) {
|
|
1944
|
-
const i = document.documentElement.clientWidth, { defaultItems:
|
|
1945
|
-
|
|
1946
|
-
|
|
1947
|
-
...
|
|
1951
|
+
const i = document.documentElement.clientWidth, { defaultItems: c, overflowItems: a } = lo(o, e, i, this.role, n), l = this.config.customButtons || [];
|
|
1952
|
+
l.length && c.push(...l.map((s) => _({ ...s })));
|
|
1953
|
+
let d = [
|
|
1954
|
+
...c.map((s) => s.name.value),
|
|
1955
|
+
...a.map((s) => s.name.value)
|
|
1948
1956
|
];
|
|
1949
|
-
this.config.groups && (
|
|
1950
|
-
const
|
|
1951
|
-
this.toolbarItems =
|
|
1957
|
+
this.config.groups && (d = Object.values(this.config.groups).flatMap((s) => s));
|
|
1958
|
+
const m = c.filter((s) => d.includes(s.name.value)).filter((s) => !this.config.excludeItems.includes(s.name.value));
|
|
1959
|
+
this.toolbarItems = m, this.overflowItems = a.filter((s) => d.includes(s.name.value));
|
|
1952
1960
|
}, /**
|
|
1953
1961
|
* Initialize default fonts from the editor
|
|
1954
1962
|
* @private
|
|
@@ -1956,9 +1964,9 @@ We = function(o, n, e = !1) {
|
|
|
1956
1964
|
*/
|
|
1957
1965
|
at = function() {
|
|
1958
1966
|
if (!this.activeEditor || !this.activeEditor.converter) return;
|
|
1959
|
-
const { typeface: o = "Arial", fontSizePt: n = 12 } = this.activeEditor.converter.getDocumentDefaultStyles() ?? {}, e = this.toolbarItems.find((
|
|
1967
|
+
const { typeface: o = "Arial", fontSizePt: n = 12 } = this.activeEditor.converter.getDocumentDefaultStyles() ?? {}, e = this.toolbarItems.find((c) => c.name.value === "fontSize");
|
|
1960
1968
|
e && (e.defaultLabel.value = n);
|
|
1961
|
-
const i = this.toolbarItems.find((
|
|
1969
|
+
const i = this.toolbarItems.find((c) => c.name.value === "fontFamily");
|
|
1962
1970
|
i && (i.defaultLabel.value = o);
|
|
1963
1971
|
}, /**
|
|
1964
1972
|
* Update highlight color options based on document colors
|
|
@@ -1967,15 +1975,15 @@ at = function() {
|
|
|
1967
1975
|
*/
|
|
1968
1976
|
rt = function() {
|
|
1969
1977
|
if (!this.activeEditor || !this.activeEditor.converter || !this.activeEditor.converter.docHiglightColors.size) return;
|
|
1970
|
-
const o = this.toolbarItems.find((
|
|
1971
|
-
const
|
|
1972
|
-
return
|
|
1973
|
-
}, []),
|
|
1978
|
+
const o = this.toolbarItems.find((a) => a.name.value === "highlight"), n = Vn(), e = 7, i = Array.from(this.activeEditor.converter.docHiglightColors).reduce((a, l, d) => {
|
|
1979
|
+
const m = Math.floor(d / e);
|
|
1980
|
+
return a[m] || (a[m] = []), n.includes(l) || a[m].push(h(l)), a;
|
|
1981
|
+
}, []), c = {
|
|
1974
1982
|
key: "color",
|
|
1975
1983
|
type: "render",
|
|
1976
1984
|
render: () => Ve(this, o, i, !0)
|
|
1977
1985
|
};
|
|
1978
|
-
o.nestedOptions.value = [
|
|
1986
|
+
o.nestedOptions.value = [c];
|
|
1979
1987
|
}, /**
|
|
1980
1988
|
* Deactivate all toolbar items
|
|
1981
1989
|
* @private
|
|
@@ -2005,44 +2013,44 @@ ct = function() {
|
|
|
2005
2013
|
*/
|
|
2006
2014
|
fe = function({ item: o, argument: n, noArgumentCallback: e = !1 }, i) {
|
|
2007
2015
|
if (!n || !this.activeEditor) return;
|
|
2008
|
-
let
|
|
2009
|
-
const
|
|
2010
|
-
if (n === "none" &&
|
|
2011
|
-
this.activeEditor.commands[
|
|
2016
|
+
let c = o.command;
|
|
2017
|
+
const a = o.noArgumentCommand;
|
|
2018
|
+
if (n === "none" && a in this.activeEditor?.commands) {
|
|
2019
|
+
this.activeEditor.commands[a](), typeof i == "function" && e && i(n), this.updateToolbarState();
|
|
2012
2020
|
return;
|
|
2013
2021
|
}
|
|
2014
|
-
|
|
2022
|
+
c in this.activeEditor?.commands && (this.activeEditor.commands[c](n), typeof i == "function" && i(n), this.updateToolbarState());
|
|
2015
2023
|
};
|
|
2016
|
-
function ho(t,
|
|
2017
|
-
if (!t.value || !
|
|
2018
|
-
const o =
|
|
2024
|
+
function ho(t, r) {
|
|
2025
|
+
if (!t.value || !r?.value?.options?.scale) return;
|
|
2026
|
+
const o = r.value.options.scale, n = t.value.getBoundingClientRect(), e = t.value.querySelectorAll(".pagination-break-wrapper");
|
|
2019
2027
|
let i;
|
|
2020
|
-
e.forEach((
|
|
2021
|
-
const
|
|
2022
|
-
if (i || (i =
|
|
2023
|
-
const
|
|
2024
|
-
|
|
2028
|
+
e.forEach((c) => {
|
|
2029
|
+
const l = (c.getBoundingClientRect().left - n.left) / o * -1 + 1;
|
|
2030
|
+
if (i || (i = l), l !== i) {
|
|
2031
|
+
const d = l - i;
|
|
2032
|
+
c.style.transform = `translateX(${d}px)`;
|
|
2025
2033
|
}
|
|
2026
2034
|
});
|
|
2027
2035
|
}
|
|
2028
|
-
const fo = (t,
|
|
2029
|
-
const o = t.clientY, n = t.clientX, { view: e } =
|
|
2030
|
-
let
|
|
2036
|
+
const fo = (t, r) => {
|
|
2037
|
+
const o = t.clientY, n = t.clientX, { view: e } = r, i = e.dom.getBoundingClientRect();
|
|
2038
|
+
let c = {
|
|
2031
2039
|
left: 0,
|
|
2032
2040
|
top: o
|
|
2033
|
-
},
|
|
2034
|
-
n > i.right ? (
|
|
2035
|
-
const
|
|
2036
|
-
if (
|
|
2037
|
-
let
|
|
2038
|
-
if (
|
|
2039
|
-
const b = e.state.doc.resolve(
|
|
2040
|
-
|
|
2041
|
+
}, a = !1;
|
|
2042
|
+
n > i.right ? (c.left = i.left + i.width - 1, a = !0) : n < i.left && (c.left = i.left);
|
|
2043
|
+
const l = e.posAtCoords(c)?.pos;
|
|
2044
|
+
if (l) {
|
|
2045
|
+
let d = l;
|
|
2046
|
+
if (a) {
|
|
2047
|
+
const b = e.state.doc.resolve(l).textOffset, v = e.state.doc.nodeAt(l), E = v?.text?.charAt(b);
|
|
2048
|
+
d = v?.isText && E !== " " ? l - 1 : l;
|
|
2041
2049
|
}
|
|
2042
|
-
const
|
|
2043
|
-
Ye.create(e.state.doc,
|
|
2050
|
+
const m = e.state.tr.setSelection(
|
|
2051
|
+
Ye.create(e.state.doc, d)
|
|
2044
2052
|
);
|
|
2045
|
-
e.dispatch(
|
|
2053
|
+
e.dispatch(m), e.focus();
|
|
2046
2054
|
}
|
|
2047
2055
|
}, vo = { class: "numbering" }, Te = 200, go = "flex-end", yo = {
|
|
2048
2056
|
__name: "Ruler",
|
|
@@ -2061,13 +2069,13 @@ const fo = (t, a) => {
|
|
|
2061
2069
|
}
|
|
2062
2070
|
},
|
|
2063
2071
|
emits: ["margin-change"],
|
|
2064
|
-
setup(t, { emit:
|
|
2065
|
-
const o =
|
|
2072
|
+
setup(t, { emit: r }) {
|
|
2073
|
+
const o = r, n = t, e = f(null), i = f([]), c = f("#CCCCCC"), a = f("#2563EB66"), l = f(null), d = f(null), m = f(!1), s = f(null), b = Ke({ side: "left", x: 0 }), v = Ke({ side: "right", x: 0 }), y = f(!1), E = f(0);
|
|
2066
2074
|
let g = 0;
|
|
2067
2075
|
const F = () => {
|
|
2068
2076
|
if (n.editor.options.mode !== "docx") return;
|
|
2069
2077
|
const I = [], { pageMargins: M, pageSize: H } = n.editor.getPageStyles();
|
|
2070
|
-
|
|
2078
|
+
l.value = H, d.value = M, v.x = H.width * 96 - M.right * 96, b.x = M.left * 96;
|
|
2071
2079
|
for (let R = 0; R < H.width; R++) {
|
|
2072
2080
|
const K = `${5.5}px`, ce = H.width - R;
|
|
2073
2081
|
if (I.push(...$(1, "main", "20%", K, R)), I.push(...$(3, "eighth", "10%", K)), I.push(...$(1, "half", "40%", K)), ce <= 0.5) break;
|
|
@@ -2089,39 +2097,39 @@ const fo = (t, a) => {
|
|
|
2089
2097
|
backgroundColor: I.color || "#666",
|
|
2090
2098
|
marginLeft: I.numbering === 0 ? null : I.margin,
|
|
2091
2099
|
marginRight: I.margin
|
|
2092
|
-
})),
|
|
2100
|
+
})), x = j(() => (I) => ({
|
|
2093
2101
|
left: `${(I === "left" ? b : v).x}px`
|
|
2094
2102
|
})), T = j(() => {
|
|
2095
2103
|
if (!e.value) return;
|
|
2096
2104
|
const H = e.value.parentElement.querySelector(".super-editor").getBoundingClientRect();
|
|
2097
2105
|
return {
|
|
2098
|
-
left: `${
|
|
2106
|
+
left: `${s.value.x}px`,
|
|
2099
2107
|
minHeight: `${H.height}px`
|
|
2100
2108
|
};
|
|
2101
2109
|
}), N = (I) => {
|
|
2102
|
-
|
|
2110
|
+
m.value = !0, ye();
|
|
2103
2111
|
const M = I.currentTarget.id;
|
|
2104
|
-
|
|
2112
|
+
s.value = M === "left-margin-handle" ? b : v, E.value = s.value.x, g = I.clientX - s.value.x, y.value = !0;
|
|
2105
2113
|
}, V = (I) => {
|
|
2106
|
-
if (!
|
|
2114
|
+
if (!m.value) return;
|
|
2107
2115
|
const M = I.clientX - g;
|
|
2108
|
-
|
|
2116
|
+
s.value.x = M, s.value.side === "left" ? M <= 0 ? s.value.x = 0 : M >= v.x - Te && (s.value.x = v.x - Te) : M >= l.value.width * 96 ? s.value.x = l.value.width * 96 : M <= b.x + Te && (s.value.x = b.x + Te);
|
|
2109
2117
|
}, te = () => {
|
|
2110
|
-
if (
|
|
2118
|
+
if (m.value = !1, y.value = !1, Z(), s.value && s.value.x !== E.value) {
|
|
2111
2119
|
const I = re();
|
|
2112
2120
|
o("margin-change", {
|
|
2113
|
-
side:
|
|
2121
|
+
side: s.value.side,
|
|
2114
2122
|
value: I
|
|
2115
2123
|
});
|
|
2116
2124
|
}
|
|
2117
2125
|
}, ye = () => {
|
|
2118
|
-
|
|
2126
|
+
c.value = a.value;
|
|
2119
2127
|
}, Z = () => {
|
|
2120
|
-
|
|
2121
|
-
}, re = () =>
|
|
2128
|
+
c.value = "#CCC";
|
|
2129
|
+
}, re = () => s.value.side === "left" ? s.value.x / 96 : (l.value.width * 96 - s.value.x) / 96, be = j(() => ({
|
|
2122
2130
|
"--alignment": go,
|
|
2123
|
-
"--ruler-handle-color":
|
|
2124
|
-
"--ruler-handle-active-color":
|
|
2131
|
+
"--ruler-handle-color": c.value,
|
|
2132
|
+
"--ruler-handle-active-color": a.value
|
|
2125
2133
|
}));
|
|
2126
2134
|
return ke(() => {
|
|
2127
2135
|
i.value = F(), window.addEventListener("mousemove", V), window.addEventListener("mouseup", te);
|
|
@@ -2137,13 +2145,13 @@ const fo = (t, a) => {
|
|
|
2137
2145
|
class: "margin-handle handle-left",
|
|
2138
2146
|
id: "left-margin-handle",
|
|
2139
2147
|
onMousedown: N,
|
|
2140
|
-
style: J(
|
|
2148
|
+
style: J(x.value("left"))
|
|
2141
2149
|
}, null, 36),
|
|
2142
2150
|
k("div", {
|
|
2143
2151
|
class: "margin-handle handle-right",
|
|
2144
2152
|
id: "right-margin-handle",
|
|
2145
2153
|
onMousedown: N,
|
|
2146
|
-
style: J(
|
|
2154
|
+
style: J(x.value("right"))
|
|
2147
2155
|
}, null, 36),
|
|
2148
2156
|
y.value ? (w(), C("div", {
|
|
2149
2157
|
key: 0,
|
|
@@ -2199,53 +2207,53 @@ const fo = (t, a) => {
|
|
|
2199
2207
|
"comments-loaded",
|
|
2200
2208
|
"selection-update"
|
|
2201
2209
|
],
|
|
2202
|
-
setup(t, { emit:
|
|
2203
|
-
const o =
|
|
2204
|
-
let
|
|
2205
|
-
const
|
|
2206
|
-
clearTimeout(
|
|
2207
|
-
},
|
|
2210
|
+
setup(t, { emit: r }) {
|
|
2211
|
+
const o = r, n = t, e = f(!1), i = nt(null), c = f(null), a = f(null);
|
|
2212
|
+
let l;
|
|
2213
|
+
const d = () => {
|
|
2214
|
+
clearTimeout(l);
|
|
2215
|
+
}, m = (p, x = 10, T = 500) => {
|
|
2208
2216
|
const N = p.getMap("meta"), V = () => {
|
|
2209
2217
|
const te = N.get("docx");
|
|
2210
|
-
te ? (
|
|
2218
|
+
te ? (d(), y({ content: te })) : x > 0 ? (console.debug(`Waiting for 'docx' data... retries left: ${x}`), l = setTimeout(V, T), x--) : console.warn("Failed to load docx data from meta map.");
|
|
2211
2219
|
};
|
|
2212
2220
|
V();
|
|
2213
|
-
},
|
|
2221
|
+
}, s = async () => {
|
|
2214
2222
|
try {
|
|
2215
|
-
const [p,
|
|
2216
|
-
return { content: p, media:
|
|
2223
|
+
const [p, x, T, N] = await ze.loadXmlData(n.fileSource);
|
|
2224
|
+
return { content: p, media: x, mediaFiles: T, fonts: N };
|
|
2217
2225
|
} catch (p) {
|
|
2218
2226
|
console.debug("Error loading new file data:", p);
|
|
2219
2227
|
}
|
|
2220
2228
|
}, b = async () => {
|
|
2221
2229
|
if (n.fileSource) {
|
|
2222
|
-
const p = await
|
|
2230
|
+
const p = await s();
|
|
2223
2231
|
return y(p);
|
|
2224
2232
|
} else if (n.options.ydoc && n.options.collaborationProvider) {
|
|
2225
2233
|
delete n.options.content;
|
|
2226
|
-
const p = n.options.ydoc,
|
|
2227
|
-
|
|
2234
|
+
const p = n.options.ydoc, x = n.options.collaborationProvider, T = () => {
|
|
2235
|
+
m(p), x.off("synced", T);
|
|
2228
2236
|
};
|
|
2229
|
-
|
|
2237
|
+
x.on("synced", T);
|
|
2230
2238
|
}
|
|
2231
2239
|
}, v = () => {
|
|
2232
2240
|
const p = St();
|
|
2233
|
-
return n.options.pagination ? p : p.filter((
|
|
2234
|
-
}, y = async ({ content: p, media:
|
|
2241
|
+
return n.options.pagination ? p : p.filter((x) => x.name !== "pagination");
|
|
2242
|
+
}, y = async ({ content: p, media: x = {}, mediaFiles: T = {}, fonts: N = {} } = {}) => {
|
|
2235
2243
|
i.value = new ze({
|
|
2236
2244
|
mode: "docx",
|
|
2237
|
-
element:
|
|
2245
|
+
element: a.value,
|
|
2238
2246
|
fileSource: n.fileSource,
|
|
2239
2247
|
extensions: v(),
|
|
2240
2248
|
externalExtensions: n.options.externalExtensions,
|
|
2241
2249
|
documentId: n.documentId,
|
|
2242
2250
|
content: p,
|
|
2243
|
-
media:
|
|
2251
|
+
media: x,
|
|
2244
2252
|
mediaFiles: T,
|
|
2245
2253
|
fonts: N,
|
|
2246
2254
|
...n.options
|
|
2247
2255
|
}), i.value.on("paginationUpdate", () => {
|
|
2248
|
-
ho(
|
|
2256
|
+
ho(a, i);
|
|
2249
2257
|
}), i.value.on("collaborationReady", () => {
|
|
2250
2258
|
setTimeout(() => {
|
|
2251
2259
|
e.value = !0;
|
|
@@ -2255,24 +2263,24 @@ const fo = (t, a) => {
|
|
|
2255
2263
|
o("editor-keydown", { editor: i.value });
|
|
2256
2264
|
}, g = (p) => {
|
|
2257
2265
|
o("editor-click", { editor: i.value });
|
|
2258
|
-
let
|
|
2259
|
-
if (!
|
|
2266
|
+
let x = a.value?.querySelector(".ProseMirror");
|
|
2267
|
+
if (!x || !i.value)
|
|
2260
2268
|
return;
|
|
2261
|
-
!
|
|
2269
|
+
!x.contains(p.target) && i.value.isEditable && i.value.view?.focus();
|
|
2262
2270
|
};
|
|
2263
2271
|
ke(() => {
|
|
2264
2272
|
b(), (n.options?.suppressSkeletonLoader || !n.options?.collaborationProvider) && (e.value = !0);
|
|
2265
2273
|
});
|
|
2266
2274
|
const F = (p) => {
|
|
2267
2275
|
p.target.classList.contains("ProseMirror") || fo(p, i.value);
|
|
2268
|
-
}, $ = ({ side: p, value:
|
|
2276
|
+
}, $ = ({ side: p, value: x }) => {
|
|
2269
2277
|
if (!i.value) return;
|
|
2270
|
-
const T = i.value.getPageStyles(), { pageMargins: N } = T, V = { ...N, [p]:
|
|
2278
|
+
const T = i.value.getPageStyles(), { pageMargins: N } = T, V = { ...N, [p]: x };
|
|
2271
2279
|
i.value?.updatePageStyle({ pageMargins: V });
|
|
2272
2280
|
};
|
|
2273
2281
|
return ot(() => {
|
|
2274
|
-
|
|
2275
|
-
}), (p,
|
|
2282
|
+
d(), i.value?.destroy(), i.value = null;
|
|
2283
|
+
}), (p, x) => (w(), C("div", wo, [
|
|
2276
2284
|
t.options.rulers && i.value ? (w(), Vt(bo, {
|
|
2277
2285
|
key: 0,
|
|
2278
2286
|
class: "ruler",
|
|
@@ -2282,14 +2290,14 @@ const fo = (t, a) => {
|
|
|
2282
2290
|
k("div", {
|
|
2283
2291
|
class: "super-editor",
|
|
2284
2292
|
ref_key: "editorWrapper",
|
|
2285
|
-
ref:
|
|
2293
|
+
ref: c,
|
|
2286
2294
|
onKeydown: E,
|
|
2287
2295
|
onClick: g,
|
|
2288
2296
|
onMousedown: F
|
|
2289
2297
|
}, [
|
|
2290
2298
|
k("div", {
|
|
2291
2299
|
ref_key: "editorElem",
|
|
2292
|
-
ref:
|
|
2300
|
+
ref: a,
|
|
2293
2301
|
class: "editor-element super-editor__element"
|
|
2294
2302
|
}, null, 512)
|
|
2295
2303
|
], 544),
|
|
@@ -2343,8 +2351,8 @@ const fo = (t, a) => {
|
|
|
2343
2351
|
}, Do = /* @__PURE__ */ q(_o, [["__scopeId", "data-v-ff8f86f4"]]), $o = {
|
|
2344
2352
|
__name: "BasicUpload",
|
|
2345
2353
|
emits: ["file-change"],
|
|
2346
|
-
setup(t, { emit:
|
|
2347
|
-
const o =
|
|
2354
|
+
setup(t, { emit: r }) {
|
|
2355
|
+
const o = r, n = (e) => {
|
|
2348
2356
|
o("file-change", e.target.files[0]);
|
|
2349
2357
|
};
|
|
2350
2358
|
return (e, i) => (w(), C("div", null, [
|
|
@@ -2379,16 +2387,16 @@ const fo = (t, a) => {
|
|
|
2379
2387
|
}
|
|
2380
2388
|
},
|
|
2381
2389
|
emits: ["update:modelValue", "focus", "blur"],
|
|
2382
|
-
setup(t, { emit:
|
|
2383
|
-
const o =
|
|
2390
|
+
setup(t, { emit: r }) {
|
|
2391
|
+
const o = r, n = t, e = nt(), i = f(null), c = f(!1), a = ({ editor: v, transaction: y }) => {
|
|
2384
2392
|
const E = v.getHTML();
|
|
2385
2393
|
o("update:modelValue", E);
|
|
2386
|
-
},
|
|
2387
|
-
|
|
2388
|
-
},
|
|
2389
|
-
|
|
2390
|
-
},
|
|
2391
|
-
At.options.placeholder = n.placeholder || "Type something...", n.options.onTransaction =
|
|
2394
|
+
}, l = ({ editor: v, transaction: y }) => {
|
|
2395
|
+
c.value = !0, b(), o("focus", { editor: v, transaction: y });
|
|
2396
|
+
}, d = ({ editor: v, transaction: y }) => {
|
|
2397
|
+
c.value = !1, o("blur", { editor: v, transaction: y });
|
|
2398
|
+
}, m = async () => {
|
|
2399
|
+
At.options.placeholder = n.placeholder || "Type something...", n.options.onTransaction = a, n.options.onFocus = l, n.options.onBlur = d, e.value = new ze({
|
|
2392
2400
|
mode: "text",
|
|
2393
2401
|
content: document.getElementById("currentContent"),
|
|
2394
2402
|
element: i.value,
|
|
@@ -2396,18 +2404,18 @@ const fo = (t, a) => {
|
|
|
2396
2404
|
users: n.users,
|
|
2397
2405
|
...n.options
|
|
2398
2406
|
});
|
|
2399
|
-
},
|
|
2400
|
-
|
|
2407
|
+
}, s = () => {
|
|
2408
|
+
c.value = !0, e.value?.view?.focus();
|
|
2401
2409
|
}, b = () => {
|
|
2402
2410
|
e.value?.setOptions({ users: n.users });
|
|
2403
2411
|
};
|
|
2404
2412
|
return ke(() => {
|
|
2405
|
-
|
|
2413
|
+
m();
|
|
2406
2414
|
}), ot(() => {
|
|
2407
2415
|
e.value?.destroy(), e.value = null;
|
|
2408
2416
|
}), (v, y) => (w(), C("div", {
|
|
2409
|
-
class: oe(["super-editor super-input", { "super-input-active":
|
|
2410
|
-
onClick: ge(
|
|
2417
|
+
class: oe(["super-editor super-input", { "super-input-active": c.value }]),
|
|
2418
|
+
onClick: ge(s, ["stop", "prevent"])
|
|
2411
2419
|
}, [
|
|
2412
2420
|
k("div", {
|
|
2413
2421
|
id: "currentContent",
|