@stll/folio-vue 0.33.0 → 0.34.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 +1 -1
- package/dist/composables/useTrackedChanges.d.ts +5 -2
- 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 -1
- package/dist/index.js +24 -23
- package/dist/{useZoom-CX69Me_z.js → useZoom-BKM59EqE.js} +357 -354
- package/dist/useZoom-C0dkG1Q4.cjs +1 -0
- package/dist/utils/comments.d.ts +1 -1
- package/package.json +2 -2
- package/dist/useZoom-QSSrGY_r.cjs +0 -1
|
@@ -5,19 +5,20 @@ import { getEditorScrollRoot as g, scrollEditorBy as _ } from "@stll/folio-core/
|
|
|
5
5
|
import { getMargins as te, getPageSize as ne, twipsToPixels as v } from "@stll/folio-core/paged-layout/sectionGeometry";
|
|
6
6
|
import { readModel as y } from "@stll/folio-core/types/documentModel";
|
|
7
7
|
import { readPaintedTableStart as b } from "@stll/folio-core/utils/paintedPositions";
|
|
8
|
+
import { canonicalReviewHeldRevisionIds as x } from "@stll/folio-core/controller/canonicalReview";
|
|
8
9
|
import { NO_ANONYMIZATION_TERMS as re } from "@stll/folio-core/controller/anonymizationHighlights";
|
|
9
10
|
import { createDisplayListPainterLoader as ie } from "@stll/folio-core/controller/deferredDisplayListPainter";
|
|
10
|
-
import { DOCUMENT_CHANGE_NOTIFY_DELAY_MS as
|
|
11
|
-
import { FOLIO_DOCX_SERIALIZATION_MODE as
|
|
12
|
-
import { createFolioEditorEmitter as
|
|
13
|
-
import { readFontSetSignature as oe, waitForInitialLayoutFonts as
|
|
14
|
-
import { createHeaderFooterEditorManager as
|
|
15
|
-
import { createHyphenationReadiness as
|
|
16
|
-
import { runLayoutPipelineWithPainter as
|
|
17
|
-
import { TRANSACTION_LAYOUT_TIMING as
|
|
18
|
-
import { createLayoutSession as
|
|
19
|
-
import { createNoteEditorManager as
|
|
20
|
-
import { PAGE_RENDERER as
|
|
11
|
+
import { DOCUMENT_CHANGE_NOTIFY_DELAY_MS as S } from "@stll/folio-core/controller/documentChangeNotification";
|
|
12
|
+
import { FOLIO_DOCX_SERIALIZATION_MODE as C, OP_STORIES as w, createFolioEditor as T } from "@stll/folio-core/controller/folioEditor";
|
|
13
|
+
import { createFolioEditorEmitter as ae } from "@stll/folio-core/controller/folioEditorEvents";
|
|
14
|
+
import { readFontSetSignature as oe, waitForInitialLayoutFonts as E, watchLayoutFontLoads as se } from "@stll/folio-core/controller/fontReadiness";
|
|
15
|
+
import { createHeaderFooterEditorManager as ce } from "@stll/folio-core/controller/headerFooterEditorManager";
|
|
16
|
+
import { createHyphenationReadiness as le } from "@stll/folio-core/controller/hyphenationReadiness";
|
|
17
|
+
import { runLayoutPipelineWithPainter as ue } from "@stll/folio-core/controller/layoutPipelineExecution";
|
|
18
|
+
import { TRANSACTION_LAYOUT_TIMING as D, browserClock as de, createLayoutScheduler as fe } from "@stll/folio-core/controller/layoutScheduler";
|
|
19
|
+
import { createLayoutSession as pe } from "@stll/folio-core/controller/layoutSession";
|
|
20
|
+
import { createNoteEditorManager as me } from "@stll/folio-core/controller/noteEditorManager";
|
|
21
|
+
import { PAGE_RENDERER as O } from "@stll/folio-core/display-list/editor/pageRenderer";
|
|
21
22
|
import { holdsUniqueParagraphIds as he, openCanonicalDocx as ge, prepareCanonicalDocumentInput as _e } from "@stll/folio-core/docx/canonicalSessionInput";
|
|
22
23
|
import { carryParseFacts as ve, cloneDocumentWithParagraphPropertySources as ye } from "@stll/folio-core/docx/document-clone";
|
|
23
24
|
import { getFootnoteText as be } from "@stll/folio-core/docx/storyPlainText";
|
|
@@ -31,61 +32,61 @@ import { createTemplateDirectivesPlugin as ke } from "@stll/folio-core/prosemirr
|
|
|
31
32
|
import { createTemplatePreviewValuesPlugin as Ae } from "@stll/folio-core/prosemirror/plugins/templatePreviewValues";
|
|
32
33
|
import { templateSlashMenuPlugin as je } from "@stll/folio-core/prosemirror/plugins/templateSlashMenu";
|
|
33
34
|
import { resolveHeaderFooterContent as Me } from "@stll/folio-core/utils/headerFooter";
|
|
34
|
-
import {
|
|
35
|
-
import {
|
|
36
|
-
import {
|
|
37
|
-
import {
|
|
38
|
-
import {
|
|
39
|
-
import {
|
|
40
|
-
import {
|
|
41
|
-
import {
|
|
42
|
-
import { extractTrackedChanges as
|
|
43
|
-
import { ZOOM_MAX as
|
|
35
|
+
import { FindReplaceManager as Ne } from "@stll/folio-core/managers/FindReplaceManager";
|
|
36
|
+
import { findInDisplayedDocument as Pe } from "@stll/folio-core/prosemirror/findReplaceSelection";
|
|
37
|
+
import { replaceFindMatch as Fe, replaceFindMatches as Ie } from "@stll/folio-core/prosemirror/replaceFindMatches";
|
|
38
|
+
import { createFindMatchView as Le, getRenderedSearchStories as Re } from "@stll/folio-core/utils/findMatchView";
|
|
39
|
+
import { createDefaultFindOptions as ze, replaceEligibility as Be } from "@stll/folio-core/utils/findReplace";
|
|
40
|
+
import { createFindSearchKey as k, sameFindSearchKey as Ve } from "@stll/folio-core/utils/findSearchKey";
|
|
41
|
+
import { MIN_CELL_WIDTH_TWIPS as He, MIN_ROW_HEIGHT_TWIPS as Ue, TWIPS_PER_PIXEL as A, clampRowResizeDelta as We, columnResizeCommand as Ge, readColumnWidthAt as Ke, readColumnWidths as qe, readRowHeight as Je, rightEdgeResizeCommand as Ye, rowResizeCommand as j } from "@stll/folio-core/prosemirror/tableResize";
|
|
42
|
+
import { trackedChangeEntryRevisionIds as Xe } from "@stll/folio-core/prosemirror/projectionReview";
|
|
43
|
+
import { extractTrackedChanges as Ze } from "@stll/folio-core/prosemirror/utils/extractTrackedChanges";
|
|
44
|
+
import { ZOOM_MAX as M, ZOOM_MIN as N, ZOOM_STEP as P } from "@stll/folio-core/utils/zoom";
|
|
44
45
|
// src/utils/colorMode.ts
|
|
45
|
-
var
|
|
46
|
-
function
|
|
46
|
+
var F = "(prefers-color-scheme: dark)";
|
|
47
|
+
function I() {
|
|
47
48
|
return typeof window < "u" && typeof window.matchMedia == "function";
|
|
48
49
|
}
|
|
49
|
-
function
|
|
50
|
+
function L(e, t) {
|
|
50
51
|
return e === "dark" || e === "system" && t;
|
|
51
52
|
}
|
|
52
|
-
function
|
|
53
|
-
if (!
|
|
54
|
-
let t = window.matchMedia(
|
|
53
|
+
function Qe(e) {
|
|
54
|
+
if (!I()) return () => {};
|
|
55
|
+
let t = window.matchMedia(F);
|
|
55
56
|
e(t.matches);
|
|
56
57
|
let n = (t) => e(t.matches);
|
|
57
58
|
return t.addEventListener("change", n), () => t.removeEventListener("change", n);
|
|
58
59
|
}
|
|
59
60
|
// src/composables/useColorMode.ts
|
|
60
|
-
var
|
|
61
|
-
a(
|
|
62
|
-
},
|
|
63
|
-
t.provide(
|
|
61
|
+
var R = "light", z = Symbol("folioColorMode"), B = (t = R) => {
|
|
62
|
+
a(z, e(() => u(t)));
|
|
63
|
+
}, V = { install(t, n = R) {
|
|
64
|
+
t.provide(z, e(() => u(n)));
|
|
64
65
|
} };
|
|
65
|
-
function
|
|
66
|
-
let n = t(
|
|
66
|
+
function $e() {
|
|
67
|
+
let n = t(z, e(() => R)), i = s(!1), a = s(!1);
|
|
67
68
|
return r(() => {
|
|
68
69
|
i.value = !0;
|
|
69
70
|
}), f((e) => {
|
|
70
|
-
i.value && n.value === "system" && e(
|
|
71
|
+
i.value && n.value === "system" && e(Qe((e) => {
|
|
71
72
|
a.value = e;
|
|
72
73
|
}));
|
|
73
|
-
}), e(() =>
|
|
74
|
+
}), e(() => L(n.value, i.value && a.value));
|
|
74
75
|
}
|
|
75
76
|
// src/utils/rawDocument.ts
|
|
76
|
-
var
|
|
77
|
+
var et = (e) => H(e, /* @__PURE__ */ new Map()), H = (e, t) => {
|
|
77
78
|
if (typeof e != "object" || !e) return e;
|
|
78
79
|
let n = l(e), r = t.get(n);
|
|
79
80
|
if (r !== void 0) return r;
|
|
80
81
|
t.set(n, n);
|
|
81
|
-
let i =
|
|
82
|
+
let i = tt(n, t);
|
|
82
83
|
return t.set(n, i), i;
|
|
83
|
-
},
|
|
84
|
+
}, tt = (e, t) => {
|
|
84
85
|
if (ArrayBuffer.isView(e) || e instanceof ArrayBuffer) return e;
|
|
85
86
|
if (e instanceof Map) {
|
|
86
87
|
let n = !1, r = [];
|
|
87
88
|
for (let [i, a] of e) {
|
|
88
|
-
let e =
|
|
89
|
+
let e = H(i, t), o = H(a, t);
|
|
89
90
|
(e !== i || o !== a) && (n = !0), r.push([e, o]);
|
|
90
91
|
}
|
|
91
92
|
return n ? new Map(r) : e;
|
|
@@ -93,14 +94,14 @@ var tt = (e) => B(e, /* @__PURE__ */ new Map()), B = (e, t) => {
|
|
|
93
94
|
if (e instanceof Set) {
|
|
94
95
|
let n = !1, r = [];
|
|
95
96
|
for (let i of e) {
|
|
96
|
-
let e =
|
|
97
|
+
let e = H(i, t);
|
|
97
98
|
e !== i && (n = !0), r.push(e);
|
|
98
99
|
}
|
|
99
100
|
return n ? new Set(r) : e;
|
|
100
101
|
}
|
|
101
102
|
if (Array.isArray(e)) {
|
|
102
103
|
let n = !1, r = e.map((e) => {
|
|
103
|
-
let r =
|
|
104
|
+
let r = H(e, t);
|
|
104
105
|
return r !== e && (n = !0), r;
|
|
105
106
|
});
|
|
106
107
|
return n ? r : e;
|
|
@@ -108,15 +109,15 @@ var tt = (e) => B(e, /* @__PURE__ */ new Map()), B = (e, t) => {
|
|
|
108
109
|
let n = Object.getOwnPropertyDescriptors(e), r = !1;
|
|
109
110
|
for (let e of Reflect.ownKeys(n)) {
|
|
110
111
|
let i = Reflect.get(n, e);
|
|
111
|
-
if (!
|
|
112
|
-
let a =
|
|
112
|
+
if (!U(i)) continue;
|
|
113
|
+
let a = H(i.value, t);
|
|
113
114
|
a !== i.value && (r = !0, i.value = a);
|
|
114
115
|
}
|
|
115
116
|
if (!r) return e;
|
|
116
117
|
let i = Object.create(Reflect.getPrototypeOf(e), n);
|
|
117
118
|
return ve(i, e), i;
|
|
118
|
-
},
|
|
119
|
-
function
|
|
119
|
+
}, U = (e) => typeof e == "object" && !!e && "value" in e, nt = 24, rt = "User", it = [], at = [];
|
|
120
|
+
function ot(e) {
|
|
120
121
|
let t = e?.columnCount ?? 1;
|
|
121
122
|
if (t <= 1) return;
|
|
122
123
|
let n = {
|
|
@@ -126,7 +127,7 @@ function ct(e) {
|
|
|
126
127
|
};
|
|
127
128
|
return e?.separator !== void 0 && (n.separator = e.separator), n;
|
|
128
129
|
}
|
|
129
|
-
function
|
|
130
|
+
function st(e, t, n, r, i, a) {
|
|
130
131
|
if (!e) return;
|
|
131
132
|
let o = t ? {
|
|
132
133
|
...a,
|
|
@@ -134,16 +135,16 @@ function lt(e, t, n, r, i, a) {
|
|
|
134
135
|
} : a, s = t ? n?.getView(t) : null;
|
|
135
136
|
return s ? xe(s.state.doc, r, i, o) : Se(e, r, i, o);
|
|
136
137
|
}
|
|
137
|
-
function
|
|
138
|
+
function ct(e, t, n, r, i) {
|
|
138
139
|
if (!e || e.size === 0) return;
|
|
139
140
|
let a = /* @__PURE__ */ new Map();
|
|
140
141
|
for (let [o, s] of e) {
|
|
141
|
-
let e =
|
|
142
|
+
let e = st(s, o, t, n, r, i);
|
|
142
143
|
e && a.set(o, e);
|
|
143
144
|
}
|
|
144
145
|
return a.size > 0 ? a : void 0;
|
|
145
146
|
}
|
|
146
|
-
function
|
|
147
|
+
function lt(e, t, n) {
|
|
147
148
|
let r = /* @__PURE__ */ new Map();
|
|
148
149
|
if (!n || !n.package.footnotes) return r;
|
|
149
150
|
let i = /* @__PURE__ */ new Map();
|
|
@@ -169,7 +170,7 @@ function dt(e, t, n) {
|
|
|
169
170
|
}
|
|
170
171
|
return r;
|
|
171
172
|
}
|
|
172
|
-
var
|
|
173
|
+
var W = /* @__PURE__ */ new Set([
|
|
173
174
|
"black",
|
|
174
175
|
"blue",
|
|
175
176
|
"cyan",
|
|
@@ -188,190 +189,190 @@ var V = /* @__PURE__ */ new Set([
|
|
|
188
189
|
"white",
|
|
189
190
|
"yellow"
|
|
190
191
|
]);
|
|
191
|
-
function
|
|
192
|
+
function ut(e) {
|
|
192
193
|
let t = [], n = (e, r) => {
|
|
193
|
-
for (let [n, i] of e.marks.entries()) i.type.name === "highlight" && !
|
|
194
|
+
for (let [n, i] of e.marks.entries()) i.type.name === "highlight" && !W.has(String(i.attrs.color)) && t.push(`${r}.marks[${n}]=${JSON.stringify(i.attrs)}`);
|
|
194
195
|
e.forEach((e, t, i) => {
|
|
195
196
|
n(e, `${r}.content[${i}]`);
|
|
196
197
|
});
|
|
197
198
|
};
|
|
198
199
|
return n(e, "doc"), t.join("; ");
|
|
199
200
|
}
|
|
200
|
-
function
|
|
201
|
-
let { hiddenContainer: t, hiddenHeaderFooterContainer: n, noteEditorContainer: r, pagesContainer: a, readOnly: o = !1, pageGap: l =
|
|
202
|
-
let e =
|
|
201
|
+
function G(e) {
|
|
202
|
+
let { hiddenContainer: t, hiddenHeaderFooterContainer: n, noteEditorContainer: r, pagesContainer: a, readOnly: o = !1, pageGap: l = nt, pageRenderer: f, markupView: ee = "all-markup", showCommentHighlights: g = !0, altChunkMarkerText: _, showMarginGuides: v, marginGuideColor: b, password: x, editorMode: w, author: ve, externalPlugins: be = [], historyShortcuts: xe = "editor", onCanonicalHistory: Se, onCanonicalHistoryDrop: Ne, collaboration: Pe, getAnonymizationTerms: Fe, getDerivedFields: Ie, showTemplateDirectives: Le, onSlashMenuChange: Re, onSlashMenuKeyAction: ze, onChange: Be, onError: k, onSelectionUpdate: Ve, onEditorViewReady: He, onCopy: Ue, onCut: A, onPaste: We, onReadOnlyEditAttempt: Ge, featureFlags: Ke, onSelectiveSaveTripwire: qe } = e, Je = n ?? t, Ye = () => u(ve) ?? rt, j = c(null), Xe = () => {
|
|
203
|
+
let e = j.value;
|
|
203
204
|
return (e && y(e).package.styles) ?? null;
|
|
204
|
-
},
|
|
205
|
-
let t =
|
|
206
|
-
|
|
207
|
-
},
|
|
208
|
-
|
|
209
|
-
let
|
|
210
|
-
onChange: (e) =>
|
|
211
|
-
onKeyAction: (e) =>
|
|
212
|
-
}),
|
|
213
|
-
function
|
|
205
|
+
}, Ze = c(null), M = 0, N = !1, P = 0, F = !1, I = c(null), L = c(null), Qe = () => u(Pe), R = c([]), z = c(null), B = c(null), V = c(null), $e = s(0), H = c([]), tt = c([]), U = s(!1), W = s(null), G = s(!1), dt = (e) => ye(e), ft = (e) => {
|
|
206
|
+
let t = dt(e);
|
|
207
|
+
Be?.(t), q.emit("docChange", t);
|
|
208
|
+
}, K = new De(Oe({ historyShortcuts: xe }));
|
|
209
|
+
K.buildSchema(), K.initializeRuntime();
|
|
210
|
+
let pt = ke(), mt = je({
|
|
211
|
+
onChange: (e) => Re?.(e),
|
|
212
|
+
onKeyAction: (e) => ze?.(e) ?? !1
|
|
213
|
+
}), ht = Ae(), gt = () => u(Le) === !0;
|
|
214
|
+
function _t() {
|
|
214
215
|
return [
|
|
215
|
-
...
|
|
216
|
-
...
|
|
217
|
-
|
|
216
|
+
...be,
|
|
217
|
+
...gt() ? [pt, mt] : [],
|
|
218
|
+
ht
|
|
218
219
|
];
|
|
219
220
|
}
|
|
220
|
-
let
|
|
221
|
+
let q = ae(), J = new Ee(), Y = pe(), vt = le({
|
|
221
222
|
relayout: () => {
|
|
222
|
-
let e =
|
|
223
|
-
e &&
|
|
223
|
+
let e = I.value?.state ?? Y.lastEditorState;
|
|
224
|
+
e && Z(e, { reason: "hyphenation-ready" });
|
|
224
225
|
},
|
|
225
|
-
onError: (e) =>
|
|
226
|
+
onError: (e) => k?.(e)
|
|
226
227
|
});
|
|
227
|
-
i(
|
|
228
|
-
measuredFontSet: () =>
|
|
228
|
+
i(vt.cancel), i(se({
|
|
229
|
+
measuredFontSet: () => Y.lastMeasureInputs?.fontSet ?? null,
|
|
229
230
|
relayout: () => {
|
|
230
|
-
if (
|
|
231
|
-
let e =
|
|
232
|
-
e &&
|
|
231
|
+
if (F) return;
|
|
232
|
+
let e = I.value?.state ?? Y.lastEditorState;
|
|
233
|
+
e && Z(e, { reason: "font-ready" });
|
|
233
234
|
}
|
|
234
235
|
}));
|
|
235
|
-
let
|
|
236
|
+
let yt = new we({
|
|
236
237
|
pageGap: l,
|
|
237
238
|
showShadow: !0
|
|
238
|
-
}),
|
|
239
|
-
getHost: () =>
|
|
239
|
+
}), bt = ce({
|
|
240
|
+
getHost: () => Je.value,
|
|
240
241
|
getReadOnly: () => u(o),
|
|
241
242
|
getCanonicalApi: () => $.api,
|
|
242
243
|
readCanonicalDocument: () => $.readCanonicalDocument(),
|
|
243
244
|
onSessionRefusal: (e, t, n) => {
|
|
244
|
-
|
|
245
|
+
W.value = e, k?.(n ?? new p({
|
|
245
246
|
ground: t,
|
|
246
247
|
message: e
|
|
247
248
|
}));
|
|
248
249
|
},
|
|
249
|
-
getStyles:
|
|
250
|
+
getStyles: Xe,
|
|
250
251
|
onTransaction: ({ rId: e, kind: t, view: n, docChanged: r, selectionChanged: i }) => {
|
|
251
|
-
if (r && (
|
|
252
|
+
if (r && (G.value = !0, wt.schedule()), r || i) {
|
|
252
253
|
let { from: r, to: i } = n.state.selection;
|
|
253
|
-
|
|
254
|
+
z.value = {
|
|
254
255
|
from: r,
|
|
255
256
|
kind: t,
|
|
256
257
|
rId: e,
|
|
257
258
|
to: i
|
|
258
|
-
},
|
|
259
|
+
}, Ve?.(n.state), q.emit("selectionChange", {
|
|
259
260
|
from: r,
|
|
260
261
|
to: i
|
|
261
262
|
});
|
|
262
263
|
}
|
|
263
|
-
|
|
264
|
+
J.requestRender();
|
|
264
265
|
}
|
|
265
|
-
}),
|
|
266
|
+
}), X = me({
|
|
266
267
|
getHost: () => r?.value ?? null,
|
|
267
268
|
getCanonicalApi: () => $.api,
|
|
268
269
|
readCanonicalDocument: () => $.readCanonicalDocument(),
|
|
269
270
|
onSessionRefusal: (e, t, n) => {
|
|
270
|
-
|
|
271
|
+
W.value = e, k?.(n ?? new p({
|
|
271
272
|
ground: t,
|
|
272
273
|
message: e
|
|
273
274
|
}));
|
|
274
275
|
},
|
|
275
|
-
getStyles:
|
|
276
|
+
getStyles: Xe,
|
|
276
277
|
onTransaction: ({ docChanged: e, selectionChanged: t, view: n }) => {
|
|
277
278
|
if (e) {
|
|
278
|
-
|
|
279
|
-
let e =
|
|
280
|
-
e && (
|
|
279
|
+
G.value = !0;
|
|
280
|
+
let e = j.value;
|
|
281
|
+
e && (j.value = $.readCanonicalDocument() ?? e, Ot()), wt.schedule();
|
|
281
282
|
}
|
|
282
283
|
if (e || t) {
|
|
283
|
-
|
|
284
|
+
Ve?.(n.state);
|
|
284
285
|
let { from: e, to: t } = n.state.selection;
|
|
285
|
-
|
|
286
|
+
q.emit("selectionChange", {
|
|
286
287
|
from: e,
|
|
287
288
|
to: t
|
|
288
289
|
});
|
|
289
290
|
}
|
|
290
291
|
}
|
|
291
|
-
}),
|
|
292
|
-
|
|
292
|
+
}), xt = () => {
|
|
293
|
+
bt.sync(), X.sync();
|
|
293
294
|
};
|
|
294
|
-
function
|
|
295
|
-
e.layout && (
|
|
295
|
+
function St(e) {
|
|
296
|
+
e.layout && (V.value = e.layout), e.blocks && (H.value = e.blocks), e.measures && (tt.value = e.measures), e.blockLookup && yt.setBlockLookup(e.blockLookup), e.layout && q.emit("layoutComplete", e.layout);
|
|
296
297
|
}
|
|
297
|
-
let
|
|
298
|
+
let Ct = ie({
|
|
298
299
|
onReady: () => {
|
|
299
|
-
if (
|
|
300
|
-
let e =
|
|
301
|
-
e &&
|
|
300
|
+
if (N || u(f) !== O.displayList) return;
|
|
301
|
+
let e = I.value;
|
|
302
|
+
e && Z(e.state, { reason: "layout-input" });
|
|
302
303
|
},
|
|
303
304
|
onError: (e) => {
|
|
304
|
-
!
|
|
305
|
+
!N && u(f) === O.displayList && k?.(e);
|
|
305
306
|
}
|
|
306
307
|
});
|
|
307
|
-
function
|
|
308
|
-
if (
|
|
309
|
-
let n = u(f), r = n ===
|
|
310
|
-
if (n ===
|
|
311
|
-
let i = a.value, o = i instanceof HTMLDivElement ? i : null, s =
|
|
312
|
-
|
|
313
|
-
let
|
|
308
|
+
function Z(e, t = {}) {
|
|
309
|
+
if (F) return;
|
|
310
|
+
let n = u(f), r = n === O.displayList ? Ct() : void 0;
|
|
311
|
+
if (n === O.displayList && !r) return;
|
|
312
|
+
let i = a.value, o = i instanceof HTMLDivElement ? i : null, s = j.value, c = s && y(s), d = c?.package.document, p = d?.sections?.[0]?.properties ?? d?.finalSectionProperties ?? null, m = ne(p), h = te(p), x = ot(p), re = m.w - h.left - h.right;
|
|
313
|
+
$e.value = re;
|
|
314
|
+
let ie = c?.package.styles ?? null, S = s?.package.theme ?? null, C = s?.package.settings?.defaultTabStop, w = s?.package.settings?.mirrorMargins === !0, T = Me(c?.package);
|
|
314
315
|
try {
|
|
315
|
-
|
|
316
|
-
contentWidth:
|
|
317
|
-
columns:
|
|
316
|
+
St(ue({
|
|
317
|
+
contentWidth: re,
|
|
318
|
+
columns: x,
|
|
318
319
|
pageSize: m,
|
|
319
320
|
margins: h,
|
|
320
321
|
pageGap: l,
|
|
321
322
|
showMarginGuides: u(v) === !0,
|
|
322
323
|
marginGuideColor: u(b),
|
|
323
324
|
...r ? { displayListPagePainter: r } : {},
|
|
324
|
-
syncCoordinator:
|
|
325
|
-
headerContent:
|
|
326
|
-
footerContent:
|
|
327
|
-
firstPageHeaderContent:
|
|
328
|
-
firstPageFooterContent:
|
|
329
|
-
headerContentRId:
|
|
330
|
-
footerContentRId:
|
|
331
|
-
firstPageHeaderContentRId:
|
|
332
|
-
firstPageFooterContentRId:
|
|
325
|
+
syncCoordinator: J,
|
|
326
|
+
headerContent: T.headerContent,
|
|
327
|
+
footerContent: T.footerContent,
|
|
328
|
+
firstPageHeaderContent: T.firstPageHeaderContent,
|
|
329
|
+
firstPageFooterContent: T.firstPageFooterContent,
|
|
330
|
+
headerContentRId: T.activeHeaderRId,
|
|
331
|
+
footerContentRId: T.activeFooterRId,
|
|
332
|
+
firstPageHeaderContentRId: T.activeFirstHeaderRId,
|
|
333
|
+
firstPageFooterContentRId: T.activeFirstFooterRId,
|
|
333
334
|
sectionHeaderFooterRefs: Ce(c),
|
|
334
|
-
theme:
|
|
335
|
+
theme: S,
|
|
335
336
|
sectionProperties: p,
|
|
336
337
|
document: s,
|
|
337
|
-
defaultTabStop:
|
|
338
|
-
mirrorMargins:
|
|
339
|
-
styles:
|
|
340
|
-
layout:
|
|
341
|
-
hfPMs:
|
|
342
|
-
painter:
|
|
338
|
+
defaultTabStop: C,
|
|
339
|
+
mirrorMargins: w,
|
|
340
|
+
styles: ie,
|
|
341
|
+
layout: V.value,
|
|
342
|
+
hfPMs: bt,
|
|
343
|
+
painter: yt,
|
|
343
344
|
pagesContainer: o,
|
|
344
|
-
session:
|
|
345
|
-
renderHfFromContentOrPm:
|
|
346
|
-
renderHeaderFooterContentByRId:
|
|
345
|
+
session: Y,
|
|
346
|
+
renderHfFromContentOrPm: st,
|
|
347
|
+
renderHeaderFooterContentByRId: ct,
|
|
347
348
|
readFontSetSignature: oe,
|
|
348
|
-
buildFootnoteRenderItems:
|
|
349
|
-
describeInvalidHighlightMarks:
|
|
350
|
-
emptyTemplatePreviewEntries:
|
|
351
|
-
emptyTemplatePreviewHidden:
|
|
352
|
-
hyphenationReadiness:
|
|
349
|
+
buildFootnoteRenderItems: lt,
|
|
350
|
+
describeInvalidHighlightMarks: ut,
|
|
351
|
+
emptyTemplatePreviewEntries: it,
|
|
352
|
+
emptyTemplatePreviewHidden: at,
|
|
353
|
+
hyphenationReadiness: vt,
|
|
353
354
|
markupView: u(ee),
|
|
354
355
|
showCommentHighlights: u(g),
|
|
355
356
|
..._ === void 0 ? {} : { altChunkMarkerText: u(_) }
|
|
356
357
|
}, e, t));
|
|
357
358
|
} catch (e) {
|
|
358
359
|
let t = e instanceof Error ? e : Error(String(e));
|
|
359
|
-
|
|
360
|
+
k?.(t);
|
|
360
361
|
}
|
|
361
362
|
}
|
|
362
|
-
let
|
|
363
|
-
readState: () =>
|
|
364
|
-
runLayout: (e, t) =>
|
|
365
|
-
...
|
|
363
|
+
let wt = fe({
|
|
364
|
+
readState: () => I.value?.state ?? null,
|
|
365
|
+
runLayout: (e, t) => Z(e, t),
|
|
366
|
+
...D,
|
|
366
367
|
clock: de
|
|
367
368
|
}), Q = null;
|
|
368
369
|
function Tt() {
|
|
369
|
-
if (Q !== null && (window.clearTimeout(Q), Q = null),
|
|
370
|
+
if (Q !== null && (window.clearTimeout(Q), Q = null), I.value && j.value) try {
|
|
370
371
|
let e = $.readCanonicalDocument();
|
|
371
372
|
if (!e) return;
|
|
372
|
-
|
|
373
|
+
j.value = e, xt(), Dt(), ft(e);
|
|
373
374
|
} catch (e) {
|
|
374
|
-
|
|
375
|
+
k?.(e instanceof Error ? e : Error(String(e)));
|
|
375
376
|
}
|
|
376
377
|
}
|
|
377
378
|
let Et = null;
|
|
@@ -381,212 +382,212 @@ function H(e) {
|
|
|
381
382
|
function Ot() {
|
|
382
383
|
Dt(), Et = window.setTimeout(() => {
|
|
383
384
|
if (Et = null, Q !== null) return;
|
|
384
|
-
let e =
|
|
385
|
-
e &&
|
|
386
|
-
},
|
|
385
|
+
let e = j.value;
|
|
386
|
+
e && ft(e);
|
|
387
|
+
}, S);
|
|
387
388
|
}
|
|
388
389
|
function kt() {
|
|
389
390
|
Q !== null && window.clearTimeout(Q), Q = window.setTimeout(() => {
|
|
390
391
|
Q = null, Tt();
|
|
391
|
-
},
|
|
392
|
+
}, S);
|
|
392
393
|
}
|
|
393
394
|
let $ = m({
|
|
394
395
|
getHost: () => t.value,
|
|
395
|
-
getDocument: () =>
|
|
396
|
-
getStyles:
|
|
397
|
-
getExtensionManager: () =>
|
|
398
|
-
getExternalPlugins:
|
|
399
|
-
getAnonymizationTerms: () =>
|
|
400
|
-
getDerivedFields: () =>
|
|
401
|
-
getCanonicalRoom:
|
|
396
|
+
getDocument: () => j.value,
|
|
397
|
+
getStyles: Xe,
|
|
398
|
+
getExtensionManager: () => K,
|
|
399
|
+
getExternalPlugins: _t,
|
|
400
|
+
getAnonymizationTerms: () => Fe?.() ?? re,
|
|
401
|
+
getDerivedFields: () => Ie?.(),
|
|
402
|
+
getCanonicalRoom: Qe,
|
|
402
403
|
getReadOnly: () => u(o),
|
|
403
|
-
getHistoryShortcuts: () =>
|
|
404
|
-
onCanonicalHistory: (e) =>
|
|
405
|
-
onCanonicalHistoryDrop: (e) =>
|
|
406
|
-
getEditingMode: () => u(
|
|
407
|
-
getSuggestionAuthor:
|
|
404
|
+
getHistoryShortcuts: () => xe,
|
|
405
|
+
onCanonicalHistory: (e) => Se?.(e),
|
|
406
|
+
onCanonicalHistoryDrop: (e) => Ne?.(e),
|
|
407
|
+
getEditingMode: () => u(w) ?? "editing",
|
|
408
|
+
getSuggestionAuthor: Ye,
|
|
408
409
|
onSessionRefusal: (e, t, n) => {
|
|
409
|
-
|
|
410
|
+
k?.(n ?? new p({
|
|
410
411
|
ground: t,
|
|
411
412
|
message: e
|
|
412
413
|
}));
|
|
413
414
|
},
|
|
414
|
-
getDocumentIdentity: () => String(
|
|
415
|
-
getDocumentContext: () =>
|
|
415
|
+
getDocumentIdentity: () => String(M),
|
|
416
|
+
getDocumentContext: () => j.value,
|
|
416
417
|
onTransaction: jt,
|
|
417
418
|
onCanonicalCompositionLayout: Mt,
|
|
418
|
-
getEmbeddedFontFamilyMap: () =>
|
|
419
|
+
getEmbeddedFontFamilyMap: () => Y.embeddedFontFamilyMap,
|
|
419
420
|
onSelectionChange: (e) => {
|
|
420
|
-
|
|
421
|
+
L.value = e, Ve?.(e), q.emit("selectionChange", {
|
|
421
422
|
from: e.selection.from,
|
|
422
423
|
to: e.selection.to
|
|
423
424
|
});
|
|
424
425
|
},
|
|
425
426
|
onKeyDown: () => !1,
|
|
426
|
-
onCopy: () =>
|
|
427
|
-
onCut: () =>
|
|
428
|
-
onPaste: () =>
|
|
429
|
-
onReadOnlyEditAttempt: () =>
|
|
427
|
+
onCopy: () => Ue?.(),
|
|
428
|
+
onCut: () => A?.(),
|
|
429
|
+
onPaste: () => We?.(),
|
|
430
|
+
onReadOnlyEditAttempt: () => Ge?.(),
|
|
430
431
|
onEditorViewReady: Nt,
|
|
431
432
|
onEditorViewDestroy: () => {
|
|
432
|
-
|
|
433
|
+
I.value = null, U.value = !1, He?.(null);
|
|
433
434
|
},
|
|
434
435
|
onRemoteSelectionsChange: (e) => {
|
|
435
|
-
|
|
436
|
+
R.value = e;
|
|
436
437
|
}
|
|
437
438
|
}), At = $.api.autocomplete.subscribe((t) => e.onAutocompleteChange?.(t));
|
|
438
|
-
d(() => u(
|
|
439
|
-
|
|
439
|
+
d(() => u(Pe), () => {
|
|
440
|
+
R.value = [], $.retryViewCreation(), $.syncExternalDocument();
|
|
440
441
|
}, { immediate: !0 });
|
|
441
442
|
function jt({ newState: e, docChanged: t }) {
|
|
442
|
-
if (
|
|
443
|
+
if (L.value = e, t) {
|
|
443
444
|
let e = $.readCanonicalDocument();
|
|
444
|
-
e && (
|
|
445
|
+
e && (j.value = e, xt()), G.value = !0, J.incrementStateSeq(), wt.schedule(), kt();
|
|
445
446
|
}
|
|
446
|
-
|
|
447
|
+
J.requestRender();
|
|
447
448
|
}
|
|
448
449
|
function Mt() {
|
|
449
|
-
let e =
|
|
450
|
-
e && (
|
|
450
|
+
let e = I.value;
|
|
451
|
+
e && (L.value = e.state), J.incrementStateSeq(), wt.schedule(), J.requestRender();
|
|
451
452
|
}
|
|
452
453
|
function Nt(e) {
|
|
453
|
-
|
|
454
|
-
let t =
|
|
455
|
-
|
|
454
|
+
I.value = e, L.value = e.state, U.value = !0;
|
|
455
|
+
let t = j.value, n = M, r = ++P;
|
|
456
|
+
F = !0;
|
|
456
457
|
let i = () => {
|
|
457
|
-
|
|
458
|
+
P === r && (F = !1, N || M !== n || $.getView() !== e || (Z(e.state, { reason: "initial" }), J.requestRender()));
|
|
458
459
|
};
|
|
459
|
-
|
|
460
|
-
|
|
460
|
+
E(t, e.state.doc).then(i, i), He?.(e), u(o) || requestAnimationFrame(() => {
|
|
461
|
+
I.value === e && !e.hasFocus() && e.focus();
|
|
461
462
|
});
|
|
462
463
|
}
|
|
463
464
|
let Pt = {
|
|
464
465
|
getDocx: async (e) => {
|
|
465
466
|
let t = await Gt(e);
|
|
466
|
-
return t?.tripwireResult &&
|
|
467
|
+
return t?.tripwireResult && qe?.(t.tripwireResult), t?.buffer ?? null;
|
|
467
468
|
},
|
|
468
469
|
loadDocument: Ht,
|
|
469
470
|
loadDocx: Vt
|
|
470
|
-
}, Ft =
|
|
471
|
+
}, Ft = T({
|
|
471
472
|
getEditorApi: () => $.api,
|
|
472
|
-
getLayout: () =>
|
|
473
|
-
runLayout: (e, t) =>
|
|
473
|
+
getLayout: () => V.value,
|
|
474
|
+
runLayout: (e, t) => Z(e, t),
|
|
474
475
|
getDocumentIO: () => Pt,
|
|
475
|
-
emitter:
|
|
476
|
+
emitter: q
|
|
476
477
|
});
|
|
477
|
-
d([() => u(
|
|
478
|
-
Ft.setCanonicalMode(u(
|
|
478
|
+
d([() => u(w), Ye], () => {
|
|
479
|
+
Ft.setCanonicalMode(u(w) === "suggesting" ? {
|
|
479
480
|
type: "suggesting",
|
|
480
|
-
author:
|
|
481
|
+
author: Ye()
|
|
481
482
|
} : { type: "editing" });
|
|
482
483
|
}), d(() => u(o), (e) => {
|
|
483
|
-
$.syncEditable(), e && en(),
|
|
484
|
+
$.syncEditable(), e && en(), bt.sync();
|
|
484
485
|
});
|
|
485
486
|
function It(e) {
|
|
486
|
-
let t =
|
|
487
|
-
if (t === e.state.plugins.includes(
|
|
488
|
-
let n = e.state.plugins.filter((e) => e !==
|
|
487
|
+
let t = gt();
|
|
488
|
+
if (t === e.state.plugins.includes(pt)) return;
|
|
489
|
+
let n = e.state.plugins.filter((e) => e !== pt && e !== mt);
|
|
489
490
|
if (t) {
|
|
490
|
-
let e = n.indexOf(
|
|
491
|
-
n.splice(t, 0,
|
|
491
|
+
let e = n.indexOf(ht), t = e === -1 ? n.length : e;
|
|
492
|
+
n.splice(t, 0, pt, mt);
|
|
492
493
|
}
|
|
493
494
|
e.updateState(e.state.reconfigure({ plugins: n }));
|
|
494
495
|
}
|
|
495
|
-
d(() =>
|
|
496
|
-
let e =
|
|
496
|
+
d(() => gt(), () => {
|
|
497
|
+
let e = I.value;
|
|
497
498
|
e && It(e);
|
|
498
499
|
});
|
|
499
500
|
function Lt() {
|
|
500
501
|
$.ensureView();
|
|
501
502
|
}
|
|
502
503
|
function Rt() {
|
|
503
|
-
Dt(),
|
|
504
|
+
Dt(), M += 1, Ze.value = j.value?.originalBuffer ?? null, G.value = !1, z.value = null, B.value = null, X.activate(null), wt.dispose(), $.destroyView(), $.ensureView(), xt(), $.ensureView(), $.getView() || zt();
|
|
504
505
|
}
|
|
505
506
|
function zt() {
|
|
506
|
-
let e =
|
|
507
|
+
let e = j.value;
|
|
507
508
|
if (e) try {
|
|
508
509
|
let t = h({
|
|
509
510
|
document: e,
|
|
510
511
|
styles: y(e).package.styles ?? null,
|
|
511
|
-
manager:
|
|
512
|
-
externalPlugins:
|
|
512
|
+
manager: K,
|
|
513
|
+
externalPlugins: _t(),
|
|
513
514
|
reason: "mount"
|
|
514
515
|
});
|
|
515
|
-
|
|
516
|
-
let n =
|
|
517
|
-
|
|
516
|
+
L.value = t;
|
|
517
|
+
let n = M, r = ++P;
|
|
518
|
+
F = !0;
|
|
518
519
|
let i = () => {
|
|
519
|
-
|
|
520
|
+
P === r && (F = !1, N || M !== n || j.value !== e || $.getView() || Z(t, { reason: "initial" }));
|
|
520
521
|
};
|
|
521
|
-
|
|
522
|
+
E(e, t.doc).then(i, i);
|
|
522
523
|
} catch (e) {
|
|
523
|
-
|
|
524
|
+
k?.(e instanceof Error ? e : Error(String(e)));
|
|
524
525
|
}
|
|
525
526
|
}
|
|
526
527
|
d([
|
|
527
528
|
t,
|
|
528
529
|
a,
|
|
529
|
-
|
|
530
|
+
Je,
|
|
530
531
|
...r ? [r] : []
|
|
531
532
|
], () => {
|
|
532
|
-
t.value &&
|
|
533
|
+
t.value && j.value && !$.getView() && Lt(), xt();
|
|
533
534
|
}, { flush: "post" });
|
|
534
535
|
let Bt = 0;
|
|
535
536
|
async function Vt(e) {
|
|
536
|
-
Bt += 1,
|
|
537
|
+
Bt += 1, W.value = null, U.value = !1;
|
|
537
538
|
try {
|
|
538
|
-
let t = await ge(e, { password: u(
|
|
539
|
+
let t = await ge(e, { password: u(x) });
|
|
539
540
|
if (t.isErr()) throw t.error;
|
|
540
541
|
let n = t.value.document;
|
|
541
|
-
|
|
542
|
+
j.value = n, Rt();
|
|
542
543
|
} catch (e) {
|
|
543
544
|
let t = e instanceof Error ? e : Error(String(e));
|
|
544
|
-
|
|
545
|
+
W.value = t.message, k?.(t);
|
|
545
546
|
}
|
|
546
547
|
}
|
|
547
548
|
function Ht(e) {
|
|
548
549
|
let t = Bt += 1;
|
|
549
|
-
|
|
550
|
-
let n =
|
|
550
|
+
W.value = null;
|
|
551
|
+
let n = et(e);
|
|
551
552
|
he(n) ? Wt(n) : Ut(n, t);
|
|
552
553
|
}
|
|
553
554
|
async function Ut(e, t) {
|
|
554
555
|
let n = await _e(e);
|
|
555
|
-
t === Bt && (n.isErr() ? (
|
|
556
|
+
t === Bt && (n.isErr() ? (W.value = n.error.message, k?.(n.error)) : Wt(n.value));
|
|
556
557
|
}
|
|
557
558
|
function Wt(e) {
|
|
558
|
-
|
|
559
|
+
j.value = e, Rt();
|
|
559
560
|
}
|
|
560
561
|
async function Gt(e) {
|
|
561
|
-
let t =
|
|
562
|
+
let t = I.value, n = j.value;
|
|
562
563
|
if (!t || !n) return null;
|
|
563
564
|
try {
|
|
564
565
|
let t = $.api.captureCanonicalSave();
|
|
565
566
|
if (t) {
|
|
566
|
-
let n = u(
|
|
567
|
+
let n = u(Ke), { canonicalSaveDiagnosticError: r, serializeCanonicalSave: i } = await import("@stll/folio-core/docx/canonicalSave"), a = await i({
|
|
567
568
|
snapshot: t,
|
|
568
569
|
options: e,
|
|
569
570
|
featureFlags: n
|
|
570
571
|
});
|
|
571
|
-
for (let t of a.diagnostics) e?.onDiagnostic ||
|
|
572
|
+
for (let t of a.diagnostics) e?.onDiagnostic || k?.(r(t));
|
|
572
573
|
return a;
|
|
573
574
|
}
|
|
574
575
|
return null;
|
|
575
576
|
} catch (e) {
|
|
576
|
-
return
|
|
577
|
+
return k?.(e instanceof Error ? e : Error(String(e))), null;
|
|
577
578
|
}
|
|
578
579
|
}
|
|
579
580
|
async function Kt(e) {
|
|
580
|
-
let t =
|
|
581
|
+
let t = I.value, n = t?.state, r = await Gt({
|
|
581
582
|
onDiagnostic: e?.onDiagnostic,
|
|
582
583
|
onSelectiveDecline: e?.onSelectiveDecline,
|
|
583
584
|
onSerializationPath: e?.onSerializationPath,
|
|
584
|
-
mode: e?.selective === !1 ?
|
|
585
|
+
mode: e?.selective === !1 ? C.full : C.preferSelective
|
|
585
586
|
});
|
|
586
|
-
return r ? (
|
|
587
|
+
return r ? (I.value === t && t?.state.doc === n?.doc && (r.version === void 0 || $.api.isCanonicalSaveCurrent(r.version)) && (r.version !== void 0 && $.api.markCanonicalSaved(r.version, {
|
|
587
588
|
buffer: r.buffer,
|
|
588
589
|
path: r.path
|
|
589
|
-
}),
|
|
590
|
+
}), j.value = r.document, xt(), G.value = !1), r.tripwireResult && qe?.(r.tripwireResult), new Blob([r.buffer], { type: "application/vnd.openxmlformats-officedocument.wordprocessingml.document" })) : null;
|
|
590
591
|
}
|
|
591
592
|
function qt() {
|
|
592
593
|
return $.readCanonicalDocument();
|
|
@@ -596,38 +597,38 @@ function H(e) {
|
|
|
596
597
|
}
|
|
597
598
|
function Yt() {
|
|
598
599
|
let e = Jt();
|
|
599
|
-
return e &&
|
|
600
|
+
return e && dt(e);
|
|
600
601
|
}
|
|
601
602
|
function Xt(e) {
|
|
602
603
|
Ht(e);
|
|
603
604
|
}
|
|
604
605
|
function Zt(e) {
|
|
605
|
-
return
|
|
606
|
+
return bt.getView(e);
|
|
606
607
|
}
|
|
607
608
|
function Qt() {
|
|
608
|
-
|
|
609
|
+
xt();
|
|
609
610
|
}
|
|
610
611
|
function $t(e) {
|
|
611
|
-
let t =
|
|
612
|
-
t && (
|
|
612
|
+
let t = X.activate(e);
|
|
613
|
+
t && (B.value = e, requestAnimationFrame(() => t.focus()));
|
|
613
614
|
}
|
|
614
615
|
function en() {
|
|
615
|
-
|
|
616
|
+
X.activate(null), B.value = null;
|
|
616
617
|
}
|
|
617
618
|
function tn() {
|
|
618
|
-
let e =
|
|
619
|
-
return e ?
|
|
619
|
+
let e = B.value;
|
|
620
|
+
return e ? X.getView(e) : null;
|
|
620
621
|
}
|
|
621
622
|
function nn() {
|
|
622
|
-
return
|
|
623
|
+
return K.getCommands();
|
|
623
624
|
}
|
|
624
625
|
function rn() {
|
|
625
626
|
let e = tn();
|
|
626
|
-
e ? e.focus() :
|
|
627
|
+
e ? e.focus() : I.value?.focus();
|
|
627
628
|
}
|
|
628
629
|
function an() {
|
|
629
|
-
let e =
|
|
630
|
-
e &&
|
|
630
|
+
let e = I.value;
|
|
631
|
+
e && Z(e.state, { reason: "manual" });
|
|
631
632
|
}
|
|
632
633
|
d([
|
|
633
634
|
() => u(v),
|
|
@@ -638,31 +639,31 @@ function H(e) {
|
|
|
638
639
|
() => u(_)
|
|
639
640
|
], () => an());
|
|
640
641
|
function on() {
|
|
641
|
-
|
|
642
|
+
N = !0, a.value && Te(a.value), P += 1, F = !1, wt.dispose(), Q !== null && (window.clearTimeout(Q), Q = null), Dt(), $.destroyView(), R.value = [], bt.destroy(), X.destroy(), K.destroy(), L.value = null, V.value = null, j.value = null, Ze.value = null, U.value = !1;
|
|
642
643
|
}
|
|
643
644
|
return i(() => {
|
|
644
645
|
on(), At();
|
|
645
646
|
}), {
|
|
646
647
|
setEmbeddedFontFamilies: (e) => {
|
|
647
|
-
e ?
|
|
648
|
+
e ? Y.embeddedFontFamilyMap = new Map(e) : delete Y.embeddedFontFamilyMap, $.refreshFonts();
|
|
648
649
|
},
|
|
649
650
|
editor: Ft,
|
|
650
|
-
editorView:
|
|
651
|
-
editorState:
|
|
652
|
-
remoteSelections:
|
|
653
|
-
headerFooterSelection:
|
|
654
|
-
activeNoteStory:
|
|
655
|
-
isReady:
|
|
656
|
-
isDirty:
|
|
657
|
-
parseError:
|
|
658
|
-
modelDocument:
|
|
651
|
+
editorView: I,
|
|
652
|
+
editorState: L,
|
|
653
|
+
remoteSelections: R,
|
|
654
|
+
headerFooterSelection: z,
|
|
655
|
+
activeNoteStory: B,
|
|
656
|
+
isReady: U,
|
|
657
|
+
isDirty: G,
|
|
658
|
+
parseError: W,
|
|
659
|
+
modelDocument: j,
|
|
659
660
|
readDocumentModel: qt,
|
|
660
|
-
sourceBuffer:
|
|
661
|
-
hiddenEditorWidth:
|
|
662
|
-
layout:
|
|
663
|
-
blocks:
|
|
664
|
-
measures:
|
|
665
|
-
syncCoordinator:
|
|
661
|
+
sourceBuffer: Ze,
|
|
662
|
+
hiddenEditorWidth: $e,
|
|
663
|
+
layout: V,
|
|
664
|
+
blocks: H,
|
|
665
|
+
measures: tt,
|
|
666
|
+
syncCoordinator: J,
|
|
666
667
|
loadBuffer: Vt,
|
|
667
668
|
loadDocument: Ht,
|
|
668
669
|
save: Kt,
|
|
@@ -681,15 +682,15 @@ function H(e) {
|
|
|
681
682
|
};
|
|
682
683
|
}
|
|
683
684
|
// src/composables/useFindReplace.ts
|
|
684
|
-
function
|
|
685
|
-
let g = new
|
|
685
|
+
function dt({ editorView: t, pagesRef: n, getDocument: r, layout: a, commentRoot: l, revealComment: u, displayMode: f, readOnly: p, onReadonlyEditAttempt: m, onResultChange: h }) {
|
|
686
|
+
let g = new Ne(), _ = s(""), te = s(""), ne = o(ze()), v = c([]), y = s(-1), b = e(() => v.value.at(y.value) ?? null), x = () => ee({
|
|
686
687
|
editingMode: t.value?.editable === !1 ? "viewing" : "editing",
|
|
687
688
|
readOnlyProp: p.value,
|
|
688
689
|
displayMode: f.value
|
|
689
|
-
}),
|
|
690
|
+
}), re = e(x), ie = e(() => {
|
|
690
691
|
let e = b.value;
|
|
691
|
-
return
|
|
692
|
-
}),
|
|
692
|
+
return x() === null && !!t.value && !!e && ae() && Be(e).status === "allowed";
|
|
693
|
+
}), S = null, C, w = null, T = (e) => {
|
|
693
694
|
let n = t.value?.state.doc;
|
|
694
695
|
return {
|
|
695
696
|
query: _.value,
|
|
@@ -700,54 +701,54 @@ function U({ editorView: t, pagesRef: n, getDocument: r, layout: a, commentRoot:
|
|
|
700
701
|
},
|
|
701
702
|
document: e,
|
|
702
703
|
...n ? { bodyVersion: n } : {},
|
|
703
|
-
context: { renderedStories:
|
|
704
|
+
context: { renderedStories: Re(a.value) }
|
|
704
705
|
};
|
|
705
|
-
},
|
|
706
|
+
}, ae = () => {
|
|
706
707
|
let e = r();
|
|
707
|
-
return !!e &&
|
|
708
|
-
},
|
|
709
|
-
clearTimeout(
|
|
708
|
+
return !!e && Ve(w, k(T(e)));
|
|
709
|
+
}, oe = () => g.getResult(), E = () => h(oe()), se = () => {
|
|
710
|
+
clearTimeout(C), C = void 0;
|
|
711
|
+
}, ce = () => {
|
|
712
|
+
se(), g.clear(), S?.destroy(), S = null, v.value = [], w = null, y.value = -1;
|
|
710
713
|
}, le = () => {
|
|
711
|
-
ce(),
|
|
712
|
-
}, ue = () => {
|
|
713
|
-
|
|
714
|
-
}, de = (e) => (y.value = e, x?.navigate(e, u), T(), !0), E = (e = "query") => {
|
|
715
|
-
ce();
|
|
714
|
+
ce(), _.value = "", E();
|
|
715
|
+
}, ue = (e) => (y.value = e, S?.navigate(e, u), E(), !0), D = (e = "query") => {
|
|
716
|
+
se();
|
|
716
717
|
let i = r(), o = n.value, s = t.value?.state.doc;
|
|
717
|
-
if (!i || !_.value.trim()) return
|
|
718
|
-
let c =
|
|
718
|
+
if (!i || !_.value.trim()) return le(), [];
|
|
719
|
+
let c = T(i), u = Pe({
|
|
719
720
|
document: c.document,
|
|
720
721
|
state: t.value?.state ?? null,
|
|
721
722
|
searchText: c.query,
|
|
722
723
|
options: c.options,
|
|
723
724
|
context: c.context
|
|
724
725
|
});
|
|
725
|
-
if (u === null) return
|
|
726
|
-
let d =
|
|
727
|
-
return
|
|
726
|
+
if (u === null) return ce(), E(), [];
|
|
727
|
+
let d = k(c), f = e === "refresh" && w?.query === d.query, p = g.setMatches(u, f ? g.getResult()?.currentIndex ?? 0 : 0);
|
|
728
|
+
return w = d, v.value = u, y.value = u.length > 0 ? p.currentIndex : -1, S?.destroy(), S = o ? Le({
|
|
728
729
|
container: o,
|
|
729
730
|
document: i,
|
|
730
731
|
bodyDoc: s,
|
|
731
732
|
matches: u,
|
|
732
733
|
commentRoot: l?.value ?? void 0,
|
|
733
734
|
layout: a.value
|
|
734
|
-
}) : null,
|
|
735
|
-
},
|
|
736
|
-
|
|
737
|
-
},
|
|
735
|
+
}) : null, S?.paint(y.value), u.at(0) && !f ? ue(0) : E(), u;
|
|
736
|
+
}, de = () => {
|
|
737
|
+
se(), C = setTimeout(() => D("refresh"), 120);
|
|
738
|
+
}, fe = (e, t) => (_.value = e, Object.assign(ne, ze(), t), D(), oe()), pe = (e) => {
|
|
738
739
|
let t = g.goTo(e);
|
|
739
|
-
return t ?
|
|
740
|
-
},
|
|
740
|
+
return t ? ue(t.index) : !1;
|
|
741
|
+
}, me = (e) => {
|
|
741
742
|
let t = g.navigate(e);
|
|
742
|
-
return t ? (
|
|
743
|
-
},
|
|
744
|
-
let e =
|
|
743
|
+
return t ? (ue(t.index), t.match) : null;
|
|
744
|
+
}, O = () => !ae() && (D("refresh"), !0), he = () => {
|
|
745
|
+
let e = x();
|
|
745
746
|
return e !== null && (m?.(e), !0);
|
|
746
747
|
};
|
|
747
748
|
return d(f, () => {
|
|
748
|
-
_.value.trim() &&
|
|
749
|
+
_.value.trim() && D();
|
|
749
750
|
}), i(() => {
|
|
750
|
-
|
|
751
|
+
se(), S?.destroy();
|
|
751
752
|
}), {
|
|
752
753
|
searchText: _,
|
|
753
754
|
replaceText: te,
|
|
@@ -755,36 +756,36 @@ function U({ editorView: t, pagesRef: n, getDocument: r, layout: a, commentRoot:
|
|
|
755
756
|
matches: v,
|
|
756
757
|
currentIndex: y,
|
|
757
758
|
currentMatch: b,
|
|
758
|
-
canReplaceCurrent:
|
|
759
|
-
replacementRefusal:
|
|
760
|
-
performSearch:
|
|
761
|
-
scheduleSearch:
|
|
762
|
-
find:
|
|
763
|
-
getFindResult:
|
|
764
|
-
goToMatch:
|
|
765
|
-
findNext: () =>
|
|
766
|
-
findPrevious: () =>
|
|
759
|
+
canReplaceCurrent: ie,
|
|
760
|
+
replacementRefusal: re,
|
|
761
|
+
performSearch: D,
|
|
762
|
+
scheduleSearch: de,
|
|
763
|
+
find: fe,
|
|
764
|
+
getFindResult: oe,
|
|
765
|
+
goToMatch: pe,
|
|
766
|
+
findNext: () => me("next"),
|
|
767
|
+
findPrevious: () => me("previous"),
|
|
767
768
|
replaceCurrent: () => {
|
|
768
769
|
let e = t.value;
|
|
769
|
-
if (!e ||
|
|
770
|
+
if (!e || he() || O()) return !1;
|
|
770
771
|
let n = b.value;
|
|
771
|
-
if (!
|
|
772
|
-
let r = e.state.doc, i =
|
|
773
|
-
return e.state.doc !== r &&
|
|
772
|
+
if (!ie.value || !n) return !1;
|
|
773
|
+
let r = e.state.doc, i = Fe(e, n, te.value);
|
|
774
|
+
return e.state.doc !== r && D("refresh"), i;
|
|
774
775
|
},
|
|
775
776
|
replaceAll: () => {
|
|
776
777
|
let e = t.value, n = v.value.length;
|
|
777
|
-
if (!e ||
|
|
778
|
+
if (!e || he() || O()) return {
|
|
778
779
|
replacedCount: 0,
|
|
779
780
|
skippedCount: n
|
|
780
781
|
};
|
|
781
|
-
let r = e.state.doc, i =
|
|
782
|
-
return e.state.doc !== r &&
|
|
782
|
+
let r = e.state.doc, i = Ie(e, v.value, te.value);
|
|
783
|
+
return e.state.doc !== r && D(), i;
|
|
783
784
|
},
|
|
784
|
-
clear:
|
|
785
|
+
clear: le
|
|
785
786
|
};
|
|
786
787
|
}
|
|
787
|
-
function
|
|
788
|
+
function ft(e, t) {
|
|
788
789
|
if (t < e.top + 40) {
|
|
789
790
|
let n = Math.max(0, e.top + 40 - t);
|
|
790
791
|
return -Math.min(12, n / 40 * 12);
|
|
@@ -796,7 +797,7 @@ function pt(e, t) {
|
|
|
796
797
|
return 0;
|
|
797
798
|
}
|
|
798
799
|
// src/composables/useDragAutoScroll.ts
|
|
799
|
-
function
|
|
800
|
+
function K({ pagesContainer: e, onScrollExtendSelection: t }) {
|
|
800
801
|
let n = null, r = 0, a = 0, o = !1;
|
|
801
802
|
function s() {
|
|
802
803
|
return g(e.value);
|
|
@@ -808,7 +809,7 @@ function mt({ pagesContainer: e, onScrollExtendSelection: t }) {
|
|
|
808
809
|
if (!o) return;
|
|
809
810
|
let e = s();
|
|
810
811
|
if (!e) return;
|
|
811
|
-
let i =
|
|
812
|
+
let i = ft(e.getBoundingClientRect(), a);
|
|
812
813
|
i !== 0 && (_(e, i), t(r, a)), n = requestAnimationFrame(l);
|
|
813
814
|
}
|
|
814
815
|
function u() {
|
|
@@ -828,7 +829,7 @@ function mt({ pagesContainer: e, onScrollExtendSelection: t }) {
|
|
|
828
829
|
};
|
|
829
830
|
}
|
|
830
831
|
// src/composables/useTableResize.ts
|
|
831
|
-
function
|
|
832
|
+
function pt({ runCommand: e }) {
|
|
832
833
|
let t = {
|
|
833
834
|
active: !1,
|
|
834
835
|
startX: 0,
|
|
@@ -847,7 +848,7 @@ function W({ runCommand: e }) {
|
|
|
847
848
|
isEdge: !1,
|
|
848
849
|
tablePmStart: 0,
|
|
849
850
|
origHeight: 0,
|
|
850
|
-
minimumHeight:
|
|
851
|
+
minimumHeight: Ue
|
|
851
852
|
}, r = {
|
|
852
853
|
active: !1,
|
|
853
854
|
startX: 0,
|
|
@@ -861,15 +862,15 @@ function W({ runCommand: e }) {
|
|
|
861
862
|
}
|
|
862
863
|
function o(e, a) {
|
|
863
864
|
let o = e.target;
|
|
864
|
-
return o instanceof HTMLElement ? o.classList.contains("layout-table-resize-handle") ? (e.preventDefault(), e.stopPropagation(), i = a, t.active = !0, t.startX = e.clientX, t.handle = o, o.classList.add("dragging"), t.columnIndex = parseInt(o.dataset.columnIndex ?? "0", 10), t.tablePmStart = b(o) ?? 0,
|
|
865
|
+
return o instanceof HTMLElement ? o.classList.contains("layout-table-resize-handle") ? (e.preventDefault(), e.stopPropagation(), i = a, t.active = !0, t.startX = e.clientX, t.handle = o, o.classList.add("dragging"), t.columnIndex = parseInt(o.dataset.columnIndex ?? "0", 10), t.tablePmStart = b(o) ?? 0, mt(a, t), !0) : o.classList.contains("layout-table-row-resize-handle") || o.classList.contains("layout-table-edge-handle-bottom") ? (e.preventDefault(), e.stopPropagation(), i = a, n.active = !0, n.startY = e.clientY, n.handle = o, n.isEdge = o.dataset.isEdge === "bottom", o.classList.add("dragging"), n.rowIndex = parseInt(o.dataset.rowIndex ?? "0", 10), n.tablePmStart = b(o) ?? 0, ht(a, n, o), !0) : o.classList.contains("layout-table-edge-handle-right") ? (e.preventDefault(), e.stopPropagation(), i = a, r.active = !0, r.startX = e.clientX, r.handle = o, o.classList.add("dragging"), r.columnIndex = parseInt(o.dataset.columnIndex ?? "0", 10), r.tablePmStart = b(o) ?? 0, gt(a, r), !0) : !1 : !1;
|
|
865
866
|
}
|
|
866
867
|
function s(e) {
|
|
867
868
|
if (t.active && t.handle) {
|
|
868
869
|
e.preventDefault();
|
|
869
870
|
let n = e.clientX - t.startX, r = parseFloat(t.handle.style.left);
|
|
870
871
|
t.handle.style.left = `${r + n}px`, t.startX = e.clientX;
|
|
871
|
-
let i = Math.round(n *
|
|
872
|
-
a >=
|
|
872
|
+
let i = Math.round(n * A), a = t.origWidths.left + i, o = t.origWidths.right - i;
|
|
873
|
+
a >= He && o >= He && (t.origWidths = {
|
|
873
874
|
left: a,
|
|
874
875
|
right: o
|
|
875
876
|
});
|
|
@@ -877,31 +878,31 @@ function W({ runCommand: e }) {
|
|
|
877
878
|
e.preventDefault();
|
|
878
879
|
let t = e.clientY - n.startY, r = parseFloat(n.handle.style.top);
|
|
879
880
|
n.startY = e.clientY;
|
|
880
|
-
let i = Math.round(t *
|
|
881
|
+
let i = Math.round(t * A), a = We({
|
|
881
882
|
currentHeight: n.origHeight,
|
|
882
883
|
delta: i,
|
|
883
884
|
minimumHeight: n.minimumHeight
|
|
884
885
|
});
|
|
885
|
-
n.handle.style.top = `${r + a /
|
|
886
|
+
n.handle.style.top = `${r + a / A}px`, n.origHeight += a;
|
|
886
887
|
} else if (r.active && r.handle) {
|
|
887
888
|
e.preventDefault();
|
|
888
889
|
let t = e.clientX - r.startX, n = parseFloat(r.handle.style.left);
|
|
889
890
|
r.handle.style.left = `${n + t}px`, r.startX = e.clientX;
|
|
890
|
-
let i = Math.round(t *
|
|
891
|
-
a >=
|
|
891
|
+
let i = Math.round(t * A), a = r.origWidth + i;
|
|
892
|
+
a >= He && (r.origWidth = a);
|
|
892
893
|
}
|
|
893
894
|
}
|
|
894
895
|
function c(a) {
|
|
895
|
-
t.active ? (t.active = !1, t.handle?.classList.remove("dragging"), i && e(i,
|
|
896
|
+
t.active ? (t.active = !1, t.handle?.classList.remove("dragging"), i && e(i, Ge({
|
|
896
897
|
pmStart: t.tablePmStart,
|
|
897
898
|
colIdx: t.columnIndex,
|
|
898
899
|
newLeft: t.origWidths.left,
|
|
899
900
|
newRight: t.origWidths.right
|
|
900
|
-
})), t.handle = null) : n.active ? (n.active = !1, n.handle?.classList.remove("dragging"), i && e(i,
|
|
901
|
+
})), t.handle = null) : n.active ? (n.active = !1, n.handle?.classList.remove("dragging"), i && e(i, j({
|
|
901
902
|
pmStart: n.tablePmStart,
|
|
902
903
|
rowIdx: n.rowIndex,
|
|
903
904
|
newHeight: n.origHeight
|
|
904
|
-
})), n.handle = null) : r.active && (r.active = !1, r.handle?.classList.remove("dragging"), i && e(i,
|
|
905
|
+
})), n.handle = null) : r.active && (r.active = !1, r.handle?.classList.remove("dragging"), i && e(i, Ye({
|
|
905
906
|
pmStart: r.tablePmStart,
|
|
906
907
|
colIdx: r.columnIndex,
|
|
907
908
|
newWidth: r.origWidth
|
|
@@ -918,50 +919,52 @@ function W({ runCommand: e }) {
|
|
|
918
919
|
isResizing: a
|
|
919
920
|
};
|
|
920
921
|
}
|
|
921
|
-
function
|
|
922
|
-
let n =
|
|
922
|
+
function mt(e, t) {
|
|
923
|
+
let n = qe(e, t.tablePmStart, t.columnIndex);
|
|
923
924
|
n && (t.origWidths = n);
|
|
924
925
|
}
|
|
925
|
-
function
|
|
926
|
-
let r =
|
|
926
|
+
function ht(e, t, n) {
|
|
927
|
+
let r = Je(e, t.tablePmStart, t.rowIndex);
|
|
927
928
|
if (r != null) t.origHeight = r;
|
|
928
929
|
else {
|
|
929
930
|
let e = n.closest(".layout-table")?.querySelector(`[data-row-index="${t.rowIndex}"]`), r = e ? e.getBoundingClientRect().height : 30;
|
|
930
|
-
t.origHeight = Math.round(r *
|
|
931
|
+
t.origHeight = Math.round(r * A);
|
|
931
932
|
}
|
|
932
|
-
t.minimumHeight = Math.min(
|
|
933
|
+
t.minimumHeight = Math.min(Ue, t.origHeight);
|
|
933
934
|
}
|
|
934
|
-
function
|
|
935
|
-
let n =
|
|
935
|
+
function gt(e, t) {
|
|
936
|
+
let n = Ke(e, t.tablePmStart, t.columnIndex);
|
|
936
937
|
n != null && (t.origWidth = n);
|
|
937
938
|
}
|
|
938
939
|
// src/composables/useTrackedChanges.ts
|
|
939
|
-
function
|
|
940
|
+
function _t(t, n, r) {
|
|
940
941
|
return e(() => {
|
|
941
942
|
n.value;
|
|
942
|
-
let e = t.value?.state ?? null,
|
|
943
|
-
if (e === null) return
|
|
944
|
-
let
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
943
|
+
let e = t.value?.state ?? null, i = Ze(e);
|
|
944
|
+
if (e === null || !r) return i;
|
|
945
|
+
let a = x({
|
|
946
|
+
editor: r,
|
|
947
|
+
state: e,
|
|
948
|
+
story: w.MAIN,
|
|
949
|
+
target: {
|
|
950
|
+
type: "revisions",
|
|
951
|
+
ids: i.entries.flatMap(Xe)
|
|
952
|
+
}
|
|
953
|
+
});
|
|
954
|
+
if (a.accept.size === 0 && a.reject.size === 0) return i;
|
|
955
|
+
let o = i.entries;
|
|
956
|
+
for (let e of o) {
|
|
957
|
+
let t = Xe(e);
|
|
952
958
|
e.heldByLock = {
|
|
953
|
-
accept: t.some((e) =>
|
|
954
|
-
reject: t.some((e) =>
|
|
959
|
+
accept: t.some((e) => a.accept.has(e)),
|
|
960
|
+
reject: t.some((e) => a.reject.has(e))
|
|
955
961
|
};
|
|
956
962
|
}
|
|
957
|
-
return
|
|
958
|
-
...r,
|
|
959
|
-
entries: a
|
|
960
|
-
};
|
|
963
|
+
return i;
|
|
961
964
|
});
|
|
962
965
|
}
|
|
963
966
|
// src/composables/useZoom.ts
|
|
964
|
-
var
|
|
967
|
+
var q = N, J = M, Y = [
|
|
965
968
|
.5,
|
|
966
969
|
.75,
|
|
967
970
|
1,
|
|
@@ -969,16 +972,16 @@ var yt = A, G = $e, K = [
|
|
|
969
972
|
1.5,
|
|
970
973
|
2
|
|
971
974
|
];
|
|
972
|
-
function
|
|
973
|
-
let i = s(Math.max(
|
|
975
|
+
function vt(t = 1) {
|
|
976
|
+
let i = s(Math.max(q, Math.min(J, t))), a = e(() => Math.round(i.value * 100)), o = e(() => i.value <= q), c = e(() => i.value >= J);
|
|
974
977
|
function l(e) {
|
|
975
|
-
i.value = Math.max(
|
|
978
|
+
i.value = Math.max(q, Math.min(J, Math.round(e * 100) / 100));
|
|
976
979
|
}
|
|
977
980
|
function u() {
|
|
978
|
-
l(i.value +
|
|
981
|
+
l(i.value + P);
|
|
979
982
|
}
|
|
980
983
|
function d() {
|
|
981
|
-
l(i.value -
|
|
984
|
+
l(i.value - P);
|
|
982
985
|
}
|
|
983
986
|
function f() {
|
|
984
987
|
l(1);
|
|
@@ -1004,7 +1007,7 @@ function q(t = 1) {
|
|
|
1004
1007
|
handleWheel: p,
|
|
1005
1008
|
handleKeyDown: m,
|
|
1006
1009
|
installShortcuts: h,
|
|
1007
|
-
ZOOM_PRESETS:
|
|
1010
|
+
ZOOM_PRESETS: Y
|
|
1008
1011
|
};
|
|
1009
1012
|
}
|
|
1010
|
-
export {
|
|
1013
|
+
export { K as a, V as c, $e as d, pt as i, R as l, Ze as n, dt as o, _t as r, G as s, vt as t, B as u };
|