@stll/folio-vue 0.23.0 → 0.24.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/README.md +24 -0
- package/dist/components/DocxEditor/types.d.ts +2 -2
- package/dist/composables/useDocxEditor.d.ts +1 -0
- package/dist/composables/useFontLifecycle.d.ts +1 -0
- package/dist/composables.cjs +1 -1
- package/dist/composables.js +1 -1
- package/dist/folio-vue.css +1 -156
- package/dist/index.cjs +1 -1
- package/dist/index.js +1161 -1161
- package/dist/{useZoom-D8Wi1XkB.js → useZoom-BA92aWwm.js} +171 -164
- package/dist/{useZoom-CkbPWZ64.cjs → useZoom-Bv8t7dYu.cjs} +1 -1
- package/dist/utils/embeddedFonts.d.ts +1 -1
- package/package.json +11 -10
|
@@ -34,40 +34,40 @@ import { createStarterKit as We } from "@stll/folio-core/prosemirror/extensions/
|
|
|
34
34
|
import { createTemplatePreviewValuesPlugin as Ge } from "@stll/folio-core/prosemirror/plugins/templatePreviewValues";
|
|
35
35
|
import { templateSlashMenuPlugin as Ke } from "@stll/folio-core/prosemirror/plugins/templateSlashMenu";
|
|
36
36
|
import { resolveHeaderFooterContent as qe } from "@stll/folio-core/utils/headerFooter";
|
|
37
|
-
import { MIN_CELL_WIDTH_TWIPS as
|
|
38
|
-
import { extractTrackedChanges as
|
|
39
|
-
import { ZOOM_MAX as
|
|
37
|
+
import { MIN_CELL_WIDTH_TWIPS as Je, MIN_ROW_HEIGHT_TWIPS as v, TWIPS_PER_PIXEL as y, commitColumnResize as Ye, commitRightEdgeResize as Xe, commitRowResize as b, readColumnWidthAt as Ze, readColumnWidths as Qe, readRowHeight as $e } from "@stll/folio-core/prosemirror/tableResize";
|
|
38
|
+
import { extractTrackedChanges as et } from "@stll/folio-core/prosemirror/utils/extractTrackedChanges";
|
|
39
|
+
import { ZOOM_MAX as tt, ZOOM_MIN as x, ZOOM_STEP as S } from "@stll/folio-core/utils/zoom";
|
|
40
40
|
//#region src/utils/colorMode.ts
|
|
41
|
-
var
|
|
42
|
-
function
|
|
41
|
+
var nt = "(prefers-color-scheme: dark)";
|
|
42
|
+
function rt() {
|
|
43
43
|
return typeof window < "u" && typeof window.matchMedia == "function";
|
|
44
44
|
}
|
|
45
|
-
function
|
|
45
|
+
function it(e, t) {
|
|
46
46
|
return e === "dark" || e === "system" && t;
|
|
47
47
|
}
|
|
48
|
-
function
|
|
49
|
-
if (!
|
|
50
|
-
let t = window.matchMedia(
|
|
48
|
+
function at(e) {
|
|
49
|
+
if (!rt()) return () => {};
|
|
50
|
+
let t = window.matchMedia(nt);
|
|
51
51
|
e(t.matches);
|
|
52
52
|
let n = (t) => e(t.matches);
|
|
53
53
|
return t.addEventListener("change", n), () => t.removeEventListener("change", n);
|
|
54
54
|
}
|
|
55
55
|
//#endregion
|
|
56
56
|
//#region src/composables/useColorMode.ts
|
|
57
|
-
var
|
|
58
|
-
a(
|
|
59
|
-
}, ot = { install(t, n =
|
|
60
|
-
t.provide(
|
|
57
|
+
var C = "light", w = Symbol("folioColorMode"), T = (t = C) => {
|
|
58
|
+
a(w, e(() => c(t)));
|
|
59
|
+
}, ot = { install(t, n = C) {
|
|
60
|
+
t.provide(w, e(() => c(n)));
|
|
61
61
|
} };
|
|
62
62
|
function E() {
|
|
63
|
-
let n = t(
|
|
63
|
+
let n = t(w, e(() => C)), i = o(!1), a = o(!1);
|
|
64
64
|
return r(() => {
|
|
65
65
|
i.value = !0;
|
|
66
66
|
}), u((e) => {
|
|
67
|
-
!i.value || n.value !== "system" || e(
|
|
67
|
+
!i.value || n.value !== "system" || e(at((e) => {
|
|
68
68
|
a.value = e;
|
|
69
69
|
}));
|
|
70
|
-
}), e(() =>
|
|
70
|
+
}), e(() => it(n.value, i.value && a.value));
|
|
71
71
|
}
|
|
72
72
|
//#endregion
|
|
73
73
|
//#region src/composables/useDocxEditor.ts
|
|
@@ -154,55 +154,55 @@ function gt(e) {
|
|
|
154
154
|
return n(e, "doc"), t.join("; ");
|
|
155
155
|
}
|
|
156
156
|
function O(e) {
|
|
157
|
-
let { hiddenContainer: t, hiddenHeaderFooterContainer: n, noteEditorContainer: r, pagesContainer: a, readOnly: u = !1, experimentalSession: _, pageGap: se = st, pageRenderer: ce, markupView: me = "all-markup", showMarginGuides: je, marginGuideColor: Me, password:
|
|
157
|
+
let { hiddenContainer: t, hiddenHeaderFooterContainer: n, noteEditorContainer: r, pagesContainer: a, readOnly: u = !1, experimentalSession: _, pageGap: se = st, pageRenderer: ce, markupView: me = "all-markup", showMarginGuides: je, marginGuideColor: Me, password: Je, editorMode: v, author: y, externalPlugins: Ye = [], historyShortcuts: Xe = "editor", collaboration: b, onAnonymizationMatchesChange: Ze, showTemplateDirectives: Qe, onSlashMenuChange: $e, onSlashMenuKeyAction: et, onChange: tt, onError: x, onSelectionUpdate: S, onEditorViewReady: nt, onCopy: rt, onCut: it, onPaste: at, onReadOnlyEditAttempt: C, featureFlags: w, onSelectiveSaveTripwire: T } = e, ot = n ?? t, E = () => c(y) ?? ct, D = s(null), O = 0, _t = !1, k = 0, A = !1, j = s(null), M = s(null), N = s(null), P = s([]), F = s(null), I = s(null), L = s(null), vt = s([]), yt = s([]), R = o(!1), z = o(null), B = o(!1), V = () => ee(c(_), d.authorityRouting), H = (e) => V() ? ie(e) : e, bt = (e, t) => {
|
|
158
158
|
if (!V()) return !1;
|
|
159
159
|
let n = new g({
|
|
160
160
|
gap: e,
|
|
161
161
|
message: f(e, t)
|
|
162
162
|
});
|
|
163
|
-
return
|
|
164
|
-
}, U = new ze(We({ historyShortcuts:
|
|
163
|
+
return x?.(n), !0;
|
|
164
|
+
}, U = new ze(We({ historyShortcuts: Xe }));
|
|
165
165
|
U.buildSchema(), U.initializeRuntime();
|
|
166
|
-
let xt = fe(!1), St = [xt], Ct = ue({ keymap: !0 }), wt = le({ onMatchesChange: (e) =>
|
|
167
|
-
onChange: (e) =>
|
|
168
|
-
onKeyAction: (e) =>
|
|
169
|
-
}), Dt = Ge(), Ot = () => c(
|
|
166
|
+
let xt = fe(!1), St = [xt], Ct = ue({ keymap: !0 }), wt = le({ onMatchesChange: (e) => Ze?.(e) }), Tt = de(), Et = Ke({
|
|
167
|
+
onChange: (e) => $e?.(e),
|
|
168
|
+
onKeyAction: (e) => et?.(e) ?? !1
|
|
169
|
+
}), Dt = Ge(), Ot = () => c(Qe) === !0;
|
|
170
170
|
function kt() {
|
|
171
171
|
return [
|
|
172
172
|
Ct,
|
|
173
173
|
xt,
|
|
174
|
-
...
|
|
175
|
-
...c(
|
|
174
|
+
...Ye,
|
|
175
|
+
...c(b)?.plugins ?? [],
|
|
176
176
|
wt,
|
|
177
177
|
...Ot() ? [Tt, Et] : [],
|
|
178
178
|
Dt
|
|
179
179
|
];
|
|
180
180
|
}
|
|
181
|
-
let W = _e(), G = new Fe(),
|
|
181
|
+
let W = _e(), G = new Fe(), K = ke(), At = Te({
|
|
182
182
|
relayout: () => {
|
|
183
|
-
let e = j.value?.state ??
|
|
184
|
-
e &&
|
|
183
|
+
let e = j.value?.state ?? K.lastEditorState;
|
|
184
|
+
e && X(e, { reason: "hyphenation-ready" });
|
|
185
185
|
},
|
|
186
|
-
onError: (e) =>
|
|
186
|
+
onError: (e) => x?.(e)
|
|
187
187
|
});
|
|
188
|
-
i(
|
|
189
|
-
measuredFontSet: () =>
|
|
188
|
+
i(At.cancel), i(Oe({
|
|
189
|
+
measuredFontSet: () => K.lastMeasureInputs?.fontSet ?? null,
|
|
190
190
|
relayout: () => {
|
|
191
191
|
if (A) return;
|
|
192
|
-
let e = j.value?.state ??
|
|
193
|
-
e &&
|
|
192
|
+
let e = j.value?.state ?? K.lastEditorState;
|
|
193
|
+
e && X(e, { reason: "font-ready" });
|
|
194
194
|
}
|
|
195
195
|
}));
|
|
196
|
-
let
|
|
196
|
+
let jt = new Pe({
|
|
197
197
|
pageGap: se,
|
|
198
198
|
showShadow: !0
|
|
199
|
-
}),
|
|
199
|
+
}), q = Se({
|
|
200
200
|
getHost: () => ot.value,
|
|
201
|
-
getDocument: () =>
|
|
202
|
-
getCanonicalApi: () =>
|
|
201
|
+
getDocument: () => $.api.getCanonicalDocument() ?? D.value,
|
|
202
|
+
getCanonicalApi: () => $.api,
|
|
203
203
|
getExperimentalSession: () => c(_),
|
|
204
204
|
onSessionRefusal: (e, t, n) => {
|
|
205
|
-
z.value = e,
|
|
205
|
+
z.value = e, x?.(n ?? new g({
|
|
206
206
|
gap: t,
|
|
207
207
|
message: e
|
|
208
208
|
}));
|
|
@@ -210,28 +210,28 @@ function O(e) {
|
|
|
210
210
|
getStyles: () => D.value?.package.styles ?? null,
|
|
211
211
|
getTheme: () => D.value?.package.theme ?? null,
|
|
212
212
|
onTransaction: ({ rId: e, kind: t, view: n, docChanged: r, selectionChanged: i }) => {
|
|
213
|
-
if (r && (B.value = !0,
|
|
213
|
+
if (r && (B.value = !0, Z.schedule()), r || i) {
|
|
214
214
|
let { from: r, to: i } = n.state.selection;
|
|
215
215
|
F.value = {
|
|
216
216
|
from: r,
|
|
217
217
|
kind: t,
|
|
218
218
|
rId: e,
|
|
219
219
|
to: i
|
|
220
|
-
},
|
|
220
|
+
}, S?.(n.state), W.emit("selectionChange", {
|
|
221
221
|
from: r,
|
|
222
222
|
to: i
|
|
223
223
|
});
|
|
224
224
|
}
|
|
225
225
|
G.requestRender();
|
|
226
226
|
}
|
|
227
|
-
}),
|
|
227
|
+
}), Mt = { current: null }, J = Ce({
|
|
228
228
|
getHost: () => r?.value ?? null,
|
|
229
229
|
getPlugins: () => St,
|
|
230
|
-
getDocument: () =>
|
|
231
|
-
getCanonicalApi: () =>
|
|
230
|
+
getDocument: () => $.api.getCanonicalDocument() ?? D.value,
|
|
231
|
+
getCanonicalApi: () => $.api,
|
|
232
232
|
getExperimentalSession: () => c(_),
|
|
233
233
|
onSessionRefusal: (e, t, n) => {
|
|
234
|
-
z.value = e,
|
|
234
|
+
z.value = e, x?.(n ?? new g({
|
|
235
235
|
gap: t,
|
|
236
236
|
message: e
|
|
237
237
|
}));
|
|
@@ -243,13 +243,13 @@ function O(e) {
|
|
|
243
243
|
B.value = !0;
|
|
244
244
|
let e = D.value;
|
|
245
245
|
if (e) {
|
|
246
|
-
let t =
|
|
247
|
-
D.value = t,
|
|
246
|
+
let t = $.api.getCanonicalDocument() ?? Mt.current?.snapshotDocument(e) ?? e;
|
|
247
|
+
D.value = t, tt?.(H(t)), W.emit("docChange", H(t));
|
|
248
248
|
}
|
|
249
|
-
|
|
249
|
+
Z.schedule();
|
|
250
250
|
}
|
|
251
251
|
if (e || t) {
|
|
252
|
-
|
|
252
|
+
S?.(n.state);
|
|
253
253
|
let { from: e, to: t } = n.state.selection;
|
|
254
254
|
W.emit("selectionChange", {
|
|
255
255
|
from: e,
|
|
@@ -258,19 +258,19 @@ function O(e) {
|
|
|
258
258
|
}
|
|
259
259
|
}
|
|
260
260
|
});
|
|
261
|
-
|
|
262
|
-
let
|
|
263
|
-
|
|
261
|
+
Mt.current = J;
|
|
262
|
+
let Y = () => {
|
|
263
|
+
q.sync(), J.sync();
|
|
264
264
|
};
|
|
265
|
-
l(() => c(_),
|
|
266
|
-
function
|
|
267
|
-
e.layout && (L.value = e.layout), e.blocks && (vt.value = e.blocks), e.measures && (yt.value = e.measures), e.blockLookup &&
|
|
265
|
+
l(() => c(_), Y);
|
|
266
|
+
function Nt(e) {
|
|
267
|
+
e.layout && (L.value = e.layout), e.blocks && (vt.value = e.blocks), e.measures && (yt.value = e.measures), e.blockLookup && jt.setBlockLookup(e.blockLookup), e.layout && W.emit("layoutComplete", e.layout);
|
|
268
268
|
}
|
|
269
|
-
function
|
|
269
|
+
function X(e, t = {}) {
|
|
270
270
|
if (A) return;
|
|
271
271
|
let n = a.value, r = n instanceof HTMLDivElement ? n : null, i = D.value, o = i?.package.document, s = o?.sections?.[0]?.properties ?? o?.finalSectionProperties ?? null, l = oe(s), u = ae(s), d = ft(s), f = l.w - u.left - u.right, ee = i?.package.styles ?? null, p = i?.package.theme ?? null, m = i?.package.settings?.defaultTabStop, h = i?.package.settings?.mirrorMargins === !0, g = qe(i?.package);
|
|
272
272
|
try {
|
|
273
|
-
|
|
273
|
+
Nt(we({
|
|
274
274
|
contentWidth: f,
|
|
275
275
|
columns: d,
|
|
276
276
|
pageSize: l,
|
|
@@ -299,10 +299,10 @@ function O(e) {
|
|
|
299
299
|
mirrorMargins: h,
|
|
300
300
|
styles: ee,
|
|
301
301
|
layout: L.value,
|
|
302
|
-
hfPMs:
|
|
303
|
-
painter:
|
|
302
|
+
hfPMs: q,
|
|
303
|
+
painter: jt,
|
|
304
304
|
pagesContainer: r,
|
|
305
|
-
session:
|
|
305
|
+
session: K,
|
|
306
306
|
renderHfFromContentOrPm: pt,
|
|
307
307
|
renderHeaderFooterContentByRId: mt,
|
|
308
308
|
readFontSetSignature: Ee,
|
|
@@ -310,96 +310,96 @@ function O(e) {
|
|
|
310
310
|
describeInvalidHighlightMarks: gt,
|
|
311
311
|
emptyTemplatePreviewEntries: ut,
|
|
312
312
|
emptyTemplatePreviewHidden: dt,
|
|
313
|
-
hyphenationReadiness:
|
|
313
|
+
hyphenationReadiness: At,
|
|
314
314
|
markupView: c(me)
|
|
315
315
|
}, e, t));
|
|
316
316
|
} catch (e) {
|
|
317
317
|
let t = e instanceof Error ? e : Error(String(e));
|
|
318
|
-
|
|
318
|
+
x?.(t);
|
|
319
319
|
}
|
|
320
320
|
}
|
|
321
|
-
let
|
|
321
|
+
let Z = h({
|
|
322
322
|
readState: () => j.value?.state ?? null,
|
|
323
|
-
runLayout: (e, t) =>
|
|
323
|
+
runLayout: (e, t) => X(e, t),
|
|
324
324
|
...p,
|
|
325
325
|
clock: m
|
|
326
|
-
}),
|
|
327
|
-
function
|
|
328
|
-
|
|
326
|
+
}), Q = null, Pt = Le();
|
|
327
|
+
function Ft() {
|
|
328
|
+
Q !== null && (window.clearTimeout(Q), Q = null);
|
|
329
329
|
let e = j.value, t = D.value;
|
|
330
330
|
if (!(!e || !t)) try {
|
|
331
|
-
let n =
|
|
331
|
+
let n = $.api.getCanonicalDocument();
|
|
332
332
|
if (!n && V()) return;
|
|
333
|
-
let r = n ??
|
|
334
|
-
D.value = r,
|
|
333
|
+
let r = n ?? Pt.reconcile(Ie(e.state.doc, t, { stylesheetSource: { type: "package" } }), e.state.doc);
|
|
334
|
+
D.value = r, Y(), tt?.(H(r)), W.emit("docChange", H(r));
|
|
335
335
|
} catch (e) {
|
|
336
|
-
|
|
336
|
+
x?.(e instanceof Error ? e : Error(String(e)));
|
|
337
337
|
}
|
|
338
338
|
}
|
|
339
|
-
function
|
|
340
|
-
|
|
341
|
-
|
|
339
|
+
function It() {
|
|
340
|
+
Q !== null && window.clearTimeout(Q), Q = window.setTimeout(() => {
|
|
341
|
+
Q = null, Ft();
|
|
342
342
|
}, lt);
|
|
343
343
|
}
|
|
344
|
-
let
|
|
344
|
+
let $ = ne({
|
|
345
345
|
getHost: () => t.value,
|
|
346
346
|
getDocument: () => D.value,
|
|
347
347
|
getStyles: () => D.value?.package.styles ?? null,
|
|
348
348
|
getExtensionManager: () => U,
|
|
349
349
|
getExternalPlugins: kt,
|
|
350
|
-
getCollaboration: () => c(
|
|
350
|
+
getCollaboration: () => c(b),
|
|
351
351
|
getCollaborationModules: () => N.value,
|
|
352
352
|
getPrecomputedInitialState: () => null,
|
|
353
353
|
getReadOnly: () => c(u),
|
|
354
354
|
getExperimentalSession: () => c(_),
|
|
355
|
-
getEditingMode: () => c(
|
|
355
|
+
getEditingMode: () => c(v) ?? "editing",
|
|
356
356
|
getSuggestionAuthor: E,
|
|
357
357
|
onSessionRefusal: (e, t, n) => {
|
|
358
|
-
|
|
358
|
+
x?.(n ?? new g({
|
|
359
359
|
gap: t,
|
|
360
360
|
message: e
|
|
361
361
|
}));
|
|
362
362
|
},
|
|
363
363
|
getDocumentIdentity: () => String(O),
|
|
364
364
|
getDocumentContext: () => D.value,
|
|
365
|
-
onTransaction:
|
|
365
|
+
onTransaction: Rt,
|
|
366
366
|
onSelectionChange: (e) => {
|
|
367
|
-
M.value = e,
|
|
367
|
+
M.value = e, S?.(e), W.emit("selectionChange", {
|
|
368
368
|
from: e.selection.from,
|
|
369
369
|
to: e.selection.to
|
|
370
370
|
});
|
|
371
371
|
},
|
|
372
372
|
onKeyDown: () => !1,
|
|
373
|
-
onCopy: () =>
|
|
374
|
-
onCut: () =>
|
|
375
|
-
onPaste: () =>
|
|
376
|
-
onReadOnlyEditAttempt: () =>
|
|
377
|
-
onEditorViewReady:
|
|
373
|
+
onCopy: () => rt?.(),
|
|
374
|
+
onCut: () => it?.(),
|
|
375
|
+
onPaste: () => at?.(),
|
|
376
|
+
onReadOnlyEditAttempt: () => C?.(),
|
|
377
|
+
onEditorViewReady: zt,
|
|
378
378
|
onEditorViewDestroy: () => {
|
|
379
|
-
j.value = null, R.value = !1,
|
|
379
|
+
j.value = null, R.value = !1, nt?.(null);
|
|
380
380
|
},
|
|
381
381
|
onRemoteSelectionsChange: (e) => {
|
|
382
382
|
P.value = e;
|
|
383
383
|
}
|
|
384
|
-
}),
|
|
385
|
-
let e = c(
|
|
384
|
+
}), Lt = () => {
|
|
385
|
+
let e = c(b)?.awareness, t = N.value, n = $.getView();
|
|
386
386
|
P.value = e && t && n ? te(n.state, e, t) : [];
|
|
387
387
|
};
|
|
388
|
-
l(() => c(
|
|
388
|
+
l(() => c(b), (e, t, n) => {
|
|
389
389
|
if (P.value = [], !e) {
|
|
390
|
-
N.value = null,
|
|
390
|
+
N.value = null, $.retryViewCreation(), $.syncExternalDocument();
|
|
391
391
|
return;
|
|
392
392
|
}
|
|
393
393
|
let r = !1;
|
|
394
394
|
n(() => {
|
|
395
395
|
r = !0;
|
|
396
396
|
}), N.value = null, xe().then((e) => {
|
|
397
|
-
r || (N.value = e,
|
|
397
|
+
r || (N.value = e, $.retryViewCreation(), $.syncExternalDocument(), Lt());
|
|
398
398
|
}, (e) => {
|
|
399
|
-
r || (N.value = null,
|
|
399
|
+
r || (N.value = null, x?.(e instanceof Error ? e : Error(String(e))));
|
|
400
400
|
});
|
|
401
401
|
}, { immediate: !0 }), l(() => ({
|
|
402
|
-
awareness: c(
|
|
402
|
+
awareness: c(b)?.awareness,
|
|
403
403
|
modules: N.value,
|
|
404
404
|
view: j.value
|
|
405
405
|
}), ({ awareness: e, modules: t, view: n }, r, i) => {
|
|
@@ -407,57 +407,57 @@ function O(e) {
|
|
|
407
407
|
P.value = [];
|
|
408
408
|
return;
|
|
409
409
|
}
|
|
410
|
-
e.on("change",
|
|
411
|
-
e.off("change",
|
|
410
|
+
e.on("change", Lt), Lt(), i(() => {
|
|
411
|
+
e.off("change", Lt), P.value = [];
|
|
412
412
|
});
|
|
413
413
|
}, { flush: "post" });
|
|
414
|
-
function
|
|
414
|
+
function Rt({ newState: e, docChanged: t, transactions: n }) {
|
|
415
415
|
M.value = e;
|
|
416
416
|
let r = n[0]?.before;
|
|
417
|
-
if (t && r &&
|
|
418
|
-
let e =
|
|
419
|
-
e && (D.value = e,
|
|
417
|
+
if (t && r && Pt.noteBase(r), t) {
|
|
418
|
+
let e = $.api.getCanonicalDocument();
|
|
419
|
+
e && (D.value = e, Y()), B.value = !0, G.incrementStateSeq(), Z.schedule(), It();
|
|
420
420
|
}
|
|
421
421
|
G.requestRender();
|
|
422
422
|
}
|
|
423
|
-
function
|
|
423
|
+
function zt(e) {
|
|
424
424
|
j.value = e, M.value = e.state, R.value = !0;
|
|
425
425
|
let t = D.value, n = O, r = ++k;
|
|
426
426
|
A = !0;
|
|
427
427
|
let i = () => {
|
|
428
|
-
k === r && (A = !1, !(_t || O !== n ||
|
|
428
|
+
k === r && (A = !1, !(_t || O !== n || $.getView() !== e) && (X(e.state, { reason: "initial" }), G.requestRender()));
|
|
429
429
|
};
|
|
430
|
-
De(t, e.state.doc).then(i, i),
|
|
430
|
+
De(t, e.state.doc).then(i, i), Ht(e), nt?.(e), c(u) || requestAnimationFrame(() => {
|
|
431
431
|
j.value === e && e.focus();
|
|
432
432
|
});
|
|
433
433
|
}
|
|
434
|
-
let
|
|
434
|
+
let Bt = {
|
|
435
435
|
getDocx: async (e) => (await Yt(e))?.buffer ?? null,
|
|
436
436
|
loadDocument: Jt,
|
|
437
437
|
loadDocx: qt
|
|
438
|
-
},
|
|
439
|
-
getEditorApi: () =>
|
|
438
|
+
}, Vt = ge({
|
|
439
|
+
getEditorApi: () => $.api,
|
|
440
440
|
getLayout: () => L.value,
|
|
441
|
-
runLayout: (e, t) =>
|
|
442
|
-
getDocumentIO: () =>
|
|
441
|
+
runLayout: (e, t) => X(e, t),
|
|
442
|
+
getDocumentIO: () => Bt,
|
|
443
443
|
emitter: W
|
|
444
444
|
});
|
|
445
|
-
function
|
|
446
|
-
pe(c(
|
|
445
|
+
function Ht(e) {
|
|
446
|
+
pe(c(v) === "suggesting", e.state, e.dispatch, E());
|
|
447
447
|
}
|
|
448
|
-
l([() => c(
|
|
449
|
-
|
|
448
|
+
l([() => c(v), E], () => {
|
|
449
|
+
Vt.setCanonicalMode(c(v) === "suggesting" ? {
|
|
450
450
|
type: "suggesting",
|
|
451
451
|
author: E()
|
|
452
452
|
} : { type: "editing" });
|
|
453
453
|
let e = j.value;
|
|
454
|
-
e &&
|
|
455
|
-
for (let e of
|
|
456
|
-
let t =
|
|
457
|
-
t &&
|
|
454
|
+
e && Ht(e);
|
|
455
|
+
for (let e of J.listStories()) {
|
|
456
|
+
let t = J.getView(e);
|
|
457
|
+
t && Ht(t);
|
|
458
458
|
}
|
|
459
459
|
}), l(() => c(u), (e) => {
|
|
460
|
-
|
|
460
|
+
$.syncEditable(), e && nn();
|
|
461
461
|
});
|
|
462
462
|
function Ut(e) {
|
|
463
463
|
let t = Ot();
|
|
@@ -474,14 +474,14 @@ function O(e) {
|
|
|
474
474
|
e && Ut(e);
|
|
475
475
|
});
|
|
476
476
|
function Wt() {
|
|
477
|
-
|
|
477
|
+
$.ensureView();
|
|
478
478
|
}
|
|
479
479
|
function Gt() {
|
|
480
|
-
O += 1, B.value = !1, F.value = null, I.value = null,
|
|
480
|
+
O += 1, B.value = !1, F.value = null, I.value = null, J.activate(null), Z.dispose(), $.destroyView(), V() && $.ensureView(), Y(), $.ensureView(), $.getView() || Kt();
|
|
481
481
|
}
|
|
482
482
|
function Kt() {
|
|
483
483
|
let e = D.value;
|
|
484
|
-
if (!(!e || c(
|
|
484
|
+
if (!(!e || c(b))) try {
|
|
485
485
|
let t = re({
|
|
486
486
|
document: e,
|
|
487
487
|
styles: e.package.styles ?? null,
|
|
@@ -494,11 +494,11 @@ function O(e) {
|
|
|
494
494
|
let n = O, r = ++k;
|
|
495
495
|
A = !0;
|
|
496
496
|
let i = () => {
|
|
497
|
-
k === r && (A = !1, !(_t || O !== n || D.value !== e ||
|
|
497
|
+
k === r && (A = !1, !(_t || O !== n || D.value !== e || $.getView()) && X(t, { reason: "initial" }));
|
|
498
498
|
};
|
|
499
499
|
De(e, t.doc).then(i, i);
|
|
500
500
|
} catch (e) {
|
|
501
|
-
|
|
501
|
+
x?.(e instanceof Error ? e : Error(String(e)));
|
|
502
502
|
}
|
|
503
503
|
}
|
|
504
504
|
l([
|
|
@@ -507,7 +507,7 @@ function O(e) {
|
|
|
507
507
|
ot,
|
|
508
508
|
...r ? [r] : []
|
|
509
509
|
], () => {
|
|
510
|
-
t.value && D.value &&
|
|
510
|
+
t.value && D.value && !$.getView() && Wt(), Y();
|
|
511
511
|
}, { flush: "post" });
|
|
512
512
|
async function qt(e) {
|
|
513
513
|
z.value = null, R.value = !1;
|
|
@@ -518,40 +518,40 @@ function O(e) {
|
|
|
518
518
|
if (n.isErr()) throw n.error;
|
|
519
519
|
t = n.value;
|
|
520
520
|
}
|
|
521
|
-
let n = await Ae(t, { password: c(
|
|
521
|
+
let n = await Ae(t, { password: c(Je) });
|
|
522
522
|
D.value = n, Gt();
|
|
523
523
|
} catch (e) {
|
|
524
524
|
let t = e instanceof Error ? e : Error(String(e));
|
|
525
|
-
z.value = t.message,
|
|
525
|
+
z.value = t.message, x?.(t);
|
|
526
526
|
}
|
|
527
527
|
}
|
|
528
528
|
function Jt(e) {
|
|
529
|
-
z.value = null, D.value = e,
|
|
529
|
+
z.value = null, D.value = e, Pt.reset(), Gt();
|
|
530
530
|
}
|
|
531
531
|
async function Yt(e) {
|
|
532
532
|
let t = j.value, n = D.value;
|
|
533
533
|
if (!t || !n) return null;
|
|
534
534
|
try {
|
|
535
|
-
let t =
|
|
535
|
+
let t = $.api.captureCanonicalSave();
|
|
536
536
|
if (t) {
|
|
537
537
|
let n = await be({
|
|
538
538
|
snapshot: t,
|
|
539
539
|
options: e,
|
|
540
|
-
featureFlags: c(
|
|
540
|
+
featureFlags: c(w)
|
|
541
541
|
});
|
|
542
|
-
for (let t of n.diagnostics) e?.onDiagnostic ||
|
|
542
|
+
for (let t of n.diagnostics) e?.onDiagnostic || x?.(new ye({
|
|
543
543
|
gap: d.save,
|
|
544
544
|
diagnostic: t,
|
|
545
545
|
message: `Canonical save used a fidelity fallback: ${t.type} (${t.part}).`
|
|
546
546
|
}));
|
|
547
|
-
return n.tripwireResult &&
|
|
547
|
+
return n.tripwireResult && T?.(n.tripwireResult), n;
|
|
548
548
|
}
|
|
549
549
|
} catch (e) {
|
|
550
|
-
return
|
|
550
|
+
return x?.(e instanceof Error ? e : Error(String(e))), null;
|
|
551
551
|
}
|
|
552
552
|
if (V()) return null;
|
|
553
|
-
|
|
554
|
-
let r =
|
|
553
|
+
Q !== null && Ft();
|
|
554
|
+
let r = J.snapshotDocument(q.snapshotDocument(n)), i = t.state, a = Re(Ie(i.doc, r, { stylesheetSource: { type: "package" } })), { resolveSelectiveSaveFlags: o } = await import("@stll/folio-core/docx/selectiveSaveFlags"), s = o(c(w)), l = a.originalBuffer ?? null, u = s.selectiveSave && e?.mode !== he.full, f = u || s.selectiveSaveTripwire, { repackDocx: ee, createDocx: p } = await import("@stll/folio-core/docx/rezip"), m = null;
|
|
555
555
|
if (f && l) {
|
|
556
556
|
let { attemptSelectiveSave: e } = await import("@stll/folio-core/docx/selectiveSave");
|
|
557
557
|
m = await e(a, l, {
|
|
@@ -570,9 +570,9 @@ function O(e) {
|
|
|
570
570
|
else if (s.selectiveSaveTripwire) try {
|
|
571
571
|
g = await te();
|
|
572
572
|
} catch {}
|
|
573
|
-
if (s.selectiveSaveTripwire && g &&
|
|
573
|
+
if (s.selectiveSaveTripwire && g && T) try {
|
|
574
574
|
let { compareSelectiveVsFull: e } = await import("@stll/folio-core/docx/selectiveSaveTripwire");
|
|
575
|
-
|
|
575
|
+
T(await e(m, g));
|
|
576
576
|
} catch {}
|
|
577
577
|
return {
|
|
578
578
|
buffer: h,
|
|
@@ -581,34 +581,34 @@ function O(e) {
|
|
|
581
581
|
}
|
|
582
582
|
async function Xt(e) {
|
|
583
583
|
let t = j.value, n = t?.state, r = await Yt({ mode: e?.selective === !1 ? he.full : he.preferSelective });
|
|
584
|
-
return r ? (j.value === t && t?.state.doc === n?.doc && (r.version === void 0 ||
|
|
584
|
+
return r ? (j.value === t && t?.state.doc === n?.doc && (r.version === void 0 || $.api.isCanonicalSaveCurrent(r.version)) && (D.value = r.document, Y(), B.value = !1), new Blob([r.buffer], { type: "application/vnd.openxmlformats-officedocument.wordprocessingml.document" })) : null;
|
|
585
585
|
}
|
|
586
586
|
function Zt() {
|
|
587
|
-
let e =
|
|
587
|
+
let e = $.api.getCanonicalDocument();
|
|
588
588
|
if (e) return e;
|
|
589
589
|
if (V()) return null;
|
|
590
590
|
let t = D.value;
|
|
591
|
-
return t ? H(
|
|
591
|
+
return t ? H(J.snapshotDocument(q.snapshotDocument(t))) : null;
|
|
592
592
|
}
|
|
593
593
|
function Qt(e) {
|
|
594
|
-
bt(d.modelEdits, "Direct document model changes are unavailable in this session.") || (D.value = e,
|
|
594
|
+
bt(d.modelEdits, "Direct document model changes are unavailable in this session.") || (D.value = e, Y(), I.value && !J.getView(I.value) && (I.value = null));
|
|
595
595
|
}
|
|
596
596
|
function $t(e) {
|
|
597
|
-
return
|
|
597
|
+
return q.getView(e);
|
|
598
598
|
}
|
|
599
599
|
function en() {
|
|
600
|
-
|
|
600
|
+
Y();
|
|
601
601
|
}
|
|
602
602
|
function tn(e) {
|
|
603
|
-
let t =
|
|
604
|
-
t && (
|
|
603
|
+
let t = J.activate(e);
|
|
604
|
+
t && (Ht(t), I.value = e, requestAnimationFrame(() => t.focus()));
|
|
605
605
|
}
|
|
606
606
|
function nn() {
|
|
607
|
-
|
|
607
|
+
J.activate(null), I.value = null;
|
|
608
608
|
}
|
|
609
609
|
function rn() {
|
|
610
610
|
let e = I.value;
|
|
611
|
-
return e ?
|
|
611
|
+
return e ? J.getView(e) : null;
|
|
612
612
|
}
|
|
613
613
|
function an() {
|
|
614
614
|
return U.getCommands();
|
|
@@ -619,7 +619,7 @@ function O(e) {
|
|
|
619
619
|
}
|
|
620
620
|
function sn() {
|
|
621
621
|
let e = j.value;
|
|
622
|
-
e &&
|
|
622
|
+
e && X(e.state, { reason: "manual" });
|
|
623
623
|
}
|
|
624
624
|
l([
|
|
625
625
|
() => c(je),
|
|
@@ -628,10 +628,17 @@ function O(e) {
|
|
|
628
628
|
() => c(me)
|
|
629
629
|
], () => sn());
|
|
630
630
|
function cn() {
|
|
631
|
-
_t = !0, k += 1, A = !1,
|
|
631
|
+
_t = !0, k += 1, A = !1, Z.dispose(), Q !== null && (window.clearTimeout(Q), Q = null), $.destroyView(), P.value = [], q.destroy(), J.destroy(), U.destroy(), M.value = null, L.value = null, D.value = null, R.value = !1;
|
|
632
632
|
}
|
|
633
633
|
return i(cn), {
|
|
634
|
-
|
|
634
|
+
setEmbeddedFontFamilies: (e) => {
|
|
635
|
+
if (e) {
|
|
636
|
+
K.embeddedFontFamilyMap = new Map(e);
|
|
637
|
+
return;
|
|
638
|
+
}
|
|
639
|
+
delete K.embeddedFontFamilyMap;
|
|
640
|
+
},
|
|
641
|
+
editor: Vt,
|
|
635
642
|
editorView: j,
|
|
636
643
|
editorState: M,
|
|
637
644
|
remoteSelections: P,
|
|
@@ -745,8 +752,8 @@ function A() {
|
|
|
745
752
|
r.preventDefault();
|
|
746
753
|
let t = r.clientX - e.startX, n = parseFloat(e.handle.style.left);
|
|
747
754
|
e.handle.style.left = `${n + t}px`, e.startX = r.clientX;
|
|
748
|
-
let i = Math.round(t *
|
|
749
|
-
a >=
|
|
755
|
+
let i = Math.round(t * y), a = e.origWidths.left + i, o = e.origWidths.right - i;
|
|
756
|
+
a >= Je && o >= Je && (e.origWidths = {
|
|
750
757
|
left: a,
|
|
751
758
|
right: o
|
|
752
759
|
});
|
|
@@ -756,21 +763,21 @@ function A() {
|
|
|
756
763
|
r.preventDefault();
|
|
757
764
|
let e = r.clientY - t.startY, n = parseFloat(t.handle.style.top);
|
|
758
765
|
t.handle.style.top = `${n + e}px`, t.startY = r.clientY;
|
|
759
|
-
let i = Math.round(e *
|
|
760
|
-
a >=
|
|
766
|
+
let i = Math.round(e * y), a = t.origHeight + i;
|
|
767
|
+
a >= v && (t.origHeight = a);
|
|
761
768
|
return;
|
|
762
769
|
}
|
|
763
770
|
if (n.active && n.handle) {
|
|
764
771
|
r.preventDefault();
|
|
765
772
|
let e = r.clientX - n.startX, t = parseFloat(n.handle.style.left);
|
|
766
773
|
n.handle.style.left = `${t + e}px`, n.startX = r.clientX;
|
|
767
|
-
let i = Math.round(e *
|
|
768
|
-
a >=
|
|
774
|
+
let i = Math.round(e * y), a = n.origWidth + i;
|
|
775
|
+
a >= Je && (n.origWidth = a);
|
|
769
776
|
}
|
|
770
777
|
}
|
|
771
778
|
function s(i) {
|
|
772
779
|
if (e.active) {
|
|
773
|
-
e.active = !1, e.handle?.classList.remove("dragging"), r &&
|
|
780
|
+
e.active = !1, e.handle?.classList.remove("dragging"), r && Ye(r, {
|
|
774
781
|
pmStart: e.tablePmStart,
|
|
775
782
|
colIdx: e.columnIndex,
|
|
776
783
|
newLeft: e.origWidths.left,
|
|
@@ -779,14 +786,14 @@ function A() {
|
|
|
779
786
|
return;
|
|
780
787
|
}
|
|
781
788
|
if (t.active) {
|
|
782
|
-
t.active = !1, t.handle?.classList.remove("dragging"), r &&
|
|
789
|
+
t.active = !1, t.handle?.classList.remove("dragging"), r && b(r, {
|
|
783
790
|
pmStart: t.tablePmStart,
|
|
784
791
|
rowIdx: t.rowIndex,
|
|
785
792
|
newHeight: t.origHeight
|
|
786
793
|
}), t.handle = null;
|
|
787
794
|
return;
|
|
788
795
|
}
|
|
789
|
-
n.active && (n.active = !1, n.handle?.classList.remove("dragging"), r &&
|
|
796
|
+
n.active && (n.active = !1, n.handle?.classList.remove("dragging"), r && Xe(r, {
|
|
790
797
|
pmStart: n.tablePmStart,
|
|
791
798
|
colIdx: n.columnIndex,
|
|
792
799
|
newWidth: n.origWidth
|
|
@@ -804,30 +811,30 @@ function A() {
|
|
|
804
811
|
};
|
|
805
812
|
}
|
|
806
813
|
function j(e, t) {
|
|
807
|
-
let n =
|
|
814
|
+
let n = Qe(e, t.tablePmStart, t.columnIndex);
|
|
808
815
|
n && (t.origWidths = n);
|
|
809
816
|
}
|
|
810
817
|
function M(e, t, n) {
|
|
811
|
-
let r =
|
|
818
|
+
let r = $e(e, t.tablePmStart, t.rowIndex);
|
|
812
819
|
if (r != null) {
|
|
813
820
|
t.origHeight = r;
|
|
814
821
|
return;
|
|
815
822
|
}
|
|
816
823
|
let i = n.closest(".layout-table")?.querySelector(`[data-row-index="${t.rowIndex}"]`), a = i ? i.getBoundingClientRect().height : 30;
|
|
817
|
-
t.origHeight = Math.round(a *
|
|
824
|
+
t.origHeight = Math.round(a * y);
|
|
818
825
|
}
|
|
819
826
|
function N(e, t) {
|
|
820
|
-
let n =
|
|
827
|
+
let n = Ze(e, t.tablePmStart, t.columnIndex);
|
|
821
828
|
n != null && (t.origWidth = n);
|
|
822
829
|
}
|
|
823
830
|
//#endregion
|
|
824
831
|
//#region src/composables/useTrackedChanges.ts
|
|
825
832
|
function P(t, n) {
|
|
826
|
-
return e(() => (n.value,
|
|
833
|
+
return e(() => (n.value, et(t.value?.state ?? null)));
|
|
827
834
|
}
|
|
828
835
|
//#endregion
|
|
829
836
|
//#region src/composables/useZoom.ts
|
|
830
|
-
var F =
|
|
837
|
+
var F = x, I = tt, L = [
|
|
831
838
|
.5,
|
|
832
839
|
.75,
|
|
833
840
|
1,
|
|
@@ -841,10 +848,10 @@ function vt(t = 1) {
|
|
|
841
848
|
i.value = Math.max(F, Math.min(I, Math.round(e * 100) / 100));
|
|
842
849
|
}
|
|
843
850
|
function u() {
|
|
844
|
-
l(i.value +
|
|
851
|
+
l(i.value + S);
|
|
845
852
|
}
|
|
846
853
|
function d() {
|
|
847
|
-
l(i.value -
|
|
854
|
+
l(i.value - S);
|
|
848
855
|
}
|
|
849
856
|
function f() {
|
|
850
857
|
l(1);
|
|
@@ -874,4 +881,4 @@ function vt(t = 1) {
|
|
|
874
881
|
};
|
|
875
882
|
}
|
|
876
883
|
//#endregion
|
|
877
|
-
export { k as a,
|
|
884
|
+
export { k as a, C as c, A as i, T as l, et as n, O as o, P as r, ot as s, vt as t, E as u };
|