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