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