@stll/folio-vue 0.26.6 → 0.27.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/DocxEditorMenuBar.vue.d.ts +7 -5
- package/dist/components/DocxEditor.vue.d.ts +13 -11
- package/dist/components/EditorToolbar.vue.d.ts +13 -11
- package/dist/components/TitleBar.vue.d.ts +9 -7
- package/dist/components/Toolbar.vue.d.ts +7 -5
- package/dist/components/ui/Button.vue.d.ts +5 -3
- package/dist/components/ui/Dialog.vue.d.ts +5 -3
- package/dist/components/ui/MenuDropdown.vue.d.ts +8 -6
- package/dist/components/ui/Popover.vue.d.ts +10 -8
- package/dist/composables/useDocxEditor.d.ts +2 -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.js +3 -2
- package/dist/{useZoom-C_7cmUyk.js → useZoom-7DkhQcMl.js} +311 -308
- package/dist/useZoom-ChRQsGBq.cjs +1 -0
- package/package.json +4 -4
- package/dist/useZoom-Bwnae1jX.cjs +0 -1
|
@@ -37,46 +37,46 @@ import { templateSlashMenuPlugin as Ve } from "@stll/folio-core/prosemirror/plug
|
|
|
37
37
|
import { resolveHeaderFooterContent as He } from "@stll/folio-core/utils/headerFooter";
|
|
38
38
|
import { FindReplaceManager as Ue } from "@stll/folio-core/managers/FindReplaceManager";
|
|
39
39
|
import { findInDisplayedDocument as We, resolveFindMatchRange as Ge } from "@stll/folio-core/prosemirror/findReplaceSelection";
|
|
40
|
-
import { createFindMatchView as Ke, getRenderedSearchStories as
|
|
41
|
-
import { createDefaultFindOptions as
|
|
40
|
+
import { createFindMatchView as Ke, getRenderedSearchStories as qe } from "@stll/folio-core/utils/findMatchView";
|
|
41
|
+
import { createDefaultFindOptions as E, replaceEligibility as Je } from "@stll/folio-core/utils/findReplace";
|
|
42
42
|
import { createFindSearchKey as Ye, sameFindSearchKey as Xe } from "@stll/folio-core/utils/findSearchKey";
|
|
43
|
-
import { MIN_CELL_WIDTH_TWIPS as Ze, MIN_ROW_HEIGHT_TWIPS as
|
|
44
|
-
import { extractTrackedChanges as
|
|
45
|
-
import { ZOOM_MAX as
|
|
43
|
+
import { MIN_CELL_WIDTH_TWIPS as Ze, MIN_ROW_HEIGHT_TWIPS as Qe, TWIPS_PER_PIXEL as D, clampRowResizeDelta as $e, commitColumnResize as et, commitRightEdgeResize as tt, commitRowResize as nt, readColumnWidthAt as rt, readColumnWidths as it, readRowHeight as at } from "@stll/folio-core/prosemirror/tableResize";
|
|
44
|
+
import { extractTrackedChanges as ot } from "@stll/folio-core/prosemirror/utils/extractTrackedChanges";
|
|
45
|
+
import { ZOOM_MAX as st, ZOOM_MIN as ct, ZOOM_STEP as O } from "@stll/folio-core/utils/zoom";
|
|
46
46
|
// src/utils/colorMode.ts
|
|
47
|
-
var
|
|
48
|
-
function
|
|
47
|
+
var k = "(prefers-color-scheme: dark)";
|
|
48
|
+
function lt() {
|
|
49
49
|
return typeof window < "u" && typeof window.matchMedia == "function";
|
|
50
50
|
}
|
|
51
|
-
function
|
|
51
|
+
function A(e, t) {
|
|
52
52
|
return e === "dark" || e === "system" && t;
|
|
53
53
|
}
|
|
54
|
-
function
|
|
55
|
-
if (!
|
|
56
|
-
let t = window.matchMedia(
|
|
54
|
+
function j(e) {
|
|
55
|
+
if (!lt()) return () => {};
|
|
56
|
+
let t = window.matchMedia(k);
|
|
57
57
|
e(t.matches);
|
|
58
58
|
let n = (t) => e(t.matches);
|
|
59
59
|
return t.addEventListener("change", n), () => t.removeEventListener("change", n);
|
|
60
60
|
}
|
|
61
61
|
// src/composables/useColorMode.ts
|
|
62
|
-
var
|
|
63
|
-
a(
|
|
64
|
-
},
|
|
65
|
-
t.provide(
|
|
62
|
+
var M = "light", N = Symbol("folioColorMode"), P = (t = M) => {
|
|
63
|
+
a(N, e(() => l(t)));
|
|
64
|
+
}, F = { install(t, n = M) {
|
|
65
|
+
t.provide(N, e(() => l(n)));
|
|
66
66
|
} };
|
|
67
|
-
function
|
|
68
|
-
let n = t(
|
|
67
|
+
function ut() {
|
|
68
|
+
let n = t(N, e(() => M)), i = s(!1), a = s(!1);
|
|
69
69
|
return r(() => {
|
|
70
70
|
i.value = !0;
|
|
71
71
|
}), d((e) => {
|
|
72
|
-
i.value && n.value === "system" && e(
|
|
72
|
+
i.value && n.value === "system" && e(j((e) => {
|
|
73
73
|
a.value = e;
|
|
74
74
|
}));
|
|
75
|
-
}), e(() =>
|
|
75
|
+
}), e(() => A(n.value, i.value && a.value));
|
|
76
76
|
}
|
|
77
77
|
// src/composables/useDocxEditor.ts
|
|
78
|
-
var
|
|
79
|
-
function
|
|
78
|
+
var dt = 24, ft = "User", pt = 250, mt = [], ht = [];
|
|
79
|
+
function gt(e) {
|
|
80
80
|
let t = e?.columnCount ?? 1;
|
|
81
81
|
if (t <= 1) return;
|
|
82
82
|
let n = {
|
|
@@ -86,7 +86,7 @@ function mt(e) {
|
|
|
86
86
|
};
|
|
87
87
|
return e?.separator !== void 0 && (n.separator = e.separator), n;
|
|
88
88
|
}
|
|
89
|
-
function
|
|
89
|
+
function _t(e, t, n, r, i, a) {
|
|
90
90
|
if (!e) return;
|
|
91
91
|
let o = t ? {
|
|
92
92
|
...a,
|
|
@@ -94,16 +94,16 @@ function ht(e, t, n, r, i, a) {
|
|
|
94
94
|
} : a, s = t ? n?.getView(t) : null;
|
|
95
95
|
return s ? Se(s.state.doc, r, i, o) : Ce(e, r, i, o);
|
|
96
96
|
}
|
|
97
|
-
function
|
|
97
|
+
function vt(e, t, n, r, i) {
|
|
98
98
|
if (!e || e.size === 0) return;
|
|
99
99
|
let a = /* @__PURE__ */ new Map();
|
|
100
100
|
for (let [o, s] of e) {
|
|
101
|
-
let e =
|
|
101
|
+
let e = _t(s, o, t, n, r, i);
|
|
102
102
|
e && a.set(o, e);
|
|
103
103
|
}
|
|
104
104
|
return a.size > 0 ? a : void 0;
|
|
105
105
|
}
|
|
106
|
-
function
|
|
106
|
+
function yt(e, t, n) {
|
|
107
107
|
let r = /* @__PURE__ */ new Map();
|
|
108
108
|
if (!n || !n.package.footnotes) return r;
|
|
109
109
|
let i = /* @__PURE__ */ new Map();
|
|
@@ -129,7 +129,7 @@ function _t(e, t, n) {
|
|
|
129
129
|
}
|
|
130
130
|
return r;
|
|
131
131
|
}
|
|
132
|
-
var
|
|
132
|
+
var I = /* @__PURE__ */ new Set([
|
|
133
133
|
"black",
|
|
134
134
|
"blue",
|
|
135
135
|
"cyan",
|
|
@@ -148,146 +148,146 @@ var R = /* @__PURE__ */ new Set([
|
|
|
148
148
|
"white",
|
|
149
149
|
"yellow"
|
|
150
150
|
]);
|
|
151
|
-
function
|
|
151
|
+
function bt(e) {
|
|
152
152
|
let t = [], n = (e, r) => {
|
|
153
|
-
for (let [n, i] of e.marks.entries()) i.type.name === "highlight" && !
|
|
153
|
+
for (let [n, i] of e.marks.entries()) i.type.name === "highlight" && !I.has(String(i.attrs.color)) && t.push(`${r}.marks[${n}]=${JSON.stringify(i.attrs)}`);
|
|
154
154
|
e.forEach((e, t, i) => {
|
|
155
155
|
n(e, `${r}.content[${i}]`);
|
|
156
156
|
});
|
|
157
157
|
};
|
|
158
158
|
return n(e, "doc"), t.join("; ");
|
|
159
159
|
}
|
|
160
|
-
function
|
|
161
|
-
let { hiddenContainer: t, hiddenHeaderFooterContainer: n, noteEditorContainer: r, pagesContainer: a, readOnly: o = !1, experimentalSession: d, pageGap: ee =
|
|
162
|
-
if (!
|
|
160
|
+
function L(e) {
|
|
161
|
+
let { hiddenContainer: t, hiddenHeaderFooterContainer: n, noteEditorContainer: r, pagesContainer: a, readOnly: o = !1, experimentalSession: d, pageGap: ee = dt, pageRenderer: _, markupView: v = "all-markup", showCommentHighlights: b = !0, altChunkMarkerText: xe, showMarginGuides: Se, marginGuideColor: Ce, password: Ue, editorMode: We, author: Ge, externalPlugins: Ke = [], historyShortcuts: qe = "editor", collaboration: E, onAnonymizationMatchesChange: Je, showTemplateDirectives: Ye, onSlashMenuChange: Xe, onSlashMenuKeyAction: Ze, onChange: Qe, onError: D, onSelectionUpdate: $e, onEditorViewReady: et, onCopy: tt, onCut: nt, onPaste: rt, onReadOnlyEditAttempt: it, featureFlags: at, onSelectiveSaveTripwire: ot } = e, st = n ?? t, ct = () => l(Ge) ?? ft, O = c(null), k = 0, lt = !1, A = 0, j = !1, M = c(null), N = c(null), P = c(null), F = c([]), ut = c(null), I = c(null), L = c(null), xt = c([]), St = c([]), R = s(!1), z = s(null), B = s(!1), V = () => re(l(d), x.authorityRouting), H = (e) => V() ? g(e) : e, Ct = (e, t) => {
|
|
162
|
+
if (!V()) return !1;
|
|
163
163
|
let n = new f({
|
|
164
164
|
gap: e,
|
|
165
165
|
message: ne(e, t)
|
|
166
166
|
});
|
|
167
167
|
return D?.(n), !0;
|
|
168
|
-
},
|
|
169
|
-
|
|
170
|
-
let
|
|
171
|
-
onChange: (e) =>
|
|
172
|
-
onKeyAction: (e) =>
|
|
173
|
-
}),
|
|
174
|
-
function
|
|
168
|
+
}, U = new ke(Pe({ historyShortcuts: qe }));
|
|
169
|
+
U.buildSchema(), U.initializeRuntime();
|
|
170
|
+
let wt = ie(!1), Tt = [wt], Et = Re({ keymap: !0 }), Dt = Le({ onMatchesChange: (e) => Je?.(e) }), Ot = ze(), kt = Ve({
|
|
171
|
+
onChange: (e) => Xe?.(e),
|
|
172
|
+
onKeyAction: (e) => Ze?.(e) ?? !1
|
|
173
|
+
}), At = Be(), jt = () => l(Ye) === !0;
|
|
174
|
+
function Mt() {
|
|
175
175
|
return [
|
|
176
|
+
Et,
|
|
176
177
|
wt,
|
|
177
|
-
|
|
178
|
-
...Ge,
|
|
178
|
+
...Ke,
|
|
179
179
|
...l(E)?.plugins ?? [],
|
|
180
|
-
|
|
181
|
-
...
|
|
182
|
-
|
|
180
|
+
Dt,
|
|
181
|
+
...jt() ? [Ot, kt] : [],
|
|
182
|
+
At
|
|
183
183
|
];
|
|
184
184
|
}
|
|
185
|
-
let
|
|
185
|
+
let W = se(), G = new De(), K = he(), Nt = de({
|
|
186
186
|
relayout: () => {
|
|
187
|
-
let e =
|
|
188
|
-
e &&
|
|
187
|
+
let e = M.value?.state ?? K.lastEditorState;
|
|
188
|
+
e && X(e, { reason: "hyphenation-ready" });
|
|
189
189
|
},
|
|
190
190
|
onError: (e) => D?.(e)
|
|
191
191
|
});
|
|
192
|
-
i(
|
|
193
|
-
measuredFontSet: () =>
|
|
192
|
+
i(Nt.cancel), i(le({
|
|
193
|
+
measuredFontSet: () => K.lastMeasureInputs?.fontSet ?? null,
|
|
194
194
|
relayout: () => {
|
|
195
|
-
if (
|
|
196
|
-
let e =
|
|
197
|
-
e &&
|
|
195
|
+
if (j) return;
|
|
196
|
+
let e = M.value?.state ?? K.lastEditorState;
|
|
197
|
+
e && X(e, { reason: "font-ready" });
|
|
198
198
|
}
|
|
199
199
|
}));
|
|
200
|
-
let
|
|
200
|
+
let Pt = new Te({
|
|
201
201
|
pageGap: ee,
|
|
202
202
|
showShadow: !0
|
|
203
|
-
}),
|
|
204
|
-
getHost: () =>
|
|
203
|
+
}), q = ue({
|
|
204
|
+
getHost: () => st.value,
|
|
205
205
|
getReadOnly: () => l(o),
|
|
206
|
-
getDocument: () => $.api.getCanonicalDocument() ??
|
|
206
|
+
getDocument: () => $.api.getCanonicalDocument() ?? O.value,
|
|
207
207
|
getCanonicalApi: () => $.api,
|
|
208
208
|
getExperimentalSession: () => l(d),
|
|
209
209
|
onSessionRefusal: (e, t, n) => {
|
|
210
|
-
|
|
210
|
+
z.value = e, D?.(n ?? new f({
|
|
211
211
|
gap: t,
|
|
212
212
|
message: e
|
|
213
213
|
}));
|
|
214
214
|
},
|
|
215
|
-
getStyles: () =>
|
|
216
|
-
getTheme: () =>
|
|
215
|
+
getStyles: () => O.value?.package.styles ?? null,
|
|
216
|
+
getTheme: () => O.value?.package.theme ?? null,
|
|
217
217
|
onTransaction: ({ rId: e, kind: t, view: n, docChanged: r, selectionChanged: i }) => {
|
|
218
|
-
if (r && (
|
|
218
|
+
if (r && (B.value = !0, Z.schedule()), r || i) {
|
|
219
219
|
let { from: r, to: i } = n.state.selection;
|
|
220
|
-
|
|
220
|
+
ut.value = {
|
|
221
221
|
from: r,
|
|
222
222
|
kind: t,
|
|
223
223
|
rId: e,
|
|
224
224
|
to: i
|
|
225
|
-
},
|
|
225
|
+
}, $e?.(n.state), W.emit("selectionChange", {
|
|
226
226
|
from: r,
|
|
227
227
|
to: i
|
|
228
228
|
});
|
|
229
229
|
}
|
|
230
|
-
|
|
230
|
+
G.requestRender();
|
|
231
231
|
}
|
|
232
|
-
}),
|
|
232
|
+
}), Ft = { current: null }, J = ge({
|
|
233
233
|
getHost: () => r?.value ?? null,
|
|
234
|
-
getPlugins: () =>
|
|
235
|
-
getDocument: () => $.api.getCanonicalDocument() ??
|
|
234
|
+
getPlugins: () => Tt,
|
|
235
|
+
getDocument: () => $.api.getCanonicalDocument() ?? O.value,
|
|
236
236
|
getCanonicalApi: () => $.api,
|
|
237
237
|
getExperimentalSession: () => l(d),
|
|
238
238
|
onSessionRefusal: (e, t, n) => {
|
|
239
|
-
|
|
239
|
+
z.value = e, D?.(n ?? new f({
|
|
240
240
|
gap: t,
|
|
241
241
|
message: e
|
|
242
242
|
}));
|
|
243
243
|
},
|
|
244
|
-
getStyles: () =>
|
|
245
|
-
getTheme: () =>
|
|
244
|
+
getStyles: () => O.value?.package.styles ?? null,
|
|
245
|
+
getTheme: () => O.value?.package.theme ?? null,
|
|
246
246
|
onTransaction: ({ docChanged: e, selectionChanged: t, view: n }) => {
|
|
247
247
|
if (e) {
|
|
248
|
-
|
|
249
|
-
let e =
|
|
248
|
+
B.value = !0;
|
|
249
|
+
let e = O.value;
|
|
250
250
|
if (e) {
|
|
251
|
-
let t = $.api.getCanonicalDocument() ??
|
|
252
|
-
|
|
251
|
+
let t = $.api.getCanonicalDocument() ?? Ft.current?.snapshotDocument(e) ?? e;
|
|
252
|
+
O.value = t, Qe?.(H(t)), W.emit("docChange", H(t));
|
|
253
253
|
}
|
|
254
|
-
|
|
254
|
+
Z.schedule();
|
|
255
255
|
}
|
|
256
256
|
if (e || t) {
|
|
257
|
-
|
|
257
|
+
$e?.(n.state);
|
|
258
258
|
let { from: e, to: t } = n.state.selection;
|
|
259
|
-
|
|
259
|
+
W.emit("selectionChange", {
|
|
260
260
|
from: e,
|
|
261
261
|
to: t
|
|
262
262
|
});
|
|
263
263
|
}
|
|
264
264
|
}
|
|
265
265
|
});
|
|
266
|
-
|
|
267
|
-
let
|
|
268
|
-
|
|
266
|
+
Ft.current = J;
|
|
267
|
+
let Y = () => {
|
|
268
|
+
q.sync(), J.sync();
|
|
269
269
|
};
|
|
270
|
-
u(() => l(d),
|
|
271
|
-
function
|
|
272
|
-
e.layout && (
|
|
270
|
+
u(() => l(d), Y);
|
|
271
|
+
function It(e) {
|
|
272
|
+
e.layout && (L.value = e.layout), e.blocks && (xt.value = e.blocks), e.measures && (St.value = e.measures), e.blockLookup && Pt.setBlockLookup(e.blockLookup), e.layout && W.emit("layoutComplete", e.layout);
|
|
273
273
|
}
|
|
274
|
-
function
|
|
275
|
-
if (
|
|
276
|
-
let n = a.value, r = n instanceof HTMLDivElement ? n : null, i =
|
|
274
|
+
function X(e, t = {}) {
|
|
275
|
+
if (j) return;
|
|
276
|
+
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, c = y(s), u = te(s), d = gt(s), f = c.w - u.left - u.right, p = i?.package.styles ?? null, m = i?.package.theme ?? null, h = i?.package.settings?.defaultTabStop, g = i?.package.settings?.mirrorMargins === !0, x = He(i?.package);
|
|
277
277
|
try {
|
|
278
|
-
|
|
278
|
+
It(fe({
|
|
279
279
|
contentWidth: f,
|
|
280
280
|
columns: d,
|
|
281
281
|
pageSize: c,
|
|
282
282
|
margins: u,
|
|
283
283
|
pageGap: ee,
|
|
284
|
-
showMarginGuides: l(
|
|
285
|
-
marginGuideColor: l(
|
|
284
|
+
showMarginGuides: l(Se) === !0,
|
|
285
|
+
marginGuideColor: l(Ce),
|
|
286
286
|
...(() => {
|
|
287
287
|
let e = l(_);
|
|
288
288
|
return e === void 0 ? {} : { pageRenderer: e };
|
|
289
289
|
})(),
|
|
290
|
-
syncCoordinator:
|
|
290
|
+
syncCoordinator: G,
|
|
291
291
|
headerContent: x.headerContent,
|
|
292
292
|
footerContent: x.footerContent,
|
|
293
293
|
firstPageHeaderContent: x.firstPageHeaderContent,
|
|
@@ -303,201 +303,203 @@ function yt(e) {
|
|
|
303
303
|
defaultTabStop: h,
|
|
304
304
|
mirrorMargins: g,
|
|
305
305
|
styles: p,
|
|
306
|
-
layout:
|
|
307
|
-
hfPMs:
|
|
308
|
-
painter:
|
|
306
|
+
layout: L.value,
|
|
307
|
+
hfPMs: q,
|
|
308
|
+
painter: Pt,
|
|
309
309
|
pagesContainer: r,
|
|
310
|
-
session:
|
|
311
|
-
renderHfFromContentOrPm:
|
|
312
|
-
renderHeaderFooterContentByRId:
|
|
310
|
+
session: K,
|
|
311
|
+
renderHfFromContentOrPm: _t,
|
|
312
|
+
renderHeaderFooterContentByRId: vt,
|
|
313
313
|
readFontSetSignature: ce,
|
|
314
|
-
buildFootnoteRenderItems:
|
|
315
|
-
describeInvalidHighlightMarks:
|
|
316
|
-
emptyTemplatePreviewEntries:
|
|
317
|
-
emptyTemplatePreviewHidden:
|
|
318
|
-
hyphenationReadiness:
|
|
314
|
+
buildFootnoteRenderItems: yt,
|
|
315
|
+
describeInvalidHighlightMarks: bt,
|
|
316
|
+
emptyTemplatePreviewEntries: mt,
|
|
317
|
+
emptyTemplatePreviewHidden: ht,
|
|
318
|
+
hyphenationReadiness: Nt,
|
|
319
319
|
markupView: l(v),
|
|
320
|
-
showCommentHighlights: l(b)
|
|
320
|
+
showCommentHighlights: l(b),
|
|
321
|
+
...xe === void 0 ? {} : { altChunkMarkerText: l(xe) }
|
|
321
322
|
}, e, t));
|
|
322
323
|
} catch (e) {
|
|
323
324
|
let t = e instanceof Error ? e : Error(String(e));
|
|
324
325
|
D?.(t);
|
|
325
326
|
}
|
|
326
327
|
}
|
|
327
|
-
let
|
|
328
|
-
readState: () =>
|
|
329
|
-
runLayout: (e, t) =>
|
|
328
|
+
let Z = me({
|
|
329
|
+
readState: () => M.value?.state ?? null,
|
|
330
|
+
runLayout: (e, t) => X(e, t),
|
|
330
331
|
...T,
|
|
331
332
|
clock: pe
|
|
332
|
-
}), Q = null,
|
|
333
|
-
function
|
|
333
|
+
}), Q = null, Lt = Fe();
|
|
334
|
+
function Rt() {
|
|
334
335
|
Q !== null && (window.clearTimeout(Q), Q = null);
|
|
335
|
-
let e =
|
|
336
|
+
let e = M.value, t = O.value;
|
|
336
337
|
if (e && t) try {
|
|
337
338
|
let n = $.api.getCanonicalDocument();
|
|
338
|
-
if (!n &&
|
|
339
|
-
let r = n ??
|
|
340
|
-
|
|
339
|
+
if (!n && V()) return;
|
|
340
|
+
let r = n ?? Lt.reconcile(Oe(e.state.doc, t, { stylesheetSource: { type: "package" } }), e.state.doc);
|
|
341
|
+
O.value = r, Y(), Qe?.(H(r)), W.emit("docChange", H(r));
|
|
341
342
|
} catch (e) {
|
|
342
343
|
D?.(e instanceof Error ? e : Error(String(e)));
|
|
343
344
|
}
|
|
344
345
|
}
|
|
345
|
-
function
|
|
346
|
+
function zt() {
|
|
346
347
|
Q !== null && window.clearTimeout(Q), Q = window.setTimeout(() => {
|
|
347
|
-
Q = null,
|
|
348
|
-
},
|
|
348
|
+
Q = null, Rt();
|
|
349
|
+
}, pt);
|
|
349
350
|
}
|
|
350
351
|
let $ = m({
|
|
351
352
|
getHost: () => t.value,
|
|
352
|
-
getDocument: () =>
|
|
353
|
-
getStyles: () =>
|
|
354
|
-
getExtensionManager: () =>
|
|
355
|
-
getExternalPlugins:
|
|
353
|
+
getDocument: () => O.value,
|
|
354
|
+
getStyles: () => O.value?.package.styles ?? null,
|
|
355
|
+
getExtensionManager: () => U,
|
|
356
|
+
getExternalPlugins: Mt,
|
|
356
357
|
getCollaboration: () => l(E),
|
|
357
|
-
getCollaborationModules: () =>
|
|
358
|
+
getCollaborationModules: () => P.value,
|
|
358
359
|
getPrecomputedInitialState: () => null,
|
|
359
360
|
getReadOnly: () => l(o),
|
|
360
361
|
getExperimentalSession: () => l(d),
|
|
361
|
-
getEditingMode: () => l(
|
|
362
|
-
getSuggestionAuthor:
|
|
362
|
+
getEditingMode: () => l(We) ?? "editing",
|
|
363
|
+
getSuggestionAuthor: ct,
|
|
363
364
|
onSessionRefusal: (e, t, n) => {
|
|
364
365
|
D?.(n ?? new f({
|
|
365
366
|
gap: t,
|
|
366
367
|
message: e
|
|
367
368
|
}));
|
|
368
369
|
},
|
|
369
|
-
getDocumentIdentity: () => String(
|
|
370
|
-
getDocumentContext: () =>
|
|
371
|
-
onTransaction:
|
|
370
|
+
getDocumentIdentity: () => String(k),
|
|
371
|
+
getDocumentContext: () => O.value,
|
|
372
|
+
onTransaction: Vt,
|
|
373
|
+
onCanonicalCompositionEnd: () => Z.schedule(),
|
|
372
374
|
onSelectionChange: (e) => {
|
|
373
|
-
|
|
375
|
+
N.value = e, $e?.(e), W.emit("selectionChange", {
|
|
374
376
|
from: e.selection.from,
|
|
375
377
|
to: e.selection.to
|
|
376
378
|
});
|
|
377
379
|
},
|
|
378
380
|
onKeyDown: () => !1,
|
|
379
|
-
onCopy: () =>
|
|
380
|
-
onCut: () =>
|
|
381
|
-
onPaste: () =>
|
|
382
|
-
onReadOnlyEditAttempt: () =>
|
|
383
|
-
onEditorViewReady:
|
|
381
|
+
onCopy: () => tt?.(),
|
|
382
|
+
onCut: () => nt?.(),
|
|
383
|
+
onPaste: () => rt?.(),
|
|
384
|
+
onReadOnlyEditAttempt: () => it?.(),
|
|
385
|
+
onEditorViewReady: Ht,
|
|
384
386
|
onEditorViewDestroy: () => {
|
|
385
|
-
|
|
387
|
+
M.value = null, R.value = !1, et?.(null);
|
|
386
388
|
},
|
|
387
389
|
onRemoteSelectionsChange: (e) => {
|
|
388
|
-
|
|
390
|
+
F.value = e;
|
|
389
391
|
}
|
|
390
|
-
}),
|
|
391
|
-
let e = l(E)?.awareness, t =
|
|
392
|
-
|
|
392
|
+
}), Bt = () => {
|
|
393
|
+
let e = l(E)?.awareness, t = P.value, n = $.getView();
|
|
394
|
+
F.value = e && t && n ? p(n.state, e, t) : [];
|
|
393
395
|
};
|
|
394
396
|
u(() => l(E), (e, t, n) => {
|
|
395
|
-
if (
|
|
396
|
-
|
|
397
|
+
if (F.value = [], !e) {
|
|
398
|
+
P.value = null, $.retryViewCreation(), $.syncExternalDocument();
|
|
397
399
|
return;
|
|
398
400
|
}
|
|
399
401
|
let r = !1;
|
|
400
402
|
n(() => {
|
|
401
403
|
r = !0;
|
|
402
|
-
}),
|
|
403
|
-
r || (
|
|
404
|
+
}), P.value = null, ae().then((e) => {
|
|
405
|
+
r || (P.value = e, $.retryViewCreation(), $.syncExternalDocument(), Bt());
|
|
404
406
|
}, (e) => {
|
|
405
|
-
r || (
|
|
407
|
+
r || (P.value = null, D?.(e instanceof Error ? e : Error(String(e))));
|
|
406
408
|
});
|
|
407
409
|
}, { immediate: !0 }), u(() => ({
|
|
408
410
|
awareness: l(E)?.awareness,
|
|
409
|
-
modules:
|
|
410
|
-
view:
|
|
411
|
+
modules: P.value,
|
|
412
|
+
view: M.value
|
|
411
413
|
}), ({ awareness: e, modules: t, view: n }, r, i) => {
|
|
412
|
-
!e || !t || !n ?
|
|
413
|
-
e.off("change",
|
|
414
|
+
!e || !t || !n ? F.value = [] : (e.on("change", Bt), Bt(), i(() => {
|
|
415
|
+
e.off("change", Bt), F.value = [];
|
|
414
416
|
}));
|
|
415
417
|
}, { flush: "post" });
|
|
416
|
-
function
|
|
417
|
-
|
|
418
|
+
function Vt({ newState: e, docChanged: t, transactions: n }) {
|
|
419
|
+
N.value = e;
|
|
418
420
|
let r = n[0]?.before;
|
|
419
|
-
if (t && r &&
|
|
421
|
+
if (t && r && Lt.noteBase(r), t) {
|
|
420
422
|
let e = $.api.getCanonicalDocument();
|
|
421
|
-
e && (
|
|
423
|
+
e && (O.value = e, Y()), B.value = !0, G.incrementStateSeq(), Z.schedule(), zt();
|
|
422
424
|
}
|
|
423
|
-
|
|
425
|
+
G.requestRender();
|
|
424
426
|
}
|
|
425
|
-
function
|
|
426
|
-
|
|
427
|
-
let t =
|
|
428
|
-
|
|
427
|
+
function Ht(e) {
|
|
428
|
+
M.value = e, N.value = e.state, R.value = !0;
|
|
429
|
+
let t = O.value, n = k, r = ++A;
|
|
430
|
+
j = !0;
|
|
429
431
|
let i = () => {
|
|
430
|
-
|
|
432
|
+
A === r && (j = !1, !(lt || k !== n || $.getView() !== e) && (X(e.state, { reason: "initial" }), G.requestRender()));
|
|
431
433
|
};
|
|
432
|
-
w(t, e.state.doc).then(i, i),
|
|
433
|
-
|
|
434
|
+
w(t, e.state.doc).then(i, i), Gt(e), et?.(e), l(o) || requestAnimationFrame(() => {
|
|
435
|
+
M.value === e && e.focus();
|
|
434
436
|
});
|
|
435
437
|
}
|
|
436
|
-
let
|
|
437
|
-
getDocx: async (e) => (await
|
|
438
|
-
loadDocument:
|
|
439
|
-
loadDocx:
|
|
440
|
-
},
|
|
438
|
+
let Ut = {
|
|
439
|
+
getDocx: async (e) => (await Qt(e))?.buffer ?? null,
|
|
440
|
+
loadDocument: Zt,
|
|
441
|
+
loadDocx: Xt
|
|
442
|
+
}, Wt = oe({
|
|
441
443
|
getEditorApi: () => $.api,
|
|
442
|
-
getLayout: () =>
|
|
443
|
-
runLayout: (e, t) =>
|
|
444
|
-
getDocumentIO: () =>
|
|
445
|
-
emitter:
|
|
444
|
+
getLayout: () => L.value,
|
|
445
|
+
runLayout: (e, t) => X(e, t),
|
|
446
|
+
getDocumentIO: () => Ut,
|
|
447
|
+
emitter: W
|
|
446
448
|
});
|
|
447
|
-
function
|
|
448
|
-
let t = l(
|
|
449
|
-
S(t, e.state, e.dispatch,
|
|
449
|
+
function Gt(e) {
|
|
450
|
+
let t = l(We) === "suggesting";
|
|
451
|
+
S(t, e.state, e.dispatch, ct());
|
|
450
452
|
}
|
|
451
|
-
u([() => l(
|
|
452
|
-
|
|
453
|
+
u([() => l(We), ct], () => {
|
|
454
|
+
Wt.setCanonicalMode(l(We) === "suggesting" ? {
|
|
453
455
|
type: "suggesting",
|
|
454
|
-
author:
|
|
456
|
+
author: ct()
|
|
455
457
|
} : { type: "editing" });
|
|
456
|
-
let e =
|
|
457
|
-
e &&
|
|
458
|
-
for (let e of
|
|
459
|
-
let t =
|
|
460
|
-
t &&
|
|
458
|
+
let e = M.value;
|
|
459
|
+
e && Gt(e);
|
|
460
|
+
for (let e of J.listStories()) {
|
|
461
|
+
let t = J.getView(e);
|
|
462
|
+
t && Gt(t);
|
|
461
463
|
}
|
|
462
464
|
}), u(() => l(o), (e) => {
|
|
463
|
-
$.syncEditable(), e &&
|
|
465
|
+
$.syncEditable(), e && on(), q.sync();
|
|
464
466
|
});
|
|
465
|
-
function
|
|
466
|
-
let t =
|
|
467
|
-
if (t === e.state.plugins.includes(
|
|
468
|
-
let n = e.state.plugins.filter((e) => e !==
|
|
467
|
+
function Kt(e) {
|
|
468
|
+
let t = jt();
|
|
469
|
+
if (t === e.state.plugins.includes(Ot)) return;
|
|
470
|
+
let n = e.state.plugins.filter((e) => e !== Ot && e !== kt);
|
|
469
471
|
if (t) {
|
|
470
|
-
let e = n.indexOf(
|
|
471
|
-
n.splice(t, 0,
|
|
472
|
+
let e = n.indexOf(At), t = e === -1 ? n.length : e;
|
|
473
|
+
n.splice(t, 0, Ot, kt);
|
|
472
474
|
}
|
|
473
475
|
e.updateState(e.state.reconfigure({ plugins: n }));
|
|
474
476
|
}
|
|
475
|
-
u(() =>
|
|
476
|
-
let e =
|
|
477
|
-
e &&
|
|
477
|
+
u(() => jt(), () => {
|
|
478
|
+
let e = M.value;
|
|
479
|
+
e && Kt(e);
|
|
478
480
|
});
|
|
479
|
-
function Kt() {
|
|
480
|
-
$.ensureView();
|
|
481
|
-
}
|
|
482
481
|
function qt() {
|
|
483
|
-
|
|
482
|
+
$.ensureView();
|
|
484
483
|
}
|
|
485
484
|
function Jt() {
|
|
486
|
-
|
|
485
|
+
k += 1, B.value = !1, ut.value = null, I.value = null, J.activate(null), Z.dispose(), $.destroyView(), V() && $.ensureView(), Y(), $.ensureView(), $.getView() || Yt();
|
|
486
|
+
}
|
|
487
|
+
function Yt() {
|
|
488
|
+
let e = O.value;
|
|
487
489
|
if (e && !l(E)) try {
|
|
488
490
|
let t = h({
|
|
489
491
|
document: e,
|
|
490
492
|
styles: e.package.styles ?? null,
|
|
491
|
-
manager:
|
|
492
|
-
externalPlugins:
|
|
493
|
+
manager: U,
|
|
494
|
+
externalPlugins: Mt(),
|
|
493
495
|
collaborationModules: null,
|
|
494
496
|
reason: "mount"
|
|
495
497
|
});
|
|
496
|
-
|
|
497
|
-
let n =
|
|
498
|
-
|
|
498
|
+
N.value = t;
|
|
499
|
+
let n = k, r = ++A;
|
|
500
|
+
j = !0;
|
|
499
501
|
let i = () => {
|
|
500
|
-
|
|
502
|
+
A === r && (j = !1, !(lt || k !== n || O.value !== e || $.getView()) && X(t, { reason: "initial" }));
|
|
501
503
|
};
|
|
502
504
|
w(e, t.doc).then(i, i);
|
|
503
505
|
} catch (e) {
|
|
@@ -507,32 +509,32 @@ function yt(e) {
|
|
|
507
509
|
u([
|
|
508
510
|
t,
|
|
509
511
|
a,
|
|
510
|
-
|
|
512
|
+
st,
|
|
511
513
|
...r ? [r] : []
|
|
512
514
|
], () => {
|
|
513
|
-
t.value &&
|
|
515
|
+
t.value && O.value && !$.getView() && qt(), Y();
|
|
514
516
|
}, { flush: "post" });
|
|
515
|
-
async function
|
|
516
|
-
|
|
517
|
+
async function Xt(e) {
|
|
518
|
+
z.value = null, R.value = !1;
|
|
517
519
|
try {
|
|
518
520
|
let t = e;
|
|
519
|
-
if (
|
|
521
|
+
if (V()) {
|
|
520
522
|
let n = await ye(e);
|
|
521
523
|
if (n.isErr()) throw n.error;
|
|
522
524
|
t = n.value;
|
|
523
525
|
}
|
|
524
|
-
let n = await be(t, { password: l(
|
|
525
|
-
|
|
526
|
+
let n = await be(t, { password: l(Ue) });
|
|
527
|
+
O.value = n, Jt();
|
|
526
528
|
} catch (e) {
|
|
527
529
|
let t = e instanceof Error ? e : Error(String(e));
|
|
528
|
-
|
|
530
|
+
z.value = t.message, D?.(t);
|
|
529
531
|
}
|
|
530
532
|
}
|
|
531
|
-
function
|
|
532
|
-
|
|
533
|
+
function Zt(e) {
|
|
534
|
+
z.value = null, O.value = e, Lt.reset(), Jt();
|
|
533
535
|
}
|
|
534
|
-
async function
|
|
535
|
-
let t =
|
|
536
|
+
async function Qt(e) {
|
|
537
|
+
let t = M.value, n = O.value;
|
|
536
538
|
if (!t || !n) return null;
|
|
537
539
|
try {
|
|
538
540
|
let t = $.api.captureCanonicalSave();
|
|
@@ -540,21 +542,21 @@ function yt(e) {
|
|
|
540
542
|
let n = await ve({
|
|
541
543
|
snapshot: t,
|
|
542
544
|
options: e,
|
|
543
|
-
featureFlags: l(
|
|
545
|
+
featureFlags: l(at)
|
|
544
546
|
});
|
|
545
547
|
for (let t of n.diagnostics) e?.onDiagnostic || D?.(new _e({
|
|
546
548
|
gap: x.save,
|
|
547
549
|
diagnostic: t,
|
|
548
550
|
message: `Canonical save used a fidelity fallback: ${t.type} (${t.part}).`
|
|
549
551
|
}));
|
|
550
|
-
return n.tripwireResult &&
|
|
552
|
+
return n.tripwireResult && ot?.(n.tripwireResult), n;
|
|
551
553
|
}
|
|
552
554
|
} catch (e) {
|
|
553
555
|
return D?.(e instanceof Error ? e : Error(String(e))), null;
|
|
554
556
|
}
|
|
555
|
-
if (
|
|
556
|
-
Q !== null &&
|
|
557
|
-
let r =
|
|
557
|
+
if (V()) return null;
|
|
558
|
+
Q !== null && Rt();
|
|
559
|
+
let r = J.snapshotDocument(q.snapshotDocument(n)), i = t.state, a = Ie(Oe(i.doc, r, { stylesheetSource: { type: "package" } })), { resolveSelectiveSaveFlags: o } = await import("@stll/folio-core/docx/selectiveSaveFlags"), s = o(l(at)), c = a.originalBuffer ?? null, u = s.selectiveSave && e?.mode !== C.full, d = u || s.selectiveSaveTripwire, { repackDocx: f, createDocx: p } = await import("@stll/folio-core/docx/rezip"), m = null;
|
|
558
560
|
if (d && c) {
|
|
559
561
|
let { attemptSelectiveSave: e } = await import("@stll/folio-core/docx/selectiveSave");
|
|
560
562
|
m = await e(a, c, {
|
|
@@ -573,105 +575,106 @@ function yt(e) {
|
|
|
573
575
|
else if (s.selectiveSaveTripwire) try {
|
|
574
576
|
g = await ee();
|
|
575
577
|
} catch {}
|
|
576
|
-
if (s.selectiveSaveTripwire && g &&
|
|
578
|
+
if (s.selectiveSaveTripwire && g && ot) try {
|
|
577
579
|
let { compareSelectiveVsFull: e } = await import("@stll/folio-core/docx/selectiveSaveTripwire");
|
|
578
|
-
|
|
580
|
+
ot(await e(m, g));
|
|
579
581
|
} catch {}
|
|
580
582
|
return {
|
|
581
583
|
buffer: h,
|
|
582
584
|
document: a
|
|
583
585
|
};
|
|
584
586
|
}
|
|
585
|
-
async function
|
|
586
|
-
let t =
|
|
587
|
-
return r ? (
|
|
587
|
+
async function $t(e) {
|
|
588
|
+
let t = M.value, n = t?.state, r = await Qt({ mode: e?.selective === !1 ? C.full : C.preferSelective });
|
|
589
|
+
return r ? (M.value === t && t?.state.doc === n?.doc && (r.version === void 0 || $.api.isCanonicalSaveCurrent(r.version)) && (O.value = r.document, Y(), B.value = !1), new Blob([r.buffer], { type: "application/vnd.openxmlformats-officedocument.wordprocessingml.document" })) : null;
|
|
588
590
|
}
|
|
589
|
-
function
|
|
591
|
+
function en() {
|
|
590
592
|
let e = $.api.getCanonicalDocument();
|
|
591
593
|
if (e) return e;
|
|
592
|
-
if (
|
|
593
|
-
let t =
|
|
594
|
+
if (V()) return null;
|
|
595
|
+
let t = O.value;
|
|
594
596
|
if (!t) return null;
|
|
595
597
|
let n = $.api.getDocument() ?? t;
|
|
596
|
-
return
|
|
597
|
-
}
|
|
598
|
-
function en(e) {
|
|
599
|
-
xt(x.modelEdits, "Direct document model changes are unavailable in this session.") || (k.value = e, X(), L.value && !Y.getView(L.value) && (L.value = null));
|
|
598
|
+
return H(J.snapshotDocument(q.snapshotDocument(n)));
|
|
600
599
|
}
|
|
601
600
|
function tn(e) {
|
|
602
|
-
|
|
601
|
+
Ct(x.modelEdits, "Direct document model changes are unavailable in this session.") || (O.value = e, Y(), I.value && !J.getView(I.value) && (I.value = null));
|
|
603
602
|
}
|
|
604
|
-
function nn() {
|
|
605
|
-
|
|
603
|
+
function nn(e) {
|
|
604
|
+
return q.getView(e);
|
|
606
605
|
}
|
|
607
|
-
function rn(
|
|
608
|
-
|
|
609
|
-
t && (Wt(t), L.value = e, requestAnimationFrame(() => t.focus()));
|
|
606
|
+
function rn() {
|
|
607
|
+
Y();
|
|
610
608
|
}
|
|
611
|
-
function an() {
|
|
612
|
-
|
|
609
|
+
function an(e) {
|
|
610
|
+
let t = J.activate(e);
|
|
611
|
+
t && (Gt(t), I.value = e, requestAnimationFrame(() => t.focus()));
|
|
613
612
|
}
|
|
614
613
|
function on() {
|
|
615
|
-
|
|
616
|
-
return e ? Y.getView(e) : null;
|
|
614
|
+
J.activate(null), I.value = null;
|
|
617
615
|
}
|
|
618
616
|
function sn() {
|
|
619
|
-
|
|
617
|
+
let e = I.value;
|
|
618
|
+
return e ? J.getView(e) : null;
|
|
620
619
|
}
|
|
621
620
|
function cn() {
|
|
622
|
-
|
|
623
|
-
e ? e.focus() : N.value?.focus();
|
|
621
|
+
return U.getCommands();
|
|
624
622
|
}
|
|
625
623
|
function ln() {
|
|
626
|
-
let e =
|
|
627
|
-
e
|
|
624
|
+
let e = sn();
|
|
625
|
+
e ? e.focus() : M.value?.focus();
|
|
626
|
+
}
|
|
627
|
+
function un() {
|
|
628
|
+
let e = M.value;
|
|
629
|
+
e && X(e.state, { reason: "manual" });
|
|
628
630
|
}
|
|
629
631
|
u([
|
|
630
|
-
() => l(xe),
|
|
631
632
|
() => l(Se),
|
|
633
|
+
() => l(Ce),
|
|
632
634
|
() => l(_),
|
|
633
635
|
() => l(v),
|
|
634
|
-
() => l(b)
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
636
|
+
() => l(b),
|
|
637
|
+
() => l(xe)
|
|
638
|
+
], () => un());
|
|
639
|
+
function dn() {
|
|
640
|
+
lt = !0, a.value && Ee(a.value), A += 1, j = !1, Z.dispose(), Q !== null && (window.clearTimeout(Q), Q = null), $.destroyView(), F.value = [], q.destroy(), J.destroy(), U.destroy(), N.value = null, L.value = null, O.value = null, R.value = !1;
|
|
638
641
|
}
|
|
639
|
-
return i(
|
|
642
|
+
return i(dn), {
|
|
640
643
|
setEmbeddedFontFamilies: (e) => {
|
|
641
|
-
e ?
|
|
644
|
+
e ? K.embeddedFontFamilyMap = new Map(e) : delete K.embeddedFontFamilyMap;
|
|
642
645
|
},
|
|
643
|
-
editor:
|
|
644
|
-
editorView:
|
|
645
|
-
editorState:
|
|
646
|
-
remoteSelections:
|
|
647
|
-
headerFooterSelection:
|
|
648
|
-
activeNoteStory:
|
|
649
|
-
isReady:
|
|
650
|
-
isDirty:
|
|
651
|
-
parseError:
|
|
652
|
-
layout:
|
|
653
|
-
blocks:
|
|
654
|
-
measures:
|
|
655
|
-
syncCoordinator:
|
|
656
|
-
loadBuffer:
|
|
657
|
-
loadDocument:
|
|
658
|
-
save:
|
|
659
|
-
getDocument:
|
|
660
|
-
setDocument:
|
|
661
|
-
getHeaderFooterView:
|
|
662
|
-
syncHeaderFooterViews:
|
|
663
|
-
openNoteStory:
|
|
664
|
-
closeNoteStory:
|
|
665
|
-
getActiveNoteView:
|
|
666
|
-
getCommands:
|
|
667
|
-
focus:
|
|
668
|
-
reLayout:
|
|
669
|
-
destroy:
|
|
646
|
+
editor: Wt,
|
|
647
|
+
editorView: M,
|
|
648
|
+
editorState: N,
|
|
649
|
+
remoteSelections: F,
|
|
650
|
+
headerFooterSelection: ut,
|
|
651
|
+
activeNoteStory: I,
|
|
652
|
+
isReady: R,
|
|
653
|
+
isDirty: B,
|
|
654
|
+
parseError: z,
|
|
655
|
+
layout: L,
|
|
656
|
+
blocks: xt,
|
|
657
|
+
measures: St,
|
|
658
|
+
syncCoordinator: G,
|
|
659
|
+
loadBuffer: Xt,
|
|
660
|
+
loadDocument: Zt,
|
|
661
|
+
save: $t,
|
|
662
|
+
getDocument: en,
|
|
663
|
+
setDocument: tn,
|
|
664
|
+
getHeaderFooterView: nn,
|
|
665
|
+
syncHeaderFooterViews: rn,
|
|
666
|
+
openNoteStory: an,
|
|
667
|
+
closeNoteStory: on,
|
|
668
|
+
getActiveNoteView: sn,
|
|
669
|
+
getCommands: cn,
|
|
670
|
+
focus: ln,
|
|
671
|
+
reLayout: un,
|
|
672
|
+
destroy: dn
|
|
670
673
|
};
|
|
671
674
|
}
|
|
672
675
|
// src/composables/useFindReplace.ts
|
|
673
|
-
function
|
|
674
|
-
let g = new Ue(), _ = s(""), v = s(""), te = o(
|
|
676
|
+
function xt({ editorView: t, pagesRef: n, getDocument: r, layout: a, commentRoot: l, revealComment: d, displayMode: f, readOnly: p, onReadonlyEditAttempt: m, onResultChange: h }) {
|
|
677
|
+
let g = new Ue(), _ = s(""), v = s(""), te = o(E()), y = c([]), b = s(-1), x = e(() => y.value.at(b.value) ?? null), ne = () => ee({
|
|
675
678
|
editingMode: t.value?.editable === !1 ? "viewing" : "editing",
|
|
676
679
|
readOnlyProp: p.value,
|
|
677
680
|
displayMode: f.value
|
|
@@ -689,7 +692,7 @@ function bt({ editorView: t, pagesRef: n, getDocument: r, layout: a, commentRoot
|
|
|
689
692
|
},
|
|
690
693
|
document: e,
|
|
691
694
|
...n ? { bodyVersion: n } : {},
|
|
692
|
-
context: { renderedStories:
|
|
695
|
+
context: { renderedStories: qe(a.value) }
|
|
693
696
|
};
|
|
694
697
|
}, se = () => {
|
|
695
698
|
let e = r();
|
|
@@ -723,7 +726,7 @@ function bt({ editorView: t, pagesRef: n, getDocument: r, layout: a, commentRoot
|
|
|
723
726
|
}) : null, S?.paint(b.value), u.at(0) && !f ? fe(0) : w(), u;
|
|
724
727
|
}, pe = () => {
|
|
725
728
|
le(), ae = setTimeout(() => T("refresh"), 120);
|
|
726
|
-
}, me = (e, t) => (_.value = e, Object.assign(te,
|
|
729
|
+
}, me = (e, t) => (_.value = e, Object.assign(te, E(), t), T(), ce()), he = (e) => {
|
|
727
730
|
let t = g.goTo(e);
|
|
728
731
|
return t ? fe(t.index) : !1;
|
|
729
732
|
}, ge = (e) => {
|
|
@@ -783,7 +786,7 @@ function bt({ editorView: t, pagesRef: n, getDocument: r, layout: a, commentRoot
|
|
|
783
786
|
clear: de
|
|
784
787
|
};
|
|
785
788
|
}
|
|
786
|
-
function
|
|
789
|
+
function St(e, t) {
|
|
787
790
|
if (t < e.top + 40) {
|
|
788
791
|
let n = Math.max(0, e.top + 40 - t);
|
|
789
792
|
return -Math.min(12, n / 40 * 12);
|
|
@@ -795,7 +798,7 @@ function z(e, t) {
|
|
|
795
798
|
return 0;
|
|
796
799
|
}
|
|
797
800
|
// src/composables/useDragAutoScroll.ts
|
|
798
|
-
function
|
|
801
|
+
function R({ pagesContainer: e, onScrollExtendSelection: t }) {
|
|
799
802
|
let n = null, r = 0, a = 0, o = !1;
|
|
800
803
|
function s() {
|
|
801
804
|
return _(e.value);
|
|
@@ -807,7 +810,7 @@ function B({ pagesContainer: e, onScrollExtendSelection: t }) {
|
|
|
807
810
|
if (!o) return;
|
|
808
811
|
let e = s();
|
|
809
812
|
if (!e) return;
|
|
810
|
-
let i =
|
|
813
|
+
let i = St(e.getBoundingClientRect(), a);
|
|
811
814
|
i !== 0 && (v(e, i), t(r, a)), n = requestAnimationFrame(l);
|
|
812
815
|
}
|
|
813
816
|
function u() {
|
|
@@ -827,7 +830,7 @@ function B({ pagesContainer: e, onScrollExtendSelection: t }) {
|
|
|
827
830
|
};
|
|
828
831
|
}
|
|
829
832
|
// src/composables/useTableResize.ts
|
|
830
|
-
function
|
|
833
|
+
function z() {
|
|
831
834
|
let e = {
|
|
832
835
|
active: !1,
|
|
833
836
|
startX: 0,
|
|
@@ -846,7 +849,7 @@ function V() {
|
|
|
846
849
|
isEdge: !1,
|
|
847
850
|
tablePmStart: 0,
|
|
848
851
|
origHeight: 0,
|
|
849
|
-
minimumHeight:
|
|
852
|
+
minimumHeight: Qe
|
|
850
853
|
}, n = {
|
|
851
854
|
active: !1,
|
|
852
855
|
startX: 0,
|
|
@@ -860,14 +863,14 @@ function V() {
|
|
|
860
863
|
}
|
|
861
864
|
function a(i, a) {
|
|
862
865
|
let o = i.target;
|
|
863
|
-
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),
|
|
866
|
+
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), B(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), V(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), H(a, n), !0) : !1 : !1;
|
|
864
867
|
}
|
|
865
868
|
function o(r) {
|
|
866
869
|
if (e.active && e.handle) {
|
|
867
870
|
r.preventDefault();
|
|
868
871
|
let t = r.clientX - e.startX, n = parseFloat(e.handle.style.left);
|
|
869
872
|
e.handle.style.left = `${n + t}px`, e.startX = r.clientX;
|
|
870
|
-
let i = Math.round(t *
|
|
873
|
+
let i = Math.round(t * D), a = e.origWidths.left + i, o = e.origWidths.right - i;
|
|
871
874
|
a >= Ze && o >= Ze && (e.origWidths = {
|
|
872
875
|
left: a,
|
|
873
876
|
right: o
|
|
@@ -876,31 +879,31 @@ function V() {
|
|
|
876
879
|
r.preventDefault();
|
|
877
880
|
let e = r.clientY - t.startY, n = parseFloat(t.handle.style.top);
|
|
878
881
|
t.startY = r.clientY;
|
|
879
|
-
let i = Math.round(e *
|
|
882
|
+
let i = Math.round(e * D), a = $e({
|
|
880
883
|
currentHeight: t.origHeight,
|
|
881
884
|
delta: i,
|
|
882
885
|
minimumHeight: t.minimumHeight
|
|
883
886
|
});
|
|
884
|
-
t.handle.style.top = `${n + a /
|
|
887
|
+
t.handle.style.top = `${n + a / D}px`, t.origHeight += a;
|
|
885
888
|
} else if (n.active && n.handle) {
|
|
886
889
|
r.preventDefault();
|
|
887
890
|
let e = r.clientX - n.startX, t = parseFloat(n.handle.style.left);
|
|
888
891
|
n.handle.style.left = `${t + e}px`, n.startX = r.clientX;
|
|
889
|
-
let i = Math.round(e *
|
|
892
|
+
let i = Math.round(e * D), a = n.origWidth + i;
|
|
890
893
|
a >= Ze && (n.origWidth = a);
|
|
891
894
|
}
|
|
892
895
|
}
|
|
893
896
|
function s(i) {
|
|
894
|
-
e.active ? (e.active = !1, e.handle?.classList.remove("dragging"), r &&
|
|
897
|
+
e.active ? (e.active = !1, e.handle?.classList.remove("dragging"), r && et(r, {
|
|
895
898
|
pmStart: e.tablePmStart,
|
|
896
899
|
colIdx: e.columnIndex,
|
|
897
900
|
newLeft: e.origWidths.left,
|
|
898
901
|
newRight: e.origWidths.right
|
|
899
|
-
}), e.handle = null) : t.active ? (t.active = !1, t.handle?.classList.remove("dragging"), r &&
|
|
902
|
+
}), e.handle = null) : t.active ? (t.active = !1, t.handle?.classList.remove("dragging"), r && nt(r, {
|
|
900
903
|
pmStart: t.tablePmStart,
|
|
901
904
|
rowIdx: t.rowIndex,
|
|
902
905
|
newHeight: t.origHeight
|
|
903
|
-
}), t.handle = null) : n.active && (n.active = !1, n.handle?.classList.remove("dragging"), r &&
|
|
906
|
+
}), t.handle = null) : n.active && (n.active = !1, n.handle?.classList.remove("dragging"), r && tt(r, {
|
|
904
907
|
pmStart: n.tablePmStart,
|
|
905
908
|
colIdx: n.columnIndex,
|
|
906
909
|
newWidth: n.origWidth
|
|
@@ -917,29 +920,29 @@ function V() {
|
|
|
917
920
|
isResizing: i
|
|
918
921
|
};
|
|
919
922
|
}
|
|
920
|
-
function
|
|
921
|
-
let n =
|
|
923
|
+
function B(e, t) {
|
|
924
|
+
let n = it(e, t.tablePmStart, t.columnIndex);
|
|
922
925
|
n && (t.origWidths = n);
|
|
923
926
|
}
|
|
924
|
-
function
|
|
925
|
-
let r =
|
|
927
|
+
function V(e, t, n) {
|
|
928
|
+
let r = at(e, t.tablePmStart, t.rowIndex);
|
|
926
929
|
if (r != null) t.origHeight = r;
|
|
927
930
|
else {
|
|
928
931
|
let e = n.closest(".layout-table")?.querySelector(`[data-row-index="${t.rowIndex}"]`), r = e ? e.getBoundingClientRect().height : 30;
|
|
929
|
-
t.origHeight = Math.round(r *
|
|
932
|
+
t.origHeight = Math.round(r * D);
|
|
930
933
|
}
|
|
931
|
-
t.minimumHeight = Math.min(
|
|
934
|
+
t.minimumHeight = Math.min(Qe, t.origHeight);
|
|
932
935
|
}
|
|
933
|
-
function
|
|
934
|
-
let n =
|
|
936
|
+
function H(e, t) {
|
|
937
|
+
let n = rt(e, t.tablePmStart, t.columnIndex);
|
|
935
938
|
n != null && (t.origWidth = n);
|
|
936
939
|
}
|
|
937
940
|
// src/composables/useTrackedChanges.ts
|
|
938
|
-
function
|
|
939
|
-
return e(() => (n.value,
|
|
941
|
+
function Ct(t, n) {
|
|
942
|
+
return e(() => (n.value, ot(t.value?.state ?? null)));
|
|
940
943
|
}
|
|
941
944
|
// src/composables/useZoom.ts
|
|
942
|
-
var
|
|
945
|
+
var U = ct, wt = st, Tt = [
|
|
943
946
|
.5,
|
|
944
947
|
.75,
|
|
945
948
|
1,
|
|
@@ -947,16 +950,16 @@ var St = k, Ct = ot, wt = [
|
|
|
947
950
|
1.5,
|
|
948
951
|
2
|
|
949
952
|
];
|
|
950
|
-
function
|
|
951
|
-
let i = s(Math.max(
|
|
953
|
+
function Et(t = 1) {
|
|
954
|
+
let i = s(Math.max(U, Math.min(wt, t))), a = e(() => Math.round(i.value * 100)), o = e(() => i.value <= U), c = e(() => i.value >= wt);
|
|
952
955
|
function l(e) {
|
|
953
|
-
i.value = Math.max(
|
|
956
|
+
i.value = Math.max(U, Math.min(wt, Math.round(e * 100) / 100));
|
|
954
957
|
}
|
|
955
958
|
function u() {
|
|
956
|
-
l(i.value +
|
|
959
|
+
l(i.value + O);
|
|
957
960
|
}
|
|
958
961
|
function d() {
|
|
959
|
-
l(i.value -
|
|
962
|
+
l(i.value - O);
|
|
960
963
|
}
|
|
961
964
|
function f() {
|
|
962
965
|
l(1);
|
|
@@ -982,7 +985,7 @@ function Tt(t = 1) {
|
|
|
982
985
|
handleWheel: p,
|
|
983
986
|
handleKeyDown: m,
|
|
984
987
|
installShortcuts: h,
|
|
985
|
-
ZOOM_PRESETS:
|
|
988
|
+
ZOOM_PRESETS: Tt
|
|
986
989
|
};
|
|
987
990
|
}
|
|
988
|
-
export {
|
|
991
|
+
export { R as a, F as c, ut as d, z as i, M as l, ot as n, xt as o, Ct as r, L as s, Et as t, P as u };
|