@stll/folio-vue 0.11.6 → 0.12.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/DocxEditor/types.d.ts +0 -7
- package/dist/composables/useDocxEditor.d.ts +0 -6
- 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.js +2 -4
- package/dist/{useZoom-DwDDS7hq.js → useZoom-CbTb1bPs.js} +193 -193
- package/dist/useZoom-lJ18bjuE.cjs +1 -0
- package/package.json +2 -2
- package/dist/useZoom-DBbzwfMG.cjs +0 -1
|
@@ -14,59 +14,59 @@ import { runLayoutPipeline as ce } from "@stll/folio-core/controller/layoutPipel
|
|
|
14
14
|
import { browserClock as le, createLayoutScheduler as ue } from "@stll/folio-core/controller/layoutScheduler";
|
|
15
15
|
import { createLayoutSession as de } from "@stll/folio-core/controller/layoutSession";
|
|
16
16
|
import { parseDocx as fe } from "@stll/folio-core/docx/parser";
|
|
17
|
-
import { getFootnoteText as
|
|
18
|
-
import { convertHeaderFooterPmDocToContent as
|
|
19
|
-
import { resolveSectionHeaderFooterRefs as
|
|
20
|
-
import { LayoutPainter as
|
|
21
|
-
import { LayoutSelectionGate as
|
|
22
|
-
import { getTransactionDirtyRange 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
|
|
32
|
-
import { extractTrackedChanges as
|
|
33
|
-
import { ZOOM_MAX as
|
|
17
|
+
import { getFootnoteText as pe } from "@stll/folio-core/docx/footnoteParser";
|
|
18
|
+
import { convertHeaderFooterPmDocToContent as me, convertHeaderFooterToContent as he } from "@stll/folio-core/layout-bridge/convert/headerFooterLayout";
|
|
19
|
+
import { resolveSectionHeaderFooterRefs as ge } from "@stll/folio-core/layout-engine";
|
|
20
|
+
import { LayoutPainter as _e } from "@stll/folio-core/layout-painter";
|
|
21
|
+
import { LayoutSelectionGate as ve } from "@stll/folio-core/paged-layout/LayoutSelectionGate";
|
|
22
|
+
import { getTransactionDirtyRange as ye } from "@stll/folio-core/paged-layout/transactionDirtyRange";
|
|
23
|
+
import { fromProseDoc as be } from "@stll/folio-core/prosemirror/conversion/fromProseDoc";
|
|
24
|
+
import { ExtensionManager as xe } from "@stll/folio-core/prosemirror/extensions/ExtensionManager";
|
|
25
|
+
import { getChangedParagraphIds as Se, hasStructuralChanges as Ce, hasUntrackedChanges as we } from "@stll/folio-core/prosemirror/extensions/features/ParagraphChangeTrackerExtension";
|
|
26
|
+
import { createStarterKit as Te } from "@stll/folio-core/prosemirror/extensions/StarterKit";
|
|
27
|
+
import { createTemplatePreviewValuesPlugin as Ee } from "@stll/folio-core/prosemirror/plugins/templatePreviewValues";
|
|
28
|
+
import { templateSlashMenuPlugin as De } from "@stll/folio-core/prosemirror/plugins/templateSlashMenu";
|
|
29
|
+
import { resolveHeaderFooterContent as Oe } from "@stll/folio-core/utils/headerFooter";
|
|
30
|
+
import { findVerticalScrollParent as y } from "@stll/folio-core/utils/findVerticalScrollParent";
|
|
31
|
+
import { MIN_CELL_WIDTH_TWIPS as b, MIN_ROW_HEIGHT_TWIPS as ke, TWIPS_PER_PIXEL as x, commitColumnResize as Ae, commitRightEdgeResize as je, commitRowResize as Me, readColumnWidthAt as Ne, readColumnWidths as Pe, readRowHeight as S } from "@stll/folio-core/prosemirror/tableResize";
|
|
32
|
+
import { extractTrackedChanges as C } from "@stll/folio-core/prosemirror/utils/extractTrackedChanges";
|
|
33
|
+
import { ZOOM_MAX as w, ZOOM_MIN as Fe, ZOOM_STEP as T } from "@stll/folio-core/utils/zoom";
|
|
34
34
|
//#region src/utils/colorMode.ts
|
|
35
|
-
var
|
|
36
|
-
function
|
|
35
|
+
var Ie = "(prefers-color-scheme: dark)";
|
|
36
|
+
function Le() {
|
|
37
37
|
return typeof window < "u" && typeof window.matchMedia == "function";
|
|
38
38
|
}
|
|
39
|
-
function
|
|
39
|
+
function Re(e, t) {
|
|
40
40
|
return e === "dark" || e === "system" && t;
|
|
41
41
|
}
|
|
42
|
-
function
|
|
43
|
-
if (!
|
|
44
|
-
let t = window.matchMedia(
|
|
42
|
+
function E(e) {
|
|
43
|
+
if (!Le()) return () => {};
|
|
44
|
+
let t = window.matchMedia(Ie);
|
|
45
45
|
e(t.matches);
|
|
46
46
|
let n = (t) => e(t.matches);
|
|
47
47
|
return t.addEventListener("change", n), () => t.removeEventListener("change", n);
|
|
48
48
|
}
|
|
49
49
|
//#endregion
|
|
50
50
|
//#region src/composables/useColorMode.ts
|
|
51
|
-
var D = "light", O = Symbol("folioColorMode"),
|
|
51
|
+
var D = "light", O = Symbol("folioColorMode"), ze = (t = D) => {
|
|
52
52
|
a(O, e(() => c(t)));
|
|
53
|
-
},
|
|
53
|
+
}, k = { install(t, n = D) {
|
|
54
54
|
t.provide(O, e(() => c(n)));
|
|
55
55
|
} };
|
|
56
|
-
function
|
|
56
|
+
function A() {
|
|
57
57
|
let n = t(O, e(() => D)), i = o(!1), a = o(!1);
|
|
58
58
|
return r(() => {
|
|
59
59
|
i.value = !0;
|
|
60
60
|
}), u((e) => {
|
|
61
|
-
!i.value || n.value !== "system" || e(
|
|
61
|
+
!i.value || n.value !== "system" || e(E((e) => {
|
|
62
62
|
a.value = e;
|
|
63
63
|
}));
|
|
64
|
-
}), e(() =>
|
|
64
|
+
}), e(() => Re(n.value, i.value && a.value));
|
|
65
65
|
}
|
|
66
66
|
//#endregion
|
|
67
67
|
//#region src/composables/useDocxEditor.ts
|
|
68
|
-
var
|
|
69
|
-
function
|
|
68
|
+
var Be = 24, Ve = 32, He = 96, Ue = 250, We = [];
|
|
69
|
+
function Ge(e) {
|
|
70
70
|
let t = e?.columnCount ?? 1;
|
|
71
71
|
if (t <= 1) return;
|
|
72
72
|
let n = {
|
|
@@ -76,24 +76,24 @@ function We(e) {
|
|
|
76
76
|
};
|
|
77
77
|
return e?.separator !== void 0 && (n.separator = e.separator), n;
|
|
78
78
|
}
|
|
79
|
-
function
|
|
79
|
+
function Ke(e, t, n, r, i, a) {
|
|
80
80
|
if (!e) return;
|
|
81
81
|
let o = t ? {
|
|
82
82
|
...a,
|
|
83
83
|
rId: t
|
|
84
84
|
} : a, s = t ? n?.getView(t) : null;
|
|
85
|
-
return s ?
|
|
85
|
+
return s ? me(s.state.doc, r, i, o) : he(e, r, i, o);
|
|
86
86
|
}
|
|
87
|
-
function
|
|
87
|
+
function qe(e, t, n, r, i) {
|
|
88
88
|
if (!e || e.size === 0) return;
|
|
89
89
|
let a = /* @__PURE__ */ new Map();
|
|
90
90
|
for (let [o, s] of e) {
|
|
91
|
-
let e =
|
|
91
|
+
let e = Ke(s, o, t, n, r, i);
|
|
92
92
|
e && a.set(o, e);
|
|
93
93
|
}
|
|
94
94
|
return a.size > 0 ? a : void 0;
|
|
95
95
|
}
|
|
96
|
-
function
|
|
96
|
+
function Je(e, t, n) {
|
|
97
97
|
let r = /* @__PURE__ */ new Map();
|
|
98
98
|
if (!n || !n.package.footnotes) return r;
|
|
99
99
|
let i = /* @__PURE__ */ new Map();
|
|
@@ -107,7 +107,7 @@ function qe(e, t, n) {
|
|
|
107
107
|
e.push({
|
|
108
108
|
displayNumber: String(o),
|
|
109
109
|
noteId: n,
|
|
110
|
-
text:
|
|
110
|
+
text: pe(r),
|
|
111
111
|
...a ? { content: {
|
|
112
112
|
blocks: a.blocks,
|
|
113
113
|
measures: a.measures,
|
|
@@ -119,7 +119,7 @@ function qe(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",
|
|
@@ -138,58 +138,58 @@ var M = /* @__PURE__ */ new Set([
|
|
|
138
138
|
"white",
|
|
139
139
|
"yellow"
|
|
140
140
|
]);
|
|
141
|
-
function
|
|
141
|
+
function Ye(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
|
});
|
|
147
147
|
};
|
|
148
148
|
return n(e, "doc"), t.join("; ");
|
|
149
149
|
}
|
|
150
|
-
function
|
|
150
|
+
function Xe() {
|
|
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
|
|
157
|
-
onChange: (e) =>
|
|
158
|
-
onKeyAction: (e) =>
|
|
159
|
-
}), tt =
|
|
153
|
+
function M(e) {
|
|
154
|
+
let { hiddenContainer: t, hiddenHeaderFooterContainer: n, noteEditorContainer: r, pagesContainer: a, readOnly: u = !1, pageGap: p = Be, showMarginGuides: pe, marginGuideColor: me, password: he, editorMode: y, author: b, externalPlugins: ke = [], collaboration: x, onAnonymizationMatchesChange: Ae, showTemplateDirectives: je, onSlashMenuChange: Me, onSlashMenuKeyAction: Ne, onChange: Pe, onError: S, onSelectionUpdate: C, onEditorViewReady: w, onCopy: Fe, onCut: T, onPaste: Ie, onReadOnlyEditAttempt: Le, featureFlags: Re, onSelectiveSaveTripwire: E } = e, D = n ?? t, O = s(null), ze = 0, k = s(null), A = s(null), j = s(null), M = s([]), N = s(null), P = s(null), F = s(null), I = s([]), L = s([]), R = o(!1), z = o(null), B = o(!1), V = new xe(Te());
|
|
155
|
+
V.buildSchema(), V.initializeRuntime();
|
|
156
|
+
let H = ee(!1), Ze = [H], Qe = h({ keymap: !0 }), $e = m({ onMatchesChange: (e) => Ae?.(e) }), U = g(), et = De({
|
|
157
|
+
onChange: (e) => Me?.(e),
|
|
158
|
+
onKeyAction: (e) => Ne?.(e) ?? !1
|
|
159
|
+
}), tt = Ee(), nt = () => c(je) === !0;
|
|
160
160
|
function rt() {
|
|
161
161
|
return [
|
|
162
162
|
Qe,
|
|
163
|
-
|
|
164
|
-
...
|
|
165
|
-
...c(
|
|
163
|
+
H,
|
|
164
|
+
...ke,
|
|
165
|
+
...c(x)?.plugins ?? [],
|
|
166
166
|
$e,
|
|
167
167
|
...nt() ? [U, et] : [],
|
|
168
168
|
tt
|
|
169
169
|
];
|
|
170
170
|
}
|
|
171
|
-
let W = ne(), G = new
|
|
171
|
+
let W = ne(), G = new ve(), it = de(), at = new _e({
|
|
172
172
|
pageGap: p,
|
|
173
173
|
showShadow: !0
|
|
174
174
|
}), K = re({
|
|
175
|
-
getHost: () =>
|
|
176
|
-
getDocument: () =>
|
|
177
|
-
getStyles: () =>
|
|
178
|
-
getTheme: () =>
|
|
175
|
+
getHost: () => D.value,
|
|
176
|
+
getDocument: () => O.value,
|
|
177
|
+
getStyles: () => O.value?.package.styles ?? null,
|
|
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
|
+
B.value = !0;
|
|
182
|
+
let e = k.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
|
+
N.value = {
|
|
188
188
|
from: r,
|
|
189
189
|
kind: t,
|
|
190
190
|
rId: e,
|
|
191
191
|
to: i
|
|
192
|
-
},
|
|
192
|
+
}, C?.(n.state), W.emit("selectionChange", {
|
|
193
193
|
from: r,
|
|
194
194
|
to: i
|
|
195
195
|
});
|
|
@@ -199,22 +199,22 @@ function N(e) {
|
|
|
199
199
|
}), ot = { current: null }, q = ie({
|
|
200
200
|
getHost: () => r?.value ?? null,
|
|
201
201
|
getPlugins: () => Ze,
|
|
202
|
-
getDocument: () =>
|
|
203
|
-
getStyles: () =>
|
|
204
|
-
getTheme: () =>
|
|
202
|
+
getDocument: () => O.value,
|
|
203
|
+
getStyles: () => O.value?.package.styles ?? null,
|
|
204
|
+
getTheme: () => O.value?.package.theme ?? null,
|
|
205
205
|
onTransaction: ({ docChanged: e, selectionChanged: t, view: n }) => {
|
|
206
206
|
if (e) {
|
|
207
|
-
|
|
208
|
-
let e =
|
|
207
|
+
B.value = !0;
|
|
208
|
+
let e = O.value;
|
|
209
209
|
if (e) {
|
|
210
210
|
let t = ot.current?.snapshotDocument(e) ?? e;
|
|
211
|
-
|
|
211
|
+
O.value = t, Pe?.(t), W.emit("docChange", t);
|
|
212
212
|
}
|
|
213
|
-
let t =
|
|
213
|
+
let t = k.value;
|
|
214
214
|
t && Y.schedule(t.state, null);
|
|
215
215
|
}
|
|
216
216
|
if (e || t) {
|
|
217
|
-
|
|
217
|
+
C?.(n.state);
|
|
218
218
|
let { from: e, to: t } = n.state.selection;
|
|
219
219
|
W.emit("selectionChange", {
|
|
220
220
|
from: e,
|
|
@@ -225,10 +225,10 @@ function N(e) {
|
|
|
225
225
|
});
|
|
226
226
|
ot.current = q;
|
|
227
227
|
function st(e) {
|
|
228
|
-
e.layout && (
|
|
228
|
+
e.layout && (F.value = e.layout), e.blocks && (I.value = e.blocks), e.measures && (L.value = e.measures), e.blockLookup && at.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 =
|
|
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 = Ge(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, ne = _ !== void 0 && "mirrorMargins" in _ && _.mirrorMargins === !0, v = Oe(i?.package);
|
|
232
232
|
try {
|
|
233
233
|
st(ce({
|
|
234
234
|
contentWidth: h,
|
|
@@ -236,8 +236,8 @@ function N(e) {
|
|
|
236
236
|
pageSize: l,
|
|
237
237
|
margins: u,
|
|
238
238
|
pageGap: p,
|
|
239
|
-
showMarginGuides: c(
|
|
240
|
-
marginGuideColor: c(
|
|
239
|
+
showMarginGuides: c(pe) === !0,
|
|
240
|
+
marginGuideColor: c(me),
|
|
241
241
|
syncCoordinator: G,
|
|
242
242
|
headerContent: v.headerContent,
|
|
243
243
|
footerContent: v.footerContent,
|
|
@@ -247,131 +247,131 @@ function N(e) {
|
|
|
247
247
|
footerContentRId: v.activeFooterRId,
|
|
248
248
|
firstPageHeaderContentRId: v.activeFirstHeaderRId,
|
|
249
249
|
firstPageFooterContentRId: v.activeFirstFooterRId,
|
|
250
|
-
sectionHeaderFooterRefs:
|
|
250
|
+
sectionHeaderFooterRefs: ge(i),
|
|
251
251
|
theme: ee,
|
|
252
252
|
sectionProperties: s,
|
|
253
253
|
document: i,
|
|
254
254
|
defaultTabStop: te,
|
|
255
255
|
mirrorMargins: ne,
|
|
256
256
|
styles: g,
|
|
257
|
-
layout:
|
|
257
|
+
layout: F.value,
|
|
258
258
|
hfPMs: K,
|
|
259
259
|
painter: at,
|
|
260
260
|
pagesContainer: r,
|
|
261
261
|
session: it,
|
|
262
|
-
renderHfFromContentOrPm:
|
|
263
|
-
renderHeaderFooterContentByRId:
|
|
264
|
-
documentFontsAreLoaded:
|
|
265
|
-
buildFootnoteRenderItems:
|
|
266
|
-
describeInvalidHighlightMarks:
|
|
267
|
-
emptyTemplatePreviewEntries:
|
|
262
|
+
renderHfFromContentOrPm: Ke,
|
|
263
|
+
renderHeaderFooterContentByRId: qe,
|
|
264
|
+
documentFontsAreLoaded: Xe,
|
|
265
|
+
buildFootnoteRenderItems: Je,
|
|
266
|
+
describeInvalidHighlightMarks: Ye,
|
|
267
|
+
emptyTemplatePreviewEntries: We
|
|
268
268
|
}, e, t));
|
|
269
269
|
} catch (e) {
|
|
270
270
|
let t = e instanceof Error ? e : Error(String(e));
|
|
271
|
-
|
|
271
|
+
S?.(t);
|
|
272
272
|
}
|
|
273
273
|
}
|
|
274
274
|
let Y = ue({
|
|
275
275
|
runLayout: (e, t) => J(e, t),
|
|
276
|
-
debounceMs:
|
|
277
|
-
maxDelayMs:
|
|
276
|
+
debounceMs: Ve,
|
|
277
|
+
maxDelayMs: He,
|
|
278
278
|
clock: le
|
|
279
279
|
}), X = null;
|
|
280
280
|
function ct() {
|
|
281
281
|
X !== null && (window.clearTimeout(X), X = null);
|
|
282
|
-
let e =
|
|
282
|
+
let e = k.value, t = O.value;
|
|
283
283
|
if (!(!e || !t)) try {
|
|
284
|
-
let n =
|
|
285
|
-
|
|
284
|
+
let n = be(e.state.doc, t);
|
|
285
|
+
O.value = n, K.sync(), q.sync(), Pe?.(n), W.emit("docChange", n);
|
|
286
286
|
} catch (e) {
|
|
287
|
-
|
|
287
|
+
S?.(e instanceof Error ? e : Error(String(e)));
|
|
288
288
|
}
|
|
289
289
|
}
|
|
290
290
|
function lt() {
|
|
291
291
|
X !== null && window.clearTimeout(X), X = window.setTimeout(() => {
|
|
292
292
|
X = null, ct();
|
|
293
|
-
},
|
|
293
|
+
}, Ue);
|
|
294
294
|
}
|
|
295
295
|
let Z = oe({
|
|
296
296
|
getHost: () => t.value,
|
|
297
|
-
getDocument: () =>
|
|
298
|
-
getStyles: () =>
|
|
299
|
-
getExtensionManager: () =>
|
|
297
|
+
getDocument: () => O.value,
|
|
298
|
+
getStyles: () => O.value?.package.styles ?? null,
|
|
299
|
+
getExtensionManager: () => V,
|
|
300
300
|
getExternalPlugins: rt,
|
|
301
|
-
getCollaboration: () => c(
|
|
302
|
-
getCollaborationModules: () =>
|
|
301
|
+
getCollaboration: () => c(x),
|
|
302
|
+
getCollaborationModules: () => j.value,
|
|
303
303
|
getPrecomputedInitialState: () => null,
|
|
304
304
|
getReadOnly: () => c(u),
|
|
305
|
-
|
|
306
|
-
getDocumentContext: () =>
|
|
305
|
+
getDocumentIdentity: () => String(ze),
|
|
306
|
+
getDocumentContext: () => O.value,
|
|
307
307
|
onTransaction: ut,
|
|
308
308
|
onSelectionChange: (e) => {
|
|
309
|
-
|
|
309
|
+
A.value = e, C?.(e), W.emit("selectionChange", {
|
|
310
310
|
from: e.selection.from,
|
|
311
311
|
to: e.selection.to
|
|
312
312
|
});
|
|
313
313
|
},
|
|
314
314
|
onKeyDown: () => !1,
|
|
315
|
-
onCopy: () =>
|
|
316
|
-
onCut: () =>
|
|
315
|
+
onCopy: () => Fe?.(),
|
|
316
|
+
onCut: () => T?.(),
|
|
317
317
|
onPaste: () => Ie?.(),
|
|
318
318
|
onReadOnlyEditAttempt: () => Le?.(),
|
|
319
319
|
onEditorViewReady: dt,
|
|
320
320
|
onEditorViewDestroy: () => {
|
|
321
|
-
|
|
321
|
+
k.value = null, R.value = !1, w?.(null);
|
|
322
322
|
},
|
|
323
323
|
onRemoteSelectionsChange: (e) => {
|
|
324
|
-
|
|
324
|
+
M.value = e;
|
|
325
325
|
}
|
|
326
326
|
}), Q = () => {
|
|
327
|
-
let e = c(
|
|
328
|
-
|
|
327
|
+
let e = c(x)?.awareness, t = j.value, n = Z.getView();
|
|
328
|
+
M.value = e && t && n ? ae(n.state, e, t) : [];
|
|
329
329
|
};
|
|
330
|
-
l(() => c(
|
|
331
|
-
if (
|
|
332
|
-
|
|
330
|
+
l(() => c(x), (e, t, n) => {
|
|
331
|
+
if (M.value = [], !e) {
|
|
332
|
+
j.value = null, Z.retryViewCreation(), Z.syncExternalDocument();
|
|
333
333
|
return;
|
|
334
334
|
}
|
|
335
335
|
let r = !1;
|
|
336
336
|
n(() => {
|
|
337
337
|
r = !0;
|
|
338
|
-
}),
|
|
339
|
-
r || (
|
|
338
|
+
}), j.value = null, v().then((e) => {
|
|
339
|
+
r || (j.value = e, Z.retryViewCreation(), Z.syncExternalDocument(), Q());
|
|
340
340
|
}, (e) => {
|
|
341
|
-
r || (
|
|
341
|
+
r || (j.value = null, S?.(e instanceof Error ? e : Error(String(e))));
|
|
342
342
|
});
|
|
343
343
|
}, { immediate: !0 }), l(() => ({
|
|
344
|
-
awareness: c(
|
|
345
|
-
modules:
|
|
346
|
-
view:
|
|
344
|
+
awareness: c(x)?.awareness,
|
|
345
|
+
modules: j.value,
|
|
346
|
+
view: k.value
|
|
347
347
|
}), ({ awareness: e, modules: t, view: n }, r, i) => {
|
|
348
348
|
if (!e || !t || !n) {
|
|
349
|
-
|
|
349
|
+
M.value = [];
|
|
350
350
|
return;
|
|
351
351
|
}
|
|
352
352
|
e.on("change", Q), Q(), i(() => {
|
|
353
|
-
e.off("change", Q),
|
|
353
|
+
e.off("change", Q), M.value = [];
|
|
354
354
|
});
|
|
355
355
|
}, { flush: "post" });
|
|
356
356
|
function ut(e, t) {
|
|
357
|
-
|
|
357
|
+
A.value = t, e.docChanged && (B.value = !0, G.incrementStateSeq(), Y.schedule(t, ye(e)), lt()), G.requestRender();
|
|
358
358
|
}
|
|
359
359
|
function dt(e) {
|
|
360
|
-
|
|
361
|
-
|
|
360
|
+
k.value = e, A.value = e.state, R.value = !0, J(e.state, { reason: "initial" }), G.requestRender(), $(e), w?.(e), c(u) || requestAnimationFrame(() => {
|
|
361
|
+
k.value === e && e.focus();
|
|
362
362
|
});
|
|
363
363
|
}
|
|
364
364
|
let ft = _({
|
|
365
365
|
getEditorApi: () => Z.api,
|
|
366
|
-
getLayout: () =>
|
|
366
|
+
getLayout: () => F.value,
|
|
367
367
|
runLayout: (e, t) => J(e, t),
|
|
368
368
|
emitter: W
|
|
369
369
|
});
|
|
370
370
|
function $(e) {
|
|
371
|
-
te(c(
|
|
371
|
+
te(c(y) === "suggesting", e.state, e.dispatch, c(b));
|
|
372
372
|
}
|
|
373
|
-
l([() => c(
|
|
374
|
-
let e =
|
|
373
|
+
l([() => c(y), () => c(b)], () => {
|
|
374
|
+
let e = k.value;
|
|
375
375
|
e && $(e);
|
|
376
376
|
for (let e of q.listStories()) {
|
|
377
377
|
let t = q.getView(e);
|
|
@@ -391,62 +391,62 @@ function N(e) {
|
|
|
391
391
|
e.updateState(e.state.reconfigure({ plugins: n }));
|
|
392
392
|
}
|
|
393
393
|
l(() => nt(), () => {
|
|
394
|
-
let e =
|
|
394
|
+
let e = k.value;
|
|
395
395
|
e && pt(e);
|
|
396
396
|
});
|
|
397
397
|
function mt() {
|
|
398
398
|
Z.ensureView();
|
|
399
399
|
}
|
|
400
400
|
function ht() {
|
|
401
|
-
|
|
401
|
+
ze += 1, B.value = !1, N.value = null, P.value = null, q.activate(null), Y.dispose(), Z.destroyView(), K.sync(), q.sync(), Z.ensureView(), Z.getView() || gt();
|
|
402
402
|
}
|
|
403
403
|
function gt() {
|
|
404
|
-
let e =
|
|
405
|
-
if (!(!e || c(
|
|
404
|
+
let e = O.value;
|
|
405
|
+
if (!(!e || c(x))) try {
|
|
406
406
|
let t = se({
|
|
407
407
|
document: e,
|
|
408
408
|
styles: e.package.styles ?? null,
|
|
409
|
-
manager:
|
|
409
|
+
manager: V,
|
|
410
410
|
externalPlugins: rt(),
|
|
411
411
|
collaborationModules: null,
|
|
412
412
|
reason: "mount"
|
|
413
413
|
});
|
|
414
|
-
|
|
414
|
+
A.value = t, J(t, { reason: "initial" });
|
|
415
415
|
} catch (e) {
|
|
416
|
-
|
|
416
|
+
S?.(e instanceof Error ? e : Error(String(e)));
|
|
417
417
|
}
|
|
418
418
|
}
|
|
419
419
|
l([
|
|
420
420
|
t,
|
|
421
421
|
a,
|
|
422
|
-
|
|
422
|
+
D,
|
|
423
423
|
...r ? [r] : []
|
|
424
424
|
], () => {
|
|
425
|
-
t.value &&
|
|
425
|
+
t.value && O.value && !Z.getView() && mt(), K.sync(), q.sync();
|
|
426
426
|
}, { flush: "post" });
|
|
427
427
|
async function _t(e) {
|
|
428
|
-
|
|
428
|
+
z.value = null, R.value = !1;
|
|
429
429
|
try {
|
|
430
|
-
let t = await fe(e, { password: c(
|
|
431
|
-
|
|
430
|
+
let t = await fe(e, { password: c(he) });
|
|
431
|
+
O.value = t, ht();
|
|
432
432
|
} catch (e) {
|
|
433
433
|
let t = e instanceof Error ? e : Error(String(e));
|
|
434
|
-
|
|
434
|
+
z.value = t.message, S?.(t);
|
|
435
435
|
}
|
|
436
436
|
}
|
|
437
437
|
function vt(e) {
|
|
438
|
-
|
|
438
|
+
z.value = null, O.value = e, ht();
|
|
439
439
|
}
|
|
440
440
|
async function yt(e) {
|
|
441
|
-
let t =
|
|
441
|
+
let t = k.value, n = O.value;
|
|
442
442
|
if (!t || !n) return null;
|
|
443
|
-
let r = q.snapshotDocument(K.snapshotDocument(n)), i = t.state, { resolveSelectiveSaveFlags: a } = await import("@stll/folio-core/docx/selectiveSaveFlags"), o = a(c(Re)), s =
|
|
443
|
+
let r = q.snapshotDocument(K.snapshotDocument(n)), i = t.state, { resolveSelectiveSaveFlags: a } = await import("@stll/folio-core/docx/selectiveSaveFlags"), o = a(c(Re)), s = be(i.doc, r), l = s.originalBuffer ?? null, u = o.selectiveSave && e?.selective !== !1, d = u || o.selectiveSaveTripwire, { repackDocx: f, createDocx: p } = await import("@stll/folio-core/docx/rezip"), m = null;
|
|
444
444
|
if (d && l) {
|
|
445
445
|
let { attemptSelectiveSave: e } = await import("@stll/folio-core/docx/selectiveSave");
|
|
446
446
|
m = await e(s, l, {
|
|
447
|
-
changedParaIds:
|
|
448
|
-
structuralChange:
|
|
449
|
-
hasUntrackedChanges:
|
|
447
|
+
changedParaIds: Se(i),
|
|
448
|
+
structuralChange: Ce(i),
|
|
449
|
+
hasUntrackedChanges: we(i),
|
|
450
450
|
maxBytes: o.selectiveSaveMaxBytes
|
|
451
451
|
});
|
|
452
452
|
}
|
|
@@ -455,18 +455,18 @@ function N(e) {
|
|
|
455
455
|
else if (o.selectiveSaveTripwire) try {
|
|
456
456
|
g = await f(s);
|
|
457
457
|
} catch {}
|
|
458
|
-
if (o.selectiveSaveTripwire && g &&
|
|
458
|
+
if (o.selectiveSaveTripwire && g && E) try {
|
|
459
459
|
let { compareSelectiveVsFull: e } = await import("@stll/folio-core/docx/selectiveSaveTripwire");
|
|
460
|
-
|
|
460
|
+
E(await e(m, g));
|
|
461
461
|
} catch {}
|
|
462
|
-
return
|
|
462
|
+
return O.value = s, K.sync(), q.sync(), B.value = !1, new Blob([h], { type: "application/vnd.openxmlformats-officedocument.wordprocessingml.document" });
|
|
463
463
|
}
|
|
464
464
|
function bt() {
|
|
465
|
-
let e =
|
|
465
|
+
let e = O.value;
|
|
466
466
|
return e ? q.snapshotDocument(K.snapshotDocument(e)) : null;
|
|
467
467
|
}
|
|
468
468
|
function xt(e) {
|
|
469
|
-
|
|
469
|
+
O.value = e, K.sync(), q.sync(), P.value && !q.getView(P.value) && (P.value = null);
|
|
470
470
|
}
|
|
471
471
|
function St(e) {
|
|
472
472
|
return K.getView(e);
|
|
@@ -476,43 +476,43 @@ function N(e) {
|
|
|
476
476
|
}
|
|
477
477
|
function wt(e) {
|
|
478
478
|
let t = q.activate(e);
|
|
479
|
-
t && ($(t),
|
|
479
|
+
t && ($(t), P.value = e, requestAnimationFrame(() => t.focus()));
|
|
480
480
|
}
|
|
481
481
|
function Tt() {
|
|
482
|
-
q.activate(null),
|
|
482
|
+
q.activate(null), P.value = null;
|
|
483
483
|
}
|
|
484
484
|
function Et() {
|
|
485
|
-
let e =
|
|
485
|
+
let e = P.value;
|
|
486
486
|
return e ? q.getView(e) : null;
|
|
487
487
|
}
|
|
488
488
|
function Dt() {
|
|
489
|
-
return
|
|
489
|
+
return V.getCommands();
|
|
490
490
|
}
|
|
491
491
|
function Ot() {
|
|
492
492
|
let e = Et();
|
|
493
|
-
e ? e.focus() :
|
|
493
|
+
e ? e.focus() : k.value?.focus();
|
|
494
494
|
}
|
|
495
495
|
function kt() {
|
|
496
|
-
let e =
|
|
496
|
+
let e = k.value;
|
|
497
497
|
e && J(e.state, { reason: "manual" });
|
|
498
498
|
}
|
|
499
|
-
l([() => c(
|
|
499
|
+
l([() => c(pe), () => c(me)], () => kt());
|
|
500
500
|
function At() {
|
|
501
|
-
Y.dispose(), X !== null && (window.clearTimeout(X), X = null), Z.destroyView(),
|
|
501
|
+
Y.dispose(), X !== null && (window.clearTimeout(X), X = null), Z.destroyView(), M.value = [], K.destroy(), q.destroy(), V.destroy(), A.value = null, F.value = null, O.value = null, R.value = !1;
|
|
502
502
|
}
|
|
503
503
|
return i(At), {
|
|
504
504
|
editor: ft,
|
|
505
|
-
editorView:
|
|
506
|
-
editorState:
|
|
507
|
-
remoteSelections:
|
|
508
|
-
headerFooterSelection:
|
|
509
|
-
activeNoteStory:
|
|
510
|
-
isReady:
|
|
511
|
-
isDirty:
|
|
512
|
-
parseError:
|
|
513
|
-
layout:
|
|
514
|
-
blocks:
|
|
515
|
-
measures:
|
|
505
|
+
editorView: k,
|
|
506
|
+
editorState: A,
|
|
507
|
+
remoteSelections: M,
|
|
508
|
+
headerFooterSelection: N,
|
|
509
|
+
activeNoteStory: P,
|
|
510
|
+
isReady: R,
|
|
511
|
+
isDirty: B,
|
|
512
|
+
parseError: z,
|
|
513
|
+
layout: F,
|
|
514
|
+
blocks: I,
|
|
515
|
+
measures: L,
|
|
516
516
|
syncCoordinator: G,
|
|
517
517
|
loadBuffer: _t,
|
|
518
518
|
loadDocument: vt,
|
|
@@ -530,7 +530,7 @@ function N(e) {
|
|
|
530
530
|
destroy: At
|
|
531
531
|
};
|
|
532
532
|
}
|
|
533
|
-
function
|
|
533
|
+
function N(e, t) {
|
|
534
534
|
if (t < e.top + 40) {
|
|
535
535
|
let n = Math.max(0, e.top + 40 - t);
|
|
536
536
|
return -Math.min(12, n / 40 * 12);
|
|
@@ -543,12 +543,12 @@ function P(e, t) {
|
|
|
543
543
|
}
|
|
544
544
|
//#endregion
|
|
545
545
|
//#region src/composables/useDragAutoScroll.ts
|
|
546
|
-
function
|
|
546
|
+
function P({ pagesContainer: e, onScrollExtendSelection: t }) {
|
|
547
547
|
let n = null, r = 0, a = 0, o = !1, s = null;
|
|
548
548
|
function c() {
|
|
549
549
|
if (s) return s;
|
|
550
550
|
let t = e.value;
|
|
551
|
-
return t ? (s =
|
|
551
|
+
return t ? (s = y(t), s) : null;
|
|
552
552
|
}
|
|
553
553
|
function l() {
|
|
554
554
|
o = !1, n !== null && (cancelAnimationFrame(n), n = null);
|
|
@@ -557,7 +557,7 @@ function F({ pagesContainer: e, onScrollExtendSelection: t }) {
|
|
|
557
557
|
if (!o) return;
|
|
558
558
|
let e = c();
|
|
559
559
|
if (!e) return;
|
|
560
|
-
let i =
|
|
560
|
+
let i = N(e.getBoundingClientRect(), a);
|
|
561
561
|
i !== 0 && (e.scrollTop += i, t(r, a)), n = requestAnimationFrame(u);
|
|
562
562
|
}
|
|
563
563
|
function d() {
|
|
@@ -578,7 +578,7 @@ function F({ pagesContainer: e, onScrollExtendSelection: t }) {
|
|
|
578
578
|
}
|
|
579
579
|
//#endregion
|
|
580
580
|
//#region src/composables/useTableResize.ts
|
|
581
|
-
function
|
|
581
|
+
function F() {
|
|
582
582
|
let e = {
|
|
583
583
|
active: !1,
|
|
584
584
|
startX: 0,
|
|
@@ -610,15 +610,15 @@ function I() {
|
|
|
610
610
|
}
|
|
611
611
|
function a(i, a) {
|
|
612
612
|
let o = i.target;
|
|
613
|
-
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),
|
|
613
|
+
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;
|
|
614
614
|
}
|
|
615
615
|
function o(r) {
|
|
616
616
|
if (e.active && e.handle) {
|
|
617
617
|
r.preventDefault();
|
|
618
618
|
let t = r.clientX - e.startX, n = parseFloat(e.handle.style.left);
|
|
619
619
|
e.handle.style.left = `${n + t}px`, e.startX = r.clientX;
|
|
620
|
-
let i = Math.round(t *
|
|
621
|
-
a >=
|
|
620
|
+
let i = Math.round(t * x), a = e.origWidths.left + i, o = e.origWidths.right - i;
|
|
621
|
+
a >= b && o >= b && (e.origWidths = {
|
|
622
622
|
left: a,
|
|
623
623
|
right: o
|
|
624
624
|
});
|
|
@@ -628,21 +628,21 @@ function I() {
|
|
|
628
628
|
r.preventDefault();
|
|
629
629
|
let e = r.clientY - t.startY, n = parseFloat(t.handle.style.top);
|
|
630
630
|
t.handle.style.top = `${n + e}px`, t.startY = r.clientY;
|
|
631
|
-
let i = Math.round(e *
|
|
632
|
-
a >=
|
|
631
|
+
let i = Math.round(e * x), a = t.origHeight + i;
|
|
632
|
+
a >= ke && (t.origHeight = a);
|
|
633
633
|
return;
|
|
634
634
|
}
|
|
635
635
|
if (n.active && n.handle) {
|
|
636
636
|
r.preventDefault();
|
|
637
637
|
let e = r.clientX - n.startX, t = parseFloat(n.handle.style.left);
|
|
638
638
|
n.handle.style.left = `${t + e}px`, n.startX = r.clientX;
|
|
639
|
-
let i = Math.round(e *
|
|
640
|
-
a >=
|
|
639
|
+
let i = Math.round(e * x), a = n.origWidth + i;
|
|
640
|
+
a >= b && (n.origWidth = a);
|
|
641
641
|
}
|
|
642
642
|
}
|
|
643
643
|
function s(i) {
|
|
644
644
|
if (e.active) {
|
|
645
|
-
e.active = !1, e.handle?.classList.remove("dragging"), r &&
|
|
645
|
+
e.active = !1, e.handle?.classList.remove("dragging"), r && Ae(r, {
|
|
646
646
|
pmStart: e.tablePmStart,
|
|
647
647
|
colIdx: e.columnIndex,
|
|
648
648
|
newLeft: e.origWidths.left,
|
|
@@ -651,14 +651,14 @@ function I() {
|
|
|
651
651
|
return;
|
|
652
652
|
}
|
|
653
653
|
if (t.active) {
|
|
654
|
-
t.active = !1, t.handle?.classList.remove("dragging"), r &&
|
|
654
|
+
t.active = !1, t.handle?.classList.remove("dragging"), r && Me(r, {
|
|
655
655
|
pmStart: t.tablePmStart,
|
|
656
656
|
rowIdx: t.rowIndex,
|
|
657
657
|
newHeight: t.origHeight
|
|
658
658
|
}), t.handle = null;
|
|
659
659
|
return;
|
|
660
660
|
}
|
|
661
|
-
n.active && (n.active = !1, n.handle?.classList.remove("dragging"), r &&
|
|
661
|
+
n.active && (n.active = !1, n.handle?.classList.remove("dragging"), r && je(r, {
|
|
662
662
|
pmStart: n.tablePmStart,
|
|
663
663
|
colIdx: n.columnIndex,
|
|
664
664
|
newWidth: n.origWidth
|
|
@@ -675,31 +675,31 @@ function I() {
|
|
|
675
675
|
isResizing: i
|
|
676
676
|
};
|
|
677
677
|
}
|
|
678
|
-
function
|
|
679
|
-
let n =
|
|
678
|
+
function I(e, t) {
|
|
679
|
+
let n = Pe(e, t.tablePmStart, t.columnIndex);
|
|
680
680
|
n && (t.origWidths = n);
|
|
681
681
|
}
|
|
682
|
-
function
|
|
683
|
-
let r =
|
|
682
|
+
function L(e, t, n) {
|
|
683
|
+
let r = S(e, t.tablePmStart, t.rowIndex);
|
|
684
684
|
if (r != null) {
|
|
685
685
|
t.origHeight = r;
|
|
686
686
|
return;
|
|
687
687
|
}
|
|
688
688
|
let i = n.closest(".layout-table")?.querySelector(`[data-row-index="${t.rowIndex}"]`), a = i ? i.getBoundingClientRect().height : 30;
|
|
689
|
-
t.origHeight = Math.round(a *
|
|
689
|
+
t.origHeight = Math.round(a * x);
|
|
690
690
|
}
|
|
691
|
-
function
|
|
692
|
-
let n =
|
|
691
|
+
function R(e, t) {
|
|
692
|
+
let n = Ne(e, t.tablePmStart, t.columnIndex);
|
|
693
693
|
n != null && (t.origWidth = n);
|
|
694
694
|
}
|
|
695
695
|
//#endregion
|
|
696
696
|
//#region src/composables/useTrackedChanges.ts
|
|
697
|
-
function
|
|
698
|
-
return e(() => (n.value,
|
|
697
|
+
function z(t, n) {
|
|
698
|
+
return e(() => (n.value, C(t.value?.state ?? null)));
|
|
699
699
|
}
|
|
700
700
|
//#endregion
|
|
701
701
|
//#region src/composables/useZoom.ts
|
|
702
|
-
var
|
|
702
|
+
var B = Fe, V = w, H = [
|
|
703
703
|
.5,
|
|
704
704
|
.75,
|
|
705
705
|
1,
|
|
@@ -708,15 +708,15 @@ var V = Pe, H = T, Xe = [
|
|
|
708
708
|
2
|
|
709
709
|
];
|
|
710
710
|
function Ze(t = 1) {
|
|
711
|
-
let i = o(Math.max(
|
|
711
|
+
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);
|
|
712
712
|
function l(e) {
|
|
713
|
-
i.value = Math.max(
|
|
713
|
+
i.value = Math.max(B, Math.min(V, Math.round(e * 100) / 100));
|
|
714
714
|
}
|
|
715
715
|
function u() {
|
|
716
|
-
l(i.value +
|
|
716
|
+
l(i.value + T);
|
|
717
717
|
}
|
|
718
718
|
function d() {
|
|
719
|
-
l(i.value -
|
|
719
|
+
l(i.value - T);
|
|
720
720
|
}
|
|
721
721
|
function f() {
|
|
722
722
|
l(1);
|
|
@@ -742,8 +742,8 @@ function Ze(t = 1) {
|
|
|
742
742
|
handleWheel: p,
|
|
743
743
|
handleKeyDown: m,
|
|
744
744
|
installShortcuts: h,
|
|
745
|
-
ZOOM_PRESETS:
|
|
745
|
+
ZOOM_PRESETS: H
|
|
746
746
|
};
|
|
747
747
|
}
|
|
748
748
|
//#endregion
|
|
749
|
-
export {
|
|
749
|
+
export { P as a, D as c, F as i, ze as l, C as n, M as o, z as r, k as s, Ze as t, A as u };
|