@stll/folio-vue 0.16.6 → 0.17.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/composables.cjs +1 -1
- package/dist/composables.js +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/{useZoom-C-7ZB0mk.js → useZoom-CBI44HNj.js} +189 -188
- package/dist/useZoom-DY0k6ovZ.cjs +1 -0
- package/package.json +2 -2
- package/dist/useZoom-UBLmfo4Z.cjs +0 -1
|
@@ -15,20 +15,20 @@ import { browserClock as ue, createLayoutScheduler as de } from "@stll/folio-cor
|
|
|
15
15
|
import { createLayoutSession as fe } from "@stll/folio-core/controller/layoutSession";
|
|
16
16
|
import { parseDocx as pe } from "@stll/folio-core/docx/parser";
|
|
17
17
|
import { getFootnoteText as me } from "@stll/folio-core/docx/footnoteParser";
|
|
18
|
-
import { convertHeaderFooterPmDocToContent as he, convertHeaderFooterToContent as
|
|
19
|
-
import { resolveSectionHeaderFooterRefs as
|
|
20
|
-
import { LayoutPainter as
|
|
21
|
-
import { LayoutSelectionGate as
|
|
22
|
-
import { getTransactionsDirtyRange as
|
|
23
|
-
import { fromProseDoc as
|
|
24
|
-
import { ExtensionManager as
|
|
25
|
-
import { getChangedParagraphIds as
|
|
26
|
-
import { createStarterKit as
|
|
27
|
-
import { createTemplatePreviewValuesPlugin as
|
|
28
|
-
import { templateSlashMenuPlugin as
|
|
29
|
-
import { resolveHeaderFooterContent as
|
|
30
|
-
import { findVerticalScrollParent as
|
|
31
|
-
import { MIN_CELL_WIDTH_TWIPS as
|
|
18
|
+
import { convertHeaderFooterPmDocToContent as he, convertHeaderFooterToContent as ge } from "@stll/folio-core/layout-bridge/convert/headerFooterLayout";
|
|
19
|
+
import { resolveSectionHeaderFooterRefs as _e } from "@stll/folio-core/layout-engine";
|
|
20
|
+
import { LayoutPainter as ve } from "@stll/folio-core/layout-painter";
|
|
21
|
+
import { LayoutSelectionGate as ye } from "@stll/folio-core/paged-layout/LayoutSelectionGate";
|
|
22
|
+
import { getTransactionsDirtyRange as be } from "@stll/folio-core/paged-layout/transactionDirtyRange";
|
|
23
|
+
import { fromProseDoc as xe } from "@stll/folio-core/prosemirror/conversion/fromProseDoc";
|
|
24
|
+
import { ExtensionManager as Se } from "@stll/folio-core/prosemirror/extensions/ExtensionManager";
|
|
25
|
+
import { getChangedParagraphIds as Ce, hasStructuralChanges as we, hasUntrackedChanges as Te } from "@stll/folio-core/prosemirror/extensions/features/ParagraphChangeTrackerExtension";
|
|
26
|
+
import { createStarterKit as Ee } from "@stll/folio-core/prosemirror/extensions/StarterKit";
|
|
27
|
+
import { createTemplatePreviewValuesPlugin as De } from "@stll/folio-core/prosemirror/plugins/templatePreviewValues";
|
|
28
|
+
import { templateSlashMenuPlugin as Oe } from "@stll/folio-core/prosemirror/plugins/templateSlashMenu";
|
|
29
|
+
import { resolveHeaderFooterContent as ke } from "@stll/folio-core/utils/headerFooter";
|
|
30
|
+
import { findVerticalScrollParent as Ae } from "@stll/folio-core/utils/findVerticalScrollParent";
|
|
31
|
+
import { MIN_CELL_WIDTH_TWIPS as y, MIN_ROW_HEIGHT_TWIPS as b, TWIPS_PER_PIXEL as x, commitColumnResize as S, commitRightEdgeResize as je, commitRowResize as Me, readColumnWidthAt as Ne, readColumnWidths as Pe, readRowHeight as C } from "@stll/folio-core/prosemirror/tableResize";
|
|
32
32
|
import { extractTrackedChanges as w } from "@stll/folio-core/prosemirror/utils/extractTrackedChanges";
|
|
33
33
|
import { ZOOM_MAX as T, ZOOM_MIN as Fe, ZOOM_STEP as Ie } from "@stll/folio-core/utils/zoom";
|
|
34
34
|
//#region src/utils/colorMode.ts
|
|
@@ -50,10 +50,10 @@ function Be(e) {
|
|
|
50
50
|
//#region src/composables/useColorMode.ts
|
|
51
51
|
var E = "light", D = Symbol("folioColorMode"), O = (t = E) => {
|
|
52
52
|
a(D, e(() => c(t)));
|
|
53
|
-
},
|
|
53
|
+
}, k = { install(t, n = E) {
|
|
54
54
|
t.provide(D, e(() => c(n)));
|
|
55
55
|
} };
|
|
56
|
-
function
|
|
56
|
+
function A() {
|
|
57
57
|
let n = t(D, e(() => E)), i = o(!1), a = o(!1);
|
|
58
58
|
return r(() => {
|
|
59
59
|
i.value = !0;
|
|
@@ -65,7 +65,7 @@ function k() {
|
|
|
65
65
|
}
|
|
66
66
|
//#endregion
|
|
67
67
|
//#region src/composables/useDocxEditor.ts
|
|
68
|
-
var
|
|
68
|
+
var Ve = 24, He = 32, Ue = 96, We = 250, Ge = [], Ke = [];
|
|
69
69
|
function qe(e) {
|
|
70
70
|
let t = e?.columnCount ?? 1;
|
|
71
71
|
if (t <= 1) return;
|
|
@@ -82,7 +82,7 @@ function Je(e, t, n, r, i, a) {
|
|
|
82
82
|
...a,
|
|
83
83
|
rId: t
|
|
84
84
|
} : a, s = t ? n?.getView(t) : null;
|
|
85
|
-
return s ? he(s.state.doc, r, i, o) :
|
|
85
|
+
return s ? he(s.state.doc, r, i, o) : ge(e, r, i, o);
|
|
86
86
|
}
|
|
87
87
|
function Ye(e, t, n, r, i) {
|
|
88
88
|
if (!e || e.size === 0) return;
|
|
@@ -119,7 +119,7 @@ function Xe(e, t, n) {
|
|
|
119
119
|
}
|
|
120
120
|
return r;
|
|
121
121
|
}
|
|
122
|
-
var
|
|
122
|
+
var j = /* @__PURE__ */ new Set([
|
|
123
123
|
"black",
|
|
124
124
|
"blue",
|
|
125
125
|
"cyan",
|
|
@@ -140,7 +140,7 @@ var A = /* @__PURE__ */ new Set([
|
|
|
140
140
|
]);
|
|
141
141
|
function Ze(e) {
|
|
142
142
|
let t = [], n = (e, r) => {
|
|
143
|
-
for (let [n, i] of e.marks.entries()) i.type.name === "highlight" && !
|
|
143
|
+
for (let [n, i] of e.marks.entries()) i.type.name === "highlight" && !j.has(String(i.attrs.color)) && t.push(`${r}.marks[${n}]=${JSON.stringify(i.attrs)}`);
|
|
144
144
|
e.forEach((e, t, i) => {
|
|
145
145
|
n(e, `${r}.content[${i}]`);
|
|
146
146
|
});
|
|
@@ -150,25 +150,25 @@ function Ze(e) {
|
|
|
150
150
|
function Qe() {
|
|
151
151
|
return typeof document > "u" || !("fonts" in document) || document.fonts.status === "loaded";
|
|
152
152
|
}
|
|
153
|
-
function
|
|
154
|
-
let { hiddenContainer: t, hiddenHeaderFooterContainer: n, noteEditorContainer: r, pagesContainer: a, readOnly: u = !1, pageGap: p =
|
|
155
|
-
|
|
156
|
-
let $e = ee(!1), et = [$e], tt = h({ keymap: !0 }), nt = m({ onMatchesChange: (e) => je?.(e) }),
|
|
153
|
+
function M(e) {
|
|
154
|
+
let { hiddenContainer: t, hiddenHeaderFooterContainer: n, noteEditorContainer: r, pagesContainer: a, readOnly: u = !1, pageGap: p = Ve, pageRenderer: me, showMarginGuides: he, marginGuideColor: ge, password: Ae, editorMode: y, author: b, externalPlugins: x = [], collaboration: S, onAnonymizationMatchesChange: je, showTemplateDirectives: Me, onSlashMenuChange: Ne, onSlashMenuKeyAction: Pe, onChange: C, onError: w, onSelectionUpdate: T, onEditorViewReady: Fe, onCopy: Ie, onCut: Le, onPaste: Re, onReadOnlyEditAttempt: ze, featureFlags: Be, onSelectiveSaveTripwire: E } = e, D = n ?? t, O = s(null), k = 0, A = s(null), j = s(null), M = s(null), N = s([]), P = s(null), F = s(null), I = s(null), L = s([]), R = s([]), z = o(!1), B = o(null), V = o(!1), H = new Se(Ee());
|
|
155
|
+
H.buildSchema(), H.initializeRuntime();
|
|
156
|
+
let $e = ee(!1), et = [$e], tt = h({ keymap: !0 }), nt = m({ onMatchesChange: (e) => je?.(e) }), U = g(), rt = Oe({
|
|
157
157
|
onChange: (e) => Ne?.(e),
|
|
158
158
|
onKeyAction: (e) => Pe?.(e) ?? !1
|
|
159
|
-
}), it =
|
|
160
|
-
function
|
|
159
|
+
}), it = De(), at = () => c(Me) === !0;
|
|
160
|
+
function ot() {
|
|
161
161
|
return [
|
|
162
162
|
tt,
|
|
163
163
|
$e,
|
|
164
164
|
...x,
|
|
165
165
|
...c(S)?.plugins ?? [],
|
|
166
166
|
nt,
|
|
167
|
-
...
|
|
167
|
+
...at() ? [U, rt] : [],
|
|
168
168
|
it
|
|
169
169
|
];
|
|
170
170
|
}
|
|
171
|
-
let W = ne(), G = new
|
|
171
|
+
let W = ne(), G = new ye(), st = fe(), ct = new ve({
|
|
172
172
|
pageGap: p,
|
|
173
173
|
showShadow: !0
|
|
174
174
|
}), K = ie({
|
|
@@ -178,13 +178,13 @@ function j(e) {
|
|
|
178
178
|
getTheme: () => O.value?.package.theme ?? null,
|
|
179
179
|
onTransaction: ({ rId: e, kind: t, view: n, docChanged: r, selectionChanged: i }) => {
|
|
180
180
|
if (r) {
|
|
181
|
-
|
|
182
|
-
let e =
|
|
181
|
+
V.value = !0;
|
|
182
|
+
let e = A.value;
|
|
183
183
|
e && Y.schedule(e.state, null);
|
|
184
184
|
}
|
|
185
185
|
if (r || i) {
|
|
186
186
|
let { from: r, to: i } = n.state.selection;
|
|
187
|
-
|
|
187
|
+
P.value = {
|
|
188
188
|
from: r,
|
|
189
189
|
kind: t,
|
|
190
190
|
rId: e,
|
|
@@ -196,7 +196,7 @@ function j(e) {
|
|
|
196
196
|
}
|
|
197
197
|
G.requestRender();
|
|
198
198
|
}
|
|
199
|
-
}),
|
|
199
|
+
}), lt = { current: null }, q = ae({
|
|
200
200
|
getHost: () => r?.value ?? null,
|
|
201
201
|
getPlugins: () => et,
|
|
202
202
|
getDocument: () => O.value,
|
|
@@ -204,13 +204,13 @@ function j(e) {
|
|
|
204
204
|
getTheme: () => O.value?.package.theme ?? null,
|
|
205
205
|
onTransaction: ({ docChanged: e, selectionChanged: t, view: n }) => {
|
|
206
206
|
if (e) {
|
|
207
|
-
|
|
207
|
+
V.value = !0;
|
|
208
208
|
let e = O.value;
|
|
209
209
|
if (e) {
|
|
210
|
-
let t =
|
|
210
|
+
let t = lt.current?.snapshotDocument(e) ?? e;
|
|
211
211
|
O.value = t, C?.(t), W.emit("docChange", t);
|
|
212
212
|
}
|
|
213
|
-
let t =
|
|
213
|
+
let t = A.value;
|
|
214
214
|
t && Y.schedule(t.state, null);
|
|
215
215
|
}
|
|
216
216
|
if (e || t) {
|
|
@@ -223,21 +223,21 @@ function j(e) {
|
|
|
223
223
|
}
|
|
224
224
|
}
|
|
225
225
|
});
|
|
226
|
-
|
|
227
|
-
function
|
|
228
|
-
e.layout && (
|
|
226
|
+
lt.current = q;
|
|
227
|
+
function ut(e) {
|
|
228
|
+
e.layout && (I.value = e.layout), e.blocks && (L.value = e.blocks), e.measures && (R.value = e.measures), e.blockLookup && ct.setBlockLookup(e.blockLookup), e.layout && W.emit("layoutComplete", e.layout);
|
|
229
229
|
}
|
|
230
230
|
function J(e, t = {}) {
|
|
231
|
-
let n = a.value, r = n instanceof HTMLDivElement ? n : null, i = O.value, o = i?.package.document, s = o?.sections?.[0]?.properties ?? o?.finalSectionProperties ?? null, l = f(s), u = d(s), m = qe(s), h = l.w - u.left - u.right, g = i?.package.styles ?? null, ee = i?.package.theme ?? null, te = i?.package.settings?.defaultTabStop, _ = i?.package.settings?.mirrorMargins === !0, v =
|
|
231
|
+
let n = a.value, r = n instanceof HTMLDivElement ? n : null, i = O.value, o = i?.package.document, s = o?.sections?.[0]?.properties ?? o?.finalSectionProperties ?? null, l = f(s), u = d(s), m = qe(s), h = l.w - u.left - u.right, g = i?.package.styles ?? null, ee = i?.package.theme ?? null, te = i?.package.settings?.defaultTabStop, _ = i?.package.settings?.mirrorMargins === !0, v = ke(i?.package);
|
|
232
232
|
try {
|
|
233
|
-
|
|
233
|
+
ut(le({
|
|
234
234
|
contentWidth: h,
|
|
235
235
|
columns: m,
|
|
236
236
|
pageSize: l,
|
|
237
237
|
margins: u,
|
|
238
238
|
pageGap: p,
|
|
239
239
|
showMarginGuides: c(he) === !0,
|
|
240
|
-
marginGuideColor: c(
|
|
240
|
+
marginGuideColor: c(ge),
|
|
241
241
|
...(() => {
|
|
242
242
|
let e = c(me);
|
|
243
243
|
return e === void 0 ? {} : { pageRenderer: e };
|
|
@@ -251,24 +251,25 @@ function j(e) {
|
|
|
251
251
|
footerContentRId: v.activeFooterRId,
|
|
252
252
|
firstPageHeaderContentRId: v.activeFirstHeaderRId,
|
|
253
253
|
firstPageFooterContentRId: v.activeFirstFooterRId,
|
|
254
|
-
sectionHeaderFooterRefs:
|
|
254
|
+
sectionHeaderFooterRefs: _e(i),
|
|
255
255
|
theme: ee,
|
|
256
256
|
sectionProperties: s,
|
|
257
257
|
document: i,
|
|
258
258
|
defaultTabStop: te,
|
|
259
259
|
mirrorMargins: _,
|
|
260
260
|
styles: g,
|
|
261
|
-
layout:
|
|
261
|
+
layout: I.value,
|
|
262
262
|
hfPMs: K,
|
|
263
|
-
painter:
|
|
263
|
+
painter: ct,
|
|
264
264
|
pagesContainer: r,
|
|
265
|
-
session:
|
|
265
|
+
session: st,
|
|
266
266
|
renderHfFromContentOrPm: Je,
|
|
267
267
|
renderHeaderFooterContentByRId: Ye,
|
|
268
268
|
documentFontsAreLoaded: Qe,
|
|
269
269
|
buildFootnoteRenderItems: Xe,
|
|
270
270
|
describeInvalidHighlightMarks: Ze,
|
|
271
|
-
emptyTemplatePreviewEntries:
|
|
271
|
+
emptyTemplatePreviewEntries: Ge,
|
|
272
|
+
emptyTemplatePreviewHidden: Ke
|
|
272
273
|
}, e, t));
|
|
273
274
|
} catch (e) {
|
|
274
275
|
let t = e instanceof Error ? e : Error(String(e));
|
|
@@ -277,40 +278,40 @@ function j(e) {
|
|
|
277
278
|
}
|
|
278
279
|
let Y = de({
|
|
279
280
|
runLayout: (e, t) => J(e, t),
|
|
280
|
-
debounceMs:
|
|
281
|
-
maxDelayMs:
|
|
281
|
+
debounceMs: He,
|
|
282
|
+
maxDelayMs: Ue,
|
|
282
283
|
clock: ue
|
|
283
284
|
}), X = null;
|
|
284
|
-
function
|
|
285
|
+
function dt() {
|
|
285
286
|
X !== null && (window.clearTimeout(X), X = null);
|
|
286
|
-
let e =
|
|
287
|
+
let e = A.value, t = O.value;
|
|
287
288
|
if (!(!e || !t)) try {
|
|
288
|
-
let n =
|
|
289
|
+
let n = xe(e.state.doc, t);
|
|
289
290
|
O.value = n, K.sync(), q.sync(), C?.(n), W.emit("docChange", n);
|
|
290
291
|
} catch (e) {
|
|
291
292
|
w?.(e instanceof Error ? e : Error(String(e)));
|
|
292
293
|
}
|
|
293
294
|
}
|
|
294
|
-
function
|
|
295
|
+
function ft() {
|
|
295
296
|
X !== null && window.clearTimeout(X), X = window.setTimeout(() => {
|
|
296
|
-
X = null,
|
|
297
|
-
},
|
|
297
|
+
X = null, dt();
|
|
298
|
+
}, We);
|
|
298
299
|
}
|
|
299
300
|
let Z = se({
|
|
300
301
|
getHost: () => t.value,
|
|
301
302
|
getDocument: () => O.value,
|
|
302
303
|
getStyles: () => O.value?.package.styles ?? null,
|
|
303
|
-
getExtensionManager: () =>
|
|
304
|
-
getExternalPlugins:
|
|
304
|
+
getExtensionManager: () => H,
|
|
305
|
+
getExternalPlugins: ot,
|
|
305
306
|
getCollaboration: () => c(S),
|
|
306
|
-
getCollaborationModules: () =>
|
|
307
|
+
getCollaborationModules: () => M.value,
|
|
307
308
|
getPrecomputedInitialState: () => null,
|
|
308
309
|
getReadOnly: () => c(u),
|
|
309
|
-
getDocumentIdentity: () => String(
|
|
310
|
+
getDocumentIdentity: () => String(k),
|
|
310
311
|
getDocumentContext: () => O.value,
|
|
311
|
-
onTransaction:
|
|
312
|
+
onTransaction: pt,
|
|
312
313
|
onSelectionChange: (e) => {
|
|
313
|
-
|
|
314
|
+
j.value = e, T?.(e), W.emit("selectionChange", {
|
|
314
315
|
from: e.selection.from,
|
|
315
316
|
to: e.selection.to
|
|
316
317
|
});
|
|
@@ -320,107 +321,107 @@ function j(e) {
|
|
|
320
321
|
onCut: () => Le?.(),
|
|
321
322
|
onPaste: () => Re?.(),
|
|
322
323
|
onReadOnlyEditAttempt: () => ze?.(),
|
|
323
|
-
onEditorViewReady:
|
|
324
|
+
onEditorViewReady: mt,
|
|
324
325
|
onEditorViewDestroy: () => {
|
|
325
|
-
|
|
326
|
+
A.value = null, z.value = !1, Fe?.(null);
|
|
326
327
|
},
|
|
327
328
|
onRemoteSelectionsChange: (e) => {
|
|
328
|
-
|
|
329
|
+
N.value = e;
|
|
329
330
|
}
|
|
330
331
|
}), Q = () => {
|
|
331
|
-
let e = c(S)?.awareness, t =
|
|
332
|
-
|
|
332
|
+
let e = c(S)?.awareness, t = M.value, n = Z.getView();
|
|
333
|
+
N.value = e && t && n ? oe(n.state, e, t) : [];
|
|
333
334
|
};
|
|
334
335
|
l(() => c(S), (e, t, n) => {
|
|
335
|
-
if (
|
|
336
|
-
|
|
336
|
+
if (N.value = [], !e) {
|
|
337
|
+
M.value = null, Z.retryViewCreation(), Z.syncExternalDocument();
|
|
337
338
|
return;
|
|
338
339
|
}
|
|
339
340
|
let r = !1;
|
|
340
341
|
n(() => {
|
|
341
342
|
r = !0;
|
|
342
|
-
}),
|
|
343
|
-
r || (
|
|
343
|
+
}), M.value = null, re().then((e) => {
|
|
344
|
+
r || (M.value = e, Z.retryViewCreation(), Z.syncExternalDocument(), Q());
|
|
344
345
|
}, (e) => {
|
|
345
|
-
r || (
|
|
346
|
+
r || (M.value = null, w?.(e instanceof Error ? e : Error(String(e))));
|
|
346
347
|
});
|
|
347
348
|
}, { immediate: !0 }), l(() => ({
|
|
348
349
|
awareness: c(S)?.awareness,
|
|
349
|
-
modules:
|
|
350
|
-
view:
|
|
350
|
+
modules: M.value,
|
|
351
|
+
view: A.value
|
|
351
352
|
}), ({ awareness: e, modules: t, view: n }, r, i) => {
|
|
352
353
|
if (!e || !t || !n) {
|
|
353
|
-
|
|
354
|
+
N.value = [];
|
|
354
355
|
return;
|
|
355
356
|
}
|
|
356
357
|
e.on("change", Q), Q(), i(() => {
|
|
357
|
-
e.off("change", Q),
|
|
358
|
+
e.off("change", Q), N.value = [];
|
|
358
359
|
});
|
|
359
360
|
}, { flush: "post" });
|
|
360
|
-
function
|
|
361
|
-
|
|
361
|
+
function pt({ transactions: e, newState: t, docChanged: n }) {
|
|
362
|
+
j.value = t, n && (V.value = !0, G.incrementStateSeq(), Y.schedule(t, be(e)), ft()), G.requestRender();
|
|
362
363
|
}
|
|
363
|
-
function
|
|
364
|
-
|
|
365
|
-
|
|
364
|
+
function mt(e) {
|
|
365
|
+
A.value = e, j.value = e.state, z.value = !0, J(e.state, { reason: "initial" }), G.requestRender(), $(e), Fe?.(e), c(u) || requestAnimationFrame(() => {
|
|
366
|
+
A.value === e && e.focus();
|
|
366
367
|
});
|
|
367
368
|
}
|
|
368
|
-
let
|
|
369
|
-
getDocx: async (e) => (await
|
|
370
|
-
loadDocument:
|
|
371
|
-
loadDocx:
|
|
372
|
-
},
|
|
369
|
+
let ht = {
|
|
370
|
+
getDocx: async (e) => (await Ct(e))?.buffer ?? null,
|
|
371
|
+
loadDocument: St,
|
|
372
|
+
loadDocx: xt
|
|
373
|
+
}, gt = v({
|
|
373
374
|
getEditorApi: () => Z.api,
|
|
374
|
-
getLayout: () =>
|
|
375
|
+
getLayout: () => I.value,
|
|
375
376
|
runLayout: (e, t) => J(e, t),
|
|
376
|
-
getDocumentIO: () =>
|
|
377
|
+
getDocumentIO: () => ht,
|
|
377
378
|
emitter: W
|
|
378
379
|
});
|
|
379
380
|
function $(e) {
|
|
380
|
-
te(c(
|
|
381
|
+
te(c(y) === "suggesting", e.state, e.dispatch, c(b));
|
|
381
382
|
}
|
|
382
|
-
l([() => c(
|
|
383
|
-
let e =
|
|
383
|
+
l([() => c(y), () => c(b)], () => {
|
|
384
|
+
let e = A.value;
|
|
384
385
|
e && $(e);
|
|
385
386
|
for (let e of q.listStories()) {
|
|
386
387
|
let t = q.getView(e);
|
|
387
388
|
t && $(t);
|
|
388
389
|
}
|
|
389
390
|
}), l(() => c(u), (e) => {
|
|
390
|
-
Z.syncEditable(), e &&
|
|
391
|
+
Z.syncEditable(), e && At();
|
|
391
392
|
});
|
|
392
|
-
function
|
|
393
|
-
let t =
|
|
394
|
-
if (t === e.state.plugins.includes(
|
|
395
|
-
let n = e.state.plugins.filter((e) => e !==
|
|
393
|
+
function _t(e) {
|
|
394
|
+
let t = at();
|
|
395
|
+
if (t === e.state.plugins.includes(U)) return;
|
|
396
|
+
let n = e.state.plugins.filter((e) => e !== U && e !== rt);
|
|
396
397
|
if (t) {
|
|
397
398
|
let e = n.indexOf(it), t = e === -1 ? n.length : e;
|
|
398
|
-
n.splice(t, 0,
|
|
399
|
+
n.splice(t, 0, U, rt);
|
|
399
400
|
}
|
|
400
401
|
e.updateState(e.state.reconfigure({ plugins: n }));
|
|
401
402
|
}
|
|
402
|
-
l(() =>
|
|
403
|
-
let e =
|
|
404
|
-
e &&
|
|
403
|
+
l(() => at(), () => {
|
|
404
|
+
let e = A.value;
|
|
405
|
+
e && _t(e);
|
|
405
406
|
});
|
|
406
|
-
function _t() {
|
|
407
|
-
Z.ensureView();
|
|
408
|
-
}
|
|
409
407
|
function vt() {
|
|
410
|
-
|
|
408
|
+
Z.ensureView();
|
|
411
409
|
}
|
|
412
410
|
function yt() {
|
|
411
|
+
k += 1, V.value = !1, P.value = null, F.value = null, q.activate(null), Y.dispose(), Z.destroyView(), K.sync(), q.sync(), Z.ensureView(), Z.getView() || bt();
|
|
412
|
+
}
|
|
413
|
+
function bt() {
|
|
413
414
|
let e = O.value;
|
|
414
415
|
if (!(!e || c(S))) try {
|
|
415
416
|
let t = ce({
|
|
416
417
|
document: e,
|
|
417
418
|
styles: e.package.styles ?? null,
|
|
418
|
-
manager:
|
|
419
|
-
externalPlugins:
|
|
419
|
+
manager: H,
|
|
420
|
+
externalPlugins: ot(),
|
|
420
421
|
collaborationModules: null,
|
|
421
422
|
reason: "mount"
|
|
422
423
|
});
|
|
423
|
-
|
|
424
|
+
j.value = t, J(t, { reason: "initial" });
|
|
424
425
|
} catch (e) {
|
|
425
426
|
w?.(e instanceof Error ? e : Error(String(e)));
|
|
426
427
|
}
|
|
@@ -431,31 +432,31 @@ function j(e) {
|
|
|
431
432
|
D,
|
|
432
433
|
...r ? [r] : []
|
|
433
434
|
], () => {
|
|
434
|
-
t.value && O.value && !Z.getView() &&
|
|
435
|
+
t.value && O.value && !Z.getView() && vt(), K.sync(), q.sync();
|
|
435
436
|
}, { flush: "post" });
|
|
436
|
-
async function
|
|
437
|
-
|
|
437
|
+
async function xt(e) {
|
|
438
|
+
B.value = null, z.value = !1;
|
|
438
439
|
try {
|
|
439
|
-
let t = await pe(e, { password: c(
|
|
440
|
-
O.value = t,
|
|
440
|
+
let t = await pe(e, { password: c(Ae) });
|
|
441
|
+
O.value = t, yt();
|
|
441
442
|
} catch (e) {
|
|
442
443
|
let t = e instanceof Error ? e : Error(String(e));
|
|
443
|
-
|
|
444
|
+
B.value = t.message, w?.(t);
|
|
444
445
|
}
|
|
445
446
|
}
|
|
446
|
-
function
|
|
447
|
-
|
|
447
|
+
function St(e) {
|
|
448
|
+
B.value = null, O.value = e, yt();
|
|
448
449
|
}
|
|
449
|
-
async function
|
|
450
|
-
let t =
|
|
450
|
+
async function Ct(e) {
|
|
451
|
+
let t = A.value, n = O.value;
|
|
451
452
|
if (!t || !n) return null;
|
|
452
|
-
let r = q.snapshotDocument(K.snapshotDocument(n)), i = t.state, { resolveSelectiveSaveFlags: a } = await import("@stll/folio-core/docx/selectiveSaveFlags"), o = a(c(Be)), s =
|
|
453
|
+
let r = q.snapshotDocument(K.snapshotDocument(n)), i = t.state, { resolveSelectiveSaveFlags: a } = await import("@stll/folio-core/docx/selectiveSaveFlags"), o = a(c(Be)), s = xe(i.doc, r), l = s.originalBuffer ?? null, u = o.selectiveSave && e?.mode !== _.full, d = u || o.selectiveSaveTripwire, { repackDocx: f, createDocx: p } = await import("@stll/folio-core/docx/rezip"), m = null;
|
|
453
454
|
if (d && l) {
|
|
454
455
|
let { attemptSelectiveSave: e } = await import("@stll/folio-core/docx/selectiveSave");
|
|
455
456
|
m = await e(s, l, {
|
|
456
|
-
changedParaIds:
|
|
457
|
-
structuralChange:
|
|
458
|
-
hasUntrackedChanges:
|
|
457
|
+
changedParaIds: Ce(i),
|
|
458
|
+
structuralChange: we(i),
|
|
459
|
+
hasUntrackedChanges: Te(i),
|
|
459
460
|
maxBytes: o.selectiveSaveMaxBytes
|
|
460
461
|
});
|
|
461
462
|
}
|
|
@@ -473,84 +474,84 @@ function j(e) {
|
|
|
473
474
|
document: s
|
|
474
475
|
};
|
|
475
476
|
}
|
|
476
|
-
async function
|
|
477
|
-
let t = await
|
|
478
|
-
return t ? (O.value = t.document, K.sync(), q.sync(),
|
|
477
|
+
async function wt(e) {
|
|
478
|
+
let t = await Ct({ mode: e?.selective === !1 ? _.full : _.preferSelective });
|
|
479
|
+
return t ? (O.value = t.document, K.sync(), q.sync(), V.value = !1, new Blob([t.buffer], { type: "application/vnd.openxmlformats-officedocument.wordprocessingml.document" })) : null;
|
|
479
480
|
}
|
|
480
|
-
function
|
|
481
|
+
function Tt() {
|
|
481
482
|
let e = O.value;
|
|
482
483
|
return e ? q.snapshotDocument(K.snapshotDocument(e)) : null;
|
|
483
484
|
}
|
|
484
|
-
function Tt(e) {
|
|
485
|
-
O.value = e, K.sync(), q.sync(), P.value && !q.getView(P.value) && (P.value = null);
|
|
486
|
-
}
|
|
487
485
|
function Et(e) {
|
|
486
|
+
O.value = e, K.sync(), q.sync(), F.value && !q.getView(F.value) && (F.value = null);
|
|
487
|
+
}
|
|
488
|
+
function Dt(e) {
|
|
488
489
|
return K.getView(e);
|
|
489
490
|
}
|
|
490
|
-
function
|
|
491
|
+
function Ot() {
|
|
491
492
|
K.sync();
|
|
492
493
|
}
|
|
493
|
-
function
|
|
494
|
+
function kt(e) {
|
|
494
495
|
let t = q.activate(e);
|
|
495
|
-
t && ($(t),
|
|
496
|
-
}
|
|
497
|
-
function kt() {
|
|
498
|
-
q.activate(null), P.value = null;
|
|
496
|
+
t && ($(t), F.value = e, requestAnimationFrame(() => t.focus()));
|
|
499
497
|
}
|
|
500
498
|
function At() {
|
|
501
|
-
|
|
502
|
-
return e ? q.getView(e) : null;
|
|
499
|
+
q.activate(null), F.value = null;
|
|
503
500
|
}
|
|
504
501
|
function jt() {
|
|
505
|
-
|
|
502
|
+
let e = F.value;
|
|
503
|
+
return e ? q.getView(e) : null;
|
|
506
504
|
}
|
|
507
505
|
function Mt() {
|
|
508
|
-
|
|
509
|
-
e ? e.focus() : k.value?.focus();
|
|
506
|
+
return H.getCommands();
|
|
510
507
|
}
|
|
511
508
|
function Nt() {
|
|
512
|
-
let e =
|
|
509
|
+
let e = jt();
|
|
510
|
+
e ? e.focus() : A.value?.focus();
|
|
511
|
+
}
|
|
512
|
+
function Pt() {
|
|
513
|
+
let e = A.value;
|
|
513
514
|
e && J(e.state, { reason: "manual" });
|
|
514
515
|
}
|
|
515
516
|
l([
|
|
516
517
|
() => c(he),
|
|
517
|
-
() => c(
|
|
518
|
+
() => c(ge),
|
|
518
519
|
() => c(me)
|
|
519
|
-
], () =>
|
|
520
|
-
function
|
|
521
|
-
Y.dispose(), X !== null && (window.clearTimeout(X), X = null), Z.destroyView(),
|
|
522
|
-
}
|
|
523
|
-
return i(
|
|
524
|
-
editor:
|
|
525
|
-
editorView:
|
|
526
|
-
editorState:
|
|
527
|
-
remoteSelections:
|
|
528
|
-
headerFooterSelection:
|
|
529
|
-
activeNoteStory:
|
|
530
|
-
isReady:
|
|
531
|
-
isDirty:
|
|
532
|
-
parseError:
|
|
533
|
-
layout:
|
|
534
|
-
blocks:
|
|
535
|
-
measures:
|
|
520
|
+
], () => Pt());
|
|
521
|
+
function Ft() {
|
|
522
|
+
Y.dispose(), X !== null && (window.clearTimeout(X), X = null), Z.destroyView(), N.value = [], K.destroy(), q.destroy(), H.destroy(), j.value = null, I.value = null, O.value = null, z.value = !1;
|
|
523
|
+
}
|
|
524
|
+
return i(Ft), {
|
|
525
|
+
editor: gt,
|
|
526
|
+
editorView: A,
|
|
527
|
+
editorState: j,
|
|
528
|
+
remoteSelections: N,
|
|
529
|
+
headerFooterSelection: P,
|
|
530
|
+
activeNoteStory: F,
|
|
531
|
+
isReady: z,
|
|
532
|
+
isDirty: V,
|
|
533
|
+
parseError: B,
|
|
534
|
+
layout: I,
|
|
535
|
+
blocks: L,
|
|
536
|
+
measures: R,
|
|
536
537
|
syncCoordinator: G,
|
|
537
|
-
loadBuffer:
|
|
538
|
-
loadDocument:
|
|
539
|
-
save:
|
|
540
|
-
getDocument:
|
|
541
|
-
setDocument:
|
|
542
|
-
getHeaderFooterView:
|
|
543
|
-
syncHeaderFooterViews:
|
|
544
|
-
openNoteStory:
|
|
545
|
-
closeNoteStory:
|
|
546
|
-
getActiveNoteView:
|
|
547
|
-
getCommands:
|
|
548
|
-
focus:
|
|
549
|
-
reLayout:
|
|
550
|
-
destroy:
|
|
538
|
+
loadBuffer: xt,
|
|
539
|
+
loadDocument: St,
|
|
540
|
+
save: wt,
|
|
541
|
+
getDocument: Tt,
|
|
542
|
+
setDocument: Et,
|
|
543
|
+
getHeaderFooterView: Dt,
|
|
544
|
+
syncHeaderFooterViews: Ot,
|
|
545
|
+
openNoteStory: kt,
|
|
546
|
+
closeNoteStory: At,
|
|
547
|
+
getActiveNoteView: jt,
|
|
548
|
+
getCommands: Mt,
|
|
549
|
+
focus: Nt,
|
|
550
|
+
reLayout: Pt,
|
|
551
|
+
destroy: Ft
|
|
551
552
|
};
|
|
552
553
|
}
|
|
553
|
-
function
|
|
554
|
+
function N(e, t) {
|
|
554
555
|
if (t < e.top + 40) {
|
|
555
556
|
let n = Math.max(0, e.top + 40 - t);
|
|
556
557
|
return -Math.min(12, n / 40 * 12);
|
|
@@ -563,12 +564,12 @@ function M(e, t) {
|
|
|
563
564
|
}
|
|
564
565
|
//#endregion
|
|
565
566
|
//#region src/composables/useDragAutoScroll.ts
|
|
566
|
-
function
|
|
567
|
+
function P({ pagesContainer: e, onScrollExtendSelection: t }) {
|
|
567
568
|
let n = null, r = 0, a = 0, o = !1, s = null;
|
|
568
569
|
function c() {
|
|
569
570
|
if (s) return s;
|
|
570
571
|
let t = e.value;
|
|
571
|
-
return t ? (s =
|
|
572
|
+
return t ? (s = Ae(t), s) : null;
|
|
572
573
|
}
|
|
573
574
|
function l() {
|
|
574
575
|
o = !1, n !== null && (cancelAnimationFrame(n), n = null);
|
|
@@ -577,7 +578,7 @@ function N({ pagesContainer: e, onScrollExtendSelection: t }) {
|
|
|
577
578
|
if (!o) return;
|
|
578
579
|
let e = c();
|
|
579
580
|
if (!e) return;
|
|
580
|
-
let i =
|
|
581
|
+
let i = N(e.getBoundingClientRect(), a);
|
|
581
582
|
i !== 0 && (e.scrollTop += i, t(r, a)), n = requestAnimationFrame(u);
|
|
582
583
|
}
|
|
583
584
|
function d() {
|
|
@@ -598,7 +599,7 @@ function N({ pagesContainer: e, onScrollExtendSelection: t }) {
|
|
|
598
599
|
}
|
|
599
600
|
//#endregion
|
|
600
601
|
//#region src/composables/useTableResize.ts
|
|
601
|
-
function
|
|
602
|
+
function F() {
|
|
602
603
|
let e = {
|
|
603
604
|
active: !1,
|
|
604
605
|
startX: 0,
|
|
@@ -630,7 +631,7 @@ function P() {
|
|
|
630
631
|
}
|
|
631
632
|
function a(i, a) {
|
|
632
633
|
let o = i.target;
|
|
633
|
-
return o instanceof HTMLElement ? o.classList.contains("layout-table-resize-handle") ? (i.preventDefault(), i.stopPropagation(), r = a, e.active = !0, e.startX = i.clientX, e.handle = o, o.classList.add("dragging"), e.columnIndex = parseInt(o.dataset.columnIndex ?? "0", 10), e.tablePmStart = parseInt(o.dataset.tablePmStart ?? "0", 10),
|
|
634
|
+
return o instanceof HTMLElement ? o.classList.contains("layout-table-resize-handle") ? (i.preventDefault(), i.stopPropagation(), r = a, e.active = !0, e.startX = i.clientX, e.handle = o, o.classList.add("dragging"), e.columnIndex = parseInt(o.dataset.columnIndex ?? "0", 10), e.tablePmStart = parseInt(o.dataset.tablePmStart ?? "0", 10), I(a, e), !0) : o.classList.contains("layout-table-row-resize-handle") || o.classList.contains("layout-table-edge-handle-bottom") ? (i.preventDefault(), i.stopPropagation(), r = a, t.active = !0, t.startY = i.clientY, t.handle = o, t.isEdge = o.dataset.isEdge === "bottom", o.classList.add("dragging"), t.rowIndex = parseInt(o.dataset.rowIndex ?? "0", 10), t.tablePmStart = parseInt(o.dataset.tablePmStart ?? "0", 10), L(a, t, o), !0) : o.classList.contains("layout-table-edge-handle-right") ? (i.preventDefault(), i.stopPropagation(), r = a, n.active = !0, n.startX = i.clientX, n.handle = o, o.classList.add("dragging"), n.columnIndex = parseInt(o.dataset.columnIndex ?? "0", 10), n.tablePmStart = parseInt(o.dataset.tablePmStart ?? "0", 10), R(a, n), !0) : !1 : !1;
|
|
634
635
|
}
|
|
635
636
|
function o(r) {
|
|
636
637
|
if (e.active && e.handle) {
|
|
@@ -638,7 +639,7 @@ function P() {
|
|
|
638
639
|
let t = r.clientX - e.startX, n = parseFloat(e.handle.style.left);
|
|
639
640
|
e.handle.style.left = `${n + t}px`, e.startX = r.clientX;
|
|
640
641
|
let i = Math.round(t * x), a = e.origWidths.left + i, o = e.origWidths.right - i;
|
|
641
|
-
a >=
|
|
642
|
+
a >= y && o >= y && (e.origWidths = {
|
|
642
643
|
left: a,
|
|
643
644
|
right: o
|
|
644
645
|
});
|
|
@@ -649,7 +650,7 @@ function P() {
|
|
|
649
650
|
let e = r.clientY - t.startY, n = parseFloat(t.handle.style.top);
|
|
650
651
|
t.handle.style.top = `${n + e}px`, t.startY = r.clientY;
|
|
651
652
|
let i = Math.round(e * x), a = t.origHeight + i;
|
|
652
|
-
a >=
|
|
653
|
+
a >= b && (t.origHeight = a);
|
|
653
654
|
return;
|
|
654
655
|
}
|
|
655
656
|
if (n.active && n.handle) {
|
|
@@ -657,7 +658,7 @@ function P() {
|
|
|
657
658
|
let e = r.clientX - n.startX, t = parseFloat(n.handle.style.left);
|
|
658
659
|
n.handle.style.left = `${t + e}px`, n.startX = r.clientX;
|
|
659
660
|
let i = Math.round(e * x), a = n.origWidth + i;
|
|
660
|
-
a >=
|
|
661
|
+
a >= y && (n.origWidth = a);
|
|
661
662
|
}
|
|
662
663
|
}
|
|
663
664
|
function s(i) {
|
|
@@ -695,11 +696,11 @@ function P() {
|
|
|
695
696
|
isResizing: i
|
|
696
697
|
};
|
|
697
698
|
}
|
|
698
|
-
function
|
|
699
|
+
function I(e, t) {
|
|
699
700
|
let n = Pe(e, t.tablePmStart, t.columnIndex);
|
|
700
701
|
n && (t.origWidths = n);
|
|
701
702
|
}
|
|
702
|
-
function
|
|
703
|
+
function L(e, t, n) {
|
|
703
704
|
let r = C(e, t.tablePmStart, t.rowIndex);
|
|
704
705
|
if (r != null) {
|
|
705
706
|
t.origHeight = r;
|
|
@@ -708,18 +709,18 @@ function I(e, t, n) {
|
|
|
708
709
|
let i = n.closest(".layout-table")?.querySelector(`[data-row-index="${t.rowIndex}"]`), a = i ? i.getBoundingClientRect().height : 30;
|
|
709
710
|
t.origHeight = Math.round(a * x);
|
|
710
711
|
}
|
|
711
|
-
function
|
|
712
|
+
function R(e, t) {
|
|
712
713
|
let n = Ne(e, t.tablePmStart, t.columnIndex);
|
|
713
714
|
n != null && (t.origWidth = n);
|
|
714
715
|
}
|
|
715
716
|
//#endregion
|
|
716
717
|
//#region src/composables/useTrackedChanges.ts
|
|
717
|
-
function
|
|
718
|
+
function z(t, n) {
|
|
718
719
|
return e(() => (n.value, w(t.value?.state ?? null)));
|
|
719
720
|
}
|
|
720
721
|
//#endregion
|
|
721
722
|
//#region src/composables/useZoom.ts
|
|
722
|
-
var
|
|
723
|
+
var B = Fe, V = T, H = [
|
|
723
724
|
.5,
|
|
724
725
|
.75,
|
|
725
726
|
1,
|
|
@@ -728,9 +729,9 @@ var z = Fe, B = T, V = [
|
|
|
728
729
|
2
|
|
729
730
|
];
|
|
730
731
|
function $e(t = 1) {
|
|
731
|
-
let i = o(Math.max(
|
|
732
|
+
let i = o(Math.max(B, Math.min(V, t))), a = e(() => Math.round(i.value * 100)), s = e(() => i.value <= B), c = e(() => i.value >= V);
|
|
732
733
|
function l(e) {
|
|
733
|
-
i.value = Math.max(
|
|
734
|
+
i.value = Math.max(B, Math.min(V, Math.round(e * 100) / 100));
|
|
734
735
|
}
|
|
735
736
|
function u() {
|
|
736
737
|
l(i.value + Ie);
|
|
@@ -762,8 +763,8 @@ function $e(t = 1) {
|
|
|
762
763
|
handleWheel: p,
|
|
763
764
|
handleKeyDown: m,
|
|
764
765
|
installShortcuts: h,
|
|
765
|
-
ZOOM_PRESETS:
|
|
766
|
+
ZOOM_PRESETS: H
|
|
766
767
|
};
|
|
767
768
|
}
|
|
768
769
|
//#endregion
|
|
769
|
-
export {
|
|
770
|
+
export { P as a, E as c, F as i, O as l, w as n, M as o, z as r, k as s, $e as t, A as u };
|