@stll/folio-vue 0.8.0 → 0.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/ListButtons-C1rU_Y1e.cjs +4 -0
- package/dist/{ListButtons-DXqMvba3.js → ListButtons-DMnOM2pN.js} +385 -410
- package/dist/{WatermarkDialog-r4wmldt4.js → WatermarkDialog-Cf9ISDvv.js} +1378 -1445
- package/dist/WatermarkDialog-ChJtT7Bs.cjs +15 -0
- package/dist/components/DocxEditor/pagedEditorRef.d.ts +2 -3
- package/dist/composables/index.d.ts +1 -2
- package/dist/composables/useDocxEditor.d.ts +26 -0
- package/dist/composables/useDocxEditorRefApi.d.ts +1 -0
- package/dist/composables/useFindReplace.d.ts +24 -22
- package/dist/composables/usePagesPointer.d.ts +9 -13
- package/dist/composables/useRemoteSelectionSync.d.ts +10 -0
- package/dist/composables/useSelectionSync.d.ts +17 -30
- package/dist/composables.cjs +2 -2
- package/dist/composables.js +80 -68
- 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.js +1578 -1174
- package/dist/styles/zIndex.d.ts +1 -0
- package/dist/styles.cjs +1 -1
- package/dist/styles.js +1 -1
- package/dist/ui.cjs +1 -1
- package/dist/ui.js +2 -2
- package/dist/useFindReplace-CL8Rbc3y.js +59 -0
- package/dist/useFindReplace-ZCrdvwEk.cjs +1 -0
- package/dist/useZoom-BYEcnpS0.cjs +1 -0
- package/dist/useZoom-C0p0o54p.js +656 -0
- package/dist/zIndex-CYoLNG_N.cjs +1 -0
- package/dist/{zIndex-BY0qa8Au.js → zIndex-Ei9BbHSW.js} +1 -0
- package/package.json +1 -1
- package/dist/ListButtons-BvsV1yti.cjs +0 -4
- package/dist/WatermarkDialog-DHfk8jrg.cjs +0 -15
- package/dist/components/sidebar/resolveItemPositions.d.ts +0 -22
- package/dist/useZoom-C7jhL696.cjs +0 -1
- package/dist/useZoom-zJvuJlUd.js +0 -615
- package/dist/zIndex-dFsQbASx.cjs +0 -1
|
@@ -0,0 +1,656 @@
|
|
|
1
|
+
import { computed as e, onBeforeUnmount as t, onMounted as n, onScopeDispose as r, ref as i, shallowRef as a, toValue as o, watch as s } from "vue";
|
|
2
|
+
import { getMargins as c, getPageSize as l, twipsToPixels as u } from "@stll/folio-core/paged-layout/sectionGeometry";
|
|
3
|
+
import { createAnonymizationDecorationsPlugin as d } from "@stll/folio-core/prosemirror/plugins/anonymizationDecorations";
|
|
4
|
+
import { createTemplateDirectivesPlugin as f } from "@stll/folio-core/prosemirror/plugins/templateDirectives";
|
|
5
|
+
import { createSuggestionModePlugin as p, setSuggestionMode as m } from "@stll/folio-core/prosemirror/plugins/suggestionMode";
|
|
6
|
+
import { createFolioEditor as h } from "@stll/folio-core/controller/folioEditor";
|
|
7
|
+
import { createFolioEditorEmitter as g } from "@stll/folio-core/controller/folioEditorEvents";
|
|
8
|
+
import { loadCollaborationModules as _ } from "@stll/folio-core/controller/collaborationModules";
|
|
9
|
+
import { createHeaderFooterEditorManager as ee } from "@stll/folio-core/controller/headerFooterEditorManager";
|
|
10
|
+
import { collectRemoteSelections as v, createHiddenEditorManager as te, createHiddenEditorState as ne } from "@stll/folio-core/controller/hiddenEditorManager";
|
|
11
|
+
import { runLayoutPipeline as re } from "@stll/folio-core/controller/layoutPipeline";
|
|
12
|
+
import { browserClock as ie, createLayoutScheduler as ae } from "@stll/folio-core/controller/layoutScheduler";
|
|
13
|
+
import { createLayoutSession as oe } from "@stll/folio-core/controller/layoutSession";
|
|
14
|
+
import { parseDocx as se } from "@stll/folio-core/docx/parser";
|
|
15
|
+
import { getFootnoteText as y } from "@stll/folio-core/docx/footnoteParser";
|
|
16
|
+
import { convertHeaderFooterPmDocToContent as b, convertHeaderFooterToContent as ce } from "@stll/folio-core/layout-bridge/convert/headerFooterLayout";
|
|
17
|
+
import { resolveSectionHeaderFooterRefs as le } from "@stll/folio-core/layout-engine";
|
|
18
|
+
import { LayoutPainter as ue } from "@stll/folio-core/layout-painter";
|
|
19
|
+
import { LayoutSelectionGate as de } from "@stll/folio-core/paged-layout/LayoutSelectionGate";
|
|
20
|
+
import { getTransactionDirtyRange as fe } from "@stll/folio-core/paged-layout/transactionDirtyRange";
|
|
21
|
+
import { fromProseDoc as pe } from "@stll/folio-core/prosemirror/conversion/fromProseDoc";
|
|
22
|
+
import { ExtensionManager as me } from "@stll/folio-core/prosemirror/extensions/ExtensionManager";
|
|
23
|
+
import { getChangedParagraphIds as he, hasStructuralChanges as ge, hasUntrackedChanges as _e } from "@stll/folio-core/prosemirror/extensions/features/ParagraphChangeTrackerExtension";
|
|
24
|
+
import { createStarterKit as ve } from "@stll/folio-core/prosemirror/extensions/StarterKit";
|
|
25
|
+
import { createTemplatePreviewValuesPlugin as ye } from "@stll/folio-core/prosemirror/plugins/templatePreviewValues";
|
|
26
|
+
import { templateSlashMenuPlugin as be } from "@stll/folio-core/prosemirror/plugins/templateSlashMenu";
|
|
27
|
+
import { resolveHeaderFooterContent as xe } from "@stll/folio-core/utils/headerFooter";
|
|
28
|
+
import { findVerticalScrollParent as Se } from "@stll/folio-core/utils/findVerticalScrollParent";
|
|
29
|
+
import { MIN_CELL_WIDTH_TWIPS as x, MIN_ROW_HEIGHT_TWIPS as S, TWIPS_PER_PIXEL as C, commitColumnResize as w, commitRightEdgeResize as Ce, commitRowResize as we, readColumnWidthAt as Te, readColumnWidths as Ee, readRowHeight as De } from "@stll/folio-core/prosemirror/tableResize";
|
|
30
|
+
import { extractTrackedChanges as T } from "@stll/folio-core/prosemirror/utils/extractTrackedChanges";
|
|
31
|
+
import { ZOOM_MAX as E, ZOOM_MIN as D, ZOOM_STEP as Oe } from "@stll/folio-core/utils/zoom";
|
|
32
|
+
//#region src/composables/useDocxEditor.ts
|
|
33
|
+
var ke = 24, Ae = 32, je = 96, Me = 250, Ne = [];
|
|
34
|
+
function Pe(e) {
|
|
35
|
+
let t = e?.columnCount ?? 1;
|
|
36
|
+
if (t <= 1) return;
|
|
37
|
+
let n = {
|
|
38
|
+
count: t,
|
|
39
|
+
gap: u(e?.columnSpace ?? 720),
|
|
40
|
+
equalWidth: e?.equalWidth ?? !0
|
|
41
|
+
};
|
|
42
|
+
return e?.separator !== void 0 && (n.separator = e.separator), n;
|
|
43
|
+
}
|
|
44
|
+
function Fe(e, t, n, r, i, a) {
|
|
45
|
+
if (!e) return;
|
|
46
|
+
let o = t ? {
|
|
47
|
+
...a,
|
|
48
|
+
rId: t
|
|
49
|
+
} : a, s = t ? n?.getView(t) : null;
|
|
50
|
+
return s ? b(s.state.doc, r, i, o) : ce(e, r, i, o);
|
|
51
|
+
}
|
|
52
|
+
function Ie(e, t, n, r, i) {
|
|
53
|
+
if (!e || e.size === 0) return;
|
|
54
|
+
let a = /* @__PURE__ */ new Map();
|
|
55
|
+
for (let [o, s] of e) {
|
|
56
|
+
let e = Fe(s, o, t, n, r, i);
|
|
57
|
+
e && a.set(o, e);
|
|
58
|
+
}
|
|
59
|
+
return a.size > 0 ? a : void 0;
|
|
60
|
+
}
|
|
61
|
+
function Le(e, t, n) {
|
|
62
|
+
let r = /* @__PURE__ */ new Map();
|
|
63
|
+
if (!n || !n.package.footnotes) return r;
|
|
64
|
+
let i = /* @__PURE__ */ new Map();
|
|
65
|
+
for (let e of n.package.footnotes) e.noteType && e.noteType !== "normal" || i.set(e.id, e);
|
|
66
|
+
for (let [n, a] of e) {
|
|
67
|
+
let e = [];
|
|
68
|
+
for (let n of a) {
|
|
69
|
+
let r = i.get(n);
|
|
70
|
+
if (!r) continue;
|
|
71
|
+
let a = t.get(n), o = a?.displayNumber ?? 0;
|
|
72
|
+
e.push({
|
|
73
|
+
displayNumber: String(o),
|
|
74
|
+
text: y(r),
|
|
75
|
+
...a ? { content: {
|
|
76
|
+
blocks: a.blocks,
|
|
77
|
+
measures: a.measures,
|
|
78
|
+
height: a.height
|
|
79
|
+
} } : {}
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
e.length > 0 && r.set(n, e);
|
|
83
|
+
}
|
|
84
|
+
return r;
|
|
85
|
+
}
|
|
86
|
+
var Re = /* @__PURE__ */ new Set([
|
|
87
|
+
"black",
|
|
88
|
+
"blue",
|
|
89
|
+
"cyan",
|
|
90
|
+
"darkBlue",
|
|
91
|
+
"darkCyan",
|
|
92
|
+
"darkGray",
|
|
93
|
+
"darkGreen",
|
|
94
|
+
"darkMagenta",
|
|
95
|
+
"darkRed",
|
|
96
|
+
"darkYellow",
|
|
97
|
+
"green",
|
|
98
|
+
"lightGray",
|
|
99
|
+
"magenta",
|
|
100
|
+
"none",
|
|
101
|
+
"red",
|
|
102
|
+
"white",
|
|
103
|
+
"yellow"
|
|
104
|
+
]);
|
|
105
|
+
function ze(e) {
|
|
106
|
+
let t = [], n = (e, r) => {
|
|
107
|
+
for (let [n, i] of e.marks.entries()) i.type.name === "highlight" && !Re.has(String(i.attrs.color)) && t.push(`${r}.marks[${n}]=${JSON.stringify(i.attrs)}`);
|
|
108
|
+
e.forEach((e, t, i) => {
|
|
109
|
+
n(e, `${r}.content[${i}]`);
|
|
110
|
+
});
|
|
111
|
+
};
|
|
112
|
+
return n(e, "doc"), t.join("; ");
|
|
113
|
+
}
|
|
114
|
+
function Be() {
|
|
115
|
+
return typeof document > "u" || !("fonts" in document) || document.fonts.status === "loaded";
|
|
116
|
+
}
|
|
117
|
+
function O(e) {
|
|
118
|
+
let { hiddenContainer: t, hiddenHeaderFooterContainer: n, pagesContainer: u, readOnly: y = !1, pageGap: b = ke, documentKey: ce, password: Se, editorMode: x, author: S, externalPlugins: C = [], collaboration: w, onAnonymizationMatchesChange: Ce, showTemplateDirectives: we, onSlashMenuChange: Te, onSlashMenuKeyAction: Ee, onChange: De, onError: T, onSelectionUpdate: E, onEditorViewReady: D, onReadOnlyEditAttempt: Oe, featureFlags: Re, onSelectiveSaveTripwire: O } = e, k = n ?? t, A = a(null), j = a(null), M = a(null), N = a(null), P = a([]), F = a(null), I = a(null), L = a([]), R = a([]), z = i(!1), B = i(null), V = i(!1), H = new me(ve());
|
|
119
|
+
H.buildSchema(), H.initializeRuntime();
|
|
120
|
+
let Ve = p(!1), He = d({ onMatchesChange: (e) => Ce?.(e) }), U = f(), W = be({
|
|
121
|
+
onChange: (e) => Te?.(e),
|
|
122
|
+
onKeyAction: (e) => Ee?.(e) ?? !1
|
|
123
|
+
}), Ue = ye(), G = () => o(we) === !0;
|
|
124
|
+
function We() {
|
|
125
|
+
return [
|
|
126
|
+
Ve,
|
|
127
|
+
...C,
|
|
128
|
+
...o(w)?.plugins ?? [],
|
|
129
|
+
He,
|
|
130
|
+
...G() ? [U, W] : [],
|
|
131
|
+
Ue
|
|
132
|
+
];
|
|
133
|
+
}
|
|
134
|
+
let K = g(), q = new de(), Ge = oe(), Ke = new ue({
|
|
135
|
+
pageGap: b,
|
|
136
|
+
showShadow: !0
|
|
137
|
+
}), J = ee({
|
|
138
|
+
getHost: () => k.value,
|
|
139
|
+
getDocument: () => A.value,
|
|
140
|
+
getStyles: () => A.value?.package.styles ?? null,
|
|
141
|
+
getTheme: () => A.value?.package.theme ?? null,
|
|
142
|
+
onTransaction: ({ rId: e, kind: t, view: n, docChanged: r, selectionChanged: i }) => {
|
|
143
|
+
if (r) {
|
|
144
|
+
V.value = !0;
|
|
145
|
+
let e = j.value;
|
|
146
|
+
e && X.schedule(e.state, null);
|
|
147
|
+
}
|
|
148
|
+
if (r || i) {
|
|
149
|
+
let { from: r, to: i } = n.state.selection;
|
|
150
|
+
F.value = {
|
|
151
|
+
from: r,
|
|
152
|
+
kind: t,
|
|
153
|
+
rId: e,
|
|
154
|
+
to: i
|
|
155
|
+
}, E?.(n.state), K.emit("selectionChange", {
|
|
156
|
+
from: r,
|
|
157
|
+
to: i
|
|
158
|
+
});
|
|
159
|
+
}
|
|
160
|
+
q.requestRender();
|
|
161
|
+
}
|
|
162
|
+
});
|
|
163
|
+
function qe(e) {
|
|
164
|
+
e.layout && (I.value = e.layout), e.blocks && (L.value = e.blocks), e.measures && (R.value = e.measures), e.blockLookup && Ke.setBlockLookup(e.blockLookup), e.layout && K.emit("layoutComplete", e.layout);
|
|
165
|
+
}
|
|
166
|
+
function Y(e, t = {}) {
|
|
167
|
+
let n = u.value, r = n instanceof HTMLDivElement ? n : null, i = A.value, a = i?.package.document, o = a?.sections?.[0]?.properties ?? a?.finalSectionProperties ?? null, s = l(o), d = c(o), f = Pe(o), p = s.w - d.left - d.right, m = i?.package.styles ?? null, h = i?.package.theme ?? null, g = i?.package.settings?.defaultTabStop, _ = i?.package.settings, ee = _ !== void 0 && "mirrorMargins" in _ && _.mirrorMargins === !0, v = xe(i?.package);
|
|
168
|
+
try {
|
|
169
|
+
qe(re({
|
|
170
|
+
contentWidth: p,
|
|
171
|
+
columns: f,
|
|
172
|
+
pageSize: s,
|
|
173
|
+
margins: d,
|
|
174
|
+
pageGap: b,
|
|
175
|
+
syncCoordinator: q,
|
|
176
|
+
headerContent: v.headerContent,
|
|
177
|
+
footerContent: v.footerContent,
|
|
178
|
+
firstPageHeaderContent: v.firstPageHeaderContent,
|
|
179
|
+
firstPageFooterContent: v.firstPageFooterContent,
|
|
180
|
+
headerContentRId: v.activeHeaderRId,
|
|
181
|
+
footerContentRId: v.activeFooterRId,
|
|
182
|
+
firstPageHeaderContentRId: v.activeFirstHeaderRId,
|
|
183
|
+
firstPageFooterContentRId: v.activeFirstFooterRId,
|
|
184
|
+
sectionHeaderFooterRefs: le(i),
|
|
185
|
+
theme: h,
|
|
186
|
+
sectionProperties: o,
|
|
187
|
+
document: i,
|
|
188
|
+
defaultTabStop: g,
|
|
189
|
+
mirrorMargins: ee,
|
|
190
|
+
styles: m,
|
|
191
|
+
layout: I.value,
|
|
192
|
+
hfPMs: J,
|
|
193
|
+
painter: Ke,
|
|
194
|
+
pagesContainer: r,
|
|
195
|
+
session: Ge,
|
|
196
|
+
renderHfFromContentOrPm: Fe,
|
|
197
|
+
renderHeaderFooterContentByRId: Ie,
|
|
198
|
+
documentFontsAreLoaded: Be,
|
|
199
|
+
buildFootnoteRenderItems: Le,
|
|
200
|
+
describeInvalidHighlightMarks: ze,
|
|
201
|
+
emptyTemplatePreviewEntries: Ne
|
|
202
|
+
}, e, t));
|
|
203
|
+
} catch (e) {
|
|
204
|
+
let t = e instanceof Error ? e : Error(String(e));
|
|
205
|
+
T?.(t);
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
let X = ae({
|
|
209
|
+
runLayout: (e, t) => Y(e, t),
|
|
210
|
+
debounceMs: Ae,
|
|
211
|
+
maxDelayMs: je,
|
|
212
|
+
clock: ie
|
|
213
|
+
}), Z = null;
|
|
214
|
+
function Je() {
|
|
215
|
+
Z !== null && (window.clearTimeout(Z), Z = null);
|
|
216
|
+
let e = j.value, t = A.value;
|
|
217
|
+
if (!(!e || !t)) try {
|
|
218
|
+
let n = pe(e.state.doc, t);
|
|
219
|
+
A.value = n, J.sync(), De?.(n), K.emit("docChange", n);
|
|
220
|
+
} catch (e) {
|
|
221
|
+
T?.(e instanceof Error ? e : Error(String(e)));
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
function Ye() {
|
|
225
|
+
Z !== null && window.clearTimeout(Z), Z = window.setTimeout(() => {
|
|
226
|
+
Z = null, Je();
|
|
227
|
+
}, Me);
|
|
228
|
+
}
|
|
229
|
+
let Q = te({
|
|
230
|
+
getHost: () => t.value,
|
|
231
|
+
getDocument: () => A.value,
|
|
232
|
+
getStyles: () => A.value?.package.styles ?? null,
|
|
233
|
+
getExtensionManager: () => H,
|
|
234
|
+
getExternalPlugins: We,
|
|
235
|
+
getCollaboration: () => o(w),
|
|
236
|
+
getCollaborationModules: () => N.value,
|
|
237
|
+
getPrecomputedInitialState: () => null,
|
|
238
|
+
getReadOnly: () => o(y),
|
|
239
|
+
getDocumentKey: () => o(ce),
|
|
240
|
+
getDocumentContext: () => A.value,
|
|
241
|
+
onTransaction: Xe,
|
|
242
|
+
onSelectionChange: (e) => {
|
|
243
|
+
M.value = e, E?.(e), K.emit("selectionChange", {
|
|
244
|
+
from: e.selection.from,
|
|
245
|
+
to: e.selection.to
|
|
246
|
+
});
|
|
247
|
+
},
|
|
248
|
+
onKeyDown: () => !1,
|
|
249
|
+
onReadOnlyEditAttempt: () => Oe?.(),
|
|
250
|
+
onEditorViewReady: Ze,
|
|
251
|
+
onEditorViewDestroy: () => {
|
|
252
|
+
j.value = null, z.value = !1, D?.(null);
|
|
253
|
+
},
|
|
254
|
+
onRemoteSelectionsChange: (e) => {
|
|
255
|
+
P.value = e;
|
|
256
|
+
}
|
|
257
|
+
}), $ = () => {
|
|
258
|
+
let e = o(w)?.awareness, t = N.value, n = Q.getView();
|
|
259
|
+
P.value = e && t && n ? v(n.state, e, t) : [];
|
|
260
|
+
};
|
|
261
|
+
s(() => o(w), (e, t, n) => {
|
|
262
|
+
if (P.value = [], !e) {
|
|
263
|
+
N.value = null, Q.retryViewCreation(), Q.syncExternalDocument();
|
|
264
|
+
return;
|
|
265
|
+
}
|
|
266
|
+
let r = !1;
|
|
267
|
+
n(() => {
|
|
268
|
+
r = !0;
|
|
269
|
+
}), N.value = null, _().then((e) => {
|
|
270
|
+
r || (N.value = e, Q.retryViewCreation(), Q.syncExternalDocument(), $());
|
|
271
|
+
}, (e) => {
|
|
272
|
+
r || (N.value = null, T?.(e instanceof Error ? e : Error(String(e))));
|
|
273
|
+
});
|
|
274
|
+
}, { immediate: !0 }), s(() => ({
|
|
275
|
+
awareness: o(w)?.awareness,
|
|
276
|
+
modules: N.value,
|
|
277
|
+
view: j.value
|
|
278
|
+
}), ({ awareness: e, modules: t, view: n }, r, i) => {
|
|
279
|
+
if (!e || !t || !n) {
|
|
280
|
+
P.value = [];
|
|
281
|
+
return;
|
|
282
|
+
}
|
|
283
|
+
e.on("change", $), $(), i(() => {
|
|
284
|
+
e.off("change", $), P.value = [];
|
|
285
|
+
});
|
|
286
|
+
}, { flush: "post" });
|
|
287
|
+
function Xe(e, t) {
|
|
288
|
+
M.value = t, e.docChanged && (V.value = !0, q.incrementStateSeq(), X.schedule(t, fe(e)), Ye()), q.requestRender();
|
|
289
|
+
}
|
|
290
|
+
function Ze(e) {
|
|
291
|
+
j.value = e, M.value = e.state, z.value = !0, Y(e.state, { reason: "initial" }), q.requestRender(), $e(e), D?.(e), o(y) || requestAnimationFrame(() => {
|
|
292
|
+
j.value === e && e.focus();
|
|
293
|
+
});
|
|
294
|
+
}
|
|
295
|
+
let Qe = h({
|
|
296
|
+
getEditorApi: () => Q.api,
|
|
297
|
+
getLayout: () => I.value,
|
|
298
|
+
runLayout: (e, t) => Y(e, t),
|
|
299
|
+
emitter: K
|
|
300
|
+
});
|
|
301
|
+
function $e(e) {
|
|
302
|
+
m(o(x) === "suggesting", e.state, e.dispatch, o(S));
|
|
303
|
+
}
|
|
304
|
+
s([() => o(x), () => o(S)], () => {
|
|
305
|
+
let e = j.value;
|
|
306
|
+
e && $e(e);
|
|
307
|
+
}), s(() => o(y), () => Q.syncEditable());
|
|
308
|
+
function et(e) {
|
|
309
|
+
let t = G();
|
|
310
|
+
if (t === e.state.plugins.includes(U)) return;
|
|
311
|
+
let n = e.state.plugins.filter((e) => e !== U && e !== W);
|
|
312
|
+
if (t) {
|
|
313
|
+
let e = n.indexOf(Ue), t = e === -1 ? n.length : e;
|
|
314
|
+
n.splice(t, 0, U, W);
|
|
315
|
+
}
|
|
316
|
+
e.updateState(e.state.reconfigure({ plugins: n }));
|
|
317
|
+
}
|
|
318
|
+
s(() => G(), () => {
|
|
319
|
+
let e = j.value;
|
|
320
|
+
e && et(e);
|
|
321
|
+
});
|
|
322
|
+
function tt() {
|
|
323
|
+
Q.ensureView();
|
|
324
|
+
}
|
|
325
|
+
function nt() {
|
|
326
|
+
V.value = !1, F.value = null, X.dispose(), Q.destroyView(), J.sync(), Q.ensureView(), Q.getView() || rt();
|
|
327
|
+
}
|
|
328
|
+
function rt() {
|
|
329
|
+
let e = A.value;
|
|
330
|
+
if (!(!e || o(w))) try {
|
|
331
|
+
let t = ne({
|
|
332
|
+
document: e,
|
|
333
|
+
styles: e.package.styles ?? null,
|
|
334
|
+
manager: H,
|
|
335
|
+
externalPlugins: We(),
|
|
336
|
+
collaborationModules: null,
|
|
337
|
+
reason: "mount"
|
|
338
|
+
});
|
|
339
|
+
M.value = t, Y(t, { reason: "initial" });
|
|
340
|
+
} catch (e) {
|
|
341
|
+
T?.(e instanceof Error ? e : Error(String(e)));
|
|
342
|
+
}
|
|
343
|
+
}
|
|
344
|
+
s([
|
|
345
|
+
t,
|
|
346
|
+
u,
|
|
347
|
+
k
|
|
348
|
+
], () => {
|
|
349
|
+
t.value && A.value && !Q.getView() && tt(), J.sync();
|
|
350
|
+
}, { flush: "post" });
|
|
351
|
+
async function it(e) {
|
|
352
|
+
B.value = null, z.value = !1;
|
|
353
|
+
try {
|
|
354
|
+
let t = await se(e, { password: o(Se) });
|
|
355
|
+
A.value = t, nt();
|
|
356
|
+
} catch (e) {
|
|
357
|
+
let t = e instanceof Error ? e : Error(String(e));
|
|
358
|
+
B.value = t.message, T?.(t);
|
|
359
|
+
}
|
|
360
|
+
}
|
|
361
|
+
function at(e) {
|
|
362
|
+
B.value = null, A.value = e, nt();
|
|
363
|
+
}
|
|
364
|
+
async function ot(e) {
|
|
365
|
+
let t = j.value, n = A.value;
|
|
366
|
+
if (!t || !n) return null;
|
|
367
|
+
let r = J.snapshotDocument(n), i = t.state, { resolveSelectiveSaveFlags: a } = await import("@stll/folio-core/docx/selectiveSaveFlags"), s = a(o(Re)), c = pe(i.doc, r), l = c.originalBuffer ?? null, u = s.selectiveSave && e?.selective !== !1, d = u || s.selectiveSaveTripwire, { repackDocx: f, createDocx: p } = await import("@stll/folio-core/docx/rezip"), m = null;
|
|
368
|
+
if (d && l) {
|
|
369
|
+
let { attemptSelectiveSave: e } = await import("@stll/folio-core/docx/selectiveSave");
|
|
370
|
+
m = await e(c, l, {
|
|
371
|
+
changedParaIds: he(i),
|
|
372
|
+
structuralChange: ge(i),
|
|
373
|
+
hasUntrackedChanges: _e(i),
|
|
374
|
+
maxBytes: s.selectiveSaveMaxBytes
|
|
375
|
+
});
|
|
376
|
+
}
|
|
377
|
+
let h = u ? m : null, g = null;
|
|
378
|
+
if (!h) g = l ? await f(c) : await p(c), h = g;
|
|
379
|
+
else if (s.selectiveSaveTripwire) try {
|
|
380
|
+
g = await f(c);
|
|
381
|
+
} catch {}
|
|
382
|
+
if (s.selectiveSaveTripwire && g && O) try {
|
|
383
|
+
let { compareSelectiveVsFull: e } = await import("@stll/folio-core/docx/selectiveSaveTripwire");
|
|
384
|
+
O(await e(m, g));
|
|
385
|
+
} catch {}
|
|
386
|
+
return A.value = c, J.sync(), V.value = !1, new Blob([h], { type: "application/vnd.openxmlformats-officedocument.wordprocessingml.document" });
|
|
387
|
+
}
|
|
388
|
+
function st() {
|
|
389
|
+
let e = A.value;
|
|
390
|
+
return e ? J.snapshotDocument(e) : null;
|
|
391
|
+
}
|
|
392
|
+
function ct(e) {
|
|
393
|
+
A.value = e, J.sync();
|
|
394
|
+
}
|
|
395
|
+
function lt(e) {
|
|
396
|
+
return J.getView(e);
|
|
397
|
+
}
|
|
398
|
+
function ut() {
|
|
399
|
+
J.sync();
|
|
400
|
+
}
|
|
401
|
+
function dt() {
|
|
402
|
+
return H.getCommands();
|
|
403
|
+
}
|
|
404
|
+
function ft() {
|
|
405
|
+
j.value?.focus();
|
|
406
|
+
}
|
|
407
|
+
function pt() {
|
|
408
|
+
let e = j.value;
|
|
409
|
+
e && Y(e.state, { reason: "manual" });
|
|
410
|
+
}
|
|
411
|
+
function mt() {
|
|
412
|
+
X.dispose(), Z !== null && (window.clearTimeout(Z), Z = null), Q.destroyView(), P.value = [], J.destroy(), H.destroy(), M.value = null, I.value = null, A.value = null, z.value = !1;
|
|
413
|
+
}
|
|
414
|
+
return r(mt), {
|
|
415
|
+
editor: Qe,
|
|
416
|
+
editorView: j,
|
|
417
|
+
editorState: M,
|
|
418
|
+
remoteSelections: P,
|
|
419
|
+
headerFooterSelection: F,
|
|
420
|
+
isReady: z,
|
|
421
|
+
isDirty: V,
|
|
422
|
+
parseError: B,
|
|
423
|
+
layout: I,
|
|
424
|
+
blocks: L,
|
|
425
|
+
measures: R,
|
|
426
|
+
syncCoordinator: q,
|
|
427
|
+
loadBuffer: it,
|
|
428
|
+
loadDocument: at,
|
|
429
|
+
save: ot,
|
|
430
|
+
getDocument: st,
|
|
431
|
+
setDocument: ct,
|
|
432
|
+
getHeaderFooterView: lt,
|
|
433
|
+
syncHeaderFooterViews: ut,
|
|
434
|
+
getCommands: dt,
|
|
435
|
+
focus: ft,
|
|
436
|
+
reLayout: pt,
|
|
437
|
+
destroy: mt
|
|
438
|
+
};
|
|
439
|
+
}
|
|
440
|
+
function k(e, t) {
|
|
441
|
+
if (t < e.top + 40) {
|
|
442
|
+
let n = Math.max(0, e.top + 40 - t);
|
|
443
|
+
return -Math.min(12, n / 40 * 12);
|
|
444
|
+
}
|
|
445
|
+
if (t > e.bottom - 40) {
|
|
446
|
+
let n = Math.max(0, t - (e.bottom - 40));
|
|
447
|
+
return Math.min(12, n / 40 * 12);
|
|
448
|
+
}
|
|
449
|
+
return 0;
|
|
450
|
+
}
|
|
451
|
+
//#endregion
|
|
452
|
+
//#region src/composables/useDragAutoScroll.ts
|
|
453
|
+
function A({ pagesContainer: e, onScrollExtendSelection: t }) {
|
|
454
|
+
let n = null, i = 0, a = 0, o = !1, s = null;
|
|
455
|
+
function c() {
|
|
456
|
+
if (s) return s;
|
|
457
|
+
let t = e.value;
|
|
458
|
+
return t ? (s = Se(t), s) : null;
|
|
459
|
+
}
|
|
460
|
+
function l() {
|
|
461
|
+
o = !1, n !== null && (cancelAnimationFrame(n), n = null);
|
|
462
|
+
}
|
|
463
|
+
function u() {
|
|
464
|
+
if (!o) return;
|
|
465
|
+
let e = c();
|
|
466
|
+
if (!e) return;
|
|
467
|
+
let r = k(e.getBoundingClientRect(), a);
|
|
468
|
+
r !== 0 && (e.scrollTop += r, t(i, a)), n = requestAnimationFrame(u);
|
|
469
|
+
}
|
|
470
|
+
function d() {
|
|
471
|
+
o || (o = !0, n = requestAnimationFrame(u));
|
|
472
|
+
}
|
|
473
|
+
function f(e, t) {
|
|
474
|
+
if (i = e, a = t, !o) {
|
|
475
|
+
let e = c();
|
|
476
|
+
if (!e) return;
|
|
477
|
+
let n = e.getBoundingClientRect();
|
|
478
|
+
(t < n.top + 40 || t > n.bottom - 40) && d();
|
|
479
|
+
}
|
|
480
|
+
}
|
|
481
|
+
return r(() => l()), {
|
|
482
|
+
updateMousePosition: f,
|
|
483
|
+
stopAutoScroll: l
|
|
484
|
+
};
|
|
485
|
+
}
|
|
486
|
+
//#endregion
|
|
487
|
+
//#region src/composables/useTableResize.ts
|
|
488
|
+
function j() {
|
|
489
|
+
let e = {
|
|
490
|
+
active: !1,
|
|
491
|
+
startX: 0,
|
|
492
|
+
handle: null,
|
|
493
|
+
columnIndex: 0,
|
|
494
|
+
tablePmStart: 0,
|
|
495
|
+
origWidths: {
|
|
496
|
+
left: 0,
|
|
497
|
+
right: 0
|
|
498
|
+
}
|
|
499
|
+
}, t = {
|
|
500
|
+
active: !1,
|
|
501
|
+
startY: 0,
|
|
502
|
+
handle: null,
|
|
503
|
+
rowIndex: 0,
|
|
504
|
+
isEdge: !1,
|
|
505
|
+
tablePmStart: 0,
|
|
506
|
+
origHeight: 0
|
|
507
|
+
}, n = {
|
|
508
|
+
active: !1,
|
|
509
|
+
startX: 0,
|
|
510
|
+
handle: null,
|
|
511
|
+
columnIndex: 0,
|
|
512
|
+
tablePmStart: 0,
|
|
513
|
+
origWidth: 0
|
|
514
|
+
}, r = null;
|
|
515
|
+
function i() {
|
|
516
|
+
return e.active || t.active || n.active;
|
|
517
|
+
}
|
|
518
|
+
function a(i, a) {
|
|
519
|
+
let o = i.target;
|
|
520
|
+
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), M(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), N(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), P(a, n), !0) : !1 : !1;
|
|
521
|
+
}
|
|
522
|
+
function o(r) {
|
|
523
|
+
if (e.active && e.handle) {
|
|
524
|
+
r.preventDefault();
|
|
525
|
+
let t = r.clientX - e.startX, n = parseFloat(e.handle.style.left);
|
|
526
|
+
e.handle.style.left = `${n + t}px`, e.startX = r.clientX;
|
|
527
|
+
let i = Math.round(t * C), a = e.origWidths.left + i, o = e.origWidths.right - i;
|
|
528
|
+
a >= x && o >= x && (e.origWidths = {
|
|
529
|
+
left: a,
|
|
530
|
+
right: o
|
|
531
|
+
});
|
|
532
|
+
return;
|
|
533
|
+
}
|
|
534
|
+
if (t.active && t.handle) {
|
|
535
|
+
r.preventDefault();
|
|
536
|
+
let e = r.clientY - t.startY, n = parseFloat(t.handle.style.top);
|
|
537
|
+
t.handle.style.top = `${n + e}px`, t.startY = r.clientY;
|
|
538
|
+
let i = Math.round(e * C), a = t.origHeight + i;
|
|
539
|
+
a >= S && (t.origHeight = a);
|
|
540
|
+
return;
|
|
541
|
+
}
|
|
542
|
+
if (n.active && n.handle) {
|
|
543
|
+
r.preventDefault();
|
|
544
|
+
let e = r.clientX - n.startX, t = parseFloat(n.handle.style.left);
|
|
545
|
+
n.handle.style.left = `${t + e}px`, n.startX = r.clientX;
|
|
546
|
+
let i = Math.round(e * C), a = n.origWidth + i;
|
|
547
|
+
a >= x && (n.origWidth = a);
|
|
548
|
+
}
|
|
549
|
+
}
|
|
550
|
+
function s(i) {
|
|
551
|
+
if (e.active) {
|
|
552
|
+
e.active = !1, e.handle?.classList.remove("dragging"), r && w(r, {
|
|
553
|
+
pmStart: e.tablePmStart,
|
|
554
|
+
colIdx: e.columnIndex,
|
|
555
|
+
newLeft: e.origWidths.left,
|
|
556
|
+
newRight: e.origWidths.right
|
|
557
|
+
}), e.handle = null;
|
|
558
|
+
return;
|
|
559
|
+
}
|
|
560
|
+
if (t.active) {
|
|
561
|
+
t.active = !1, t.handle?.classList.remove("dragging"), r && we(r, {
|
|
562
|
+
pmStart: t.tablePmStart,
|
|
563
|
+
rowIdx: t.rowIndex,
|
|
564
|
+
newHeight: t.origHeight
|
|
565
|
+
}), t.handle = null;
|
|
566
|
+
return;
|
|
567
|
+
}
|
|
568
|
+
n.active && (n.active = !1, n.handle?.classList.remove("dragging"), r && Ce(r, {
|
|
569
|
+
pmStart: n.tablePmStart,
|
|
570
|
+
colIdx: n.columnIndex,
|
|
571
|
+
newWidth: n.origWidth
|
|
572
|
+
}), n.handle = null);
|
|
573
|
+
}
|
|
574
|
+
function c() {
|
|
575
|
+
return document.addEventListener("mousemove", o), document.addEventListener("mouseup", s), () => {
|
|
576
|
+
document.removeEventListener("mousemove", o), document.removeEventListener("mouseup", s);
|
|
577
|
+
};
|
|
578
|
+
}
|
|
579
|
+
return {
|
|
580
|
+
tryStartResize: a,
|
|
581
|
+
install: c,
|
|
582
|
+
isResizing: i
|
|
583
|
+
};
|
|
584
|
+
}
|
|
585
|
+
function M(e, t) {
|
|
586
|
+
let n = Ee(e, t.tablePmStart, t.columnIndex);
|
|
587
|
+
n && (t.origWidths = n);
|
|
588
|
+
}
|
|
589
|
+
function N(e, t, n) {
|
|
590
|
+
let r = De(e, t.tablePmStart, t.rowIndex);
|
|
591
|
+
if (r != null) {
|
|
592
|
+
t.origHeight = r;
|
|
593
|
+
return;
|
|
594
|
+
}
|
|
595
|
+
let i = n.closest(".layout-table")?.querySelector(`[data-row-index="${t.rowIndex}"]`), a = i ? i.getBoundingClientRect().height : 30;
|
|
596
|
+
t.origHeight = Math.round(a * C);
|
|
597
|
+
}
|
|
598
|
+
function P(e, t) {
|
|
599
|
+
let n = Te(e, t.tablePmStart, t.columnIndex);
|
|
600
|
+
n != null && (t.origWidth = n);
|
|
601
|
+
}
|
|
602
|
+
//#endregion
|
|
603
|
+
//#region src/composables/useTrackedChanges.ts
|
|
604
|
+
function F(t, n) {
|
|
605
|
+
return e(() => (n.value, T(t.value?.state ?? null)));
|
|
606
|
+
}
|
|
607
|
+
//#endregion
|
|
608
|
+
//#region src/composables/useZoom.ts
|
|
609
|
+
var I = D, L = E, R = [
|
|
610
|
+
.5,
|
|
611
|
+
.75,
|
|
612
|
+
1,
|
|
613
|
+
1.25,
|
|
614
|
+
1.5,
|
|
615
|
+
2
|
|
616
|
+
];
|
|
617
|
+
function z(r = 1) {
|
|
618
|
+
let a = i(Math.max(I, Math.min(L, r))), o = e(() => Math.round(a.value * 100)), s = e(() => a.value <= I), c = e(() => a.value >= L);
|
|
619
|
+
function l(e) {
|
|
620
|
+
a.value = Math.max(I, Math.min(L, Math.round(e * 100) / 100));
|
|
621
|
+
}
|
|
622
|
+
function u() {
|
|
623
|
+
l(a.value + Oe);
|
|
624
|
+
}
|
|
625
|
+
function d() {
|
|
626
|
+
l(a.value - Oe);
|
|
627
|
+
}
|
|
628
|
+
function f() {
|
|
629
|
+
l(1);
|
|
630
|
+
}
|
|
631
|
+
function p(e) {
|
|
632
|
+
(e.ctrlKey || e.metaKey) && (e.preventDefault(), e.deltaY < 0 ? u() : d());
|
|
633
|
+
}
|
|
634
|
+
function m(e) {
|
|
635
|
+
(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())));
|
|
636
|
+
}
|
|
637
|
+
function h() {
|
|
638
|
+
n(() => document.addEventListener("keydown", m)), t(() => document.removeEventListener("keydown", m));
|
|
639
|
+
}
|
|
640
|
+
return {
|
|
641
|
+
zoom: a,
|
|
642
|
+
zoomPercent: o,
|
|
643
|
+
isMinZoom: s,
|
|
644
|
+
isMaxZoom: c,
|
|
645
|
+
setZoom: l,
|
|
646
|
+
zoomIn: u,
|
|
647
|
+
zoomOut: d,
|
|
648
|
+
resetZoom: f,
|
|
649
|
+
handleWheel: p,
|
|
650
|
+
handleKeyDown: m,
|
|
651
|
+
installShortcuts: h,
|
|
652
|
+
ZOOM_PRESETS: R
|
|
653
|
+
};
|
|
654
|
+
}
|
|
655
|
+
//#endregion
|
|
656
|
+
export { A as a, j as i, T as n, O as o, F as r, z as t };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var e={selectionOverlay:10,decorationLayer:11,remoteSelection:12,imageOverlay:15,hfInlineEditor:10,ruler:30,dropdown:100,contextMenu:1e4};Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return e}});
|
package/package.json
CHANGED