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