@stll/folio-vue 0.22.1 → 0.22.3
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 +5 -0
- package/dist/composables/useCommentLifecycle.d.ts +5 -0
- package/dist/composables/useCommentManagement.d.ts +2 -0
- package/dist/composables/useOutlineDrawerFocus.d.ts +11 -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 +1307 -1190
- package/dist/useZoom-CkbPWZ64.cjs +1 -0
- package/dist/{useZoom-BjQJG8XD.js → useZoom-D8Wi1XkB.js} +197 -193
- package/package.json +2 -2
- package/dist/useZoom-CKMoQv-y.cjs +0 -1
|
@@ -54,12 +54,12 @@ function it(e) {
|
|
|
54
54
|
}
|
|
55
55
|
//#endregion
|
|
56
56
|
//#region src/composables/useColorMode.ts
|
|
57
|
-
var w = "light", T = Symbol("folioColorMode"),
|
|
57
|
+
var w = "light", T = Symbol("folioColorMode"), at = (t = w) => {
|
|
58
58
|
a(T, e(() => c(t)));
|
|
59
|
-
},
|
|
59
|
+
}, ot = { install(t, n = w) {
|
|
60
60
|
t.provide(T, e(() => c(n)));
|
|
61
61
|
} };
|
|
62
|
-
function
|
|
62
|
+
function E() {
|
|
63
63
|
let n = t(T, e(() => w)), i = o(!1), a = o(!1);
|
|
64
64
|
return r(() => {
|
|
65
65
|
i.value = !0;
|
|
@@ -71,8 +71,8 @@ function D() {
|
|
|
71
71
|
}
|
|
72
72
|
//#endregion
|
|
73
73
|
//#region src/composables/useDocxEditor.ts
|
|
74
|
-
var
|
|
75
|
-
function
|
|
74
|
+
var st = 24, ct = "User", lt = 250, ut = [], dt = [];
|
|
75
|
+
function ft(e) {
|
|
76
76
|
let t = e?.columnCount ?? 1;
|
|
77
77
|
if (t <= 1) return;
|
|
78
78
|
let n = {
|
|
@@ -82,7 +82,7 @@ function ut(e) {
|
|
|
82
82
|
};
|
|
83
83
|
return e?.separator !== void 0 && (n.separator = e.separator), n;
|
|
84
84
|
}
|
|
85
|
-
function
|
|
85
|
+
function pt(e, t, n, r, i, a) {
|
|
86
86
|
if (!e) return;
|
|
87
87
|
let o = t ? {
|
|
88
88
|
...a,
|
|
@@ -90,16 +90,16 @@ function dt(e, t, n, r, i, a) {
|
|
|
90
90
|
} : a, s = t ? n?.getView(t) : null;
|
|
91
91
|
return s ? je(s.state.doc, r, i, o) : Me(e, r, i, o);
|
|
92
92
|
}
|
|
93
|
-
function
|
|
93
|
+
function mt(e, t, n, r, i) {
|
|
94
94
|
if (!e || e.size === 0) return;
|
|
95
95
|
let a = /* @__PURE__ */ new Map();
|
|
96
96
|
for (let [o, s] of e) {
|
|
97
|
-
let e =
|
|
97
|
+
let e = pt(s, o, t, n, r, i);
|
|
98
98
|
e && a.set(o, e);
|
|
99
99
|
}
|
|
100
100
|
return a.size > 0 ? a : void 0;
|
|
101
101
|
}
|
|
102
|
-
function
|
|
102
|
+
function ht(e, t, n) {
|
|
103
103
|
let r = /* @__PURE__ */ new Map();
|
|
104
104
|
if (!n || !n.package.footnotes) return r;
|
|
105
105
|
let i = /* @__PURE__ */ new Map();
|
|
@@ -125,7 +125,7 @@ function pt(e, t, n) {
|
|
|
125
125
|
}
|
|
126
126
|
return r;
|
|
127
127
|
}
|
|
128
|
-
var
|
|
128
|
+
var D = /* @__PURE__ */ new Set([
|
|
129
129
|
"black",
|
|
130
130
|
"blue",
|
|
131
131
|
"cyan",
|
|
@@ -144,17 +144,17 @@ var O = /* @__PURE__ */ new Set([
|
|
|
144
144
|
"white",
|
|
145
145
|
"yellow"
|
|
146
146
|
]);
|
|
147
|
-
function
|
|
147
|
+
function gt(e) {
|
|
148
148
|
let t = [], n = (e, r) => {
|
|
149
|
-
for (let [n, i] of e.marks.entries()) i.type.name === "highlight" && !
|
|
149
|
+
for (let [n, i] of e.marks.entries()) i.type.name === "highlight" && !D.has(String(i.attrs.color)) && t.push(`${r}.marks[${n}]=${JSON.stringify(i.attrs)}`);
|
|
150
150
|
e.forEach((e, t, i) => {
|
|
151
151
|
n(e, `${r}.content[${i}]`);
|
|
152
152
|
});
|
|
153
153
|
};
|
|
154
154
|
return n(e, "doc"), t.join("; ");
|
|
155
155
|
}
|
|
156
|
-
function
|
|
157
|
-
let { hiddenContainer: t, hiddenHeaderFooterContainer: n, noteEditorContainer: r, pagesContainer: a, readOnly: u = !1, experimentalSession: _, pageGap: se =
|
|
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: v, editorMode: y, author: b, externalPlugins: Je = [], historyShortcuts: Ye = "editor", collaboration: x, onAnonymizationMatchesChange: Xe, showTemplateDirectives: Ze, onSlashMenuChange: Qe, onSlashMenuKeyAction: $e, onChange: et, onError: S, onSelectionUpdate: C, onEditorViewReady: tt, onCopy: nt, onCut: rt, onPaste: it, onReadOnlyEditAttempt: w, featureFlags: T, onSelectiveSaveTripwire: at } = e, ot = n ?? t, E = () => c(b) ?? 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,
|
|
@@ -163,46 +163,46 @@ function k(e) {
|
|
|
163
163
|
return S?.(n), !0;
|
|
164
164
|
}, U = new ze(We({ historyShortcuts: Ye }));
|
|
165
165
|
U.buildSchema(), U.initializeRuntime();
|
|
166
|
-
let
|
|
166
|
+
let xt = fe(!1), St = [xt], Ct = ue({ keymap: !0 }), wt = le({ onMatchesChange: (e) => Xe?.(e) }), Tt = de(), Et = Ke({
|
|
167
167
|
onChange: (e) => Qe?.(e),
|
|
168
168
|
onKeyAction: (e) => $e?.(e) ?? !1
|
|
169
|
-
}),
|
|
170
|
-
function
|
|
169
|
+
}), Dt = Ge(), Ot = () => c(Ze) === !0;
|
|
170
|
+
function kt() {
|
|
171
171
|
return [
|
|
172
|
+
Ct,
|
|
172
173
|
xt,
|
|
173
|
-
yt,
|
|
174
174
|
...Je,
|
|
175
175
|
...c(x)?.plugins ?? [],
|
|
176
|
-
|
|
177
|
-
...
|
|
178
|
-
|
|
176
|
+
wt,
|
|
177
|
+
...Ot() ? [Tt, Et] : [],
|
|
178
|
+
Dt
|
|
179
179
|
];
|
|
180
180
|
}
|
|
181
|
-
let W = _e(), G = new Fe(),
|
|
181
|
+
let W = _e(), G = new Fe(), At = ke(), jt = Te({
|
|
182
182
|
relayout: () => {
|
|
183
|
-
let e =
|
|
183
|
+
let e = j.value?.state ?? At.lastEditorState;
|
|
184
184
|
e && Y(e, { reason: "hyphenation-ready" });
|
|
185
185
|
},
|
|
186
186
|
onError: (e) => S?.(e)
|
|
187
187
|
});
|
|
188
|
-
i(
|
|
189
|
-
measuredFontSet: () =>
|
|
188
|
+
i(jt.cancel), i(Oe({
|
|
189
|
+
measuredFontSet: () => At.lastMeasureInputs?.fontSet ?? null,
|
|
190
190
|
relayout: () => {
|
|
191
|
-
if (
|
|
192
|
-
let e =
|
|
191
|
+
if (A) return;
|
|
192
|
+
let e = j.value?.state ?? At.lastEditorState;
|
|
193
193
|
e && Y(e, { reason: "font-ready" });
|
|
194
194
|
}
|
|
195
195
|
}));
|
|
196
|
-
let
|
|
196
|
+
let Mt = new Pe({
|
|
197
197
|
pageGap: se,
|
|
198
198
|
showShadow: !0
|
|
199
199
|
}), K = Se({
|
|
200
|
-
getHost: () =>
|
|
200
|
+
getHost: () => ot.value,
|
|
201
201
|
getDocument: () => Q.api.getCanonicalDocument() ?? D.value,
|
|
202
202
|
getCanonicalApi: () => Q.api,
|
|
203
203
|
getExperimentalSession: () => c(_),
|
|
204
|
-
onSessionRefusal: (e, t) => {
|
|
205
|
-
z.value = e, S?.(new g({
|
|
204
|
+
onSessionRefusal: (e, t, n) => {
|
|
205
|
+
z.value = e, S?.(n ?? new g({
|
|
206
206
|
gap: t,
|
|
207
207
|
message: e
|
|
208
208
|
}));
|
|
@@ -212,7 +212,7 @@ function k(e) {
|
|
|
212
212
|
onTransaction: ({ rId: e, kind: t, view: n, docChanged: r, selectionChanged: i }) => {
|
|
213
213
|
if (r && (B.value = !0, X.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,
|
|
@@ -224,14 +224,14 @@ function k(e) {
|
|
|
224
224
|
}
|
|
225
225
|
G.requestRender();
|
|
226
226
|
}
|
|
227
|
-
}),
|
|
227
|
+
}), Nt = { current: null }, q = Ce({
|
|
228
228
|
getHost: () => r?.value ?? null,
|
|
229
|
-
getPlugins: () =>
|
|
229
|
+
getPlugins: () => St,
|
|
230
230
|
getDocument: () => Q.api.getCanonicalDocument() ?? D.value,
|
|
231
231
|
getCanonicalApi: () => Q.api,
|
|
232
232
|
getExperimentalSession: () => c(_),
|
|
233
|
-
onSessionRefusal: (e, t) => {
|
|
234
|
-
z.value = e, S?.(new g({
|
|
233
|
+
onSessionRefusal: (e, t, n) => {
|
|
234
|
+
z.value = e, S?.(n ?? new g({
|
|
235
235
|
gap: t,
|
|
236
236
|
message: e
|
|
237
237
|
}));
|
|
@@ -243,7 +243,7 @@ function k(e) {
|
|
|
243
243
|
B.value = !0;
|
|
244
244
|
let e = D.value;
|
|
245
245
|
if (e) {
|
|
246
|
-
let t = Q.api.getCanonicalDocument() ??
|
|
246
|
+
let t = Q.api.getCanonicalDocument() ?? Nt.current?.snapshotDocument(e) ?? e;
|
|
247
247
|
D.value = t, et?.(H(t)), W.emit("docChange", H(t));
|
|
248
248
|
}
|
|
249
249
|
X.schedule();
|
|
@@ -258,19 +258,19 @@ function k(e) {
|
|
|
258
258
|
}
|
|
259
259
|
}
|
|
260
260
|
});
|
|
261
|
-
|
|
261
|
+
Nt.current = q;
|
|
262
262
|
let J = () => {
|
|
263
263
|
K.sync(), q.sync();
|
|
264
264
|
};
|
|
265
265
|
l(() => c(_), J);
|
|
266
|
-
function
|
|
267
|
-
e.layout && (L.value = e.layout), e.blocks && (
|
|
266
|
+
function Pt(e) {
|
|
267
|
+
e.layout && (L.value = e.layout), e.blocks && (vt.value = e.blocks), e.measures && (yt.value = e.measures), e.blockLookup && Mt.setBlockLookup(e.blockLookup), e.layout && W.emit("layoutComplete", e.layout);
|
|
268
268
|
}
|
|
269
269
|
function Y(e, t = {}) {
|
|
270
|
-
if (
|
|
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 =
|
|
270
|
+
if (A) return;
|
|
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
|
+
Pt(we({
|
|
274
274
|
contentWidth: f,
|
|
275
275
|
columns: d,
|
|
276
276
|
pageSize: l,
|
|
@@ -300,17 +300,17 @@ function k(e) {
|
|
|
300
300
|
styles: ee,
|
|
301
301
|
layout: L.value,
|
|
302
302
|
hfPMs: K,
|
|
303
|
-
painter:
|
|
303
|
+
painter: Mt,
|
|
304
304
|
pagesContainer: r,
|
|
305
|
-
session:
|
|
306
|
-
renderHfFromContentOrPm:
|
|
307
|
-
renderHeaderFooterContentByRId:
|
|
305
|
+
session: At,
|
|
306
|
+
renderHfFromContentOrPm: pt,
|
|
307
|
+
renderHeaderFooterContentByRId: mt,
|
|
308
308
|
readFontSetSignature: Ee,
|
|
309
|
-
buildFootnoteRenderItems:
|
|
310
|
-
describeInvalidHighlightMarks:
|
|
311
|
-
emptyTemplatePreviewEntries:
|
|
312
|
-
emptyTemplatePreviewHidden:
|
|
313
|
-
hyphenationReadiness:
|
|
309
|
+
buildFootnoteRenderItems: ht,
|
|
310
|
+
describeInvalidHighlightMarks: gt,
|
|
311
|
+
emptyTemplatePreviewEntries: ut,
|
|
312
|
+
emptyTemplatePreviewHidden: dt,
|
|
313
|
+
hyphenationReadiness: jt,
|
|
314
314
|
markupView: c(me)
|
|
315
315
|
}, e, t));
|
|
316
316
|
} catch (e) {
|
|
@@ -319,52 +319,52 @@ function k(e) {
|
|
|
319
319
|
}
|
|
320
320
|
}
|
|
321
321
|
let X = h({
|
|
322
|
-
readState: () =>
|
|
322
|
+
readState: () => j.value?.state ?? null,
|
|
323
323
|
runLayout: (e, t) => Y(e, t),
|
|
324
324
|
...p,
|
|
325
325
|
clock: m
|
|
326
|
-
}), Z = null,
|
|
327
|
-
function
|
|
326
|
+
}), Z = null, Ft = Le();
|
|
327
|
+
function It() {
|
|
328
328
|
Z !== null && (window.clearTimeout(Z), Z = null);
|
|
329
|
-
let e =
|
|
329
|
+
let e = j.value, t = D.value;
|
|
330
330
|
if (!(!e || !t)) try {
|
|
331
331
|
let n = Q.api.getCanonicalDocument();
|
|
332
332
|
if (!n && V()) return;
|
|
333
|
-
let r = n ??
|
|
333
|
+
let r = n ?? Ft.reconcile(Ie(e.state.doc, t, { stylesheetSource: { type: "package" } }), e.state.doc);
|
|
334
334
|
D.value = r, J(), et?.(H(r)), W.emit("docChange", H(r));
|
|
335
335
|
} catch (e) {
|
|
336
336
|
S?.(e instanceof Error ? e : Error(String(e)));
|
|
337
337
|
}
|
|
338
338
|
}
|
|
339
|
-
function
|
|
339
|
+
function Lt() {
|
|
340
340
|
Z !== null && window.clearTimeout(Z), Z = window.setTimeout(() => {
|
|
341
|
-
Z = null,
|
|
342
|
-
},
|
|
341
|
+
Z = null, It();
|
|
342
|
+
}, lt);
|
|
343
343
|
}
|
|
344
344
|
let Q = ne({
|
|
345
345
|
getHost: () => t.value,
|
|
346
346
|
getDocument: () => D.value,
|
|
347
347
|
getStyles: () => D.value?.package.styles ?? null,
|
|
348
348
|
getExtensionManager: () => U,
|
|
349
|
-
getExternalPlugins:
|
|
349
|
+
getExternalPlugins: kt,
|
|
350
350
|
getCollaboration: () => c(x),
|
|
351
|
-
getCollaborationModules: () =>
|
|
351
|
+
getCollaborationModules: () => N.value,
|
|
352
352
|
getPrecomputedInitialState: () => null,
|
|
353
353
|
getReadOnly: () => c(u),
|
|
354
354
|
getExperimentalSession: () => c(_),
|
|
355
355
|
getEditingMode: () => c(y) ?? "editing",
|
|
356
|
-
getSuggestionAuthor:
|
|
357
|
-
onSessionRefusal: (e, t) => {
|
|
358
|
-
S?.(new g({
|
|
356
|
+
getSuggestionAuthor: E,
|
|
357
|
+
onSessionRefusal: (e, t, n) => {
|
|
358
|
+
S?.(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: zt,
|
|
366
366
|
onSelectionChange: (e) => {
|
|
367
|
-
|
|
367
|
+
M.value = e, C?.(e), W.emit("selectionChange", {
|
|
368
368
|
from: e.selection.from,
|
|
369
369
|
to: e.selection.to
|
|
370
370
|
});
|
|
@@ -374,123 +374,127 @@ function k(e) {
|
|
|
374
374
|
onCut: () => rt?.(),
|
|
375
375
|
onPaste: () => it?.(),
|
|
376
376
|
onReadOnlyEditAttempt: () => w?.(),
|
|
377
|
-
onEditorViewReady:
|
|
377
|
+
onEditorViewReady: Bt,
|
|
378
378
|
onEditorViewDestroy: () => {
|
|
379
|
-
|
|
379
|
+
j.value = null, R.value = !1, tt?.(null);
|
|
380
380
|
},
|
|
381
381
|
onRemoteSelectionsChange: (e) => {
|
|
382
|
-
|
|
382
|
+
P.value = e;
|
|
383
383
|
}
|
|
384
|
-
}),
|
|
385
|
-
let e = c(x)?.awareness, t =
|
|
386
|
-
|
|
384
|
+
}), Rt = () => {
|
|
385
|
+
let e = c(x)?.awareness, t = N.value, n = Q.getView();
|
|
386
|
+
P.value = e && t && n ? te(n.state, e, t) : [];
|
|
387
387
|
};
|
|
388
388
|
l(() => c(x), (e, t, n) => {
|
|
389
|
-
if (
|
|
390
|
-
|
|
389
|
+
if (P.value = [], !e) {
|
|
390
|
+
N.value = null, Q.retryViewCreation(), Q.syncExternalDocument();
|
|
391
391
|
return;
|
|
392
392
|
}
|
|
393
393
|
let r = !1;
|
|
394
394
|
n(() => {
|
|
395
395
|
r = !0;
|
|
396
|
-
}),
|
|
397
|
-
r || (
|
|
396
|
+
}), N.value = null, xe().then((e) => {
|
|
397
|
+
r || (N.value = e, Q.retryViewCreation(), Q.syncExternalDocument(), Rt());
|
|
398
398
|
}, (e) => {
|
|
399
|
-
r || (
|
|
399
|
+
r || (N.value = null, S?.(e instanceof Error ? e : Error(String(e))));
|
|
400
400
|
});
|
|
401
401
|
}, { immediate: !0 }), l(() => ({
|
|
402
402
|
awareness: c(x)?.awareness,
|
|
403
|
-
modules:
|
|
404
|
-
view:
|
|
403
|
+
modules: N.value,
|
|
404
|
+
view: j.value
|
|
405
405
|
}), ({ awareness: e, modules: t, view: n }, r, i) => {
|
|
406
406
|
if (!e || !t || !n) {
|
|
407
|
-
|
|
407
|
+
P.value = [];
|
|
408
408
|
return;
|
|
409
409
|
}
|
|
410
|
-
e.on("change",
|
|
411
|
-
e.off("change",
|
|
410
|
+
e.on("change", Rt), Rt(), i(() => {
|
|
411
|
+
e.off("change", Rt), P.value = [];
|
|
412
412
|
});
|
|
413
413
|
}, { flush: "post" });
|
|
414
|
-
function
|
|
415
|
-
|
|
414
|
+
function zt({ newState: e, docChanged: t, transactions: n }) {
|
|
415
|
+
M.value = e;
|
|
416
416
|
let r = n[0]?.before;
|
|
417
|
-
if (t && r &&
|
|
417
|
+
if (t && r && Ft.noteBase(r), t) {
|
|
418
418
|
let e = Q.api.getCanonicalDocument();
|
|
419
|
-
e && (D.value = e, J()), B.value = !0, G.incrementStateSeq(), X.schedule(),
|
|
419
|
+
e && (D.value = e, J()), B.value = !0, G.incrementStateSeq(), X.schedule(), Lt();
|
|
420
420
|
}
|
|
421
421
|
G.requestRender();
|
|
422
422
|
}
|
|
423
|
-
function
|
|
424
|
-
|
|
425
|
-
let t = D.value, n = O, r = ++
|
|
426
|
-
|
|
423
|
+
function Bt(e) {
|
|
424
|
+
j.value = e, M.value = e.state, R.value = !0;
|
|
425
|
+
let t = D.value, n = O, r = ++k;
|
|
426
|
+
A = !0;
|
|
427
427
|
let i = () => {
|
|
428
|
-
|
|
428
|
+
k === r && (A = !1, !(_t || O !== n || Q.getView() !== e) && (Y(e.state, { reason: "initial" }), G.requestRender()));
|
|
429
429
|
};
|
|
430
430
|
De(t, e.state.doc).then(i, i), $(e), tt?.(e), c(u) || requestAnimationFrame(() => {
|
|
431
|
-
|
|
431
|
+
j.value === e && e.focus();
|
|
432
432
|
});
|
|
433
433
|
}
|
|
434
|
-
let
|
|
435
|
-
getDocx: async (e) => (await
|
|
436
|
-
loadDocument:
|
|
437
|
-
loadDocx:
|
|
438
|
-
},
|
|
434
|
+
let Vt = {
|
|
435
|
+
getDocx: async (e) => (await Yt(e))?.buffer ?? null,
|
|
436
|
+
loadDocument: Jt,
|
|
437
|
+
loadDocx: qt
|
|
438
|
+
}, Ht = ge({
|
|
439
439
|
getEditorApi: () => Q.api,
|
|
440
440
|
getLayout: () => L.value,
|
|
441
441
|
runLayout: (e, t) => Y(e, t),
|
|
442
|
-
getDocumentIO: () =>
|
|
442
|
+
getDocumentIO: () => Vt,
|
|
443
443
|
emitter: W
|
|
444
444
|
});
|
|
445
445
|
function $(e) {
|
|
446
|
-
pe(c(y) === "suggesting", e.state, e.dispatch,
|
|
447
|
-
}
|
|
448
|
-
l([() => c(y),
|
|
449
|
-
|
|
446
|
+
pe(c(y) === "suggesting", e.state, e.dispatch, E());
|
|
447
|
+
}
|
|
448
|
+
l([() => c(y), E], () => {
|
|
449
|
+
Ht.setCanonicalMode(c(y) === "suggesting" ? {
|
|
450
|
+
type: "suggesting",
|
|
451
|
+
author: E()
|
|
452
|
+
} : { type: "editing" });
|
|
453
|
+
let e = j.value;
|
|
450
454
|
e && $(e);
|
|
451
455
|
for (let e of q.listStories()) {
|
|
452
456
|
let t = q.getView(e);
|
|
453
457
|
t && $(t);
|
|
454
458
|
}
|
|
455
459
|
}), l(() => c(u), (e) => {
|
|
456
|
-
Q.syncEditable(), e &&
|
|
460
|
+
Q.syncEditable(), e && nn();
|
|
457
461
|
});
|
|
458
|
-
function
|
|
459
|
-
let t =
|
|
460
|
-
if (t === e.state.plugins.includes(
|
|
461
|
-
let n = e.state.plugins.filter((e) => e !==
|
|
462
|
+
function Ut(e) {
|
|
463
|
+
let t = Ot();
|
|
464
|
+
if (t === e.state.plugins.includes(Tt)) return;
|
|
465
|
+
let n = e.state.plugins.filter((e) => e !== Tt && e !== Et);
|
|
462
466
|
if (t) {
|
|
463
|
-
let e = n.indexOf(
|
|
464
|
-
n.splice(t, 0,
|
|
467
|
+
let e = n.indexOf(Dt), t = e === -1 ? n.length : e;
|
|
468
|
+
n.splice(t, 0, Tt, Et);
|
|
465
469
|
}
|
|
466
470
|
e.updateState(e.state.reconfigure({ plugins: n }));
|
|
467
471
|
}
|
|
468
|
-
l(() =>
|
|
469
|
-
let e =
|
|
470
|
-
e &&
|
|
472
|
+
l(() => Ot(), () => {
|
|
473
|
+
let e = j.value;
|
|
474
|
+
e && Ut(e);
|
|
471
475
|
});
|
|
472
|
-
function
|
|
476
|
+
function Wt() {
|
|
473
477
|
Q.ensureView();
|
|
474
478
|
}
|
|
475
|
-
function
|
|
476
|
-
O += 1, B.value = !1,
|
|
479
|
+
function Gt() {
|
|
480
|
+
O += 1, B.value = !1, F.value = null, I.value = null, q.activate(null), X.dispose(), Q.destroyView(), V() && Q.ensureView(), J(), Q.ensureView(), Q.getView() || Kt();
|
|
477
481
|
}
|
|
478
|
-
function
|
|
482
|
+
function Kt() {
|
|
479
483
|
let e = D.value;
|
|
480
484
|
if (!(!e || c(x))) try {
|
|
481
485
|
let t = re({
|
|
482
486
|
document: e,
|
|
483
487
|
styles: e.package.styles ?? null,
|
|
484
488
|
manager: U,
|
|
485
|
-
externalPlugins:
|
|
489
|
+
externalPlugins: kt(),
|
|
486
490
|
collaborationModules: null,
|
|
487
491
|
reason: "mount"
|
|
488
492
|
});
|
|
489
|
-
|
|
490
|
-
let n = O, r = ++
|
|
491
|
-
|
|
493
|
+
M.value = t;
|
|
494
|
+
let n = O, r = ++k;
|
|
495
|
+
A = !0;
|
|
492
496
|
let i = () => {
|
|
493
|
-
|
|
497
|
+
k === r && (A = !1, !(_t || O !== n || D.value !== e || Q.getView()) && Y(t, { reason: "initial" }));
|
|
494
498
|
};
|
|
495
499
|
De(e, t.doc).then(i, i);
|
|
496
500
|
} catch (e) {
|
|
@@ -500,12 +504,12 @@ function k(e) {
|
|
|
500
504
|
l([
|
|
501
505
|
t,
|
|
502
506
|
a,
|
|
503
|
-
|
|
507
|
+
ot,
|
|
504
508
|
...r ? [r] : []
|
|
505
509
|
], () => {
|
|
506
|
-
t.value && D.value && !Q.getView() &&
|
|
510
|
+
t.value && D.value && !Q.getView() && Wt(), J();
|
|
507
511
|
}, { flush: "post" });
|
|
508
|
-
async function
|
|
512
|
+
async function qt(e) {
|
|
509
513
|
z.value = null, R.value = !1;
|
|
510
514
|
try {
|
|
511
515
|
let t = e;
|
|
@@ -515,17 +519,17 @@ function k(e) {
|
|
|
515
519
|
t = n.value;
|
|
516
520
|
}
|
|
517
521
|
let n = await Ae(t, { password: c(v) });
|
|
518
|
-
D.value = n,
|
|
522
|
+
D.value = n, Gt();
|
|
519
523
|
} catch (e) {
|
|
520
524
|
let t = e instanceof Error ? e : Error(String(e));
|
|
521
525
|
z.value = t.message, S?.(t);
|
|
522
526
|
}
|
|
523
527
|
}
|
|
524
|
-
function
|
|
525
|
-
z.value = null, D.value = e,
|
|
528
|
+
function Jt(e) {
|
|
529
|
+
z.value = null, D.value = e, Ft.reset(), Gt();
|
|
526
530
|
}
|
|
527
|
-
async function
|
|
528
|
-
let t =
|
|
531
|
+
async function Yt(e) {
|
|
532
|
+
let t = j.value, n = D.value;
|
|
529
533
|
if (!t || !n) return null;
|
|
530
534
|
try {
|
|
531
535
|
let t = Q.api.captureCanonicalSave();
|
|
@@ -540,14 +544,14 @@ function k(e) {
|
|
|
540
544
|
diagnostic: t,
|
|
541
545
|
message: `Canonical save used a fidelity fallback: ${t.type} (${t.part}).`
|
|
542
546
|
}));
|
|
543
|
-
return n.tripwireResult &&
|
|
547
|
+
return n.tripwireResult && at?.(n.tripwireResult), n;
|
|
544
548
|
}
|
|
545
549
|
} catch (e) {
|
|
546
550
|
return S?.(e instanceof Error ? e : Error(String(e))), null;
|
|
547
551
|
}
|
|
548
552
|
if (V()) return null;
|
|
549
|
-
Z !== null &&
|
|
550
|
-
let r = q.snapshotDocument(K.snapshotDocument(n)), i = t.state, a = Re(Ie(i.doc, r)), { resolveSelectiveSaveFlags: o } = await import("@stll/folio-core/docx/selectiveSaveFlags"), s = o(c(T)), 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;
|
|
553
|
+
Z !== null && It();
|
|
554
|
+
let r = q.snapshotDocument(K.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(T)), 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;
|
|
551
555
|
if (f && l) {
|
|
552
556
|
let { attemptSelectiveSave: e } = await import("@stll/folio-core/docx/selectiveSave");
|
|
553
557
|
m = await e(a, l, {
|
|
@@ -566,55 +570,55 @@ function k(e) {
|
|
|
566
570
|
else if (s.selectiveSaveTripwire) try {
|
|
567
571
|
g = await te();
|
|
568
572
|
} catch {}
|
|
569
|
-
if (s.selectiveSaveTripwire && g &&
|
|
573
|
+
if (s.selectiveSaveTripwire && g && at) try {
|
|
570
574
|
let { compareSelectiveVsFull: e } = await import("@stll/folio-core/docx/selectiveSaveTripwire");
|
|
571
|
-
|
|
575
|
+
at(await e(m, g));
|
|
572
576
|
} catch {}
|
|
573
577
|
return {
|
|
574
578
|
buffer: h,
|
|
575
579
|
document: a
|
|
576
580
|
};
|
|
577
581
|
}
|
|
578
|
-
async function
|
|
579
|
-
let t =
|
|
580
|
-
return r ? (
|
|
582
|
+
async function Xt(e) {
|
|
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 || Q.api.isCanonicalSaveCurrent(r.version)) && (D.value = r.document, J(), B.value = !1), new Blob([r.buffer], { type: "application/vnd.openxmlformats-officedocument.wordprocessingml.document" })) : null;
|
|
581
585
|
}
|
|
582
|
-
function
|
|
586
|
+
function Zt() {
|
|
583
587
|
let e = Q.api.getCanonicalDocument();
|
|
584
588
|
if (e) return e;
|
|
585
589
|
if (V()) return null;
|
|
586
590
|
let t = D.value;
|
|
587
591
|
return t ? H(q.snapshotDocument(K.snapshotDocument(t))) : null;
|
|
588
592
|
}
|
|
589
|
-
function
|
|
590
|
-
|
|
593
|
+
function Qt(e) {
|
|
594
|
+
bt(d.modelEdits, "Direct document model changes are unavailable in this session.") || (D.value = e, J(), I.value && !q.getView(I.value) && (I.value = null));
|
|
591
595
|
}
|
|
592
|
-
function
|
|
596
|
+
function $t(e) {
|
|
593
597
|
return K.getView(e);
|
|
594
598
|
}
|
|
595
|
-
function
|
|
599
|
+
function en() {
|
|
596
600
|
J();
|
|
597
601
|
}
|
|
598
|
-
function
|
|
602
|
+
function tn(e) {
|
|
599
603
|
let t = q.activate(e);
|
|
600
604
|
t && ($(t), I.value = e, requestAnimationFrame(() => t.focus()));
|
|
601
605
|
}
|
|
602
|
-
function
|
|
606
|
+
function nn() {
|
|
603
607
|
q.activate(null), I.value = null;
|
|
604
608
|
}
|
|
605
|
-
function
|
|
609
|
+
function rn() {
|
|
606
610
|
let e = I.value;
|
|
607
611
|
return e ? q.getView(e) : null;
|
|
608
612
|
}
|
|
609
|
-
function
|
|
613
|
+
function an() {
|
|
610
614
|
return U.getCommands();
|
|
611
615
|
}
|
|
612
|
-
function
|
|
613
|
-
let e =
|
|
614
|
-
e ? e.focus() :
|
|
616
|
+
function on() {
|
|
617
|
+
let e = rn();
|
|
618
|
+
e ? e.focus() : j.value?.focus();
|
|
615
619
|
}
|
|
616
|
-
function
|
|
617
|
-
let e =
|
|
620
|
+
function sn() {
|
|
621
|
+
let e = j.value;
|
|
618
622
|
e && Y(e.state, { reason: "manual" });
|
|
619
623
|
}
|
|
620
624
|
l([
|
|
@@ -622,41 +626,41 @@ function k(e) {
|
|
|
622
626
|
() => c(Me),
|
|
623
627
|
() => c(ce),
|
|
624
628
|
() => c(me)
|
|
625
|
-
], () =>
|
|
626
|
-
function
|
|
627
|
-
|
|
628
|
-
}
|
|
629
|
-
return i(
|
|
630
|
-
editor:
|
|
631
|
-
editorView:
|
|
632
|
-
editorState:
|
|
633
|
-
remoteSelections:
|
|
634
|
-
headerFooterSelection:
|
|
629
|
+
], () => sn());
|
|
630
|
+
function cn() {
|
|
631
|
+
_t = !0, k += 1, A = !1, X.dispose(), Z !== null && (window.clearTimeout(Z), Z = null), Q.destroyView(), P.value = [], K.destroy(), q.destroy(), U.destroy(), M.value = null, L.value = null, D.value = null, R.value = !1;
|
|
632
|
+
}
|
|
633
|
+
return i(cn), {
|
|
634
|
+
editor: Ht,
|
|
635
|
+
editorView: j,
|
|
636
|
+
editorState: M,
|
|
637
|
+
remoteSelections: P,
|
|
638
|
+
headerFooterSelection: F,
|
|
635
639
|
activeNoteStory: I,
|
|
636
640
|
isReady: R,
|
|
637
641
|
isDirty: B,
|
|
638
642
|
parseError: z,
|
|
639
643
|
layout: L,
|
|
640
|
-
blocks:
|
|
641
|
-
measures:
|
|
644
|
+
blocks: vt,
|
|
645
|
+
measures: yt,
|
|
642
646
|
syncCoordinator: G,
|
|
643
|
-
loadBuffer:
|
|
644
|
-
loadDocument:
|
|
645
|
-
save:
|
|
646
|
-
getDocument:
|
|
647
|
-
setDocument:
|
|
648
|
-
getHeaderFooterView:
|
|
649
|
-
syncHeaderFooterViews:
|
|
650
|
-
openNoteStory:
|
|
651
|
-
closeNoteStory:
|
|
652
|
-
getActiveNoteView:
|
|
653
|
-
getCommands:
|
|
654
|
-
focus:
|
|
655
|
-
reLayout:
|
|
656
|
-
destroy:
|
|
647
|
+
loadBuffer: qt,
|
|
648
|
+
loadDocument: Jt,
|
|
649
|
+
save: Xt,
|
|
650
|
+
getDocument: Zt,
|
|
651
|
+
setDocument: Qt,
|
|
652
|
+
getHeaderFooterView: $t,
|
|
653
|
+
syncHeaderFooterViews: en,
|
|
654
|
+
openNoteStory: tn,
|
|
655
|
+
closeNoteStory: nn,
|
|
656
|
+
getActiveNoteView: rn,
|
|
657
|
+
getCommands: an,
|
|
658
|
+
focus: on,
|
|
659
|
+
reLayout: sn,
|
|
660
|
+
destroy: cn
|
|
657
661
|
};
|
|
658
662
|
}
|
|
659
|
-
function
|
|
663
|
+
function _t(e, t) {
|
|
660
664
|
if (t < e.top + 40) {
|
|
661
665
|
let n = Math.max(0, e.top + 40 - t);
|
|
662
666
|
return -Math.min(12, n / 40 * 12);
|
|
@@ -669,7 +673,7 @@ function A(e, t) {
|
|
|
669
673
|
}
|
|
670
674
|
//#endregion
|
|
671
675
|
//#region src/composables/useDragAutoScroll.ts
|
|
672
|
-
function
|
|
676
|
+
function k({ pagesContainer: e, onScrollExtendSelection: t }) {
|
|
673
677
|
let n = null, r = 0, a = 0, o = !1;
|
|
674
678
|
function s() {
|
|
675
679
|
return se(e.value);
|
|
@@ -681,7 +685,7 @@ function j({ pagesContainer: e, onScrollExtendSelection: t }) {
|
|
|
681
685
|
if (!o) return;
|
|
682
686
|
let e = s();
|
|
683
687
|
if (!e) return;
|
|
684
|
-
let i =
|
|
688
|
+
let i = _t(e.getBoundingClientRect(), a);
|
|
685
689
|
i !== 0 && (ce(e, i), t(r, a)), n = requestAnimationFrame(l);
|
|
686
690
|
}
|
|
687
691
|
function u() {
|
|
@@ -702,7 +706,7 @@ function j({ pagesContainer: e, onScrollExtendSelection: t }) {
|
|
|
702
706
|
}
|
|
703
707
|
//#endregion
|
|
704
708
|
//#region src/composables/useTableResize.ts
|
|
705
|
-
function
|
|
709
|
+
function A() {
|
|
706
710
|
let e = {
|
|
707
711
|
active: !1,
|
|
708
712
|
startX: 0,
|
|
@@ -734,7 +738,7 @@ function M() {
|
|
|
734
738
|
}
|
|
735
739
|
function a(i, a) {
|
|
736
740
|
let o = i.target;
|
|
737
|
-
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),
|
|
741
|
+
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), j(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), M(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), N(a, n), !0) : !1 : !1;
|
|
738
742
|
}
|
|
739
743
|
function o(r) {
|
|
740
744
|
if (e.active && e.handle) {
|
|
@@ -799,11 +803,11 @@ function M() {
|
|
|
799
803
|
isResizing: i
|
|
800
804
|
};
|
|
801
805
|
}
|
|
802
|
-
function
|
|
806
|
+
function j(e, t) {
|
|
803
807
|
let n = Ze(e, t.tablePmStart, t.columnIndex);
|
|
804
808
|
n && (t.origWidths = n);
|
|
805
809
|
}
|
|
806
|
-
function
|
|
810
|
+
function M(e, t, n) {
|
|
807
811
|
let r = Qe(e, t.tablePmStart, t.rowIndex);
|
|
808
812
|
if (r != null) {
|
|
809
813
|
t.origHeight = r;
|
|
@@ -812,18 +816,18 @@ function P(e, t, n) {
|
|
|
812
816
|
let i = n.closest(".layout-table")?.querySelector(`[data-row-index="${t.rowIndex}"]`), a = i ? i.getBoundingClientRect().height : 30;
|
|
813
817
|
t.origHeight = Math.round(a * b);
|
|
814
818
|
}
|
|
815
|
-
function
|
|
819
|
+
function N(e, t) {
|
|
816
820
|
let n = Xe(e, t.tablePmStart, t.columnIndex);
|
|
817
821
|
n != null && (t.origWidth = n);
|
|
818
822
|
}
|
|
819
823
|
//#endregion
|
|
820
824
|
//#region src/composables/useTrackedChanges.ts
|
|
821
|
-
function
|
|
825
|
+
function P(t, n) {
|
|
822
826
|
return e(() => (n.value, $e(t.value?.state ?? null)));
|
|
823
827
|
}
|
|
824
828
|
//#endregion
|
|
825
829
|
//#region src/composables/useZoom.ts
|
|
826
|
-
var
|
|
830
|
+
var F = S, I = et, L = [
|
|
827
831
|
.5,
|
|
828
832
|
.75,
|
|
829
833
|
1,
|
|
@@ -831,10 +835,10 @@ var I = S, L = et, gt = [
|
|
|
831
835
|
1.5,
|
|
832
836
|
2
|
|
833
837
|
];
|
|
834
|
-
function
|
|
835
|
-
let i = o(Math.max(
|
|
838
|
+
function vt(t = 1) {
|
|
839
|
+
let i = o(Math.max(F, Math.min(I, t))), a = e(() => Math.round(i.value * 100)), s = e(() => i.value <= F), c = e(() => i.value >= I);
|
|
836
840
|
function l(e) {
|
|
837
|
-
i.value = Math.max(
|
|
841
|
+
i.value = Math.max(F, Math.min(I, Math.round(e * 100) / 100));
|
|
838
842
|
}
|
|
839
843
|
function u() {
|
|
840
844
|
l(i.value + C);
|
|
@@ -866,8 +870,8 @@ function _t(t = 1) {
|
|
|
866
870
|
handleWheel: ee,
|
|
867
871
|
handleKeyDown: p,
|
|
868
872
|
installShortcuts: m,
|
|
869
|
-
ZOOM_PRESETS:
|
|
873
|
+
ZOOM_PRESETS: L
|
|
870
874
|
};
|
|
871
875
|
}
|
|
872
876
|
//#endregion
|
|
873
|
-
export {
|
|
877
|
+
export { k as a, w as c, A as i, at as l, $e as n, O as o, P as r, ot as s, vt as t, E as u };
|