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