@stll/folio-vue 0.29.0 → 0.30.0
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/components/DocxEditor/types.d.ts +14 -0
- package/dist/composables/useDocxEditor.d.ts +3 -0
- package/dist/composables.cjs +1 -1
- package/dist/composables.js +1 -1
- package/dist/folio-vue.css +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.js +5 -2
- package/dist/useZoom-7jho8rWN.cjs +1 -0
- package/dist/{useZoom-BGTTHZwV.js → useZoom-hVxyaoZn.js} +309 -306
- package/package.json +2 -2
- package/dist/useZoom-u9lZMwJR.cjs +0 -1
|
@@ -37,29 +37,30 @@ import { ExtensionManager as ze } from "@stll/folio-core/prosemirror/extensions/
|
|
|
37
37
|
import { getChangedParagraphIds as Be, hasStructuralChanges as Ve, hasUntrackedChanges as He, repackWithEditorSectionRemovals as Ue } from "@stll/folio-core/prosemirror/extensions/features/ParagraphChangeTrackerExtension";
|
|
38
38
|
import { createStarterKit as We } from "@stll/folio-core/prosemirror/extensions/StarterKit";
|
|
39
39
|
import { createNoteReferenceFollower as Ge, heldUnreferencedNotes as Ke, withoutUnreferencedNotes as qe } from "@stll/folio-core/prosemirror/noteReferenceReview";
|
|
40
|
-
import {
|
|
41
|
-
import {
|
|
42
|
-
import {
|
|
43
|
-
import {
|
|
44
|
-
import {
|
|
45
|
-
import {
|
|
46
|
-
import {
|
|
47
|
-
import {
|
|
48
|
-
import {
|
|
49
|
-
import {
|
|
50
|
-
import {
|
|
40
|
+
import { createDerivedFieldsPlugin as Je } from "@stll/folio-core/prosemirror/plugins/derivedFields";
|
|
41
|
+
import { createTemplateDirectivesPlugin as Ye } from "@stll/folio-core/prosemirror/plugins/templateDirectives";
|
|
42
|
+
import { createTemplatePreviewValuesPlugin as Xe } from "@stll/folio-core/prosemirror/plugins/templatePreviewValues";
|
|
43
|
+
import { templateSlashMenuPlugin as Ze } from "@stll/folio-core/prosemirror/plugins/templateSlashMenu";
|
|
44
|
+
import { resolveHeaderFooterContent as Qe } from "@stll/folio-core/utils/headerFooter";
|
|
45
|
+
import { FindReplaceManager as $e } from "@stll/folio-core/managers/FindReplaceManager";
|
|
46
|
+
import { findInDisplayedDocument as et } from "@stll/folio-core/prosemirror/findReplaceSelection";
|
|
47
|
+
import { replaceFindMatch as tt, replaceFindMatches as nt } from "@stll/folio-core/prosemirror/replaceFindMatches";
|
|
48
|
+
import { createFindMatchView as rt, getRenderedSearchStories as it } from "@stll/folio-core/utils/findMatchView";
|
|
49
|
+
import { createDefaultFindOptions as at, replaceEligibility as ot } from "@stll/folio-core/utils/findReplace";
|
|
50
|
+
import { createFindSearchKey as st, sameFindSearchKey as ct } from "@stll/folio-core/utils/findSearchKey";
|
|
51
|
+
import { MIN_CELL_WIDTH_TWIPS as k, MIN_ROW_HEIGHT_TWIPS as lt, TWIPS_PER_PIXEL as A, clampRowResizeDelta as ut, columnResizeCommand as dt, readColumnWidthAt as ft, readColumnWidths as pt, readRowHeight as mt, rightEdgeResizeCommand as ht, rowResizeCommand as gt } from "@stll/folio-core/prosemirror/tableResize";
|
|
51
52
|
import { extractTrackedChanges as _t } from "@stll/folio-core/prosemirror/utils/extractTrackedChanges";
|
|
52
|
-
import { ZOOM_MAX as
|
|
53
|
+
import { ZOOM_MAX as vt, ZOOM_MIN as j, ZOOM_STEP as yt } from "@stll/folio-core/utils/zoom";
|
|
53
54
|
// src/utils/colorMode.ts
|
|
54
55
|
var bt = "(prefers-color-scheme: dark)";
|
|
55
|
-
function
|
|
56
|
+
function xt() {
|
|
56
57
|
return typeof window < "u" && typeof window.matchMedia == "function";
|
|
57
58
|
}
|
|
58
|
-
function
|
|
59
|
+
function M(e, t) {
|
|
59
60
|
return e === "dark" || e === "system" && t;
|
|
60
61
|
}
|
|
61
|
-
function
|
|
62
|
-
if (!
|
|
62
|
+
function St(e) {
|
|
63
|
+
if (!xt()) return () => {};
|
|
63
64
|
let t = window.matchMedia(bt);
|
|
64
65
|
e(t.matches);
|
|
65
66
|
let n = (t) => e(t.matches);
|
|
@@ -76,20 +77,20 @@ function L() {
|
|
|
76
77
|
return r(() => {
|
|
77
78
|
i.value = !0;
|
|
78
79
|
}), f((e) => {
|
|
79
|
-
i.value && n.value === "system" && e(
|
|
80
|
+
i.value && n.value === "system" && e(St((e) => {
|
|
80
81
|
a.value = e;
|
|
81
82
|
}));
|
|
82
|
-
}), e(() =>
|
|
83
|
+
}), e(() => M(n.value, i.value && a.value));
|
|
83
84
|
}
|
|
84
85
|
// src/utils/rawDocument.ts
|
|
85
|
-
var
|
|
86
|
+
var Ct = (e) => R(e, /* @__PURE__ */ new Map()), R = (e, t) => {
|
|
86
87
|
if (typeof e != "object" || !e) return e;
|
|
87
88
|
let n = l(e), r = t.get(n);
|
|
88
89
|
if (r !== void 0) return r;
|
|
89
90
|
t.set(n, n);
|
|
90
|
-
let i =
|
|
91
|
+
let i = wt(n, t);
|
|
91
92
|
return t.set(n, i), i;
|
|
92
|
-
},
|
|
93
|
+
}, wt = (e, t) => {
|
|
93
94
|
if (ArrayBuffer.isView(e) || e instanceof ArrayBuffer) return e;
|
|
94
95
|
if (e instanceof Map) {
|
|
95
96
|
let n = !1, r = [];
|
|
@@ -117,15 +118,15 @@ var St = (e) => R(e, /* @__PURE__ */ new Map()), R = (e, t) => {
|
|
|
117
118
|
let n = Object.getOwnPropertyDescriptors(e), r = !1;
|
|
118
119
|
for (let e of Reflect.ownKeys(n)) {
|
|
119
120
|
let i = Reflect.get(n, e);
|
|
120
|
-
if (!
|
|
121
|
+
if (!z(i)) continue;
|
|
121
122
|
let a = R(i.value, t);
|
|
122
123
|
a !== i.value && (r = !0, i.value = a);
|
|
123
124
|
}
|
|
124
125
|
if (!r) return e;
|
|
125
126
|
let i = Object.create(Reflect.getPrototypeOf(e), n);
|
|
126
127
|
return _(i, e), i;
|
|
127
|
-
},
|
|
128
|
-
function
|
|
128
|
+
}, z = (e) => typeof e == "object" && !!e && "value" in e, Tt = 24, Et = "User", Dt = [], Ot = [];
|
|
129
|
+
function kt(e) {
|
|
129
130
|
let t = e?.columnCount ?? 1;
|
|
130
131
|
if (t <= 1) return;
|
|
131
132
|
let n = {
|
|
@@ -135,7 +136,7 @@ function Ot(e) {
|
|
|
135
136
|
};
|
|
136
137
|
return e?.separator !== void 0 && (n.separator = e.separator), n;
|
|
137
138
|
}
|
|
138
|
-
function
|
|
139
|
+
function At(e, t, n, r, i, a) {
|
|
139
140
|
if (!e) return;
|
|
140
141
|
let o = t ? {
|
|
141
142
|
...a,
|
|
@@ -143,16 +144,16 @@ function kt(e, t, n, r, i, a) {
|
|
|
143
144
|
} : a, s = t ? n?.getView(t) : null;
|
|
144
145
|
return s ? Me(s.state.doc, r, i, o) : Ne(e, r, i, o);
|
|
145
146
|
}
|
|
146
|
-
function
|
|
147
|
+
function jt(e, t, n, r, i) {
|
|
147
148
|
if (!e || e.size === 0) return;
|
|
148
149
|
let a = /* @__PURE__ */ new Map();
|
|
149
150
|
for (let [o, s] of e) {
|
|
150
|
-
let e =
|
|
151
|
+
let e = At(s, o, t, n, r, i);
|
|
151
152
|
e && a.set(o, e);
|
|
152
153
|
}
|
|
153
154
|
return a.size > 0 ? a : void 0;
|
|
154
155
|
}
|
|
155
|
-
function
|
|
156
|
+
function Mt(e, t, n) {
|
|
156
157
|
let r = /* @__PURE__ */ new Map();
|
|
157
158
|
if (!n || !n.package.footnotes) return r;
|
|
158
159
|
let i = /* @__PURE__ */ new Map();
|
|
@@ -178,7 +179,7 @@ function jt(e, t, n) {
|
|
|
178
179
|
}
|
|
179
180
|
return r;
|
|
180
181
|
}
|
|
181
|
-
var
|
|
182
|
+
var Nt = /* @__PURE__ */ new Set([
|
|
182
183
|
"black",
|
|
183
184
|
"blue",
|
|
184
185
|
"cyan",
|
|
@@ -197,144 +198,145 @@ var B = /* @__PURE__ */ new Set([
|
|
|
197
198
|
"white",
|
|
198
199
|
"yellow"
|
|
199
200
|
]);
|
|
200
|
-
function
|
|
201
|
+
function Pt(e) {
|
|
201
202
|
let t = [], n = (e, r) => {
|
|
202
|
-
for (let [n, i] of e.marks.entries()) i.type.name === "highlight" && !
|
|
203
|
+
for (let [n, i] of e.marks.entries()) i.type.name === "highlight" && !Nt.has(String(i.attrs.color)) && t.push(`${r}.marks[${n}]=${JSON.stringify(i.attrs)}`);
|
|
203
204
|
e.forEach((e, t, i) => {
|
|
204
205
|
n(e, `${r}.content[${i}]`);
|
|
205
206
|
});
|
|
206
207
|
};
|
|
207
208
|
return n(e, "doc"), t.join("; ");
|
|
208
209
|
}
|
|
209
|
-
function
|
|
210
|
-
let { comments: t, hiddenContainer: n, hiddenHeaderFooterContainer: r, noteEditorContainer: a, pagesContainer: o, readOnly: l = !1, experimentalSession: f, pageGap: _ =
|
|
211
|
-
let e =
|
|
210
|
+
function B(e) {
|
|
211
|
+
let { comments: t, hiddenContainer: n, hiddenHeaderFooterContainer: r, noteEditorContainer: a, pagesContainer: o, readOnly: l = !1, experimentalSession: f, pageGap: _ = Tt, pageRenderer: te, markupView: b = "all-markup", showCommentHighlights: x = !0, altChunkMarkerText: re, showMarginGuides: T, marginGuideColor: E, password: D, editorMode: je, author: Me, externalPlugins: Ne = [], historyShortcuts: $e = "editor", onCanonicalHistory: et, onCanonicalHistoryDrop: tt, collaboration: nt, getAnonymizationTerms: rt, getDerivedFields: it, showTemplateDirectives: at, onSlashMenuChange: ot, onSlashMenuKeyAction: st, onChange: ct, onError: k, onSelectionUpdate: lt, onEditorViewReady: A, onCopy: ut, onCut: dt, onPaste: ft, onReadOnlyEditAttempt: pt, featureFlags: mt, onSelectiveSaveTripwire: ht } = e, gt = () => u(f) ?? (u(nt)?.yXmlFragment === void 0 ? void 0 : "legacy"), _t = r ?? n, vt = () => u(Me) ?? Et, j = c(null), yt = /* @__PURE__ */ new Set(), bt = () => {
|
|
212
|
+
let e = j.value;
|
|
212
213
|
return (e && w(e).package.styles) ?? null;
|
|
213
|
-
},
|
|
214
|
-
let e = u(
|
|
214
|
+
}, xt = c(null), M = 0, St = !1, N = 0, P = !1, F = c(null), I = c(null), L = c(null), R = () => {
|
|
215
|
+
let e = u(nt);
|
|
215
216
|
return e === void 0 || p(e) ? void 0 : e;
|
|
216
|
-
},
|
|
217
|
-
let e = u(
|
|
217
|
+
}, wt = () => {
|
|
218
|
+
let e = u(nt);
|
|
218
219
|
return e !== void 0 && p(e) ? e : void 0;
|
|
219
|
-
}, z = c([]),
|
|
220
|
-
let t =
|
|
221
|
-
|
|
222
|
-
},
|
|
220
|
+
}, z = c([]), Nt = c(null), B = c(null), V = c(null), Ft = s(0), It = c([]), Lt = c([]), Rt = s(!1), H = s(null), U = s(!1), W = () => oe(u(gt), ie.authorityRouting), zt = (e) => v(e), Bt = (e) => {
|
|
221
|
+
let t = zt(e);
|
|
222
|
+
ct?.(t), Xt.emit("docChange", t);
|
|
223
|
+
}, Vt = (e, t) => {
|
|
223
224
|
if (!W()) return !1;
|
|
224
225
|
let n = new m({
|
|
225
226
|
ground: { gap: e },
|
|
226
227
|
message: ae(e, t)
|
|
227
228
|
});
|
|
228
229
|
return k?.(n), !0;
|
|
229
|
-
}, G = new ze(We({ historyShortcuts:
|
|
230
|
+
}, G = new ze(We({ historyShortcuts: $e }));
|
|
230
231
|
G.buildSchema(), G.initializeRuntime();
|
|
231
|
-
let
|
|
232
|
-
onChange: (e) =>
|
|
233
|
-
onKeyAction: (e) =>
|
|
234
|
-
}),
|
|
235
|
-
function
|
|
232
|
+
let Ht = se(!1), Ut = [Ht], Wt = Ye(), Gt = Ze({
|
|
233
|
+
onChange: (e) => ot?.(e),
|
|
234
|
+
onKeyAction: (e) => st?.(e) ?? !1
|
|
235
|
+
}), Kt = Xe(), qt = Je(() => it?.()), Jt = () => u(at) === !0;
|
|
236
|
+
function Yt() {
|
|
236
237
|
return [
|
|
237
|
-
|
|
238
|
+
Ht,
|
|
238
239
|
...Ne,
|
|
239
|
-
...
|
|
240
|
-
...
|
|
241
|
-
|
|
240
|
+
...R()?.plugins ?? [],
|
|
241
|
+
...Jt() ? [Wt, Gt] : [],
|
|
242
|
+
Kt,
|
|
243
|
+
qt
|
|
242
244
|
];
|
|
243
245
|
}
|
|
244
|
-
let
|
|
246
|
+
let Xt = pe(), K = new Le(), q = Ce(), Zt = ve({
|
|
245
247
|
relayout: () => {
|
|
246
|
-
let e =
|
|
248
|
+
let e = F.value?.state ?? q.lastEditorState;
|
|
247
249
|
e && Z(e, { reason: "hyphenation-ready" });
|
|
248
250
|
},
|
|
249
251
|
onError: (e) => k?.(e)
|
|
250
252
|
});
|
|
251
|
-
i(
|
|
253
|
+
i(Zt.cancel), i(ge({
|
|
252
254
|
measuredFontSet: () => q.lastMeasureInputs?.fontSet ?? null,
|
|
253
255
|
relayout: () => {
|
|
254
|
-
if (
|
|
255
|
-
let e =
|
|
256
|
+
if (P) return;
|
|
257
|
+
let e = F.value?.state ?? q.lastEditorState;
|
|
256
258
|
e && Z(e, { reason: "font-ready" });
|
|
257
259
|
}
|
|
258
260
|
}));
|
|
259
|
-
let
|
|
261
|
+
let Qt = new Fe({
|
|
260
262
|
pageGap: _,
|
|
261
263
|
showShadow: !0
|
|
262
264
|
}), J = _e({
|
|
263
|
-
getHost: () =>
|
|
265
|
+
getHost: () => _t.value,
|
|
264
266
|
getReadOnly: () => u(l),
|
|
265
|
-
getDocument: () =>
|
|
267
|
+
getDocument: () => j.value,
|
|
266
268
|
getCanonicalApi: () => $.api,
|
|
267
269
|
readCanonicalDocument: () => $.readCanonicalDocument(),
|
|
268
|
-
getExperimentalSession: () => u(
|
|
270
|
+
getExperimentalSession: () => u(gt),
|
|
269
271
|
onSessionRefusal: (e, t, n) => {
|
|
270
272
|
H.value = e, k?.(n ?? new m({
|
|
271
273
|
ground: t,
|
|
272
274
|
message: e
|
|
273
275
|
}));
|
|
274
276
|
},
|
|
275
|
-
getStyles:
|
|
276
|
-
getTheme: () =>
|
|
277
|
+
getStyles: bt,
|
|
278
|
+
getTheme: () => j.value?.package.theme ?? null,
|
|
277
279
|
onTransaction: ({ rId: e, kind: t, view: n, docChanged: r, selectionChanged: i }) => {
|
|
278
|
-
if (r && (U.value = !0,
|
|
280
|
+
if (r && (U.value = !0, tn.schedule()), r || i) {
|
|
279
281
|
let { from: r, to: i } = n.state.selection;
|
|
280
|
-
|
|
282
|
+
Nt.value = {
|
|
281
283
|
from: r,
|
|
282
284
|
kind: t,
|
|
283
285
|
rId: e,
|
|
284
286
|
to: i
|
|
285
|
-
},
|
|
287
|
+
}, lt?.(n.state), Xt.emit("selectionChange", {
|
|
286
288
|
from: r,
|
|
287
289
|
to: i
|
|
288
290
|
});
|
|
289
291
|
}
|
|
290
292
|
K.requestRender();
|
|
291
293
|
}
|
|
292
|
-
}),
|
|
294
|
+
}), $t = { current: null }, Y = we({
|
|
293
295
|
getHost: () => a?.value ?? null,
|
|
294
|
-
getPlugins: () =>
|
|
295
|
-
getDocument: () =>
|
|
296
|
+
getPlugins: () => Ut,
|
|
297
|
+
getDocument: () => j.value,
|
|
296
298
|
getCanonicalApi: () => $.api,
|
|
297
299
|
readCanonicalDocument: () => $.readCanonicalDocument(),
|
|
298
|
-
getExperimentalSession: () => u(
|
|
300
|
+
getExperimentalSession: () => u(gt),
|
|
299
301
|
onSessionRefusal: (e, t, n) => {
|
|
300
302
|
H.value = e, k?.(n ?? new m({
|
|
301
303
|
ground: t,
|
|
302
304
|
message: e
|
|
303
305
|
}));
|
|
304
306
|
},
|
|
305
|
-
getStyles:
|
|
306
|
-
getTheme: () =>
|
|
307
|
+
getStyles: bt,
|
|
308
|
+
getTheme: () => j.value?.package.theme ?? null,
|
|
307
309
|
onTransaction: ({ docChanged: e, selectionChanged: t, view: n }) => {
|
|
308
310
|
if (e) {
|
|
309
311
|
U.value = !0;
|
|
310
|
-
let e =
|
|
311
|
-
e && (
|
|
312
|
+
let e = j.value;
|
|
313
|
+
e && (j.value = $.readCanonicalDocument() ?? $t.current?.snapshotDocument(e) ?? e, sn()), tn.schedule();
|
|
312
314
|
}
|
|
313
315
|
if (e || t) {
|
|
314
|
-
|
|
316
|
+
lt?.(n.state);
|
|
315
317
|
let { from: e, to: t } = n.state.selection;
|
|
316
|
-
|
|
318
|
+
Xt.emit("selectionChange", {
|
|
317
319
|
from: e,
|
|
318
320
|
to: t
|
|
319
321
|
});
|
|
320
322
|
}
|
|
321
323
|
}
|
|
322
324
|
});
|
|
323
|
-
|
|
325
|
+
$t.current = Y;
|
|
324
326
|
let X = () => {
|
|
325
327
|
J.sync(), Y.sync();
|
|
326
328
|
};
|
|
327
|
-
d(() => u(
|
|
328
|
-
function
|
|
329
|
-
e.layout && (V.value = e.layout), e.blocks && (
|
|
329
|
+
d(() => u(gt), X);
|
|
330
|
+
function en(e) {
|
|
331
|
+
e.layout && (V.value = e.layout), e.blocks && (It.value = e.blocks), e.measures && (Lt.value = e.measures), e.blockLookup && Qt.setBlockLookup(e.blockLookup), e.layout && Xt.emit("layoutComplete", e.layout);
|
|
330
332
|
}
|
|
331
333
|
function Z(e, t = {}) {
|
|
332
|
-
if (
|
|
333
|
-
let n = o.value, r = n instanceof HTMLDivElement ? n : null, i =
|
|
334
|
-
|
|
335
|
-
let m = a?.package.styles ?? null, ee = i?.package.theme ?? null, h = i?.package.settings?.defaultTabStop, g = i?.package.settings?.mirrorMargins === !0, v =
|
|
334
|
+
if (P) return;
|
|
335
|
+
let n = o.value, r = n instanceof HTMLDivElement ? n : null, i = j.value, a = i && w(i), s = a?.package.document, c = s?.sections?.[0]?.properties ?? s?.finalSectionProperties ?? null, l = ne(c), d = S(c), f = kt(c), p = l.w - d.left - d.right;
|
|
336
|
+
Ft.value = p;
|
|
337
|
+
let m = a?.package.styles ?? null, ee = i?.package.theme ?? null, h = i?.package.settings?.defaultTabStop, g = i?.package.settings?.mirrorMargins === !0, v = Qe(a?.package);
|
|
336
338
|
try {
|
|
337
|
-
|
|
339
|
+
en(ye({
|
|
338
340
|
contentWidth: p,
|
|
339
341
|
columns: f,
|
|
340
342
|
pageSize: l,
|
|
@@ -364,17 +366,17 @@ function V(e) {
|
|
|
364
366
|
styles: m,
|
|
365
367
|
layout: V.value,
|
|
366
368
|
hfPMs: J,
|
|
367
|
-
painter:
|
|
369
|
+
painter: Qt,
|
|
368
370
|
pagesContainer: r,
|
|
369
371
|
session: q,
|
|
370
|
-
renderHfFromContentOrPm:
|
|
371
|
-
renderHeaderFooterContentByRId:
|
|
372
|
+
renderHfFromContentOrPm: At,
|
|
373
|
+
renderHeaderFooterContentByRId: jt,
|
|
372
374
|
readFontSetSignature: me,
|
|
373
|
-
buildFootnoteRenderItems:
|
|
374
|
-
describeInvalidHighlightMarks:
|
|
375
|
-
emptyTemplatePreviewEntries:
|
|
376
|
-
emptyTemplatePreviewHidden:
|
|
377
|
-
hyphenationReadiness:
|
|
375
|
+
buildFootnoteRenderItems: Mt,
|
|
376
|
+
describeInvalidHighlightMarks: Pt,
|
|
377
|
+
emptyTemplatePreviewEntries: Dt,
|
|
378
|
+
emptyTemplatePreviewHidden: Ot,
|
|
379
|
+
hyphenationReadiness: Zt,
|
|
378
380
|
markupView: u(b),
|
|
379
381
|
showCommentHighlights: u(x),
|
|
380
382
|
...re === void 0 ? {} : { altChunkMarkerText: u(re) }
|
|
@@ -384,205 +386,206 @@ function V(e) {
|
|
|
384
386
|
k?.(t);
|
|
385
387
|
}
|
|
386
388
|
}
|
|
387
|
-
let
|
|
388
|
-
readState: () =>
|
|
389
|
+
let tn = Se({
|
|
390
|
+
readState: () => F.value?.state ?? null,
|
|
389
391
|
runLayout: (e, t) => Z(e, t),
|
|
390
392
|
...be,
|
|
391
393
|
clock: xe
|
|
392
|
-
}), Q = null,
|
|
393
|
-
function
|
|
394
|
+
}), Q = null, nn = Ge();
|
|
395
|
+
function rn() {
|
|
394
396
|
Q !== null && (window.clearTimeout(Q), Q = null);
|
|
395
|
-
let e =
|
|
397
|
+
let e = F.value, t = j.value;
|
|
396
398
|
if (e && t) try {
|
|
397
399
|
let n = $.readCanonicalDocument();
|
|
398
400
|
if (!n && W()) return;
|
|
399
|
-
let r = n ??
|
|
400
|
-
|
|
401
|
+
let r = n ?? nn.reconcile(Re(e.state.doc, w(t), { stylesheetSource: { type: "package" } }), e.state.doc);
|
|
402
|
+
j.value = r, X(), on(), Bt(r);
|
|
401
403
|
} catch (e) {
|
|
402
404
|
k?.(e instanceof Error ? e : Error(String(e)));
|
|
403
405
|
}
|
|
404
406
|
}
|
|
405
|
-
let
|
|
406
|
-
function
|
|
407
|
-
|
|
407
|
+
let an = null;
|
|
408
|
+
function on() {
|
|
409
|
+
an !== null && (window.clearTimeout(an), an = null);
|
|
408
410
|
}
|
|
409
|
-
function
|
|
410
|
-
|
|
411
|
-
if (
|
|
412
|
-
let e =
|
|
413
|
-
e &&
|
|
411
|
+
function sn() {
|
|
412
|
+
on(), an = window.setTimeout(() => {
|
|
413
|
+
if (an = null, Q !== null) return;
|
|
414
|
+
let e = j.value;
|
|
415
|
+
e && Bt(e);
|
|
414
416
|
}, ue);
|
|
415
417
|
}
|
|
416
|
-
function
|
|
418
|
+
function cn() {
|
|
417
419
|
Q !== null && window.clearTimeout(Q), Q = window.setTimeout(() => {
|
|
418
|
-
Q = null,
|
|
420
|
+
Q = null, rn();
|
|
419
421
|
}, ue);
|
|
420
422
|
}
|
|
421
423
|
let $ = h({
|
|
422
424
|
getHost: () => n.value,
|
|
423
|
-
getDocument: () =>
|
|
424
|
-
getStyles:
|
|
425
|
+
getDocument: () => j.value,
|
|
426
|
+
getStyles: bt,
|
|
425
427
|
getExtensionManager: () => G,
|
|
426
|
-
getExternalPlugins:
|
|
427
|
-
getAnonymizationTerms: () =>
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
428
|
+
getExternalPlugins: Yt,
|
|
429
|
+
getAnonymizationTerms: () => rt?.() ?? le,
|
|
430
|
+
getDerivedFields: () => it?.(),
|
|
431
|
+
getCollaboration: R,
|
|
432
|
+
getCollaborationModules: () => L.value,
|
|
433
|
+
getCanonicalRoom: wt,
|
|
431
434
|
getPrecomputedInitialState: () => null,
|
|
432
435
|
getReadOnly: () => u(l),
|
|
433
|
-
getExperimentalSession: () => u(
|
|
434
|
-
getHistoryShortcuts: () =>
|
|
435
|
-
onCanonicalHistory: (e) =>
|
|
436
|
-
onCanonicalHistoryDrop: (e) =>
|
|
436
|
+
getExperimentalSession: () => u(gt),
|
|
437
|
+
getHistoryShortcuts: () => $e,
|
|
438
|
+
onCanonicalHistory: (e) => et?.(e),
|
|
439
|
+
onCanonicalHistoryDrop: (e) => tt?.(e),
|
|
437
440
|
getEditingMode: () => u(je) ?? "editing",
|
|
438
|
-
getSuggestionAuthor:
|
|
441
|
+
getSuggestionAuthor: vt,
|
|
439
442
|
onSessionRefusal: (e, t, n) => {
|
|
440
443
|
k?.(n ?? new m({
|
|
441
444
|
ground: t,
|
|
442
445
|
message: e
|
|
443
446
|
}));
|
|
444
447
|
},
|
|
445
|
-
getDocumentIdentity: () => String(
|
|
446
|
-
getDocumentContext: () =>
|
|
447
|
-
onTransaction:
|
|
448
|
-
onCanonicalCompositionLayout:
|
|
448
|
+
getDocumentIdentity: () => String(M),
|
|
449
|
+
getDocumentContext: () => j.value,
|
|
450
|
+
onTransaction: dn,
|
|
451
|
+
onCanonicalCompositionLayout: fn,
|
|
449
452
|
getEmbeddedFontFamilyMap: () => q.embeddedFontFamilyMap,
|
|
450
453
|
onSelectionChange: (e) => {
|
|
451
|
-
|
|
454
|
+
I.value = e, lt?.(e), Xt.emit("selectionChange", {
|
|
452
455
|
from: e.selection.from,
|
|
453
456
|
to: e.selection.to
|
|
454
457
|
});
|
|
455
458
|
},
|
|
456
459
|
onKeyDown: () => !1,
|
|
457
|
-
onCopy: () =>
|
|
458
|
-
onCut: () =>
|
|
459
|
-
onPaste: () =>
|
|
460
|
-
onReadOnlyEditAttempt: () =>
|
|
461
|
-
onEditorViewReady:
|
|
460
|
+
onCopy: () => ut?.(),
|
|
461
|
+
onCut: () => dt?.(),
|
|
462
|
+
onPaste: () => ft?.(),
|
|
463
|
+
onReadOnlyEditAttempt: () => pt?.(),
|
|
464
|
+
onEditorViewReady: pn,
|
|
462
465
|
onEditorViewDestroy: () => {
|
|
463
|
-
|
|
466
|
+
F.value = null, Rt.value = !1, A?.(null);
|
|
464
467
|
},
|
|
465
468
|
onRemoteSelectionsChange: (e) => {
|
|
466
469
|
z.value = e;
|
|
467
470
|
}
|
|
468
|
-
}),
|
|
469
|
-
let e =
|
|
471
|
+
}), ln = $.api.autocomplete.subscribe((t) => e.onAutocompleteChange?.(t)), un = () => {
|
|
472
|
+
let e = R()?.awareness, t = L.value, n = $.getView();
|
|
470
473
|
z.value = e && t && n ? ee(n.state, e, t) : [];
|
|
471
474
|
};
|
|
472
|
-
d(() => u(
|
|
475
|
+
d(() => u(nt), (e, t, n) => {
|
|
473
476
|
if (z.value = [], !e || p(e)) {
|
|
474
|
-
|
|
477
|
+
L.value = null, $.retryViewCreation(), $.syncExternalDocument();
|
|
475
478
|
return;
|
|
476
479
|
}
|
|
477
480
|
let r = !1;
|
|
478
481
|
n(() => {
|
|
479
482
|
r = !0;
|
|
480
|
-
}),
|
|
481
|
-
r || (
|
|
483
|
+
}), L.value = null, O().then((e) => {
|
|
484
|
+
r || (L.value = e, $.retryViewCreation(), $.syncExternalDocument(), un());
|
|
482
485
|
}, (e) => {
|
|
483
|
-
r || (
|
|
486
|
+
r || (L.value = null, k?.(e instanceof Error ? e : Error(String(e))));
|
|
484
487
|
});
|
|
485
488
|
}, { immediate: !0 }), d(() => ({
|
|
486
|
-
awareness:
|
|
487
|
-
modules:
|
|
488
|
-
view:
|
|
489
|
+
awareness: R()?.awareness,
|
|
490
|
+
modules: L.value,
|
|
491
|
+
view: F.value
|
|
489
492
|
}), ({ awareness: e, modules: t, view: n }, r, i) => {
|
|
490
|
-
|
|
491
|
-
e.off("change",
|
|
493
|
+
wt() === void 0 && (!e || !t || !n ? z.value = [] : (e.on("change", un), un(), i(() => {
|
|
494
|
+
e.off("change", un), z.value = [];
|
|
492
495
|
})));
|
|
493
496
|
}, { flush: "post" });
|
|
494
|
-
function
|
|
495
|
-
|
|
497
|
+
function dn({ newState: e, docChanged: t, transactions: n }) {
|
|
498
|
+
I.value = e;
|
|
496
499
|
let r = n[0]?.before;
|
|
497
|
-
if (t && r &&
|
|
500
|
+
if (t && r && nn.noteBase(r), t) {
|
|
498
501
|
let e = $.readCanonicalDocument();
|
|
499
|
-
e && (
|
|
502
|
+
e && (j.value = e, X()), U.value = !0, K.incrementStateSeq(), tn.schedule(), cn();
|
|
500
503
|
}
|
|
501
504
|
K.requestRender();
|
|
502
505
|
}
|
|
503
|
-
function
|
|
504
|
-
let e =
|
|
505
|
-
e && (
|
|
506
|
+
function fn() {
|
|
507
|
+
let e = F.value;
|
|
508
|
+
e && (I.value = e.state), K.incrementStateSeq(), tn.schedule(), K.requestRender();
|
|
506
509
|
}
|
|
507
|
-
function
|
|
508
|
-
|
|
509
|
-
let t =
|
|
510
|
-
|
|
510
|
+
function pn(e) {
|
|
511
|
+
F.value = e, I.value = e.state, Rt.value = !0;
|
|
512
|
+
let t = j.value, n = M, r = ++N;
|
|
513
|
+
P = !0;
|
|
511
514
|
let i = () => {
|
|
512
|
-
|
|
515
|
+
N === r && (P = !1, St || M !== n || $.getView() !== e || (Z(e.state, { reason: "initial" }), K.requestRender()));
|
|
513
516
|
};
|
|
514
|
-
he(t, e.state.doc).then(i, i),
|
|
515
|
-
|
|
517
|
+
he(t, e.state.doc).then(i, i), gn(e), A?.(e), u(l) || requestAnimationFrame(() => {
|
|
518
|
+
F.value === e && !e.hasFocus() && e.focus();
|
|
516
519
|
});
|
|
517
520
|
}
|
|
518
|
-
let
|
|
521
|
+
let mn = {
|
|
519
522
|
getDocx: async (e) => {
|
|
520
|
-
let t = await
|
|
521
|
-
return t?.tripwireResult &&
|
|
523
|
+
let t = await En(e);
|
|
524
|
+
return t?.tripwireResult && ht?.(t.tripwireResult), t?.buffer ?? null;
|
|
522
525
|
},
|
|
523
|
-
loadDocument:
|
|
524
|
-
loadDocx:
|
|
525
|
-
},
|
|
526
|
+
loadDocument: Cn,
|
|
527
|
+
loadDocx: Sn
|
|
528
|
+
}, hn = fe({
|
|
526
529
|
getEditorApi: () => $.api,
|
|
527
530
|
getLayout: () => V.value,
|
|
528
531
|
runLayout: (e, t) => Z(e, t),
|
|
529
|
-
getDocumentIO: () =>
|
|
530
|
-
emitter:
|
|
532
|
+
getDocumentIO: () => mn,
|
|
533
|
+
emitter: Xt
|
|
531
534
|
});
|
|
532
|
-
function
|
|
535
|
+
function gn(e) {
|
|
533
536
|
let t = u(je) === "suggesting";
|
|
534
|
-
ce(t, e.state, e.dispatch,
|
|
537
|
+
ce(t, e.state, e.dispatch, vt());
|
|
535
538
|
}
|
|
536
|
-
d([() => u(je),
|
|
537
|
-
|
|
539
|
+
d([() => u(je), vt], () => {
|
|
540
|
+
hn.setCanonicalMode(u(je) === "suggesting" ? {
|
|
538
541
|
type: "suggesting",
|
|
539
|
-
author:
|
|
542
|
+
author: vt()
|
|
540
543
|
} : { type: "editing" });
|
|
541
|
-
let e =
|
|
542
|
-
e &&
|
|
544
|
+
let e = F.value;
|
|
545
|
+
e && gn(e);
|
|
543
546
|
for (let e of Y.listStories()) {
|
|
544
547
|
let t = Y.getView(e);
|
|
545
|
-
t &&
|
|
548
|
+
t && gn(t);
|
|
546
549
|
}
|
|
547
550
|
}), d(() => u(l), (e) => {
|
|
548
|
-
$.syncEditable(), e &&
|
|
551
|
+
$.syncEditable(), e && Fn(), J.sync();
|
|
549
552
|
});
|
|
550
|
-
function
|
|
551
|
-
let t =
|
|
552
|
-
if (t === e.state.plugins.includes(
|
|
553
|
-
let n = e.state.plugins.filter((e) => e !==
|
|
553
|
+
function _n(e) {
|
|
554
|
+
let t = Jt();
|
|
555
|
+
if (t === e.state.plugins.includes(Wt)) return;
|
|
556
|
+
let n = e.state.plugins.filter((e) => e !== Wt && e !== Gt);
|
|
554
557
|
if (t) {
|
|
555
|
-
let e = n.indexOf(
|
|
556
|
-
n.splice(t, 0,
|
|
558
|
+
let e = n.indexOf(Kt), t = e === -1 ? n.length : e;
|
|
559
|
+
n.splice(t, 0, Wt, Gt);
|
|
557
560
|
}
|
|
558
561
|
e.updateState(e.state.reconfigure({ plugins: n }));
|
|
559
562
|
}
|
|
560
|
-
d(() =>
|
|
561
|
-
let e =
|
|
562
|
-
e &&
|
|
563
|
+
d(() => Jt(), () => {
|
|
564
|
+
let e = F.value;
|
|
565
|
+
e && _n(e);
|
|
563
566
|
});
|
|
564
|
-
function
|
|
567
|
+
function vn() {
|
|
565
568
|
$.ensureView();
|
|
566
569
|
}
|
|
567
|
-
function
|
|
568
|
-
|
|
570
|
+
function yn() {
|
|
571
|
+
on(), M += 1, xt.value = j.value?.originalBuffer ?? null, U.value = !1, Nt.value = null, B.value = null, Y.activate(null), tn.dispose(), $.destroyView(), W() && $.ensureView(), X(), $.ensureView(), $.getView() || bn();
|
|
569
572
|
}
|
|
570
|
-
function
|
|
571
|
-
let e =
|
|
572
|
-
if (e && !
|
|
573
|
+
function bn() {
|
|
574
|
+
let e = j.value;
|
|
575
|
+
if (e && !R()) try {
|
|
573
576
|
let t = g({
|
|
574
577
|
document: e,
|
|
575
578
|
styles: w(e).package.styles ?? null,
|
|
576
579
|
manager: G,
|
|
577
|
-
externalPlugins:
|
|
580
|
+
externalPlugins: Yt(),
|
|
578
581
|
collaborationModules: null,
|
|
579
582
|
reason: "mount"
|
|
580
583
|
});
|
|
581
|
-
|
|
582
|
-
let n =
|
|
583
|
-
|
|
584
|
+
I.value = t;
|
|
585
|
+
let n = M, r = ++N;
|
|
586
|
+
P = !0;
|
|
584
587
|
let i = () => {
|
|
585
|
-
|
|
588
|
+
N === r && (P = !1, St || M !== n || j.value !== e || $.getView() || Z(t, { reason: "initial" }));
|
|
586
589
|
};
|
|
587
590
|
he(e, t.doc).then(i, i);
|
|
588
591
|
} catch (e) {
|
|
@@ -592,14 +595,14 @@ function V(e) {
|
|
|
592
595
|
d([
|
|
593
596
|
n,
|
|
594
597
|
o,
|
|
595
|
-
|
|
598
|
+
_t,
|
|
596
599
|
...a ? [a] : []
|
|
597
600
|
], () => {
|
|
598
|
-
n.value &&
|
|
601
|
+
n.value && j.value && !$.getView() && vn(), X();
|
|
599
602
|
}, { flush: "post" });
|
|
600
|
-
let
|
|
601
|
-
async function
|
|
602
|
-
|
|
603
|
+
let xn = 0;
|
|
604
|
+
async function Sn(e) {
|
|
605
|
+
xn += 1, H.value = null, Rt.value = !1;
|
|
603
606
|
try {
|
|
604
607
|
let t;
|
|
605
608
|
if (W()) {
|
|
@@ -607,27 +610,27 @@ function V(e) {
|
|
|
607
610
|
if (n.isErr()) throw n.error;
|
|
608
611
|
t = n.value.document;
|
|
609
612
|
} else t = await Ae(e, { password: u(D) });
|
|
610
|
-
|
|
613
|
+
yt = Ke(t), j.value = t, yn();
|
|
611
614
|
} catch (e) {
|
|
612
615
|
let t = e instanceof Error ? e : Error(String(e));
|
|
613
616
|
H.value = t.message, k?.(t);
|
|
614
617
|
}
|
|
615
618
|
}
|
|
616
|
-
function
|
|
617
|
-
let t =
|
|
619
|
+
function Cn(e) {
|
|
620
|
+
let t = xn += 1;
|
|
618
621
|
H.value = null;
|
|
619
|
-
let n =
|
|
620
|
-
!W() || De(n) ?
|
|
622
|
+
let n = Ct(e);
|
|
623
|
+
!W() || De(n) ? Tn(n) : wn(n, t);
|
|
621
624
|
}
|
|
622
|
-
async function
|
|
625
|
+
async function wn(e, t) {
|
|
623
626
|
let n = await ke(e);
|
|
624
|
-
t ===
|
|
627
|
+
t === xn && (n.isErr() ? (H.value = n.error.message, k?.(n.error)) : Tn(n.value));
|
|
625
628
|
}
|
|
626
|
-
function
|
|
627
|
-
|
|
629
|
+
function Tn(e) {
|
|
630
|
+
yt = Ke(e), j.value = e, nn.reset(), yn();
|
|
628
631
|
}
|
|
629
|
-
async function
|
|
630
|
-
let n =
|
|
632
|
+
async function En(e) {
|
|
633
|
+
let n = F.value, r = j.value;
|
|
631
634
|
if (!n || !r) return null;
|
|
632
635
|
try {
|
|
633
636
|
let i = $.api.captureCanonicalSave();
|
|
@@ -635,14 +638,14 @@ function V(e) {
|
|
|
635
638
|
let t = await Ee({
|
|
636
639
|
snapshot: i,
|
|
637
640
|
options: e,
|
|
638
|
-
featureFlags: u(
|
|
641
|
+
featureFlags: u(mt)
|
|
639
642
|
});
|
|
640
643
|
for (let n of t.diagnostics) e?.onDiagnostic || k?.(Te(n));
|
|
641
644
|
return t;
|
|
642
645
|
}
|
|
643
646
|
if (W()) return null;
|
|
644
|
-
Q !== null &&
|
|
645
|
-
let a = Y.snapshotDocument(J.snapshotDocument(r)), o = n.state, s = Re(o.doc, w(a), { stylesheetSource: { type: "package" } }), c = qe(t ? y(s, t(), { anchoredInEditor: C(o.doc) }) : s,
|
|
647
|
+
Q !== null && rn();
|
|
648
|
+
let a = Y.snapshotDocument(J.snapshotDocument(r)), o = n.state, s = Re(o.doc, w(a), { stylesheetSource: { type: "package" } }), c = qe(t ? y(s, t(), { anchoredInEditor: C(o.doc) }) : s, yt), { resolveSelectiveSaveFlags: l } = await import("@stll/folio-core/docx/selectiveSaveFlags"), d = l(u(mt)), f = c.originalBuffer ?? null, p = d.selectiveSave && e?.mode !== de.full, m = p || d.selectiveSaveTripwire, { repackDocx: ee, createDocx: h } = await import("@stll/folio-core/docx/rezip"), g = null;
|
|
646
649
|
if (m && f) {
|
|
647
650
|
let { attemptSelectiveSave: t } = await import("@stll/folio-core/docx/selectiveSave");
|
|
648
651
|
g = await t(c, f, {
|
|
@@ -664,7 +667,7 @@ function V(e) {
|
|
|
664
667
|
v = await S();
|
|
665
668
|
} catch {}
|
|
666
669
|
let ne = null;
|
|
667
|
-
if (d.selectiveSaveTripwire && v &&
|
|
670
|
+
if (d.selectiveSaveTripwire && v && ht) try {
|
|
668
671
|
let { compareSelectiveVsFull: e } = await import("@stll/folio-core/docx/selectiveSaveTripwire");
|
|
669
672
|
ne = await e(g, v);
|
|
670
673
|
} catch {}
|
|
@@ -679,63 +682,63 @@ function V(e) {
|
|
|
679
682
|
return k?.(e instanceof Error ? e : Error(String(e))), null;
|
|
680
683
|
}
|
|
681
684
|
}
|
|
682
|
-
async function
|
|
683
|
-
let t =
|
|
685
|
+
async function Dn(e) {
|
|
686
|
+
let t = F.value, n = t?.state, r = await En({
|
|
684
687
|
onDiagnostic: e?.onDiagnostic,
|
|
685
688
|
onSelectiveDecline: e?.onSelectiveDecline,
|
|
686
689
|
onSerializationPath: e?.onSerializationPath,
|
|
687
690
|
mode: e?.selective === !1 ? de.full : de.preferSelective
|
|
688
691
|
});
|
|
689
|
-
return r ? (
|
|
692
|
+
return r ? (F.value === t && t?.state.doc === n?.doc && (r.version === void 0 || $.api.isCanonicalSaveCurrent(r.version)) && (r.version !== void 0 && $.api.markCanonicalSaved(r.version, {
|
|
690
693
|
buffer: r.buffer,
|
|
691
694
|
path: r.path
|
|
692
|
-
}),
|
|
695
|
+
}), j.value = r.document, X(), U.value = !1), r.tripwireResult && ht?.(r.tripwireResult), new Blob([r.buffer], { type: "application/vnd.openxmlformats-officedocument.wordprocessingml.document" })) : null;
|
|
693
696
|
}
|
|
694
|
-
function
|
|
697
|
+
function On() {
|
|
695
698
|
return $.readCanonicalDocument();
|
|
696
699
|
}
|
|
697
|
-
function
|
|
698
|
-
let e =
|
|
700
|
+
function kn() {
|
|
701
|
+
let e = On();
|
|
699
702
|
if (e) return e;
|
|
700
703
|
if (W()) return null;
|
|
701
|
-
let t =
|
|
704
|
+
let t = j.value;
|
|
702
705
|
if (!t) return null;
|
|
703
706
|
let n = $.api.getDocument() ?? t;
|
|
704
707
|
return Y.snapshotDocument(J.snapshotDocument(n));
|
|
705
708
|
}
|
|
706
|
-
function
|
|
707
|
-
let e =
|
|
708
|
-
return e &&
|
|
709
|
+
function An() {
|
|
710
|
+
let e = kn();
|
|
711
|
+
return e && zt(e);
|
|
709
712
|
}
|
|
710
|
-
function
|
|
711
|
-
|
|
713
|
+
function jn(e) {
|
|
714
|
+
Vt(ie.modelEdits, "Direct document model changes are unavailable in this session.") || (j.value = Ct(e), on(), xt.value = e.originalBuffer ?? null, X(), B.value && !Y.getView(B.value) && (B.value = null));
|
|
712
715
|
}
|
|
713
|
-
function
|
|
716
|
+
function Mn(e) {
|
|
714
717
|
return J.getView(e);
|
|
715
718
|
}
|
|
716
|
-
function
|
|
719
|
+
function Nn() {
|
|
717
720
|
X();
|
|
718
721
|
}
|
|
719
|
-
function
|
|
722
|
+
function Pn(e) {
|
|
720
723
|
let t = Y.activate(e);
|
|
721
|
-
t && (
|
|
724
|
+
t && (gn(t), B.value = e, requestAnimationFrame(() => t.focus()));
|
|
722
725
|
}
|
|
723
|
-
function
|
|
726
|
+
function Fn() {
|
|
724
727
|
Y.activate(null), B.value = null;
|
|
725
728
|
}
|
|
726
|
-
function
|
|
729
|
+
function In() {
|
|
727
730
|
let e = B.value;
|
|
728
731
|
return e ? Y.getView(e) : null;
|
|
729
732
|
}
|
|
730
|
-
function
|
|
733
|
+
function Ln() {
|
|
731
734
|
return G.getCommands();
|
|
732
735
|
}
|
|
733
|
-
function
|
|
734
|
-
let e =
|
|
735
|
-
e ? e.focus() :
|
|
736
|
+
function Rn() {
|
|
737
|
+
let e = In();
|
|
738
|
+
e ? e.focus() : F.value?.focus();
|
|
736
739
|
}
|
|
737
|
-
function
|
|
738
|
-
let e =
|
|
740
|
+
function zn() {
|
|
741
|
+
let e = F.value;
|
|
739
742
|
e && Z(e.state, { reason: "manual" });
|
|
740
743
|
}
|
|
741
744
|
d([
|
|
@@ -745,59 +748,59 @@ function V(e) {
|
|
|
745
748
|
() => u(b),
|
|
746
749
|
() => u(x),
|
|
747
750
|
() => u(re)
|
|
748
|
-
], () =>
|
|
749
|
-
function
|
|
750
|
-
|
|
751
|
+
], () => zn());
|
|
752
|
+
function Bn() {
|
|
753
|
+
St = !0, o.value && Ie(o.value), N += 1, P = !1, tn.dispose(), Q !== null && (window.clearTimeout(Q), Q = null), on(), $.destroyView(), z.value = [], J.destroy(), Y.destroy(), G.destroy(), I.value = null, V.value = null, j.value = null, xt.value = null, Rt.value = !1;
|
|
751
754
|
}
|
|
752
755
|
return i(() => {
|
|
753
|
-
|
|
756
|
+
Bn(), ln();
|
|
754
757
|
}), {
|
|
755
758
|
setEmbeddedFontFamilies: (e) => {
|
|
756
759
|
e ? q.embeddedFontFamilyMap = new Map(e) : delete q.embeddedFontFamilyMap, $.refreshFonts();
|
|
757
760
|
},
|
|
758
|
-
editor:
|
|
759
|
-
editorView:
|
|
760
|
-
editorState:
|
|
761
|
+
editor: hn,
|
|
762
|
+
editorView: F,
|
|
763
|
+
editorState: I,
|
|
761
764
|
remoteSelections: z,
|
|
762
|
-
headerFooterSelection:
|
|
765
|
+
headerFooterSelection: Nt,
|
|
763
766
|
activeNoteStory: B,
|
|
764
|
-
isReady:
|
|
767
|
+
isReady: Rt,
|
|
765
768
|
isDirty: U,
|
|
766
769
|
parseError: H,
|
|
767
|
-
modelDocument:
|
|
768
|
-
readDocumentModel:
|
|
769
|
-
sourceBuffer:
|
|
770
|
-
hiddenEditorWidth:
|
|
770
|
+
modelDocument: j,
|
|
771
|
+
readDocumentModel: On,
|
|
772
|
+
sourceBuffer: xt,
|
|
773
|
+
hiddenEditorWidth: Ft,
|
|
771
774
|
layout: V,
|
|
772
|
-
blocks:
|
|
773
|
-
measures:
|
|
775
|
+
blocks: It,
|
|
776
|
+
measures: Lt,
|
|
774
777
|
syncCoordinator: K,
|
|
775
|
-
loadBuffer:
|
|
776
|
-
loadDocument:
|
|
777
|
-
save:
|
|
778
|
-
getDocument:
|
|
779
|
-
readDocument:
|
|
780
|
-
setDocument:
|
|
781
|
-
getHeaderFooterView:
|
|
782
|
-
syncHeaderFooterViews:
|
|
783
|
-
openNoteStory:
|
|
784
|
-
closeNoteStory:
|
|
785
|
-
getActiveNoteView:
|
|
786
|
-
getCommands:
|
|
787
|
-
focus:
|
|
788
|
-
reLayout:
|
|
789
|
-
destroy:
|
|
778
|
+
loadBuffer: Sn,
|
|
779
|
+
loadDocument: Cn,
|
|
780
|
+
save: Dn,
|
|
781
|
+
getDocument: An,
|
|
782
|
+
readDocument: kn,
|
|
783
|
+
setDocument: jn,
|
|
784
|
+
getHeaderFooterView: Mn,
|
|
785
|
+
syncHeaderFooterViews: Nn,
|
|
786
|
+
openNoteStory: Pn,
|
|
787
|
+
closeNoteStory: Fn,
|
|
788
|
+
getActiveNoteView: In,
|
|
789
|
+
getCommands: Ln,
|
|
790
|
+
focus: Rn,
|
|
791
|
+
reLayout: zn,
|
|
792
|
+
destroy: Bn
|
|
790
793
|
};
|
|
791
794
|
}
|
|
792
795
|
// src/composables/useFindReplace.ts
|
|
793
|
-
function
|
|
794
|
-
let h = new
|
|
796
|
+
function V({ editorView: t, pagesRef: n, getDocument: r, layout: a, commentRoot: l, revealComment: u, displayMode: f, readOnly: p, onReadonlyEditAttempt: m, onResultChange: ee }) {
|
|
797
|
+
let h = new $e(), g = s(""), _ = s(""), v = o(at()), y = c([]), b = s(-1), x = e(() => y.value.at(b.value) ?? null), S = () => te({
|
|
795
798
|
editingMode: t.value?.editable === !1 ? "viewing" : "editing",
|
|
796
799
|
readOnlyProp: p.value,
|
|
797
800
|
displayMode: f.value
|
|
798
801
|
}), ne = e(S), re = e(() => {
|
|
799
802
|
let e = x.value;
|
|
800
|
-
return S() === null && !!t.value && !!e && w() &&
|
|
803
|
+
return S() === null && !!t.value && !!e && w() && ot(e).status === "allowed";
|
|
801
804
|
}), C = null, ie, ae = null, oe = (e) => {
|
|
802
805
|
let n = t.value?.state.doc;
|
|
803
806
|
return {
|
|
@@ -809,11 +812,11 @@ function Nt({ editorView: t, pagesRef: n, getDocument: r, layout: a, commentRoot
|
|
|
809
812
|
},
|
|
810
813
|
document: e,
|
|
811
814
|
...n ? { bodyVersion: n } : {},
|
|
812
|
-
context: { renderedStories:
|
|
815
|
+
context: { renderedStories: it(a.value) }
|
|
813
816
|
};
|
|
814
817
|
}, w = () => {
|
|
815
818
|
let e = r();
|
|
816
|
-
return !!e &&
|
|
819
|
+
return !!e && ct(ae, st(oe(e)));
|
|
817
820
|
}, T = () => h.getResult(), E = () => ee(T()), D = () => {
|
|
818
821
|
clearTimeout(ie), ie = void 0;
|
|
819
822
|
}, se = () => {
|
|
@@ -824,7 +827,7 @@ function Nt({ editorView: t, pagesRef: n, getDocument: r, layout: a, commentRoot
|
|
|
824
827
|
D();
|
|
825
828
|
let i = r(), o = n.value, s = t.value?.state.doc;
|
|
826
829
|
if (!i || !g.value.trim()) return ce(), [];
|
|
827
|
-
let c = oe(i), u =
|
|
830
|
+
let c = oe(i), u = et({
|
|
828
831
|
document: c.document,
|
|
829
832
|
state: t.value?.state ?? null,
|
|
830
833
|
searchText: c.query,
|
|
@@ -832,8 +835,8 @@ function Nt({ editorView: t, pagesRef: n, getDocument: r, layout: a, commentRoot
|
|
|
832
835
|
context: c.context
|
|
833
836
|
});
|
|
834
837
|
if (u === null) return se(), E(), [];
|
|
835
|
-
let d =
|
|
836
|
-
return ae = d, y.value = u, b.value = u.length > 0 ? p.currentIndex : -1, C?.destroy(), C = o ?
|
|
838
|
+
let d = st(c), f = e === "refresh" && ae?.query === d.query, p = h.setMatches(u, f ? h.getResult()?.currentIndex ?? 0 : 0);
|
|
839
|
+
return ae = d, y.value = u, b.value = u.length > 0 ? p.currentIndex : -1, C?.destroy(), C = o ? rt({
|
|
837
840
|
container: o,
|
|
838
841
|
document: i,
|
|
839
842
|
bodyDoc: s,
|
|
@@ -843,7 +846,7 @@ function Nt({ editorView: t, pagesRef: n, getDocument: r, layout: a, commentRoot
|
|
|
843
846
|
}) : null, C?.paint(b.value), u.at(0) && !f ? le(0) : E(), u;
|
|
844
847
|
}, ue = () => {
|
|
845
848
|
D(), ie = setTimeout(() => O("refresh"), 120);
|
|
846
|
-
}, de = (e, t) => (g.value = e, Object.assign(v,
|
|
849
|
+
}, de = (e, t) => (g.value = e, Object.assign(v, at(), t), O(), T()), fe = (e) => {
|
|
847
850
|
let t = h.goTo(e);
|
|
848
851
|
return t ? le(t.index) : !1;
|
|
849
852
|
}, pe = (e) => {
|
|
@@ -878,7 +881,7 @@ function Nt({ editorView: t, pagesRef: n, getDocument: r, layout: a, commentRoot
|
|
|
878
881
|
if (!e || he() || me()) return !1;
|
|
879
882
|
let n = x.value;
|
|
880
883
|
if (!re.value || !n) return !1;
|
|
881
|
-
let r = e.state.doc, i =
|
|
884
|
+
let r = e.state.doc, i = tt(e, n, _.value);
|
|
882
885
|
return e.state.doc !== r && O("refresh"), i;
|
|
883
886
|
},
|
|
884
887
|
replaceAll: () => {
|
|
@@ -887,13 +890,13 @@ function Nt({ editorView: t, pagesRef: n, getDocument: r, layout: a, commentRoot
|
|
|
887
890
|
replacedCount: 0,
|
|
888
891
|
skippedCount: n
|
|
889
892
|
};
|
|
890
|
-
let r = e.state.doc, i =
|
|
893
|
+
let r = e.state.doc, i = nt(e, y.value, _.value);
|
|
891
894
|
return e.state.doc !== r && O(), i;
|
|
892
895
|
},
|
|
893
896
|
clear: ce
|
|
894
897
|
};
|
|
895
898
|
}
|
|
896
|
-
function
|
|
899
|
+
function Ft(e, t) {
|
|
897
900
|
if (t < e.top + 40) {
|
|
898
901
|
let n = Math.max(0, e.top + 40 - t);
|
|
899
902
|
return -Math.min(12, n / 40 * 12);
|
|
@@ -905,7 +908,7 @@ function Pt(e, t) {
|
|
|
905
908
|
return 0;
|
|
906
909
|
}
|
|
907
910
|
// src/composables/useDragAutoScroll.ts
|
|
908
|
-
function
|
|
911
|
+
function It({ pagesContainer: e, onScrollExtendSelection: t }) {
|
|
909
912
|
let n = null, r = 0, a = 0, o = !1;
|
|
910
913
|
function s() {
|
|
911
914
|
return b(e.value);
|
|
@@ -917,7 +920,7 @@ function Ft({ pagesContainer: e, onScrollExtendSelection: t }) {
|
|
|
917
920
|
if (!o) return;
|
|
918
921
|
let e = s();
|
|
919
922
|
if (!e) return;
|
|
920
|
-
let i =
|
|
923
|
+
let i = Ft(e.getBoundingClientRect(), a);
|
|
921
924
|
i !== 0 && (x(e, i), t(r, a)), n = requestAnimationFrame(l);
|
|
922
925
|
}
|
|
923
926
|
function u() {
|
|
@@ -937,7 +940,7 @@ function Ft({ pagesContainer: e, onScrollExtendSelection: t }) {
|
|
|
937
940
|
};
|
|
938
941
|
}
|
|
939
942
|
// src/composables/useTableResize.ts
|
|
940
|
-
function
|
|
943
|
+
function Lt({ runCommand: e }) {
|
|
941
944
|
let t = {
|
|
942
945
|
active: !1,
|
|
943
946
|
startX: 0,
|
|
@@ -956,7 +959,7 @@ function It({ runCommand: e }) {
|
|
|
956
959
|
isEdge: !1,
|
|
957
960
|
tablePmStart: 0,
|
|
958
961
|
origHeight: 0,
|
|
959
|
-
minimumHeight:
|
|
962
|
+
minimumHeight: lt
|
|
960
963
|
}, r = {
|
|
961
964
|
active: !1,
|
|
962
965
|
startX: 0,
|
|
@@ -970,15 +973,15 @@ function It({ runCommand: e }) {
|
|
|
970
973
|
}
|
|
971
974
|
function o(e, a) {
|
|
972
975
|
let o = e.target;
|
|
973
|
-
return o instanceof HTMLElement ? o.classList.contains("layout-table-resize-handle") ? (e.preventDefault(), e.stopPropagation(), i = a, t.active = !0, t.startX = e.clientX, t.handle = o, o.classList.add("dragging"), t.columnIndex = parseInt(o.dataset.columnIndex ?? "0", 10), t.tablePmStart = T(o) ?? 0,
|
|
976
|
+
return o instanceof HTMLElement ? o.classList.contains("layout-table-resize-handle") ? (e.preventDefault(), e.stopPropagation(), i = a, t.active = !0, t.startX = e.clientX, t.handle = o, o.classList.add("dragging"), t.columnIndex = parseInt(o.dataset.columnIndex ?? "0", 10), t.tablePmStart = T(o) ?? 0, Rt(a, t), !0) : o.classList.contains("layout-table-row-resize-handle") || o.classList.contains("layout-table-edge-handle-bottom") ? (e.preventDefault(), e.stopPropagation(), i = a, n.active = !0, n.startY = e.clientY, n.handle = o, n.isEdge = o.dataset.isEdge === "bottom", o.classList.add("dragging"), n.rowIndex = parseInt(o.dataset.rowIndex ?? "0", 10), n.tablePmStart = T(o) ?? 0, H(a, n, o), !0) : o.classList.contains("layout-table-edge-handle-right") ? (e.preventDefault(), e.stopPropagation(), i = a, r.active = !0, r.startX = e.clientX, r.handle = o, o.classList.add("dragging"), r.columnIndex = parseInt(o.dataset.columnIndex ?? "0", 10), r.tablePmStart = T(o) ?? 0, U(a, r), !0) : !1 : !1;
|
|
974
977
|
}
|
|
975
978
|
function s(e) {
|
|
976
979
|
if (t.active && t.handle) {
|
|
977
980
|
e.preventDefault();
|
|
978
981
|
let n = e.clientX - t.startX, r = parseFloat(t.handle.style.left);
|
|
979
982
|
t.handle.style.left = `${r + n}px`, t.startX = e.clientX;
|
|
980
|
-
let i = Math.round(n *
|
|
981
|
-
a >=
|
|
983
|
+
let i = Math.round(n * A), a = t.origWidths.left + i, o = t.origWidths.right - i;
|
|
984
|
+
a >= k && o >= k && (t.origWidths = {
|
|
982
985
|
left: a,
|
|
983
986
|
right: o
|
|
984
987
|
});
|
|
@@ -986,18 +989,18 @@ function It({ runCommand: e }) {
|
|
|
986
989
|
e.preventDefault();
|
|
987
990
|
let t = e.clientY - n.startY, r = parseFloat(n.handle.style.top);
|
|
988
991
|
n.startY = e.clientY;
|
|
989
|
-
let i = Math.round(t *
|
|
992
|
+
let i = Math.round(t * A), a = ut({
|
|
990
993
|
currentHeight: n.origHeight,
|
|
991
994
|
delta: i,
|
|
992
995
|
minimumHeight: n.minimumHeight
|
|
993
996
|
});
|
|
994
|
-
n.handle.style.top = `${r + a /
|
|
997
|
+
n.handle.style.top = `${r + a / A}px`, n.origHeight += a;
|
|
995
998
|
} else if (r.active && r.handle) {
|
|
996
999
|
e.preventDefault();
|
|
997
1000
|
let t = e.clientX - r.startX, n = parseFloat(r.handle.style.left);
|
|
998
1001
|
r.handle.style.left = `${n + t}px`, r.startX = e.clientX;
|
|
999
|
-
let i = Math.round(t *
|
|
1000
|
-
a >=
|
|
1002
|
+
let i = Math.round(t * A), a = r.origWidth + i;
|
|
1003
|
+
a >= k && (r.origWidth = a);
|
|
1001
1004
|
}
|
|
1002
1005
|
}
|
|
1003
1006
|
function c(a) {
|
|
@@ -1027,25 +1030,25 @@ function It({ runCommand: e }) {
|
|
|
1027
1030
|
isResizing: a
|
|
1028
1031
|
};
|
|
1029
1032
|
}
|
|
1030
|
-
function
|
|
1033
|
+
function Rt(e, t) {
|
|
1031
1034
|
let n = pt(e, t.tablePmStart, t.columnIndex);
|
|
1032
1035
|
n && (t.origWidths = n);
|
|
1033
1036
|
}
|
|
1034
|
-
function
|
|
1037
|
+
function H(e, t, n) {
|
|
1035
1038
|
let r = mt(e, t.tablePmStart, t.rowIndex);
|
|
1036
1039
|
if (r != null) t.origHeight = r;
|
|
1037
1040
|
else {
|
|
1038
1041
|
let e = n.closest(".layout-table")?.querySelector(`[data-row-index="${t.rowIndex}"]`), r = e ? e.getBoundingClientRect().height : 30;
|
|
1039
|
-
t.origHeight = Math.round(r *
|
|
1042
|
+
t.origHeight = Math.round(r * A);
|
|
1040
1043
|
}
|
|
1041
|
-
t.minimumHeight = Math.min(
|
|
1044
|
+
t.minimumHeight = Math.min(lt, t.origHeight);
|
|
1042
1045
|
}
|
|
1043
|
-
function
|
|
1046
|
+
function U(e, t) {
|
|
1044
1047
|
let n = ft(e, t.tablePmStart, t.columnIndex);
|
|
1045
1048
|
n != null && (t.origWidth = n);
|
|
1046
1049
|
}
|
|
1047
1050
|
// src/composables/useTrackedChanges.ts
|
|
1048
|
-
function
|
|
1051
|
+
function W(t, n) {
|
|
1049
1052
|
return e(() => {
|
|
1050
1053
|
n.value;
|
|
1051
1054
|
let e = t.value?.state ?? null, r = _t(e);
|
|
@@ -1070,7 +1073,7 @@ function Lt(t, n) {
|
|
|
1070
1073
|
});
|
|
1071
1074
|
}
|
|
1072
1075
|
// src/composables/useZoom.ts
|
|
1073
|
-
var
|
|
1076
|
+
var zt = j, Bt = vt, Vt = [
|
|
1074
1077
|
.5,
|
|
1075
1078
|
.75,
|
|
1076
1079
|
1,
|
|
@@ -1078,10 +1081,10 @@ var Rt = vt, zt = A, G = [
|
|
|
1078
1081
|
1.5,
|
|
1079
1082
|
2
|
|
1080
1083
|
];
|
|
1081
|
-
function
|
|
1082
|
-
let i = s(Math.max(
|
|
1084
|
+
function G(t = 1) {
|
|
1085
|
+
let i = s(Math.max(zt, Math.min(Bt, t))), a = e(() => Math.round(i.value * 100)), o = e(() => i.value <= zt), c = e(() => i.value >= Bt);
|
|
1083
1086
|
function l(e) {
|
|
1084
|
-
i.value = Math.max(
|
|
1087
|
+
i.value = Math.max(zt, Math.min(Bt, Math.round(e * 100) / 100));
|
|
1085
1088
|
}
|
|
1086
1089
|
function u() {
|
|
1087
1090
|
l(i.value + yt);
|
|
@@ -1113,7 +1116,7 @@ function Bt(t = 1) {
|
|
|
1113
1116
|
handleWheel: p,
|
|
1114
1117
|
handleKeyDown: m,
|
|
1115
1118
|
installShortcuts: ee,
|
|
1116
|
-
ZOOM_PRESETS:
|
|
1119
|
+
ZOOM_PRESETS: Vt
|
|
1117
1120
|
};
|
|
1118
1121
|
}
|
|
1119
|
-
export {
|
|
1122
|
+
export { It as a, I as c, L as d, Lt as i, N as l, _t as n, V as o, W as r, B as s, G as t, F as u };
|