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