@stll/folio-vue 0.3.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-3UeVXRAK.cjs → ListButtons-BvsV1yti.cjs} +2 -2
- package/dist/{ListButtons-CDkmhg3v.js → ListButtons-DXqMvba3.js} +105 -117
- package/dist/WatermarkDialog-DHfk8jrg.cjs +15 -0
- package/dist/{PageSetupDialog-Djs8aW5A.js → WatermarkDialog-r4wmldt4.js} +2094 -1322
- package/dist/components/DocxEditor/types.d.ts +10 -1
- package/dist/components/dialogs/index.d.ts +13 -9
- package/dist/components/sidebar/cardStyles.d.ts +1 -1
- package/dist/composables/useDocxEditor.d.ts +2 -0
- package/dist/composables.cjs +1 -1
- package/dist/composables.js +1 -1
- package/dist/dialogs.cjs +1 -1
- package/dist/dialogs.js +5 -3
- package/dist/folio-vue.css +1 -1
- package/dist/index.cjs +1 -3
- package/dist/index.d.ts +4 -2
- package/dist/index.js +1236 -1226
- package/dist/ui.cjs +1 -1
- package/dist/ui.d.ts +6 -2
- package/dist/ui.js +58 -59
- package/dist/useZoom-BB6hSMvM.cjs +1 -0
- package/dist/{useZoom-CIIRid8U.js → useZoom-BxDANpqb.js} +215 -212
- package/package.json +11 -6
- package/dist/PageSetupDialog-GGWMpoe-.cjs +0 -15
- package/dist/TablePropertiesDialog-B399kZgL.js +0 -901
- package/dist/TablePropertiesDialog-DYbjwevC.cjs +0 -1
- package/dist/useZoom-BryUw3Cu.cjs +0 -1
- package/dist/utils/aiEditRange.d.ts +0 -26
- package/dist/utils/pageText.d.ts +0 -14
package/dist/index.js
CHANGED
|
@@ -1,69 +1,71 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { D as m,
|
|
3
|
-
import { t as
|
|
4
|
-
import { a as
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
18
|
-
import {
|
|
19
|
-
import {
|
|
20
|
-
import {
|
|
21
|
-
import {
|
|
22
|
-
import {
|
|
23
|
-
import {
|
|
24
|
-
import {
|
|
25
|
-
import {
|
|
26
|
-
import {
|
|
27
|
-
import {
|
|
28
|
-
import {
|
|
29
|
-
import {
|
|
30
|
-
import {
|
|
31
|
-
import {
|
|
32
|
-
import {
|
|
33
|
-
import {
|
|
34
|
-
import {
|
|
35
|
-
import {
|
|
36
|
-
import {
|
|
37
|
-
import {
|
|
38
|
-
import {
|
|
39
|
-
import {
|
|
40
|
-
import { applyStyle as
|
|
41
|
-
import { getCachedNumberingMap as
|
|
42
|
-
import { insertPageBreak as
|
|
43
|
-
import { insertSectionBreakContinuous as
|
|
44
|
-
import { editHyperlinkAtCursor as
|
|
45
|
-
import { collectHeadings as
|
|
46
|
-
import { TABLE_INSERT_HIDE_DELAY_MS as
|
|
47
|
-
import { createCellDragTracker as
|
|
48
|
-
import {
|
|
49
|
-
import {
|
|
50
|
-
import {
|
|
51
|
-
import {
|
|
52
|
-
import {
|
|
53
|
-
import {
|
|
54
|
-
import {
|
|
55
|
-
import {
|
|
56
|
-
import {
|
|
57
|
-
import {
|
|
58
|
-
import {
|
|
59
|
-
import {
|
|
1
|
+
import { A as e, F as t, O as n, P as r, _ as i, d as a, f as o, g as s, j as c, k as l, m as u, p as d, u as f, y as p } from "./WatermarkDialog-r4wmldt4.js";
|
|
2
|
+
import { D as m, E as h, d as g, f as _, i as v, n as y, r as b, t as x, v as S, w as C, y as ee } from "./ListButtons-DXqMvba3.js";
|
|
3
|
+
import { t as te } from "./zIndex-BY0qa8Au.js";
|
|
4
|
+
import { a as w, i as ne, o as T, r as re, t as ie } from "./useZoom-BxDANpqb.js";
|
|
5
|
+
import { FindReplaceDialog as E, FootnotePropertiesDialog as D, HyperlinkDialog as ae, ImagePositionDialog as oe, ImagePropertiesDialog as se, InsertImageDialog as O, InsertSymbolDialog as k, InsertTableDialog as ce, PageSetupDialog as le, PasteSpecialDialog as ue, SplitCellDialog as de, TablePropertiesDialog as fe, WatermarkDialog as A } from "./dialogs.js";
|
|
6
|
+
import { Fragment as j, Teleport as M, computed as N, createApp as pe, createBlock as P, createCommentVNode as F, createElementBlock as I, createElementVNode as L, createSlots as me, createStaticVNode as he, createTextVNode as ge, createVNode as R, defineComponent as z, h as B, inject as _e, mergeProps as ve, nextTick as ye, normalizeClass as V, normalizeStyle as H, onBeforeUnmount as be, onMounted as xe, openBlock as U, provide as Se, ref as W, renderList as G, renderSlot as Ce, shallowRef as we, toDisplayString as K, unref as q, vModelText as Te, watch as J, withCtx as Ee, withDirectives as De, withKeys as Oe, withModifiers as Y } from "vue";
|
|
7
|
+
import { createStyleResolver as ke, extractSelectionState as Ae, getSelectedText as je, insertImageFromFile as Me, insertImageFromFile as Ne, insertPageBreakInView as Pe, insertPageBreakInView as Fe, insertTableInView as X, insertTableInView as Ie, insertTableOfContentsInView as Le, insertTableOfContentsInView as Re } from "@stll/folio-core/prosemirror";
|
|
8
|
+
import { extractSelectionContext as ze } from "@stll/folio-core/prosemirror/plugins/selectionTracker";
|
|
9
|
+
import { inspectDocxCompatibility as Be } from "@stll/folio-core/docx/compatibility";
|
|
10
|
+
import { clearAllCaches as Ve, resetCanvasContext as He } from "@stll/folio-core/layout-bridge/engine/measuring";
|
|
11
|
+
import { onFontsLoaded as Ue } from "@stll/folio-core/utils/fontLoader";
|
|
12
|
+
import { twipsToPixels as We } from "@stll/folio-core/paged-layout/sectionGeometry";
|
|
13
|
+
import { measureDirectiveGutter as Ge, projectRangesToRects as Ke } from "@stll/folio-core/paged-layout/rangeProjection";
|
|
14
|
+
import { prefersReducedMotionBehavior as qe } from "@stll/folio-core/paged-layout/scrollNavigation";
|
|
15
|
+
import { anonymizationDecorationsKey as Je, getAnonymizationMatches as Ye, getAnonymizationMatches as Xe, setAnonymizationTermsMeta as Ze, slugAnonymizationLabel as Qe } from "@stll/folio-core/prosemirror/plugins/anonymizationDecorations";
|
|
16
|
+
import { NodeSelection as $e, Selection as et, TextSelection as Z } from "prosemirror-state";
|
|
17
|
+
import { pixelsToEmu as tt } from "@stll/folio-core/utils/units";
|
|
18
|
+
import { IMAGE_LAYOUT_OPTIONS as nt, captureInlinePositionEmu as rt, deriveLayoutChoice as it, findImageElement as at, isImageLayoutOptionEnabled as ot, toolbarValueToLayoutTarget as st } from "@stll/folio-core/layout-painter/imageLayout";
|
|
19
|
+
import { isTrackChangesMode as ct, toggledTrackChangesMode as lt } from "@stll/folio-core/managers/EditorModeManager";
|
|
20
|
+
import { clickToPositionDom as ut } from "@stll/folio-core/layout-bridge/dom/clickToPositionDom";
|
|
21
|
+
import { calculateResizedImageDimensions as dt, commitImageFloatMove as ft, commitImageInlineMove as pt, commitImageResize as mt, isFloatingImage as ht } from "@stll/folio-core/prosemirror/imageCommit";
|
|
22
|
+
import { findBodyPmAnchor as gt, findBodyPmSpans as _t } from "@stll/folio-core/layout-bridge/dom/findBodyPmSpans";
|
|
23
|
+
import { getTemplateDirectives as vt, getTemplateDirectives as yt, scanDirectives as bt } from "@stll/folio-core/prosemirror/plugins/templateDirectives";
|
|
24
|
+
import { clearFormatting as xt } from "@stll/folio-core/prosemirror/commands/formatting";
|
|
25
|
+
import { getTableContext as St } from "@stll/folio-core/prosemirror/extensions/nodes/TableExtension";
|
|
26
|
+
import { PENDING_COMMENT_ID as Ct, createCommentIdAllocator as wt, seedCommentAllocator as Tt } from "@stll/folio-core/prosemirror/commentIdAllocator";
|
|
27
|
+
import { createComment as Et } from "@stll/folio-core/prosemirror/commentOps";
|
|
28
|
+
import { findChangeRange as Dt } from "@stll/folio-core/prosemirror/queries";
|
|
29
|
+
import { acceptAIEditRevision as Ot, acceptChange as kt, findAIEditRevisionRange as At, rejectAIEditRevision as jt, rejectChange as Mt } from "@stll/folio-core/prosemirror/commands/comments";
|
|
30
|
+
import { makeRevisionInfo as Nt } from "@stll/folio-core/prosemirror/plugins/suggestionMode";
|
|
31
|
+
import { setTemplatePreviewValues as Pt } from "@stll/folio-core/prosemirror/plugins/templatePreviewValues";
|
|
32
|
+
import { clearTemplateSlashMenu as Ft, consumeTemplateSlashQuery as It, getTemplateSlashMenu as Lt, resetTemplateSlashQuery as Rt, templateSlashMenuKey as Q } from "@stll/folio-core/prosemirror/plugins/templateSlashMenu";
|
|
33
|
+
import { FOLIO_DOCUMENT_OPERATION_CONTRACT_VERSION as zt, applyFolioAIEditOperations as $, applyFolioAIEditOperations as Bt, applyFolioDocumentOperations as Vt, assertSupportedFolioDocumentOperationVersion as Ht, createFolioAIEditSnapshot as Ut, createFolioAIEditSnapshot as Wt, diffWordSegments as Gt, getCommentAnchorsFromDoc as Kt, getFolioDocumentOperationIssues as qt, getTrackedChangesFromDoc as Jt, hashFolioAIBlockText as Yt, normalizeFolioAIBlockText as Xt } from "@stll/folio-core/ai-edits";
|
|
34
|
+
import { findPageIndexContainingPmPos as Zt } from "@stll/folio-core/layout-engine";
|
|
35
|
+
import { findParagraphFragmentsByParaId as Qt, flashParagraphElements as $t } from "@stll/folio-core/paged-layout/paragraphFlash";
|
|
36
|
+
import { blockSdtAttrsToSdtProperties as en, findBlockSdtMatch as tn, findBlockSdtMatches as nn, removeContentControlTr as rn, setContentControlContentTr as an, setContentControlValueTr as on } from "@stll/folio-core/prosemirror/commands/contentControls";
|
|
37
|
+
import { setContentControlContentBlocksTr as sn } from "@stll/folio-core/prosemirror/commands/contentControlsBlockFill";
|
|
38
|
+
import { clampRangeToDocSize as cn, resolveFolioAIBlockRange as ln } from "@stll/folio-core/ai-edits/blockRange";
|
|
39
|
+
import { getPageTextFromLayout as un } from "@stll/folio-core/paged-layout/pageText";
|
|
40
|
+
import { applyStyle as dn, removeTabStop as fn, setIndentFirstLine as pn, setIndentLeft as mn, setIndentRight as hn } from "@stll/folio-core/prosemirror/commands/paragraph";
|
|
41
|
+
import { getCachedNumberingMap as gn } from "@stll/folio-core/docx";
|
|
42
|
+
import { insertPageBreak as _n } from "@stll/folio-core/prosemirror/commands/pageBreak";
|
|
43
|
+
import { insertSectionBreakContinuous as vn, insertSectionBreakNextPage as yn } from "@stll/folio-core/prosemirror/commands/sectionBreak";
|
|
44
|
+
import { editHyperlinkAtCursor as bn, removeHyperlinkAtCursor as xn } from "@stll/folio-core/prosemirror/commands/hyperlink";
|
|
45
|
+
import { collectHeadings as Sn } from "@stll/folio-core/utils/headingCollector";
|
|
46
|
+
import { TABLE_INSERT_HIDE_DELAY_MS as Cn, detectTableInsertHover as wn } from "@stll/folio-core/layout-bridge/tableInsertHover";
|
|
47
|
+
import { createCellDragTracker as Tn, findCellPosFromPmPos as En } from "@stll/folio-core/prosemirror/cellDragSelection";
|
|
48
|
+
import { getDocumentWatermark as Dn, setDocumentWatermark as On } from "@stll/folio-core/watermark";
|
|
49
|
+
import { createEmptyDocument as kn } from "@stll/folio-core/utils/createDocument";
|
|
50
|
+
import { createDocx as An } from "@stll/folio-core/docx/rezip";
|
|
51
|
+
import { deriveBlockId as jn, getFolioParaIdFromBlockId as Mn, isFolioBlockId as Nn, isSequentialFolioBlockId as Pn } from "@stll/folio-core/types/block-id";
|
|
52
|
+
import { DEFAULT_AI_SUGGESTION_PRESETS as Fn } from "@stll/folio-core/ai-suggestions/types";
|
|
53
|
+
import { applySuggestions as In } from "@stll/folio-core/ai-suggestions/apply";
|
|
54
|
+
import { isSuggestionStale as Ln, resolveSuggestionAnchor as Rn } from "@stll/folio-core/ai-suggestions/conflict";
|
|
55
|
+
import { buildPositionalText as zn } from "@stll/folio-core/ai-suggestions/text-positions";
|
|
56
|
+
import { setAISuggestionsMeta as Bn, setFocusedSuggestionMeta as Vn } from "@stll/folio-core/prosemirror/plugins/aiSuggestionDecorations";
|
|
57
|
+
import { scrollFolioPositionIntoView as Hn } from "@stll/folio-core/paged-layout/scrollToPmPosition";
|
|
58
|
+
import { getFolioCaretViewportRect as Un, getFolioSelectionViewportRect as Wn } from "@stll/folio-core/paged-layout/selectionViewportRect";
|
|
59
|
+
import { createAICitationDecorationsPlugin as Gn, setAICitationsMeta as Kn, setActiveCitationMeta as qn } from "@stll/folio-core/prosemirror/plugins/aiCitationDecorations";
|
|
60
|
+
import { DEFAULT_AUTOCOMPLETE_DEAD_ZONE_NODES as Jn, acceptAutocompleteSuggestion as Yn, acceptAutocompleteWord as Xn, appendAutocompleteToken as Zn, autocompleteSuggestionKey as Qn, autocompleteSuggestionPlugin as $n, clearAutocompleteSuggestion as er, finishAutocompleteSuggestion as tr, getAutocompleteSuggestion as nr, shouldTriggerAutocomplete as rr, startAutocompleteSuggestion as ir } from "@stll/folio-core/prosemirror/plugins/autocompleteSuggestion";
|
|
61
|
+
import { fromMarkdown as ar, toMarkdown as or, toMarkdownResult as sr } from "@stll/folio-core/markdown";
|
|
60
62
|
//#region src/components/AnonymizationRectsOverlay.vue?vue&type=script&setup=true&lang.ts
|
|
61
|
-
var
|
|
63
|
+
var cr = [
|
|
62
64
|
"data-folio-anonymization-label",
|
|
63
65
|
"data-folio-anonymization-canonical",
|
|
64
66
|
"data-folio-anonymization-selected",
|
|
65
67
|
"title"
|
|
66
|
-
],
|
|
68
|
+
], lr = /*#__PURE__*/ t(/* @__PURE__ */ z({
|
|
67
69
|
__name: "AnonymizationRectsOverlay",
|
|
68
70
|
props: {
|
|
69
71
|
getView: { type: Function },
|
|
@@ -78,7 +80,7 @@ var Gn = [
|
|
|
78
80
|
selectionSeq: {}
|
|
79
81
|
},
|
|
80
82
|
setup(e) {
|
|
81
|
-
let t = e, n =
|
|
83
|
+
let t = e, n = W(null), r = W([]), i = 0, a = null;
|
|
82
84
|
function o() {
|
|
83
85
|
a !== null && cancelAnimationFrame(a), a = requestAnimationFrame(() => {
|
|
84
86
|
a = null, s();
|
|
@@ -90,12 +92,12 @@ var Gn = [
|
|
|
90
92
|
r.value = [];
|
|
91
93
|
return;
|
|
92
94
|
}
|
|
93
|
-
let s =
|
|
95
|
+
let s = Xe(o);
|
|
94
96
|
if (s.length === 0) {
|
|
95
97
|
r.value = [];
|
|
96
98
|
return;
|
|
97
99
|
}
|
|
98
|
-
let c = await
|
|
100
|
+
let c = await Ke(s, {
|
|
99
101
|
pagesContainer: a,
|
|
100
102
|
zoom: t.zoom,
|
|
101
103
|
layout: t.layout,
|
|
@@ -115,7 +117,7 @@ var Gn = [
|
|
|
115
117
|
}))
|
|
116
118
|
}));
|
|
117
119
|
}
|
|
118
|
-
|
|
120
|
+
J(() => [
|
|
119
121
|
t.editorState,
|
|
120
122
|
t.zoom,
|
|
121
123
|
t.layout,
|
|
@@ -137,10 +139,10 @@ var Gn = [
|
|
|
137
139
|
index: a
|
|
138
140
|
}, i.item(a)?.scrollIntoView({
|
|
139
141
|
block: "center",
|
|
140
|
-
behavior:
|
|
142
|
+
behavior: qe()
|
|
141
143
|
});
|
|
142
144
|
}
|
|
143
|
-
|
|
145
|
+
J(() => [t.selectedCanonical, t.selectionSeq], () => l(), { flush: "post" });
|
|
144
146
|
function u(e) {
|
|
145
147
|
if (e.button !== 0 || !t.onTermClick) return;
|
|
146
148
|
let r = n.value;
|
|
@@ -157,35 +159,35 @@ var Gn = [
|
|
|
157
159
|
}
|
|
158
160
|
}
|
|
159
161
|
}
|
|
160
|
-
return
|
|
162
|
+
return xe(() => {
|
|
161
163
|
document.addEventListener("click", u), o();
|
|
162
|
-
}),
|
|
164
|
+
}), be(() => {
|
|
163
165
|
document.removeEventListener("click", u), a !== null && (cancelAnimationFrame(a), a = null);
|
|
164
|
-
}), (t, i) => (
|
|
166
|
+
}), (t, i) => (U(), I("div", {
|
|
165
167
|
ref_key: "rootRef",
|
|
166
168
|
ref: n,
|
|
167
169
|
class: "folio-anonymization-overlay",
|
|
168
170
|
"data-folio-anonymization-overlay": ""
|
|
169
|
-
}, [(
|
|
171
|
+
}, [(U(!0), I(j, null, G(r.value, (t) => (U(), I(j, { key: `${t.label}:${t.canonical}` }, [(U(!0), I(j, null, G(t.rects, (n, r) => (U(), I("span", {
|
|
170
172
|
key: `${t.canonical}:${r}:${n.left}:${n.top}`,
|
|
171
|
-
class:
|
|
173
|
+
class: V(["folio-anonymization-term", `folio-anonymization-term--${q(Qe)(t.label)}`]),
|
|
172
174
|
"data-folio-anonymization-label": t.label,
|
|
173
175
|
"data-folio-anonymization-canonical": t.canonical,
|
|
174
176
|
"data-folio-anonymization-selected": t.canonical === e.selectedCanonical ? "true" : void 0,
|
|
175
177
|
title: `Anonymized: ${t.canonical}`,
|
|
176
|
-
style:
|
|
178
|
+
style: H({
|
|
177
179
|
position: "absolute",
|
|
178
180
|
left: `${n.left}px`,
|
|
179
181
|
top: `${n.top}px`,
|
|
180
182
|
width: `${n.width}px`,
|
|
181
183
|
height: `${n.height}px`
|
|
182
184
|
})
|
|
183
|
-
}, null, 14,
|
|
185
|
+
}, null, 14, cr))), 128))], 64))), 128))], 512));
|
|
184
186
|
}
|
|
185
|
-
}), [["__scopeId", "data-v-c7db88e1"]]),
|
|
187
|
+
}), [["__scopeId", "data-v-c7db88e1"]]), ur = { class: "doc-outline__header" }, dr = { class: "doc-outline__body" }, fr = {
|
|
186
188
|
key: 0,
|
|
187
189
|
class: "doc-outline__empty"
|
|
188
|
-
},
|
|
190
|
+
}, pr = /*#__PURE__*/ t(/* @__PURE__ */ z({
|
|
189
191
|
__name: "DocumentOutline",
|
|
190
192
|
props: {
|
|
191
193
|
isOpen: { type: Boolean },
|
|
@@ -196,7 +198,7 @@ var Gn = [
|
|
|
196
198
|
},
|
|
197
199
|
emits: ["close", "navigate"],
|
|
198
200
|
setup(e, { emit: t }) {
|
|
199
|
-
let
|
|
201
|
+
let n = e, { OutlineRail: i } = p(), a = N(() => n.headings.length ? Math.min(...n.headings.map((e) => e.level)) : 0), o = N(() => n.headings.map((e) => ({
|
|
200
202
|
id: String(e.pmPos),
|
|
201
203
|
label: e.text || "(untitled)",
|
|
202
204
|
level: e.level - a.value
|
|
@@ -204,33 +206,33 @@ var Gn = [
|
|
|
204
206
|
function c(e) {
|
|
205
207
|
s("navigate", Number(e));
|
|
206
208
|
}
|
|
207
|
-
return (t,
|
|
209
|
+
return (t, n) => e.isOpen ? (U(), I("nav", {
|
|
208
210
|
key: 0,
|
|
209
211
|
class: "doc-outline",
|
|
210
|
-
style:
|
|
212
|
+
style: H({
|
|
211
213
|
left: e.leftOffset + "px",
|
|
212
214
|
top: e.topPx + "px"
|
|
213
215
|
}),
|
|
214
216
|
role: "navigation",
|
|
215
217
|
"aria-label": "Document outline",
|
|
216
|
-
onMousedown:
|
|
217
|
-
}, [
|
|
218
|
+
onMousedown: n[1] ||= Y(() => {}, ["stop"])
|
|
219
|
+
}, [L("div", ur, [L("button", {
|
|
218
220
|
class: "doc-outline__back",
|
|
219
221
|
title: "Close outline",
|
|
220
222
|
"aria-label": "Close outline",
|
|
221
|
-
onClick:
|
|
222
|
-
}, [
|
|
223
|
+
onClick: n[0] ||= (e) => t.$emit("close")
|
|
224
|
+
}, [R(r, {
|
|
223
225
|
name: "arrow_back",
|
|
224
226
|
size: 20
|
|
225
|
-
})]),
|
|
227
|
+
})]), n[2] ||= L("span", { class: "doc-outline__title" }, "Document Outline", -1)]), L("div", dr, [e.headings.length === 0 ? (U(), I("div", fr, "No headings found")) : (U(), P(q(i), {
|
|
226
228
|
key: 1,
|
|
227
229
|
items: o.value,
|
|
228
230
|
"get-scroll-container": e.getScrollContainer ?? (() => null),
|
|
229
231
|
"on-jump": c,
|
|
230
232
|
"aria-label": "Document outline"
|
|
231
|
-
}, null, 8, ["items", "get-scroll-container"]))])], 36)) :
|
|
233
|
+
}, null, 8, ["items", "get-scroll-container"]))])], 36)) : F("", !0);
|
|
232
234
|
}
|
|
233
|
-
}), [["__scopeId", "data-v-
|
|
235
|
+
}), [["__scopeId", "data-v-0797b3b1"]]), mr = /* @__PURE__ */ z({
|
|
234
236
|
__name: "DocxEditorDialogs",
|
|
235
237
|
props: {
|
|
236
238
|
view: {},
|
|
@@ -256,51 +258,51 @@ var Gn = [
|
|
|
256
258
|
],
|
|
257
259
|
setup(e, { emit: t }) {
|
|
258
260
|
let n = t;
|
|
259
|
-
return (t,
|
|
260
|
-
|
|
261
|
+
return (t, r) => (U(), I(j, null, [
|
|
262
|
+
R(u, {
|
|
261
263
|
"is-open": e.showFindReplace,
|
|
262
264
|
view: e.view,
|
|
263
|
-
onClose:
|
|
265
|
+
onClose: r[0] ||= (e) => n("update:showFindReplace", !1)
|
|
264
266
|
}, null, 8, ["is-open", "view"]),
|
|
265
|
-
|
|
267
|
+
R(d, {
|
|
266
268
|
"is-open": e.showHyperlink,
|
|
267
269
|
view: e.view,
|
|
268
270
|
bookmarks: e.bookmarks,
|
|
269
|
-
onClose:
|
|
270
|
-
onSubmit:
|
|
271
|
-
onRemove:
|
|
271
|
+
onClose: r[1] ||= (e) => n("update:showHyperlink", !1),
|
|
272
|
+
onSubmit: r[2] ||= (e) => n("hyperlink-submit", e),
|
|
273
|
+
onRemove: r[3] ||= (e) => n("hyperlink-remove")
|
|
272
274
|
}, null, 8, [
|
|
273
275
|
"is-open",
|
|
274
276
|
"view",
|
|
275
277
|
"bookmarks"
|
|
276
278
|
]),
|
|
277
|
-
|
|
279
|
+
R(a, {
|
|
278
280
|
"is-open": e.showInsertSymbol,
|
|
279
|
-
onClose:
|
|
280
|
-
onInsert:
|
|
281
|
+
onClose: r[4] ||= (e) => n("update:showInsertSymbol", !1),
|
|
282
|
+
onInsert: r[5] ||= (e) => n("insert-symbol", e)
|
|
281
283
|
}, null, 8, ["is-open"]),
|
|
282
|
-
|
|
284
|
+
R(o, {
|
|
283
285
|
"is-open": e.showImageProperties,
|
|
284
286
|
view: e.view,
|
|
285
287
|
"pm-pos": e.selectedImagePmPos,
|
|
286
|
-
onClose:
|
|
288
|
+
onClose: r[6] ||= (e) => n("update:showImageProperties", !1)
|
|
287
289
|
}, null, 8, [
|
|
288
290
|
"is-open",
|
|
289
291
|
"view",
|
|
290
292
|
"pm-pos"
|
|
291
293
|
]),
|
|
292
|
-
|
|
294
|
+
R(f, {
|
|
293
295
|
"is-open": e.showPageSetup,
|
|
294
296
|
"section-properties": e.sectionProperties,
|
|
295
|
-
onClose:
|
|
296
|
-
onApply:
|
|
297
|
+
onClose: r[7] ||= (e) => n("update:showPageSetup", !1),
|
|
298
|
+
onApply: r[8] ||= (e) => n("page-setup-apply", e)
|
|
297
299
|
}, null, 8, ["is-open", "section-properties"])
|
|
298
300
|
], 64));
|
|
299
301
|
}
|
|
300
|
-
}),
|
|
302
|
+
}), hr = {
|
|
301
303
|
key: 0,
|
|
302
304
|
class: "docx-editor-vue__title-bar"
|
|
303
|
-
},
|
|
305
|
+
}, gr = { class: "docx-editor-vue__title-bar-left" }, _r = { class: "docx-editor-vue__title-bar-center" }, vr = { class: "docx-editor-vue__title-bar-right" }, yr = /* @__PURE__ */ z({
|
|
304
306
|
__name: "DocxEditorMenuBar",
|
|
305
307
|
props: {
|
|
306
308
|
showMenuBar: {
|
|
@@ -332,13 +334,13 @@ var Gn = [
|
|
|
332
334
|
],
|
|
333
335
|
setup(e, { emit: t }) {
|
|
334
336
|
let n = t;
|
|
335
|
-
return (t, r) => e.showMenuBar ? (
|
|
336
|
-
|
|
337
|
-
|
|
337
|
+
return (t, r) => e.showMenuBar ? (U(), I("div", hr, [
|
|
338
|
+
L("div", gr, [Ce(t.$slots, "title-bar-left")]),
|
|
339
|
+
L("div", _r, [R(h, {
|
|
338
340
|
"model-value": e.documentName,
|
|
339
341
|
editable: e.documentNameEditable,
|
|
340
342
|
"onUpdate:modelValue": r[0] ||= (e) => n("rename", e)
|
|
341
|
-
}, null, 8, ["model-value", "editable"]),
|
|
343
|
+
}, null, 8, ["model-value", "editable"]), R(C, {
|
|
342
344
|
"show-file-open": e.showFileOpen,
|
|
343
345
|
"show-help-menu": e.showHelpMenu,
|
|
344
346
|
"show-table-insert": e.showTableInsert,
|
|
@@ -349,40 +351,40 @@ var Gn = [
|
|
|
349
351
|
"show-help-menu",
|
|
350
352
|
"show-table-insert"
|
|
351
353
|
])]),
|
|
352
|
-
|
|
353
|
-
])) :
|
|
354
|
+
L("div", vr, [Ce(t.$slots, "title-bar-right")])
|
|
355
|
+
])) : F("", !0);
|
|
354
356
|
}
|
|
355
|
-
}),
|
|
356
|
-
function
|
|
357
|
-
|
|
357
|
+
}), br = Symbol("docx-portal-class");
|
|
358
|
+
function xr(e) {
|
|
359
|
+
Se(br, N(() => ({
|
|
358
360
|
"ep-root": !0,
|
|
359
|
-
dark: !!
|
|
361
|
+
dark: !!q(e)
|
|
360
362
|
})));
|
|
361
363
|
}
|
|
362
|
-
function
|
|
363
|
-
return
|
|
364
|
+
function Sr() {
|
|
365
|
+
return _e(br, N(() => ({ "ep-root": !0 })));
|
|
364
366
|
}
|
|
365
367
|
//#endregion
|
|
366
368
|
//#region src/components/ImageContextMenu.vue?vue&type=script&setup=true&lang.ts
|
|
367
|
-
var
|
|
369
|
+
var Cr = ["aria-label"], wr = { class: "image-ctx-menu__icon" }, Tr = { class: "image-ctx-menu__label" }, Er = {
|
|
368
370
|
key: 1,
|
|
369
371
|
class: "image-ctx-menu__divider",
|
|
370
372
|
role: "separator"
|
|
371
|
-
},
|
|
373
|
+
}, Dr = [
|
|
372
374
|
"data-wrap-type",
|
|
373
375
|
"data-current",
|
|
374
376
|
"data-disabled",
|
|
375
377
|
"disabled",
|
|
376
378
|
"title",
|
|
377
379
|
"onClick"
|
|
378
|
-
],
|
|
380
|
+
], Or = { class: "image-ctx-menu__icon" }, kr = { class: "image-ctx-menu__label" }, Ar = ["aria-label"], jr = ["disabled", "onClick"], Mr = { class: "image-ctx-menu__label" }, Nr = {
|
|
379
381
|
key: 0,
|
|
380
382
|
class: "image-ctx-menu__shortcut"
|
|
381
|
-
},
|
|
383
|
+
}, Pr = {
|
|
382
384
|
key: 0,
|
|
383
385
|
class: "image-ctx-menu__divider",
|
|
384
386
|
role: "separator"
|
|
385
|
-
},
|
|
387
|
+
}, Fr = 18, Ir = 260, Lr = 10, Rr = /*#__PURE__*/ t(/* @__PURE__ */ z({
|
|
386
388
|
__name: "ImageContextMenu",
|
|
387
389
|
props: {
|
|
388
390
|
state: {},
|
|
@@ -398,12 +400,12 @@ var or = ["aria-label"], sr = { class: "image-ctx-menu__icon" }, cr = { class: "
|
|
|
398
400
|
"text-action",
|
|
399
401
|
"open-properties"
|
|
400
402
|
],
|
|
401
|
-
setup(e, { emit:
|
|
402
|
-
let
|
|
403
|
-
function
|
|
404
|
-
|
|
403
|
+
setup(e, { emit: t }) {
|
|
404
|
+
let n = e, i = t;
|
|
405
|
+
function a() {
|
|
406
|
+
i("open-properties"), i("close");
|
|
405
407
|
}
|
|
406
|
-
let { t:
|
|
408
|
+
let { t: o } = c(), s = Sr(), l = nt, u = N(() => n.state ? it(n.state.currentWrapType, n.state.currentCssFloat ?? null) : null), d = {
|
|
407
409
|
inline: "wrap_text",
|
|
408
410
|
squareLeft: "format_image_left",
|
|
409
411
|
squareRight: "format_image_right",
|
|
@@ -413,104 +415,104 @@ var or = ["aria-label"], sr = { class: "image-ctx-menu__icon" }, cr = { class: "
|
|
|
413
415
|
function f(e) {
|
|
414
416
|
return d[e];
|
|
415
417
|
}
|
|
416
|
-
let p =
|
|
417
|
-
if (!
|
|
418
|
-
let e =
|
|
419
|
-
return typeof window < "u" && (t +
|
|
418
|
+
let p = N(() => {
|
|
419
|
+
if (!n.state) return {};
|
|
420
|
+
let e = nt.length * 36 + 16, t = n.state.position.x, r = n.state.position.y;
|
|
421
|
+
return typeof window < "u" && (t + Ir > window.innerWidth && (t = window.innerWidth - Ir - Lr), r + e > window.innerHeight && (r = window.innerHeight - e - Lr), t < Lr && (t = Lr), r < Lr && (r = Lr)), {
|
|
420
422
|
position: "fixed",
|
|
421
423
|
left: `${t}px`,
|
|
422
|
-
top: `${
|
|
423
|
-
minWidth: `${
|
|
424
|
+
top: `${r}px`,
|
|
425
|
+
minWidth: `${Ir}px`,
|
|
424
426
|
zIndex: 400
|
|
425
427
|
};
|
|
426
428
|
});
|
|
427
429
|
function m(e) {
|
|
428
|
-
return
|
|
430
|
+
return n.state ? ot(e, n.state.currentWrapType) : !1;
|
|
429
431
|
}
|
|
430
432
|
function h(e) {
|
|
431
|
-
m(e) && (
|
|
433
|
+
m(e) && (i("select", e.choice), i("close"));
|
|
432
434
|
}
|
|
433
435
|
function g(e) {
|
|
434
|
-
e.disabled || (
|
|
436
|
+
e.disabled || (i("text-action", e.action), i("close"));
|
|
435
437
|
}
|
|
436
438
|
function _(e) {
|
|
437
|
-
e.preventDefault(),
|
|
439
|
+
e.preventDefault(), i("close");
|
|
438
440
|
}
|
|
439
441
|
function v(e) {
|
|
440
|
-
e.key === "Escape" && (e.preventDefault(),
|
|
442
|
+
e.key === "Escape" && (e.preventDefault(), i("close"));
|
|
441
443
|
}
|
|
442
|
-
return (t,
|
|
444
|
+
return (t, n) => (U(), P(M, { to: "body" }, [e.state && e.state.open ? (U(), I("div", {
|
|
443
445
|
key: 0,
|
|
444
446
|
class: "image-ctx-menu-backdrop",
|
|
445
447
|
onMousedown: _,
|
|
446
|
-
onContextmenu:
|
|
447
|
-
}, null, 32)) :
|
|
448
|
+
onContextmenu: n[0] ||= Y((e) => t.$emit("close"), ["prevent"])
|
|
449
|
+
}, null, 32)) : F("", !0), e.state && e.state.open ? (U(), I("div", {
|
|
448
450
|
key: 1,
|
|
449
|
-
class:
|
|
451
|
+
class: V(["image-ctx-menu", q(s)]),
|
|
450
452
|
role: "menu",
|
|
451
|
-
"aria-label":
|
|
453
|
+
"aria-label": q(o)("imageWrap.menu.ariaLabel"),
|
|
452
454
|
"data-testid": "image-context-menu",
|
|
453
|
-
style:
|
|
454
|
-
onContextmenu:
|
|
455
|
+
style: H(p.value),
|
|
456
|
+
onContextmenu: n[4] ||= Y(() => {}, ["prevent"]),
|
|
455
457
|
onKeydown: v
|
|
456
458
|
}, [
|
|
457
|
-
e.canOpenProperties ? (
|
|
459
|
+
e.canOpenProperties ? (U(), I("button", {
|
|
458
460
|
key: 0,
|
|
459
461
|
type: "button",
|
|
460
462
|
role: "menuitem",
|
|
461
463
|
class: "image-ctx-menu__item",
|
|
462
464
|
"data-action": "open-properties",
|
|
463
|
-
onMousedown:
|
|
464
|
-
onClick:
|
|
465
|
-
}, [
|
|
465
|
+
onMousedown: n[1] ||= Y(() => {}, ["prevent"]),
|
|
466
|
+
onClick: a
|
|
467
|
+
}, [L("span", wr, [R(r, {
|
|
466
468
|
name: "settings",
|
|
467
|
-
size:
|
|
468
|
-
})]),
|
|
469
|
-
e.canOpenProperties ? (
|
|
470
|
-
(
|
|
469
|
+
size: Fr
|
|
470
|
+
})]), L("span", Tr, K(q(o)("imageWrap.menu.imageProperties")), 1)], 32)) : F("", !0),
|
|
471
|
+
e.canOpenProperties ? (U(), I("div", Er)) : F("", !0),
|
|
472
|
+
(U(!0), I(j, null, G(q(l), (e) => (U(), I("button", {
|
|
471
473
|
key: e.choice,
|
|
472
474
|
type: "button",
|
|
473
475
|
role: "menuitem",
|
|
474
|
-
class:
|
|
476
|
+
class: V(["image-ctx-menu__item", { "image-ctx-menu__item--current": e.choice === u.value }]),
|
|
475
477
|
"data-wrap-type": e.choice,
|
|
476
478
|
"data-current": e.choice === u.value ? "true" : "false",
|
|
477
479
|
"data-disabled": m(e) ? "false" : "true",
|
|
478
480
|
disabled: !m(e),
|
|
479
|
-
title:
|
|
480
|
-
onMousedown:
|
|
481
|
+
title: q(o)(`imageWrap.menuDesc.${e.i18nDescKey}`),
|
|
482
|
+
onMousedown: n[2] ||= Y(() => {}, ["prevent"]),
|
|
481
483
|
onClick: (t) => h(e)
|
|
482
484
|
}, [
|
|
483
|
-
|
|
485
|
+
L("span", Or, [R(r, {
|
|
484
486
|
name: f(e.iconHint),
|
|
485
|
-
size:
|
|
487
|
+
size: Fr
|
|
486
488
|
}, null, 8, ["name"])]),
|
|
487
|
-
|
|
488
|
-
e.choice === u.value ? (
|
|
489
|
+
L("span", kr, K(q(o)(`imageWrap.menu.${e.i18nLabelKey}`)), 1),
|
|
490
|
+
e.choice === u.value ? (U(), I("span", {
|
|
489
491
|
key: 0,
|
|
490
492
|
class: "image-ctx-menu__current-dot",
|
|
491
|
-
"aria-label":
|
|
492
|
-
}, "●", 8,
|
|
493
|
-
], 42,
|
|
494
|
-
e.textActions && e.textActions.length > 0 ? (
|
|
493
|
+
"aria-label": q(o)("imageWrap.menu.ariaLabel")
|
|
494
|
+
}, "●", 8, Ar)) : F("", !0)
|
|
495
|
+
], 42, Dr))), 128)),
|
|
496
|
+
e.textActions && e.textActions.length > 0 ? (U(), I(j, { key: 2 }, [n[5] ||= L("div", {
|
|
495
497
|
class: "image-ctx-menu__divider",
|
|
496
498
|
role: "separator"
|
|
497
|
-
}, null, -1), (
|
|
499
|
+
}, null, -1), (U(!0), I(j, null, G(e.textActions, (e, t) => (U(), I(j, { key: `${e.action}-${t}` }, [L("button", {
|
|
498
500
|
type: "button",
|
|
499
501
|
role: "menuitem",
|
|
500
502
|
class: "image-ctx-menu__item image-ctx-menu__item--text",
|
|
501
503
|
disabled: e.disabled,
|
|
502
|
-
onMousedown:
|
|
504
|
+
onMousedown: n[3] ||= Y(() => {}, ["prevent"]),
|
|
503
505
|
onClick: (t) => g(e)
|
|
504
|
-
}, [
|
|
505
|
-
], 46,
|
|
506
|
+
}, [L("span", Mr, K(e.label), 1), e.shortcut ? (U(), I("span", Nr, K(e.shortcut), 1)) : F("", !0)], 40, jr), e.dividerAfter ? (U(), I("div", Pr)) : F("", !0)], 64))), 128))], 64)) : F("", !0)
|
|
507
|
+
], 46, Cr)) : F("", !0)]));
|
|
506
508
|
}
|
|
507
|
-
}), [["__scopeId", "data-v-
|
|
509
|
+
}), [["__scopeId", "data-v-fc8f35bc"]]), zr = ["disabled", "onMousedown"], Br = {
|
|
508
510
|
key: 0,
|
|
509
511
|
class: "ctx-menu__icon"
|
|
510
|
-
},
|
|
512
|
+
}, Vr = { class: "ctx-menu__label" }, Hr = {
|
|
511
513
|
key: 1,
|
|
512
514
|
class: "ctx-menu__shortcut"
|
|
513
|
-
},
|
|
515
|
+
}, Ur = 220, Wr = 32, Gr = 10, Kr = /*#__PURE__*/ t(/* @__PURE__ */ z({
|
|
514
516
|
__name: "TextContextMenu",
|
|
515
517
|
props: {
|
|
516
518
|
isOpen: { type: Boolean },
|
|
@@ -524,11 +526,11 @@ var or = ["aria-label"], sr = { class: "image-ctx-menu__icon" }, cr = { class: "
|
|
|
524
526
|
customItems: {}
|
|
525
527
|
},
|
|
526
528
|
emits: ["close", "action"],
|
|
527
|
-
setup(e, { emit:
|
|
528
|
-
let
|
|
529
|
-
|
|
530
|
-
let
|
|
531
|
-
let e = [], t =
|
|
529
|
+
setup(e, { emit: t }) {
|
|
530
|
+
let n = e, r = ({ node: e }) => e;
|
|
531
|
+
r.props = ["node"];
|
|
532
|
+
let i = t, { t: a } = c(), o = Sr(), s = W(null), l = N(() => {
|
|
533
|
+
let e = [], t = n.customItems ?? [];
|
|
532
534
|
for (let [n, r] of t.entries()) e.push({
|
|
533
535
|
id: `custom-${r.id}`,
|
|
534
536
|
label: r.label,
|
|
@@ -543,28 +545,28 @@ var or = ["aria-label"], sr = { class: "image-ctx-menu__icon" }, cr = { class: "
|
|
|
543
545
|
});
|
|
544
546
|
return e.push({
|
|
545
547
|
id: "cut",
|
|
546
|
-
label:
|
|
548
|
+
label: a("cut"),
|
|
547
549
|
action: "cut",
|
|
548
|
-
shortcut:
|
|
549
|
-
disabled: !
|
|
550
|
+
shortcut: a("contextMenu.cutShortcut"),
|
|
551
|
+
disabled: !n.hasSelection || !n.isEditable
|
|
550
552
|
}, {
|
|
551
553
|
id: "copy",
|
|
552
|
-
label:
|
|
554
|
+
label: a("copy"),
|
|
553
555
|
action: "copy",
|
|
554
|
-
shortcut:
|
|
555
|
-
disabled: !
|
|
556
|
+
shortcut: a("contextMenu.copyShortcut"),
|
|
557
|
+
disabled: !n.hasSelection
|
|
556
558
|
}, {
|
|
557
559
|
id: "paste",
|
|
558
|
-
label:
|
|
560
|
+
label: a("paste"),
|
|
559
561
|
action: "paste",
|
|
560
|
-
shortcut:
|
|
561
|
-
disabled: !
|
|
562
|
+
shortcut: a("contextMenu.pasteShortcut"),
|
|
563
|
+
disabled: !n.isEditable
|
|
562
564
|
}, {
|
|
563
565
|
id: "pasteAsPlainText",
|
|
564
|
-
label:
|
|
566
|
+
label: a("pasteUnformatted"),
|
|
565
567
|
action: "pasteAsPlainText",
|
|
566
|
-
shortcut:
|
|
567
|
-
disabled: !
|
|
568
|
+
shortcut: a("contextMenu.pastePlainTextShortcut"),
|
|
569
|
+
disabled: !n.isEditable
|
|
568
570
|
}, {
|
|
569
571
|
id: "div1",
|
|
570
572
|
label: "",
|
|
@@ -572,49 +574,49 @@ var or = ["aria-label"], sr = { class: "image-ctx-menu__icon" }, cr = { class: "
|
|
|
572
574
|
divider: !0
|
|
573
575
|
}, {
|
|
574
576
|
id: "delete",
|
|
575
|
-
label:
|
|
577
|
+
label: a("delete"),
|
|
576
578
|
action: "delete",
|
|
577
|
-
shortcut:
|
|
578
|
-
disabled: !
|
|
579
|
+
shortcut: a("contextMenu.deleteShortcut"),
|
|
580
|
+
disabled: !n.hasSelection || !n.isEditable
|
|
579
581
|
}, {
|
|
580
582
|
id: "selectAll",
|
|
581
|
-
label:
|
|
583
|
+
label: a("selectAll"),
|
|
582
584
|
action: "selectAll",
|
|
583
|
-
shortcut:
|
|
584
|
-
}),
|
|
585
|
+
shortcut: a("contextMenu.selectAllShortcut")
|
|
586
|
+
}), n.onImage && n.isEditable && e.push({
|
|
585
587
|
id: "div-img",
|
|
586
588
|
label: "",
|
|
587
589
|
action: "",
|
|
588
590
|
divider: !0
|
|
589
591
|
}, {
|
|
590
592
|
id: "replaceImage",
|
|
591
|
-
label:
|
|
593
|
+
label: a("imageOverlay.replaceImage"),
|
|
592
594
|
action: "replaceImage"
|
|
593
595
|
}, {
|
|
594
596
|
id: "imageProperties",
|
|
595
|
-
label:
|
|
597
|
+
label: a("imageWrap.menu.imageProperties"),
|
|
596
598
|
action: "imageProperties"
|
|
597
599
|
}, {
|
|
598
600
|
id: "deleteImage",
|
|
599
|
-
label:
|
|
601
|
+
label: a("imageOverlay.deleteImage"),
|
|
600
602
|
action: "deleteImage",
|
|
601
|
-
shortcut:
|
|
602
|
-
}),
|
|
603
|
+
shortcut: a("contextMenu.deleteShortcut")
|
|
604
|
+
}), n.inTable && n.isEditable && e.push({
|
|
603
605
|
id: "div2",
|
|
604
606
|
label: "",
|
|
605
607
|
action: "",
|
|
606
608
|
divider: !0
|
|
607
609
|
}, {
|
|
608
610
|
id: "addRowAbove",
|
|
609
|
-
label:
|
|
611
|
+
label: a("insertRowAbove"),
|
|
610
612
|
action: "addRowAbove"
|
|
611
613
|
}, {
|
|
612
614
|
id: "addRowBelow",
|
|
613
|
-
label:
|
|
615
|
+
label: a("insertRowBelow"),
|
|
614
616
|
action: "addRowBelow"
|
|
615
617
|
}, {
|
|
616
618
|
id: "deleteRow",
|
|
617
|
-
label:
|
|
619
|
+
label: a("deleteRow"),
|
|
618
620
|
action: "deleteRow"
|
|
619
621
|
}, {
|
|
620
622
|
id: "div3",
|
|
@@ -623,15 +625,15 @@ var or = ["aria-label"], sr = { class: "image-ctx-menu__icon" }, cr = { class: "
|
|
|
623
625
|
divider: !0
|
|
624
626
|
}, {
|
|
625
627
|
id: "addColLeft",
|
|
626
|
-
label:
|
|
628
|
+
label: a("insertColumnLeft"),
|
|
627
629
|
action: "addColumnLeft"
|
|
628
630
|
}, {
|
|
629
631
|
id: "addColRight",
|
|
630
|
-
label:
|
|
632
|
+
label: a("insertColumnRight"),
|
|
631
633
|
action: "addColumnRight"
|
|
632
634
|
}, {
|
|
633
635
|
id: "deleteCol",
|
|
634
|
-
label:
|
|
636
|
+
label: a("deleteColumn"),
|
|
635
637
|
action: "deleteColumn"
|
|
636
638
|
}, {
|
|
637
639
|
id: "div4",
|
|
@@ -640,14 +642,14 @@ var or = ["aria-label"], sr = { class: "image-ctx-menu__icon" }, cr = { class: "
|
|
|
640
642
|
divider: !0
|
|
641
643
|
}, {
|
|
642
644
|
id: "mergeCells",
|
|
643
|
-
label:
|
|
645
|
+
label: a("table.mergeCells"),
|
|
644
646
|
action: "mergeCells",
|
|
645
|
-
disabled: !
|
|
647
|
+
disabled: !n.canMergeCells
|
|
646
648
|
}, {
|
|
647
649
|
id: "splitCell",
|
|
648
|
-
label:
|
|
650
|
+
label: a("table.splitCell"),
|
|
649
651
|
action: "splitCell",
|
|
650
|
-
disabled: !
|
|
652
|
+
disabled: !n.canSplitCell
|
|
651
653
|
}, {
|
|
652
654
|
id: "div5",
|
|
653
655
|
label: "",
|
|
@@ -655,16 +657,16 @@ var or = ["aria-label"], sr = { class: "image-ctx-menu__icon" }, cr = { class: "
|
|
|
655
657
|
divider: !0
|
|
656
658
|
}, {
|
|
657
659
|
id: "selectTable",
|
|
658
|
-
label:
|
|
660
|
+
label: a("table.selectTable"),
|
|
659
661
|
action: "selectTable"
|
|
660
662
|
}, {
|
|
661
663
|
id: "deleteTable",
|
|
662
|
-
label:
|
|
664
|
+
label: a("table.deleteTable"),
|
|
663
665
|
action: "deleteTable"
|
|
664
666
|
}), e;
|
|
665
|
-
}), u =
|
|
666
|
-
let e =
|
|
667
|
-
return typeof window < "u" && (e +
|
|
667
|
+
}), u = N(() => {
|
|
668
|
+
let e = n.position.x, t = n.position.y, r = l.value.filter((e) => !e.divider).length, i = l.value.filter((e) => e.divider).length, a = r * Wr + i * 9;
|
|
669
|
+
return typeof window < "u" && (e + Ur + Gr > window.innerWidth && (e = window.innerWidth - Ur - Gr), t + a + Gr > window.innerHeight && (t = window.innerHeight - a - Gr)), {
|
|
668
670
|
position: "fixed",
|
|
669
671
|
left: `${e}px`,
|
|
670
672
|
top: `${t}px`,
|
|
@@ -672,42 +674,42 @@ var or = ["aria-label"], sr = { class: "image-ctx-menu__icon" }, cr = { class: "
|
|
|
672
674
|
};
|
|
673
675
|
});
|
|
674
676
|
function d(e) {
|
|
675
|
-
e && (
|
|
677
|
+
e && (i("action", e), i("close"));
|
|
676
678
|
}
|
|
677
679
|
function f(e) {
|
|
678
|
-
e.key === "Escape" &&
|
|
680
|
+
e.key === "Escape" && i("close");
|
|
679
681
|
}
|
|
680
|
-
return
|
|
681
|
-
e &&
|
|
682
|
-
}), (t, n) => (
|
|
682
|
+
return J(() => n.isOpen, (e) => {
|
|
683
|
+
e && ye(() => s.value?.focus());
|
|
684
|
+
}), (t, n) => (U(), P(M, { to: "body" }, [e.isOpen ? (U(), I("div", {
|
|
683
685
|
key: 0,
|
|
684
686
|
class: "ctx-menu-backdrop",
|
|
685
687
|
onMousedown: n[0] ||= (e) => t.$emit("close"),
|
|
686
|
-
onContextmenu: n[1] ||=
|
|
687
|
-
}, null, 32)) :
|
|
688
|
+
onContextmenu: n[1] ||= Y((e) => t.$emit("close"), ["prevent"])
|
|
689
|
+
}, null, 32)) : F("", !0), e.isOpen ? (U(), I("div", {
|
|
688
690
|
key: 1,
|
|
689
691
|
ref_key: "menuRef",
|
|
690
|
-
ref:
|
|
691
|
-
class:
|
|
692
|
-
style:
|
|
693
|
-
onContextmenu: n[2] ||=
|
|
692
|
+
ref: s,
|
|
693
|
+
class: V(["ctx-menu", q(o)]),
|
|
694
|
+
style: H(u.value),
|
|
695
|
+
onContextmenu: n[2] ||= Y(() => {}, ["prevent"]),
|
|
694
696
|
onKeydown: f
|
|
695
|
-
}, [(
|
|
697
|
+
}, [(U(!0), I(j, null, G(l.value, (e, t) => (U(), I("button", {
|
|
696
698
|
key: e.id || t,
|
|
697
|
-
class:
|
|
699
|
+
class: V(["ctx-menu__item", {
|
|
698
700
|
"ctx-menu__item--disabled": e.disabled,
|
|
699
701
|
"ctx-menu__item--divider": e.divider,
|
|
700
702
|
"ctx-menu__item--emphasis": e.emphasis
|
|
701
703
|
}]),
|
|
702
704
|
disabled: e.disabled,
|
|
703
|
-
onMousedown:
|
|
705
|
+
onMousedown: Y((t) => d(e.action), ["prevent"])
|
|
704
706
|
}, [
|
|
705
|
-
e.icon ? (
|
|
706
|
-
|
|
707
|
-
e.shortcut ? (
|
|
708
|
-
], 42,
|
|
707
|
+
e.icon ? (U(), I("span", Br, [R(r, { node: e.icon }, null, 8, ["node"])])) : F("", !0),
|
|
708
|
+
L("span", Vr, K(e.label), 1),
|
|
709
|
+
e.shortcut ? (U(), I("span", Hr, K(e.shortcut), 1)) : F("", !0)
|
|
710
|
+
], 42, zr))), 128))], 38)) : F("", !0)]));
|
|
709
711
|
}
|
|
710
|
-
}), [["__scopeId", "data-v-
|
|
712
|
+
}), [["__scopeId", "data-v-c1416e84"]]), qr = /* @__PURE__ */ z({
|
|
711
713
|
__name: "DocxEditorOverlays",
|
|
712
714
|
props: {
|
|
713
715
|
readOnly: { type: Boolean },
|
|
@@ -726,7 +728,7 @@ var or = ["aria-label"], sr = { class: "image-ctx-menu__icon" }, cr = { class: "
|
|
|
726
728
|
],
|
|
727
729
|
setup(e, { emit: t }) {
|
|
728
730
|
let n = t;
|
|
729
|
-
return (t, r) => (
|
|
731
|
+
return (t, r) => (U(), I(j, null, [R(Kr, {
|
|
730
732
|
"is-open": e.contextMenu.isOpen,
|
|
731
733
|
position: e.contextMenu.position,
|
|
732
734
|
"has-selection": e.contextMenu.hasSelection,
|
|
@@ -748,7 +750,7 @@ var or = ["aria-label"], sr = { class: "image-ctx-menu__icon" }, cr = { class: "
|
|
|
748
750
|
"can-merge-cells",
|
|
749
751
|
"can-split-cell",
|
|
750
752
|
"custom-items"
|
|
751
|
-
]),
|
|
753
|
+
]), R(Rr, {
|
|
752
754
|
state: e.imageContextMenu,
|
|
753
755
|
"text-actions": e.imageContextMenuTextActions,
|
|
754
756
|
"can-open-properties": e.canOpenImageProperties,
|
|
@@ -765,7 +767,7 @@ var or = ["aria-label"], sr = { class: "image-ctx-menu__icon" }, cr = { class: "
|
|
|
765
767
|
});
|
|
766
768
|
//#endregion
|
|
767
769
|
//#region src/composables/imageOverlayRect.ts
|
|
768
|
-
function
|
|
770
|
+
function Jr(e) {
|
|
769
771
|
let t = Math.max(0, e.parentOffsetWidth - e.parentClientWidth) / 2, n = e.zoom || 1;
|
|
770
772
|
return {
|
|
771
773
|
left: (e.imageRect.left - e.parentRect.left - t + e.scrollLeft) / n,
|
|
@@ -776,13 +778,13 @@ function jr(e) {
|
|
|
776
778
|
}
|
|
777
779
|
//#endregion
|
|
778
780
|
//#region src/components/ImageSelectionOverlay.vue?vue&type=script&setup=true&lang.ts
|
|
779
|
-
var
|
|
781
|
+
var Yr = ["data-handle", "onMousedown"], Xr = ["title"], Zr = {
|
|
780
782
|
key: 0,
|
|
781
783
|
class: "image-overlay__dim"
|
|
782
|
-
},
|
|
784
|
+
}, Qr = {
|
|
783
785
|
key: 1,
|
|
784
786
|
class: "image-overlay__dim image-overlay__dim--rotate"
|
|
785
|
-
},
|
|
787
|
+
}, $r = 4, ei = 15, ti = 250, ni = 700, ri = /*#__PURE__*/ t(/* @__PURE__ */ z({
|
|
786
788
|
__name: "ImageSelectionOverlay",
|
|
787
789
|
props: {
|
|
788
790
|
imageInfo: {},
|
|
@@ -795,9 +797,9 @@ var Mr = ["data-handle", "onMousedown"], Nr = ["title"], Pr = {
|
|
|
795
797
|
"interact-end",
|
|
796
798
|
"context-menu"
|
|
797
799
|
],
|
|
798
|
-
setup(e, { emit:
|
|
799
|
-
let { t:
|
|
800
|
-
function
|
|
800
|
+
setup(e, { emit: t }) {
|
|
801
|
+
let { t: n } = c(), r = e, i = t, a = W(null), o = W(!1), s = W(!1), l = W(!1), u = W(0), d = W(0), f = W(0), p = W(null), m = "se", h = 0, g = 0, _ = 0, v = 0, y = null, b = null, x = null, S = null;
|
|
802
|
+
function C(e, t) {
|
|
801
803
|
if (!e) return null;
|
|
802
804
|
try {
|
|
803
805
|
let n = e.state.doc.nodeAt(t);
|
|
@@ -806,88 +808,88 @@ var Mr = ["data-handle", "onMousedown"], Nr = ["title"], Pr = {
|
|
|
806
808
|
return null;
|
|
807
809
|
}
|
|
808
810
|
}
|
|
809
|
-
function
|
|
811
|
+
function ee(e) {
|
|
810
812
|
if (!e) return null;
|
|
811
813
|
let t = e.attrs.transform;
|
|
812
814
|
return typeof t == "string" ? t : null;
|
|
813
815
|
}
|
|
814
|
-
function
|
|
815
|
-
return
|
|
816
|
+
function w() {
|
|
817
|
+
return a.value?.closest(".docx-editor-vue__pages-viewport")?.querySelector(".docx-editor-vue__pages") ?? null;
|
|
816
818
|
}
|
|
817
|
-
function
|
|
818
|
-
let e =
|
|
819
|
+
function ne() {
|
|
820
|
+
let e = r.imageInfo;
|
|
819
821
|
if (!e) return null;
|
|
820
822
|
if (e.element.isConnected) return e.element;
|
|
821
|
-
let t =
|
|
823
|
+
let t = w();
|
|
822
824
|
if (!t) return null;
|
|
823
|
-
let n =
|
|
824
|
-
return n ?
|
|
825
|
+
let n = gt(t, e.pmPos);
|
|
826
|
+
return n ? at(n) : null;
|
|
825
827
|
}
|
|
826
|
-
function
|
|
827
|
-
let e =
|
|
828
|
-
if (!e || !
|
|
828
|
+
function T() {
|
|
829
|
+
let e = ne();
|
|
830
|
+
if (!e || !a.value) {
|
|
829
831
|
p.value = null;
|
|
830
832
|
return;
|
|
831
833
|
}
|
|
832
|
-
let t =
|
|
834
|
+
let t = a.value.offsetParent;
|
|
833
835
|
if (!(t instanceof HTMLElement)) {
|
|
834
836
|
p.value = null;
|
|
835
837
|
return;
|
|
836
838
|
}
|
|
837
|
-
let n = t.getBoundingClientRect();
|
|
838
|
-
p.value =
|
|
839
|
-
imageRect:
|
|
839
|
+
let n = t.getBoundingClientRect(), i = e.getBoundingClientRect();
|
|
840
|
+
p.value = Jr({
|
|
841
|
+
imageRect: i,
|
|
840
842
|
parentRect: n,
|
|
841
843
|
scrollLeft: t.scrollLeft,
|
|
842
844
|
scrollTop: t.scrollTop,
|
|
843
845
|
parentOffsetWidth: t.offsetWidth,
|
|
844
846
|
parentClientWidth: t.clientWidth,
|
|
845
|
-
zoom:
|
|
847
|
+
zoom: r.zoom
|
|
846
848
|
});
|
|
847
849
|
}
|
|
848
|
-
let
|
|
849
|
-
function
|
|
850
|
-
|
|
850
|
+
let re = null;
|
|
851
|
+
function ie() {
|
|
852
|
+
re?.();
|
|
851
853
|
let e = 0, t = "", n = 0, r = 0, i = (a) => {
|
|
852
854
|
r === 0 && (r = a);
|
|
853
855
|
let o = a - r;
|
|
854
|
-
|
|
856
|
+
T();
|
|
855
857
|
let s = p.value, c = s ? `${s.left}|${s.top}|${s.width}|${s.height}` : "";
|
|
856
|
-
n = c === t ? n + 1 : 0, t = c, !(o >=
|
|
858
|
+
n = c === t ? n + 1 : 0, t = c, !(o >= ti && n >= 2) && o < ni && (e = requestAnimationFrame(i));
|
|
857
859
|
};
|
|
858
860
|
e = requestAnimationFrame(i);
|
|
859
|
-
let a = setTimeout(
|
|
860
|
-
|
|
861
|
+
let a = setTimeout(T, ti);
|
|
862
|
+
re = () => {
|
|
861
863
|
cancelAnimationFrame(e), clearTimeout(a);
|
|
862
864
|
};
|
|
863
865
|
}
|
|
864
|
-
|
|
865
|
-
if (!
|
|
866
|
+
J(() => r.imageInfo, (e, t, n) => {
|
|
867
|
+
if (!r.imageInfo) {
|
|
866
868
|
p.value = null;
|
|
867
869
|
return;
|
|
868
870
|
}
|
|
869
|
-
|
|
870
|
-
}, { immediate: !0 }),
|
|
871
|
-
|
|
872
|
-
}),
|
|
873
|
-
if (!
|
|
874
|
-
let
|
|
875
|
-
b && cancelAnimationFrame(b), b = requestAnimationFrame(
|
|
876
|
-
},
|
|
877
|
-
|
|
871
|
+
ie(), n(() => re?.());
|
|
872
|
+
}, { immediate: !0 }), J(() => r.zoom, () => {
|
|
873
|
+
r.imageInfo && ie();
|
|
874
|
+
}), J(() => r.imageInfo, (e, t, n) => {
|
|
875
|
+
if (!r.imageInfo) return;
|
|
876
|
+
let i = () => {
|
|
877
|
+
b && cancelAnimationFrame(b), b = requestAnimationFrame(T);
|
|
878
|
+
}, o = a.value?.closest(".docx-editor-vue__pages-viewport");
|
|
879
|
+
o?.addEventListener("scroll", i, { passive: !0 }), window.addEventListener("resize", i, { passive: !0 });
|
|
878
880
|
let s = null, c = !1;
|
|
879
|
-
|
|
880
|
-
if (c || !
|
|
881
|
-
let e =
|
|
882
|
-
e && (s = new MutationObserver(() =>
|
|
881
|
+
ye(() => {
|
|
882
|
+
if (c || !r.imageInfo) return;
|
|
883
|
+
let e = w();
|
|
884
|
+
e && (s = new MutationObserver(() => ie()), s.observe(e, {
|
|
883
885
|
attributes: !0,
|
|
884
886
|
attributeFilter: ["style"]
|
|
885
887
|
}));
|
|
886
888
|
}), n(() => {
|
|
887
|
-
c = !0,
|
|
889
|
+
c = !0, o?.removeEventListener("scroll", i), window.removeEventListener("resize", i), s?.disconnect(), b && cancelAnimationFrame(b);
|
|
888
890
|
});
|
|
889
891
|
}, { immediate: !0 });
|
|
890
|
-
let
|
|
892
|
+
let E = N(() => o.value ? u.value : p.value?.width || 0), D = N(() => o.value ? d.value : p.value?.height || 0), ae = N(() => {
|
|
891
893
|
let e = p.value;
|
|
892
894
|
if (!e) return {
|
|
893
895
|
position: "absolute",
|
|
@@ -896,20 +898,20 @@ var Mr = ["data-handle", "onMousedown"], Nr = ["title"], Pr = {
|
|
|
896
898
|
visibility: "hidden",
|
|
897
899
|
pointerEvents: "none"
|
|
898
900
|
};
|
|
899
|
-
let t =
|
|
901
|
+
let t = o.value ? u.value : e.width, n = o.value ? d.value : e.height, i = r.zoom || 1;
|
|
900
902
|
return {
|
|
901
903
|
position: "absolute",
|
|
902
|
-
left: `${e.left *
|
|
903
|
-
top: `${e.top *
|
|
904
|
+
left: `${e.left * i}px`,
|
|
905
|
+
top: `${e.top * i}px`,
|
|
904
906
|
width: `${t}px`,
|
|
905
907
|
height: `${n}px`,
|
|
906
|
-
transform:
|
|
908
|
+
transform: i === 1 ? void 0 : `scale(${i})`,
|
|
907
909
|
transformOrigin: "top left",
|
|
908
|
-
zIndex:
|
|
910
|
+
zIndex: te.imageOverlay,
|
|
909
911
|
pointerEvents: "auto"
|
|
910
912
|
};
|
|
911
|
-
}),
|
|
912
|
-
let e =
|
|
913
|
+
}), oe = N(() => {
|
|
914
|
+
let e = E.value, t = D.value, n = `${e / 2 - 5}px`, r = `${t / 2 - 5}px`, i = `${e - 5}px`, a = `${t - 5}px`, o = "-5px";
|
|
913
915
|
return [
|
|
914
916
|
{
|
|
915
917
|
pos: "nw",
|
|
@@ -977,164 +979,166 @@ var Mr = ["data-handle", "onMousedown"], Nr = ["title"], Pr = {
|
|
|
977
979
|
}
|
|
978
980
|
];
|
|
979
981
|
});
|
|
980
|
-
function
|
|
981
|
-
!
|
|
982
|
+
function se(e, t) {
|
|
983
|
+
!r.imageInfo || !p.value || (m = t, h = e.clientX, g = e.clientY, _ = p.value.width, v = p.value.height, y = { ...p.value }, u.value = Math.round(_), d.value = Math.round(v), o.value = !0, i("interact-start"), document.addEventListener("mousemove", O), document.addEventListener("mouseup", k));
|
|
982
984
|
}
|
|
983
|
-
function
|
|
984
|
-
let t =
|
|
985
|
+
function O(e) {
|
|
986
|
+
let t = r.zoom, n = (e.clientX - h) / t, i = (e.clientY - g) / t, a = !e.shiftKey, o = dt(m, n, i, _, v, a);
|
|
985
987
|
u.value = Math.round(o.width), d.value = Math.round(o.height);
|
|
986
988
|
let s = y;
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
989
|
+
if (s) {
|
|
990
|
+
let e = m.includes("w") ? s.left + (s.width - o.width) : s.left, t = m.includes("n") ? s.top + (s.height - o.height) : s.top;
|
|
991
|
+
p.value = {
|
|
992
|
+
left: e,
|
|
993
|
+
top: t,
|
|
994
|
+
width: s.width,
|
|
995
|
+
height: s.height
|
|
996
|
+
};
|
|
997
|
+
}
|
|
993
998
|
}
|
|
994
|
-
function
|
|
995
|
-
document.removeEventListener("mousemove",
|
|
996
|
-
let e =
|
|
999
|
+
function k() {
|
|
1000
|
+
document.removeEventListener("mousemove", O), document.removeEventListener("mouseup", k), o.value = !1, y = null, i("interact-end");
|
|
1001
|
+
let e = r.view, t = r.imageInfo;
|
|
997
1002
|
if (!e || !t) {
|
|
998
|
-
|
|
1003
|
+
T();
|
|
999
1004
|
return;
|
|
1000
1005
|
}
|
|
1001
|
-
let n =
|
|
1002
|
-
n !== null &&
|
|
1006
|
+
let n = mt(e, t.pmPos, u.value, d.value);
|
|
1007
|
+
n !== null && _e(n), ye(() => T());
|
|
1003
1008
|
}
|
|
1004
|
-
let
|
|
1005
|
-
function
|
|
1009
|
+
let ce = 0, le = 0, ue = 0, de = 0, fe = null, A = null;
|
|
1010
|
+
function M(e) {
|
|
1006
1011
|
if (!e) return 0;
|
|
1007
1012
|
let t = e.match(/rotate\((-?\d+(?:\.\d+)?)deg\)/)?.[1];
|
|
1008
1013
|
return t ? parseFloat(t) : 0;
|
|
1009
1014
|
}
|
|
1010
|
-
function
|
|
1015
|
+
function pe(e, t) {
|
|
1011
1016
|
let n = /scaleX\(-1\)/.test(e || ""), r = /scaleY\(-1\)/.test(e || ""), i = [], a = (t % 360 + 360) % 360;
|
|
1012
1017
|
return a !== 0 && i.push(`rotate(${a}deg)`), n && i.push("scaleX(-1)"), r && i.push("scaleY(-1)"), i.length > 0 ? i.join(" ") : null;
|
|
1013
1018
|
}
|
|
1014
|
-
function
|
|
1015
|
-
return Math.atan2(e -
|
|
1019
|
+
function P(e, t) {
|
|
1020
|
+
return Math.atan2(e - ce, -(t - le)) * 180 / Math.PI;
|
|
1016
1021
|
}
|
|
1017
|
-
function
|
|
1018
|
-
if (!
|
|
1019
|
-
let t =
|
|
1020
|
-
|
|
1022
|
+
function me(e) {
|
|
1023
|
+
if (!r.imageInfo) return;
|
|
1024
|
+
let t = r.imageInfo.element.getBoundingClientRect();
|
|
1025
|
+
ce = t.left + t.width / 2, le = t.top + t.height / 2, fe = ee(C(r.view, r.imageInfo.pmPos)), de = M(fe), A = r.imageInfo.element.querySelector("img"), ue = P(e.clientX, e.clientY), f.value = de, l.value = !0, i("interact-start"), document.addEventListener("mousemove", he), document.addEventListener("mouseup", ge);
|
|
1021
1026
|
}
|
|
1022
|
-
function
|
|
1023
|
-
let t =
|
|
1024
|
-
e.shiftKey || (n = Math.round(n /
|
|
1027
|
+
function he(e) {
|
|
1028
|
+
let t = P(e.clientX, e.clientY) - ue, n = de + t;
|
|
1029
|
+
e.shiftKey || (n = Math.round(n / ei) * ei), f.value = (n % 360 + 360) % 360, A && (A.style.transform = pe(fe, f.value) || "");
|
|
1025
1030
|
}
|
|
1026
|
-
function
|
|
1027
|
-
document.removeEventListener("mousemove",
|
|
1028
|
-
let e =
|
|
1031
|
+
function ge() {
|
|
1032
|
+
document.removeEventListener("mousemove", he), document.removeEventListener("mouseup", ge), l.value = !1, i("interact-end");
|
|
1033
|
+
let e = r.view, t = r.imageInfo;
|
|
1029
1034
|
try {
|
|
1030
|
-
let n = e && t ?
|
|
1035
|
+
let n = e && t ? C(e, t.pmPos) : null;
|
|
1031
1036
|
e && t && n && (e.dispatch(e.state.tr.setNodeMarkup(t.pmPos, void 0, {
|
|
1032
1037
|
...n.attrs,
|
|
1033
|
-
transform:
|
|
1034
|
-
})),
|
|
1038
|
+
transform: pe(ee(n), f.value)
|
|
1039
|
+
})), _e(t.pmPos));
|
|
1035
1040
|
} catch {} finally {
|
|
1036
|
-
|
|
1041
|
+
A && (A.style.transform = ""), A = null, fe = null;
|
|
1037
1042
|
}
|
|
1038
|
-
|
|
1043
|
+
ye(() => T());
|
|
1039
1044
|
}
|
|
1040
|
-
let
|
|
1041
|
-
function
|
|
1042
|
-
if (!
|
|
1043
|
-
let t = e.clientX, n = e.clientY,
|
|
1044
|
-
let
|
|
1045
|
-
if (!(!o && Math.sqrt(
|
|
1045
|
+
let R = null;
|
|
1046
|
+
function z(e) {
|
|
1047
|
+
if (!r.imageInfo || !p.value) return;
|
|
1048
|
+
let t = e.clientX, n = e.clientY, a = p.value, o = !1, c = (e) => {
|
|
1049
|
+
let c = e.clientX - t, l = e.clientY - n;
|
|
1050
|
+
if (!(!o && Math.sqrt(c * c + l * l) < $r)) {
|
|
1046
1051
|
if (!o) {
|
|
1047
|
-
o = !0,
|
|
1048
|
-
let e =
|
|
1049
|
-
|
|
1052
|
+
o = !0, s.value = !0, i("interact-start"), R = document.createElement("div"), R.style.cssText = "position: fixed; pointer-events: none; z-index: 10000; opacity: 0.5; border: 2px dashed #2563eb; border-radius: 4px; background: rgba(37, 99, 235, 0.1);";
|
|
1053
|
+
let e = r.zoom;
|
|
1054
|
+
R.style.width = `${a.width * e}px`, R.style.height = `${a.height * e}px`, document.body.appendChild(R);
|
|
1050
1055
|
}
|
|
1051
|
-
if (
|
|
1052
|
-
let t =
|
|
1053
|
-
|
|
1056
|
+
if (R) {
|
|
1057
|
+
let t = r.zoom;
|
|
1058
|
+
R.style.left = `${e.clientX - a.width * t / 2}px`, R.style.top = `${e.clientY - a.height * t / 2}px`;
|
|
1054
1059
|
}
|
|
1055
1060
|
}
|
|
1056
1061
|
}, l = (e) => {
|
|
1057
|
-
document.removeEventListener("mousemove",
|
|
1062
|
+
document.removeEventListener("mousemove", c), document.removeEventListener("mouseup", l), x = null, S = null, R &&= (R.remove(), null), s.value = !1, o && (i("interact-end"), B(e.clientX, e.clientY));
|
|
1058
1063
|
};
|
|
1059
|
-
x =
|
|
1064
|
+
x = c, S = l, document.addEventListener("mousemove", c), document.addEventListener("mouseup", l);
|
|
1060
1065
|
}
|
|
1061
|
-
function
|
|
1062
|
-
let n =
|
|
1063
|
-
if (!n || !
|
|
1064
|
-
let
|
|
1065
|
-
if (
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
}
|
|
1077
|
-
if (!s) {
|
|
1078
|
-
let e = a.item(a.length - 1);
|
|
1079
|
-
s = e ? e.querySelector(".layout-page-content") : null;
|
|
1066
|
+
function B(e, t) {
|
|
1067
|
+
let n = r.view, i = r.imageInfo;
|
|
1068
|
+
if (!n || !i) return;
|
|
1069
|
+
let o = C(n, i.pmPos);
|
|
1070
|
+
if (!o) return;
|
|
1071
|
+
let s;
|
|
1072
|
+
if (ht(o)) {
|
|
1073
|
+
let o = (a.value?.closest(".docx-editor-vue__pages-viewport"))?.querySelectorAll(".layout-page");
|
|
1074
|
+
if (!o || o.length === 0) return;
|
|
1075
|
+
let c = null;
|
|
1076
|
+
for (let e of o) {
|
|
1077
|
+
let n = e.getBoundingClientRect();
|
|
1078
|
+
if (t >= n.top && t <= n.bottom) {
|
|
1079
|
+
c = e.querySelector(".layout-page-content");
|
|
1080
|
+
break;
|
|
1080
1081
|
}
|
|
1081
|
-
if (!s) return;
|
|
1082
|
-
let c = s.getBoundingClientRect(), l = i.zoom, u = Ue((e - c.left) / l), d = Ue((t - c.top) / l), f = et(n, r.pmPos, u, d);
|
|
1083
|
-
f !== null && ve(f);
|
|
1084
|
-
} else {
|
|
1085
|
-
let i = ne();
|
|
1086
|
-
if (!i) return;
|
|
1087
|
-
let a = Qe(i, e, t, 1);
|
|
1088
|
-
if (a == null || a < 0) return;
|
|
1089
|
-
let o = tt(n, r.pmPos, a);
|
|
1090
|
-
o !== null && ve(o);
|
|
1091
1082
|
}
|
|
1092
|
-
|
|
1083
|
+
if (!c) {
|
|
1084
|
+
let e = o.item(o.length - 1);
|
|
1085
|
+
c = e ? e.querySelector(".layout-page-content") : null;
|
|
1086
|
+
}
|
|
1087
|
+
if (!c) return;
|
|
1088
|
+
let l = c.getBoundingClientRect(), u = r.zoom, d = tt((e - l.left) / u), f = tt((t - l.top) / u);
|
|
1089
|
+
s = ft(n, i.pmPos, d, f);
|
|
1090
|
+
} else {
|
|
1091
|
+
let r = w();
|
|
1092
|
+
if (!r) return;
|
|
1093
|
+
let a = ut(r, e, t, 1);
|
|
1094
|
+
if (a == null || a < 0) return;
|
|
1095
|
+
s = pt(n, i.pmPos, a);
|
|
1093
1096
|
}
|
|
1097
|
+
s !== null && _e(s), ye(() => T());
|
|
1094
1098
|
}
|
|
1095
|
-
function
|
|
1096
|
-
let t =
|
|
1099
|
+
function _e(e) {
|
|
1100
|
+
let t = r.view;
|
|
1097
1101
|
if (t) try {
|
|
1098
|
-
let n =
|
|
1102
|
+
let n = $e.create(t.state.doc, e);
|
|
1099
1103
|
t.dispatch(t.state.tr.setSelection(n));
|
|
1100
1104
|
} catch {}
|
|
1101
1105
|
}
|
|
1102
|
-
return
|
|
1103
|
-
document.removeEventListener("mousemove",
|
|
1104
|
-
}), (t,
|
|
1106
|
+
return be(() => {
|
|
1107
|
+
document.removeEventListener("mousemove", O), document.removeEventListener("mouseup", k), document.removeEventListener("mousemove", he), document.removeEventListener("mouseup", ge), x && document.removeEventListener("mousemove", x), S && document.removeEventListener("mouseup", S), R &&= (R.remove(), null), b && cancelAnimationFrame(b), re?.();
|
|
1108
|
+
}), (t, r) => e.imageInfo ? (U(), I("div", {
|
|
1105
1109
|
key: 0,
|
|
1106
1110
|
ref_key: "overlayRootRef",
|
|
1107
|
-
ref:
|
|
1111
|
+
ref: a,
|
|
1108
1112
|
class: "image-overlay",
|
|
1109
|
-
style:
|
|
1110
|
-
onMousedown:
|
|
1113
|
+
style: H(ae.value),
|
|
1114
|
+
onMousedown: r[3] ||= Y(() => {}, ["stop"])
|
|
1111
1115
|
}, [
|
|
1112
|
-
|
|
1113
|
-
|
|
1116
|
+
r[4] ||= L("div", { class: "image-overlay__border" }, null, -1),
|
|
1117
|
+
L("div", {
|
|
1114
1118
|
class: "image-overlay__body",
|
|
1115
|
-
style:
|
|
1116
|
-
onMousedown:
|
|
1117
|
-
onContextmenu:
|
|
1119
|
+
style: H({ cursor: s.value ? "grabbing" : "grab" }),
|
|
1120
|
+
onMousedown: r[0] ||= Y((e) => z(e), ["prevent", "stop"]),
|
|
1121
|
+
onContextmenu: r[1] ||= Y((e) => t.$emit("context-menu", e), ["prevent", "stop"])
|
|
1118
1122
|
}, null, 36),
|
|
1119
|
-
(
|
|
1123
|
+
(U(!0), I(j, null, G(oe.value, (e) => (U(), I("div", {
|
|
1120
1124
|
key: e.pos,
|
|
1121
1125
|
class: "image-overlay__handle",
|
|
1122
|
-
style:
|
|
1126
|
+
style: H(e.style),
|
|
1123
1127
|
"data-handle": e.pos,
|
|
1124
|
-
onMousedown:
|
|
1125
|
-
}, null, 44,
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
+
onMousedown: Y((t) => se(t, e.pos), ["prevent", "stop"])
|
|
1129
|
+
}, null, 44, Yr))), 128)),
|
|
1130
|
+
r[5] ||= L("div", { class: "image-overlay__rotate-line" }, null, -1),
|
|
1131
|
+
L("div", {
|
|
1128
1132
|
class: "image-overlay__rotate-handle",
|
|
1129
|
-
style:
|
|
1130
|
-
title:
|
|
1131
|
-
onMousedown:
|
|
1132
|
-
}, null, 44,
|
|
1133
|
-
|
|
1134
|
-
l.value ? (
|
|
1135
|
-
], 36)) :
|
|
1133
|
+
style: H({ left: `${E.value / 2 - 7}px` }),
|
|
1134
|
+
title: q(n)("imageOverlay.rotate"),
|
|
1135
|
+
onMousedown: r[2] ||= Y((e) => me(e), ["prevent", "stop"])
|
|
1136
|
+
}, null, 44, Xr),
|
|
1137
|
+
o.value ? (U(), I("div", Zr, K(Math.round(u.value)) + " × " + K(Math.round(d.value)), 1)) : F("", !0),
|
|
1138
|
+
l.value ? (U(), I("div", Qr, K(Math.round(f.value)) + "° ", 1)) : F("", !0)
|
|
1139
|
+
], 36)) : F("", !0);
|
|
1136
1140
|
}
|
|
1137
|
-
}), [["__scopeId", "data-v-
|
|
1141
|
+
}), [["__scopeId", "data-v-4c3d1a1d"]]), ii = ["title", "aria-label"], ai = /* @__PURE__ */ z({
|
|
1138
1142
|
__name: "OutlineToggleButton",
|
|
1139
1143
|
props: {
|
|
1140
1144
|
leftOffset: {},
|
|
@@ -1142,24 +1146,24 @@ var Mr = ["data-handle", "onMousedown"], Nr = ["title"], Pr = {
|
|
|
1142
1146
|
},
|
|
1143
1147
|
emits: ["toggle"],
|
|
1144
1148
|
setup(e) {
|
|
1145
|
-
let { t
|
|
1146
|
-
return (
|
|
1149
|
+
let { t } = c();
|
|
1150
|
+
return (n, i) => (U(), I("button", {
|
|
1147
1151
|
type: "button",
|
|
1148
1152
|
class: "docx-outline-toggle docx-editor-vue__outline-toggle",
|
|
1149
|
-
style:
|
|
1153
|
+
style: H({
|
|
1150
1154
|
left: e.leftOffset + "px",
|
|
1151
1155
|
top: e.topPx + "px"
|
|
1152
1156
|
}),
|
|
1153
|
-
title:
|
|
1154
|
-
"aria-label":
|
|
1155
|
-
onClick: i[0] ||= (e) =>
|
|
1156
|
-
onMousedown: i[1] ||=
|
|
1157
|
-
}, [
|
|
1157
|
+
title: q(t)("editor.showDocumentOutline"),
|
|
1158
|
+
"aria-label": q(t)("editor.showDocumentOutline"),
|
|
1159
|
+
onClick: i[0] ||= (e) => n.$emit("toggle"),
|
|
1160
|
+
onMousedown: i[1] ||= Y(() => {}, ["stop"])
|
|
1161
|
+
}, [R(r, {
|
|
1158
1162
|
name: "format_list_bulleted",
|
|
1159
1163
|
size: 20
|
|
1160
|
-
})], 44,
|
|
1164
|
+
})], 44, ii));
|
|
1161
1165
|
}
|
|
1162
|
-
}),
|
|
1166
|
+
}), oi = /*#__PURE__*/ t(/* @__PURE__ */ z({
|
|
1163
1167
|
__name: "PageIndicator",
|
|
1164
1168
|
props: {
|
|
1165
1169
|
currentPage: {},
|
|
@@ -1167,18 +1171,18 @@ var Mr = ["data-handle", "onMousedown"], Nr = ["title"], Pr = {
|
|
|
1167
1171
|
visible: { type: Boolean }
|
|
1168
1172
|
},
|
|
1169
1173
|
setup(e) {
|
|
1170
|
-
let { t
|
|
1171
|
-
return (
|
|
1174
|
+
let { t } = c();
|
|
1175
|
+
return (n, r) => (U(), I("div", {
|
|
1172
1176
|
class: "docx-editor-vue__page-indicator",
|
|
1173
|
-
style:
|
|
1177
|
+
style: H({ opacity: +!!e.visible }),
|
|
1174
1178
|
"aria-live": "polite",
|
|
1175
1179
|
role: "status"
|
|
1176
|
-
},
|
|
1180
|
+
}, K(q(t)("viewer.pageIndicator", {
|
|
1177
1181
|
current: e.currentPage,
|
|
1178
1182
|
total: e.totalPages
|
|
1179
1183
|
})), 5));
|
|
1180
1184
|
}
|
|
1181
|
-
}), [["__scopeId", "data-v-
|
|
1185
|
+
}), [["__scopeId", "data-v-f1904974"]]), si = ["data-folio-block-id"], ci = ["data-folio-block-id", "title"], li = 2.5, ui = 5, di = 6, fi = 2, pi = 2, mi = /*#__PURE__*/ t(/* @__PURE__ */ z({
|
|
1182
1186
|
__name: "TemplateDirectivesOverlay",
|
|
1183
1187
|
props: {
|
|
1184
1188
|
getView: { type: Function },
|
|
@@ -1190,21 +1194,21 @@ var Mr = ["data-handle", "onMousedown"], Nr = ["title"], Pr = {
|
|
|
1190
1194
|
measures: {}
|
|
1191
1195
|
},
|
|
1192
1196
|
setup(e) {
|
|
1193
|
-
let t = e, n = new Set(["if", "each"]), r = new Set(["endif", "endeach"]), i = (e) => e === "each" ? "each" : "if";
|
|
1197
|
+
let t = e, n = /* @__PURE__ */ new Set(["if", "each"]), r = /* @__PURE__ */ new Set(["endif", "endeach"]), i = (e) => e === "each" ? "each" : "if";
|
|
1194
1198
|
function a(e) {
|
|
1195
|
-
let t = e -
|
|
1196
|
-
return t <= 0 ? 0 : Math.floor(t /
|
|
1199
|
+
let t = e - di - li - fi;
|
|
1200
|
+
return t <= 0 ? 0 : Math.floor(t / ui);
|
|
1197
1201
|
}
|
|
1198
1202
|
function o(e, t, n) {
|
|
1199
1203
|
let r = a(n), i = Math.min(Math.max(0, e), r);
|
|
1200
|
-
return t -
|
|
1204
|
+
return t - di - li - (r - i) * ui;
|
|
1201
1205
|
}
|
|
1202
1206
|
function s(e, t) {
|
|
1203
|
-
if (t.length === 0) return e.bottom - e.top >=
|
|
1207
|
+
if (t.length === 0) return e.bottom - e.top >= pi ? [e] : [];
|
|
1204
1208
|
let n = [];
|
|
1205
1209
|
for (let r of t) {
|
|
1206
1210
|
let t = Math.max(e.top, r.top), i = Math.min(e.bottom, r.bottom);
|
|
1207
|
-
i - t >=
|
|
1211
|
+
i - t >= pi && n.push({
|
|
1208
1212
|
top: t,
|
|
1209
1213
|
bottom: i
|
|
1210
1214
|
});
|
|
@@ -1269,7 +1273,7 @@ var Mr = ["data-handle", "onMousedown"], Nr = ["title"], Pr = {
|
|
|
1269
1273
|
}
|
|
1270
1274
|
return i;
|
|
1271
1275
|
}
|
|
1272
|
-
let f =
|
|
1276
|
+
let f = W([]), p = W([]), m = W(null), h = W(null), g = W(null), _ = 0, v = null;
|
|
1273
1277
|
function y() {
|
|
1274
1278
|
v !== null && cancelAnimationFrame(v), v = requestAnimationFrame(() => {
|
|
1275
1279
|
v = null, b();
|
|
@@ -1281,12 +1285,12 @@ var Mr = ["data-handle", "onMousedown"], Nr = ["title"], Pr = {
|
|
|
1281
1285
|
f.value = [], p.value = [], m.value = null, h.value = null;
|
|
1282
1286
|
return;
|
|
1283
1287
|
}
|
|
1284
|
-
let a =
|
|
1288
|
+
let a = yt(i);
|
|
1285
1289
|
if (a.length === 0) {
|
|
1286
1290
|
f.value = [], p.value = [], m.value = null, h.value = null;
|
|
1287
1291
|
return;
|
|
1288
1292
|
}
|
|
1289
|
-
let o =
|
|
1293
|
+
let o = Ge(r, t.zoom), s = await Ke(a, {
|
|
1290
1294
|
pagesContainer: r,
|
|
1291
1295
|
zoom: t.zoom,
|
|
1292
1296
|
layout: t.layout,
|
|
@@ -1295,95 +1299,95 @@ var Mr = ["data-handle", "onMousedown"], Nr = ["title"], Pr = {
|
|
|
1295
1299
|
});
|
|
1296
1300
|
e === _ && (f.value = a, h.value = i.selection.head, m.value = o, p.value = s);
|
|
1297
1301
|
}
|
|
1298
|
-
|
|
1302
|
+
J(() => [
|
|
1299
1303
|
t.editorState,
|
|
1300
1304
|
t.zoom,
|
|
1301
1305
|
t.layout,
|
|
1302
1306
|
t.blocks,
|
|
1303
1307
|
t.measures
|
|
1304
1308
|
], () => y());
|
|
1305
|
-
let x =
|
|
1309
|
+
let x = N(() => c(f.value)), S = N(() => m.value ? d(x.value, p.value, m.value) : []), C = N(() => {
|
|
1306
1310
|
let e = /* @__PURE__ */ new Map();
|
|
1307
1311
|
for (let t of x.value) e.set(t.openerFrom, t.blockId), e.set(t.closerFrom, t.blockId);
|
|
1308
1312
|
return e;
|
|
1309
|
-
}),
|
|
1313
|
+
}), ee = N(() => {
|
|
1310
1314
|
let e = /* @__PURE__ */ new Map();
|
|
1311
1315
|
for (let t of x.value) e.set(t.closerFrom, l(t.kind, t.openerExpr));
|
|
1312
1316
|
return e;
|
|
1313
|
-
}),
|
|
1314
|
-
function
|
|
1315
|
-
return e === g.value || e ===
|
|
1317
|
+
}), te = N(() => u(x.value, h.value));
|
|
1318
|
+
function w(e) {
|
|
1319
|
+
return e === g.value || e === te.value;
|
|
1316
1320
|
}
|
|
1317
|
-
function
|
|
1321
|
+
function ne(e) {
|
|
1318
1322
|
return e.block && (n.has(e.kind) || r.has(e.kind));
|
|
1319
1323
|
}
|
|
1320
|
-
function
|
|
1321
|
-
return e.block ?
|
|
1324
|
+
function T(e) {
|
|
1325
|
+
return e.block ? C.value.get(e.from) : void 0;
|
|
1322
1326
|
}
|
|
1323
|
-
function
|
|
1324
|
-
return e.block ?
|
|
1327
|
+
function re(e) {
|
|
1328
|
+
return e.block ? ee.value.get(e.from) : void 0;
|
|
1325
1329
|
}
|
|
1326
|
-
function
|
|
1327
|
-
let t =
|
|
1330
|
+
function ie(e) {
|
|
1331
|
+
let t = T(e), n = t !== void 0 && w(t);
|
|
1328
1332
|
return [
|
|
1329
1333
|
"folio-template-directive",
|
|
1330
1334
|
`folio-template-directive--${e.kind}`,
|
|
1331
|
-
{ "folio-template-directive--block":
|
|
1335
|
+
{ "folio-template-directive--block": ne(e) },
|
|
1332
1336
|
{ "folio-template-directive--active": n }
|
|
1333
1337
|
];
|
|
1334
1338
|
}
|
|
1335
|
-
function
|
|
1339
|
+
function E(e) {
|
|
1336
1340
|
if (!(e instanceof HTMLElement)) return null;
|
|
1337
1341
|
let t = e.dataset.folioBlockId;
|
|
1338
1342
|
return t === void 0 ? null : Number(t);
|
|
1339
1343
|
}
|
|
1340
|
-
function
|
|
1341
|
-
let t =
|
|
1344
|
+
function D(e) {
|
|
1345
|
+
let t = E(e.target);
|
|
1342
1346
|
t !== null && (g.value = t);
|
|
1343
1347
|
}
|
|
1344
|
-
function
|
|
1345
|
-
let t =
|
|
1348
|
+
function ae(e) {
|
|
1349
|
+
let t = E(e.target);
|
|
1346
1350
|
if (t === null) return;
|
|
1347
|
-
let n =
|
|
1351
|
+
let n = E(e.relatedTarget);
|
|
1348
1352
|
n !== t && g.value === t && (g.value = n);
|
|
1349
1353
|
}
|
|
1350
|
-
return
|
|
1354
|
+
return xe(() => y()), be(() => {
|
|
1351
1355
|
v !== null && (cancelAnimationFrame(v), v = null);
|
|
1352
|
-
}), (t, n) => (
|
|
1356
|
+
}), (t, n) => (U(), I("div", {
|
|
1353
1357
|
class: "folio-template-directives-overlay",
|
|
1354
1358
|
"data-folio-template-directives-overlay": "",
|
|
1355
|
-
onPointerover:
|
|
1356
|
-
onPointerout:
|
|
1357
|
-
}, [(
|
|
1359
|
+
onPointerover: D,
|
|
1360
|
+
onPointerout: ae
|
|
1361
|
+
}, [(U(!0), I(j, null, G(S.value, (t) => (U(), I(j, { key: `rail:${t.blockId}` }, [(U(!0), I(j, null, G(t.segments, (n, r) => (U(), I("div", {
|
|
1358
1362
|
key: `rail:${t.blockId}:${r}`,
|
|
1359
|
-
class:
|
|
1363
|
+
class: V([
|
|
1360
1364
|
"folio-template-band-rail",
|
|
1361
1365
|
`folio-template-band-rail--${t.kind}`,
|
|
1362
|
-
{ "folio-template-band-rail--active":
|
|
1366
|
+
{ "folio-template-band-rail--active": w(t.blockId) }
|
|
1363
1367
|
]),
|
|
1364
1368
|
"data-folio-block-id": t.blockId,
|
|
1365
|
-
style:
|
|
1369
|
+
style: H({
|
|
1366
1370
|
position: "absolute",
|
|
1367
1371
|
left: `${t.railX * e.zoom}px`,
|
|
1368
1372
|
top: `${n.top * e.zoom}px`,
|
|
1369
|
-
width: `${
|
|
1373
|
+
width: `${li * e.zoom}px`,
|
|
1370
1374
|
height: `${Math.max(0, n.bottom - n.top) * e.zoom}px`
|
|
1371
1375
|
})
|
|
1372
|
-
}, null, 14,
|
|
1376
|
+
}, null, 14, si))), 128))], 64))), 128)), (U(!0), I(j, null, G(p.value, (t, n) => (U(), I(j, { key: `d:${n}` }, [(U(!0), I(j, null, G(t.rects, (r, i) => (U(), I("span", {
|
|
1373
1377
|
key: `d:${n}:${i}`,
|
|
1374
|
-
class:
|
|
1375
|
-
"data-folio-block-id":
|
|
1376
|
-
title:
|
|
1377
|
-
style:
|
|
1378
|
+
class: V(ie(t.range)),
|
|
1379
|
+
"data-folio-block-id": T(t.range),
|
|
1380
|
+
title: re(t.range),
|
|
1381
|
+
style: H({
|
|
1378
1382
|
position: "absolute",
|
|
1379
1383
|
left: `${(r.x - 1) * e.zoom}px`,
|
|
1380
1384
|
top: `${(r.y + 1) * e.zoom}px`,
|
|
1381
1385
|
width: `${(r.width + 2) * e.zoom}px`,
|
|
1382
1386
|
height: `${Math.max(0, r.height - 2) * e.zoom}px`
|
|
1383
1387
|
})
|
|
1384
|
-
}, null, 14,
|
|
1388
|
+
}, null, 14, ci))), 128))], 64))), 128))], 32));
|
|
1385
1389
|
}
|
|
1386
|
-
}), [["__scopeId", "data-v-142d2ac6"]]),
|
|
1390
|
+
}), [["__scopeId", "data-v-142d2ac6"]]), hi = ["href", "title"], gi = ["title"], _i = ["title"], vi = ["title"], yi = { class: "docx-hyperlink-popup__edit-row" }, bi = ["placeholder", "onKeydown"], xi = { class: "docx-hyperlink-popup__edit-row" }, Si = ["onKeydown"], Ci = ["disabled"], wi = /*#__PURE__*/ t(/* @__PURE__ */ z({
|
|
1387
1391
|
__name: "HyperlinkPopup",
|
|
1388
1392
|
props: {
|
|
1389
1393
|
data: {},
|
|
@@ -1396,70 +1400,70 @@ var Mr = ["data-handle", "onMousedown"], Nr = ["title"], Pr = {
|
|
|
1396
1400
|
"remove",
|
|
1397
1401
|
"close"
|
|
1398
1402
|
],
|
|
1399
|
-
setup(e, { emit:
|
|
1400
|
-
let { t:
|
|
1401
|
-
left: (
|
|
1402
|
-
top: (
|
|
1403
|
+
setup(e, { emit: t }) {
|
|
1404
|
+
let { t: n } = c(), r = e, i = t, a = W(!1), o = W(""), s = W(""), l = W(null), u = N(() => ({
|
|
1405
|
+
left: (r.data?.position.left ?? 0) + "px",
|
|
1406
|
+
top: (r.data?.position.top ?? 0) + "px"
|
|
1403
1407
|
}));
|
|
1404
|
-
|
|
1405
|
-
|
|
1408
|
+
J(() => r.data?.href, () => {
|
|
1409
|
+
a.value = !1;
|
|
1406
1410
|
});
|
|
1407
1411
|
let d = null, f = null;
|
|
1408
1412
|
function p() {
|
|
1409
1413
|
f &&= (clearTimeout(f), null), d &&= (document.removeEventListener("mousedown", d), null);
|
|
1410
1414
|
}
|
|
1411
|
-
|
|
1415
|
+
J(() => r.data, (e) => {
|
|
1412
1416
|
p(), e && (d = (e) => {
|
|
1413
1417
|
let t = l.value, n = e.target;
|
|
1414
|
-
t && n instanceof Node && !t.contains(n) &&
|
|
1418
|
+
t && n instanceof Node && !t.contains(n) && i("close");
|
|
1415
1419
|
}, f = setTimeout(() => {
|
|
1416
1420
|
d && document.addEventListener("mousedown", d);
|
|
1417
1421
|
}, 0));
|
|
1418
|
-
}, { immediate: !0 }),
|
|
1422
|
+
}, { immediate: !0 }), be(p);
|
|
1419
1423
|
function m() {
|
|
1420
|
-
|
|
1424
|
+
r.data && (o.value = r.data.displayText, s.value = r.data.href, a.value = !0);
|
|
1421
1425
|
}
|
|
1422
1426
|
function h() {
|
|
1423
|
-
|
|
1427
|
+
s.value.trim() && (i("edit", o.value, s.value), a.value = !1);
|
|
1424
1428
|
}
|
|
1425
1429
|
function g() {
|
|
1426
|
-
|
|
1430
|
+
r.data && (i("copy", r.data.href), typeof navigator < "u" && navigator.clipboard && navigator.clipboard.writeText(r.data.href).catch(() => {}));
|
|
1427
1431
|
}
|
|
1428
|
-
return (t,
|
|
1432
|
+
return (t, r) => e.data ? (U(), I("div", {
|
|
1429
1433
|
key: 0,
|
|
1430
1434
|
ref_key: "popupRef",
|
|
1431
1435
|
ref: l,
|
|
1432
|
-
class:
|
|
1433
|
-
style:
|
|
1434
|
-
onMousedown:
|
|
1435
|
-
}, [
|
|
1436
|
+
class: V(["docx-hyperlink-popup", { "docx-hyperlink-popup--edit": a.value }]),
|
|
1437
|
+
style: H(u.value),
|
|
1438
|
+
onMousedown: r[6] ||= Y(() => {}, ["stop"])
|
|
1439
|
+
}, [a.value ? (U(), I(j, { key: 1 }, [L("div", yi, [De(L("input", {
|
|
1436
1440
|
class: "docx-hyperlink-popup__input",
|
|
1437
|
-
placeholder:
|
|
1438
|
-
"onUpdate:modelValue":
|
|
1439
|
-
onKeydown: [
|
|
1440
|
-
}, null, 40,
|
|
1441
|
+
placeholder: q(n)("displayText"),
|
|
1442
|
+
"onUpdate:modelValue": r[2] ||= (e) => o.value = e,
|
|
1443
|
+
onKeydown: [Oe(Y(h, ["prevent"]), ["enter"]), r[3] ||= Oe((e) => t.$emit("close"), ["esc"])]
|
|
1444
|
+
}, null, 40, bi), [[Te, o.value]])]), L("div", xi, [De(L("input", {
|
|
1441
1445
|
class: "docx-hyperlink-popup__input",
|
|
1442
1446
|
placeholder: "https://...",
|
|
1443
|
-
"onUpdate:modelValue":
|
|
1444
|
-
onKeydown: [
|
|
1445
|
-
}, null, 40,
|
|
1447
|
+
"onUpdate:modelValue": r[4] ||= (e) => s.value = e,
|
|
1448
|
+
onKeydown: [Oe(Y(h, ["prevent"]), ["enter"]), r[5] ||= Oe((e) => t.$emit("close"), ["esc"])]
|
|
1449
|
+
}, null, 40, Si), [[Te, s.value]]), L("button", {
|
|
1446
1450
|
class: "docx-hyperlink-popup__apply",
|
|
1447
|
-
disabled: !
|
|
1448
|
-
onClick:
|
|
1449
|
-
},
|
|
1450
|
-
|
|
1451
|
-
|
|
1451
|
+
disabled: !s.value.trim(),
|
|
1452
|
+
onClick: Y(h, ["prevent"])
|
|
1453
|
+
}, K(q(n)("common.apply")), 9, Ci)])], 64)) : (U(), I(j, { key: 0 }, [
|
|
1454
|
+
r[10] ||= he("<span class=\"docx-hyperlink-popup__icon\" aria-hidden data-v-366df18c><svg width=\"18\" height=\"18\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\" data-v-366df18c><circle cx=\"12\" cy=\"12\" r=\"10\" data-v-366df18c></circle><path d=\"M2 12h20\" data-v-366df18c></path><path d=\"M12 2a15.3 15.3 0 0 1 4 10 15.3 15.3 0 0 1-4 10 15.3 15.3 0 0 1-4-10 15.3 15.3 0 0 1 4-10z\" data-v-366df18c></path></svg></span>", 1),
|
|
1455
|
+
L("a", {
|
|
1452
1456
|
class: "docx-hyperlink-popup__url",
|
|
1453
1457
|
href: e.data.href,
|
|
1454
1458
|
title: e.data.href,
|
|
1455
|
-
onClick:
|
|
1456
|
-
},
|
|
1457
|
-
|
|
1458
|
-
|
|
1459
|
+
onClick: r[0] ||= Y((n) => t.$emit("navigate", e.data.href), ["prevent"])
|
|
1460
|
+
}, K(e.data.href), 9, hi),
|
|
1461
|
+
r[11] ||= L("span", { class: "docx-hyperlink-popup__sep" }, null, -1),
|
|
1462
|
+
L("button", {
|
|
1459
1463
|
class: "docx-hyperlink-popup__btn",
|
|
1460
|
-
title:
|
|
1461
|
-
onClick:
|
|
1462
|
-
}, [...
|
|
1464
|
+
title: q(n)("copyLink"),
|
|
1465
|
+
onClick: Y(g, ["prevent"])
|
|
1466
|
+
}, [...r[7] ||= [L("svg", {
|
|
1463
1467
|
width: "18",
|
|
1464
1468
|
height: "18",
|
|
1465
1469
|
viewBox: "0 0 24 24",
|
|
@@ -1468,20 +1472,20 @@ var Mr = ["data-handle", "onMousedown"], Nr = ["title"], Pr = {
|
|
|
1468
1472
|
"stroke-width": "2",
|
|
1469
1473
|
"stroke-linecap": "round",
|
|
1470
1474
|
"stroke-linejoin": "round"
|
|
1471
|
-
}, [
|
|
1475
|
+
}, [L("rect", {
|
|
1472
1476
|
x: "9",
|
|
1473
1477
|
y: "9",
|
|
1474
1478
|
width: "13",
|
|
1475
1479
|
height: "13",
|
|
1476
1480
|
rx: "2",
|
|
1477
1481
|
ry: "2"
|
|
1478
|
-
}),
|
|
1479
|
-
e.readOnly ?
|
|
1482
|
+
}), L("path", { d: "M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1" })], -1)]], 8, gi),
|
|
1483
|
+
e.readOnly ? F("", !0) : (U(), I("button", {
|
|
1480
1484
|
key: 0,
|
|
1481
1485
|
class: "docx-hyperlink-popup__btn",
|
|
1482
|
-
title:
|
|
1483
|
-
onClick:
|
|
1484
|
-
}, [...
|
|
1486
|
+
title: q(n)("editLink"),
|
|
1487
|
+
onClick: Y(m, ["prevent"])
|
|
1488
|
+
}, [...r[8] ||= [L("svg", {
|
|
1485
1489
|
width: "18",
|
|
1486
1490
|
height: "18",
|
|
1487
1491
|
viewBox: "0 0 24 24",
|
|
@@ -1490,44 +1494,44 @@ var Mr = ["data-handle", "onMousedown"], Nr = ["title"], Pr = {
|
|
|
1490
1494
|
"stroke-width": "2",
|
|
1491
1495
|
"stroke-linecap": "round",
|
|
1492
1496
|
"stroke-linejoin": "round"
|
|
1493
|
-
}, [
|
|
1494
|
-
e.readOnly ?
|
|
1497
|
+
}, [L("path", { d: "M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7" }), L("path", { d: "M18.5 2.5a2.121 2.121 0 0 1 3 3L12 15l-4 1 1-4 9.5-9.5z" })], -1)]], 8, _i)),
|
|
1498
|
+
e.readOnly ? F("", !0) : (U(), I("button", {
|
|
1495
1499
|
key: 1,
|
|
1496
1500
|
class: "docx-hyperlink-popup__btn",
|
|
1497
|
-
title:
|
|
1498
|
-
onClick:
|
|
1499
|
-
}, [...
|
|
1500
|
-
], 64))], 38)) :
|
|
1501
|
+
title: q(n)("removeLink"),
|
|
1502
|
+
onClick: r[1] ||= Y((e) => t.$emit("remove"), ["prevent"])
|
|
1503
|
+
}, [...r[9] ||= [he("<svg width=\"18\" height=\"18\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\" data-v-366df18c><path d=\"M18.84 12.25l1.72-1.71h-.02a5.004 5.004 0 0 0-.12-7.07 5.006 5.006 0 0 0-6.95 0l-1.72 1.71\" data-v-366df18c></path><path d=\"M5.17 11.75l-1.71 1.71a5.004 5.004 0 0 0 .12 7.07 5.006 5.006 0 0 0 6.95 0l1.71-1.71\" data-v-366df18c></path><line x1=\"8\" y1=\"2\" x2=\"8\" y2=\"5\" data-v-366df18c></line><line x1=\"2\" y1=\"8\" x2=\"5\" y2=\"8\" data-v-366df18c></line><line x1=\"16\" y1=\"19\" x2=\"16\" y2=\"22\" data-v-366df18c></line><line x1=\"19\" y1=\"16\" x2=\"22\" y2=\"16\" data-v-366df18c></line></svg>", 1)]], 8, vi))
|
|
1504
|
+
], 64))], 38)) : F("", !0);
|
|
1501
1505
|
}
|
|
1502
|
-
}), [["__scopeId", "data-v-
|
|
1506
|
+
}), [["__scopeId", "data-v-366df18c"]]);
|
|
1503
1507
|
//#endregion
|
|
1504
1508
|
//#region src/composables/commentMarks.ts
|
|
1505
|
-
function
|
|
1509
|
+
function Ti(e, t) {
|
|
1506
1510
|
let n = Math.max(0, Math.min(t.from, e)), r = Math.max(n, Math.min(t.to, e));
|
|
1507
1511
|
return n === r ? null : {
|
|
1508
1512
|
from: n,
|
|
1509
1513
|
to: r
|
|
1510
1514
|
};
|
|
1511
1515
|
}
|
|
1512
|
-
function
|
|
1516
|
+
function Ei({ docSize: e, capturedRange: t, currentRange: n, savedRange: r }) {
|
|
1513
1517
|
let i = t.from === t.to ? n.from === n.to ? r && r.from !== r.to ? r : null : n : t;
|
|
1514
|
-
return i ?
|
|
1518
|
+
return i ? Ti(e, i) : null;
|
|
1515
1519
|
}
|
|
1516
|
-
function
|
|
1517
|
-
let i = e.state.schema.marks.comment, a =
|
|
1520
|
+
function Di(e, t, n, r) {
|
|
1521
|
+
let i = e.state.schema.marks.comment, a = Ti(e.state.doc.content.size, t);
|
|
1518
1522
|
if (!i || !a) return !1;
|
|
1519
1523
|
let o = e.state.tr;
|
|
1520
|
-
return r?.replacePending && (o = o.removeMark(a.from, a.to, i.create({ commentId:
|
|
1524
|
+
return r?.replacePending && (o = o.removeMark(a.from, a.to, i.create({ commentId: Ct }))), o = o.addMark(a.from, a.to, i.create({ commentId: n })), r?.selectEnd && (o = o.setSelection(et.near(o.doc.resolve(a.to), -1))), e.dispatch(o), !0;
|
|
1521
1525
|
}
|
|
1522
|
-
function
|
|
1523
|
-
let n = e.state.schema.marks.comment, r =
|
|
1524
|
-
!n || !r || e.dispatch(e.state.tr.removeMark(r.from, r.to, n.create({ commentId:
|
|
1526
|
+
function Oi(e, t) {
|
|
1527
|
+
let n = e.state.schema.marks.comment, r = Ti(e.state.doc.content.size, t);
|
|
1528
|
+
!n || !r || e.dispatch(e.state.tr.removeMark(r.from, r.to, n.create({ commentId: Ct })));
|
|
1525
1529
|
}
|
|
1526
1530
|
//#endregion
|
|
1527
1531
|
//#region src/composables/useCommentLifecycle.ts
|
|
1528
|
-
var
|
|
1529
|
-
function
|
|
1530
|
-
let t =
|
|
1532
|
+
var ki = 408, Ai = 12;
|
|
1533
|
+
function ji(e) {
|
|
1534
|
+
let t = W(!1), n = W(null), r = W(null), i = W(null), a = W(null);
|
|
1531
1535
|
function o(t) {
|
|
1532
1536
|
let n = e.editorView.value, r = e.pagesContainer.value;
|
|
1533
1537
|
if (!n || !r) return null;
|
|
@@ -1559,7 +1563,7 @@ function mi(e) {
|
|
|
1559
1563
|
r.value = null;
|
|
1560
1564
|
return;
|
|
1561
1565
|
}
|
|
1562
|
-
let l = i.getBoundingClientRect(), u = e.pagesContainer.value?.getBoundingClientRect(), d = u ? u.right - l.left +
|
|
1566
|
+
let l = i.getBoundingClientRect(), u = e.pagesContainer.value?.getBoundingClientRect(), d = u ? u.right - l.left + Ai : l.width / 2 + ki;
|
|
1563
1567
|
r.value = {
|
|
1564
1568
|
top: c.top - l.top,
|
|
1565
1569
|
left: Math.max(16, Math.min(d, l.width - 16)),
|
|
@@ -1570,7 +1574,7 @@ function mi(e) {
|
|
|
1570
1574
|
function c() {
|
|
1571
1575
|
let s = e.editorView.value;
|
|
1572
1576
|
if (!s) return;
|
|
1573
|
-
let c = r.value, l = s.state.selection, u =
|
|
1577
|
+
let c = r.value, l = s.state.selection, u = Ei({
|
|
1574
1578
|
docSize: s.state.doc.content.size,
|
|
1575
1579
|
capturedRange: c ? {
|
|
1576
1580
|
from: c.from,
|
|
@@ -1589,7 +1593,7 @@ function mi(e) {
|
|
|
1589
1593
|
r.value = null;
|
|
1590
1594
|
return;
|
|
1591
1595
|
}
|
|
1592
|
-
if (!
|
|
1596
|
+
if (!Di(s, u, Ct, { selectEnd: !0 })) {
|
|
1593
1597
|
r.value = null, i.value = null;
|
|
1594
1598
|
return;
|
|
1595
1599
|
}
|
|
@@ -1602,11 +1606,11 @@ function mi(e) {
|
|
|
1602
1606
|
let n = e.editorView.value, r = i.value;
|
|
1603
1607
|
if (!n || !r) return !1;
|
|
1604
1608
|
let a = e.createComment(t);
|
|
1605
|
-
return
|
|
1609
|
+
return Di(n, r, a.id, { replacePending: !0 }) ? (e.pushComment(a), e.reLayout(), e.setActiveSidebarItem(`comment-${a.id}`), l(), !0) : !1;
|
|
1606
1610
|
}
|
|
1607
1611
|
function d() {
|
|
1608
1612
|
let t = e.editorView.value;
|
|
1609
|
-
t && i.value &&
|
|
1613
|
+
t && i.value && Oi(t, i.value), l();
|
|
1610
1614
|
}
|
|
1611
1615
|
return {
|
|
1612
1616
|
isAddingComment: t,
|
|
@@ -1620,15 +1624,15 @@ function mi(e) {
|
|
|
1620
1624
|
}
|
|
1621
1625
|
//#endregion
|
|
1622
1626
|
//#region src/composables/useCommentManagement.ts
|
|
1623
|
-
function
|
|
1624
|
-
let t =
|
|
1627
|
+
function Mi(e) {
|
|
1628
|
+
let t = wt(), n = W([]), r = W(!1);
|
|
1625
1629
|
function i() {
|
|
1626
1630
|
r.value = !0;
|
|
1627
1631
|
}
|
|
1628
1632
|
function a() {
|
|
1629
1633
|
r.value = !1;
|
|
1630
1634
|
}
|
|
1631
|
-
let o =
|
|
1635
|
+
let o = N(() => e.commentsProp() !== void 0), s = N(() => o.value ? e.commentsProp() ?? [] : n.value);
|
|
1632
1636
|
function c(t) {
|
|
1633
1637
|
o.value || (n.value = t), e.onCommentsChange(t);
|
|
1634
1638
|
}
|
|
@@ -1636,12 +1640,12 @@ function hi(e) {
|
|
|
1636
1640
|
i(), c([...s.value, e]);
|
|
1637
1641
|
}
|
|
1638
1642
|
function u(n, r) {
|
|
1639
|
-
return
|
|
1643
|
+
return Tt(t, s.value, e.editorView.value), Et(t, n, e.author(), r);
|
|
1640
1644
|
}
|
|
1641
1645
|
function d() {
|
|
1642
1646
|
if (a(), o.value) return;
|
|
1643
1647
|
let n = e.getDocument()?.package.document.comments;
|
|
1644
|
-
|
|
1648
|
+
Tt(t, n, e.editorView.value), c(n && n.length > 0 ? n : []);
|
|
1645
1649
|
}
|
|
1646
1650
|
function f(e, t) {
|
|
1647
1651
|
l(u(t, e));
|
|
@@ -1667,8 +1671,8 @@ function hi(e) {
|
|
|
1667
1671
|
function _(t, n) {
|
|
1668
1672
|
let r = e.editorView.value;
|
|
1669
1673
|
if (!r) return;
|
|
1670
|
-
let i =
|
|
1671
|
-
i && (n ?
|
|
1674
|
+
let i = Dt(r, t);
|
|
1675
|
+
i && (n ? kt : Mt)(i.from, i.to)(r.state, r.dispatch);
|
|
1672
1676
|
}
|
|
1673
1677
|
function v(e) {
|
|
1674
1678
|
_(e, !0);
|
|
@@ -1678,15 +1682,15 @@ function hi(e) {
|
|
|
1678
1682
|
}
|
|
1679
1683
|
function b(t, n) {
|
|
1680
1684
|
let r = e.editorView.value;
|
|
1681
|
-
r &&
|
|
1685
|
+
r && kt(t, n)(r.state, r.dispatch);
|
|
1682
1686
|
}
|
|
1683
1687
|
function x(t, n) {
|
|
1684
1688
|
let r = e.editorView.value;
|
|
1685
|
-
r &&
|
|
1689
|
+
r && Mt(t, n)(r.state, r.dispatch);
|
|
1686
1690
|
}
|
|
1687
1691
|
return {
|
|
1688
1692
|
comments: s,
|
|
1689
|
-
commentsDirty:
|
|
1693
|
+
commentsDirty: N(() => r.value),
|
|
1690
1694
|
clearCommentsDirty: a,
|
|
1691
1695
|
createComment: u,
|
|
1692
1696
|
pushComment: l,
|
|
@@ -1705,8 +1709,8 @@ function hi(e) {
|
|
|
1705
1709
|
}
|
|
1706
1710
|
//#endregion
|
|
1707
1711
|
//#region src/utils/imageClipboard.ts
|
|
1708
|
-
function
|
|
1709
|
-
let r =
|
|
1712
|
+
function Ni(e, t, n) {
|
|
1713
|
+
let r = Nt(e.state), i = e.state.schema.marks.insertion;
|
|
1710
1714
|
if (!r || !i) return;
|
|
1711
1715
|
let a = t.selection.from, o = a - n.nodeSize;
|
|
1712
1716
|
o < 0 || t.addMark(o, a, i.create({
|
|
@@ -1715,7 +1719,7 @@ function gi(e, t, n) {
|
|
|
1715
1719
|
date: r.date
|
|
1716
1720
|
}));
|
|
1717
1721
|
}
|
|
1718
|
-
function
|
|
1722
|
+
function Pi(e, t) {
|
|
1719
1723
|
let n = e.state.doc.nodeAt(t);
|
|
1720
1724
|
if (!n || n.type.name !== "image") return;
|
|
1721
1725
|
let r = n.attrs.src;
|
|
@@ -1729,7 +1733,7 @@ function _i(e, t) {
|
|
|
1729
1733
|
e.value = i, document.body.appendChild(e), e.select(), document.execCommand("copy"), document.body.removeChild(e);
|
|
1730
1734
|
});
|
|
1731
1735
|
}
|
|
1732
|
-
function
|
|
1736
|
+
function Fi(e) {
|
|
1733
1737
|
return new Promise((t, n) => {
|
|
1734
1738
|
let r = new FileReader();
|
|
1735
1739
|
r.onload = () => {
|
|
@@ -1737,7 +1741,7 @@ function vi(e) {
|
|
|
1737
1741
|
}, r.onerror = () => n(r.error ?? /* @__PURE__ */ Error("Failed to read blob")), r.readAsDataURL(e);
|
|
1738
1742
|
});
|
|
1739
1743
|
}
|
|
1740
|
-
function
|
|
1744
|
+
function Ii(e) {
|
|
1741
1745
|
return new Promise((t) => {
|
|
1742
1746
|
let n = new Image();
|
|
1743
1747
|
n.onload = () => t({
|
|
@@ -1749,7 +1753,7 @@ function yi(e) {
|
|
|
1749
1753
|
}), n.src = e;
|
|
1750
1754
|
});
|
|
1751
1755
|
}
|
|
1752
|
-
function
|
|
1756
|
+
function Li(e, t, n, r) {
|
|
1753
1757
|
let i = e.state.schema.nodes.image;
|
|
1754
1758
|
if (!i) return;
|
|
1755
1759
|
let a = i.create({
|
|
@@ -1760,23 +1764,23 @@ function bi(e, t, n, r) {
|
|
|
1760
1764
|
wrapType: "inline",
|
|
1761
1765
|
displayMode: "inline"
|
|
1762
1766
|
}), o = e.state.tr.replaceSelectionWith(a);
|
|
1763
|
-
|
|
1767
|
+
Ni(e, o, a), e.dispatch(o);
|
|
1764
1768
|
}
|
|
1765
|
-
async function
|
|
1769
|
+
async function Ri(e) {
|
|
1766
1770
|
try {
|
|
1767
1771
|
let t = await navigator.clipboard.read();
|
|
1768
1772
|
for (let n of t) {
|
|
1769
1773
|
let t = n.types.find((e) => e.startsWith("image/"));
|
|
1770
1774
|
if (t) {
|
|
1771
|
-
let r = await
|
|
1772
|
-
a > 612 && (o = Math.round(612 / a * o), a = 612),
|
|
1775
|
+
let r = await Fi(await n.getType(t)), i = await Ii(r), a = i.width, o = i.height;
|
|
1776
|
+
a > 612 && (o = Math.round(612 / a * o), a = 612), Li(e, r, a, o);
|
|
1773
1777
|
return;
|
|
1774
1778
|
}
|
|
1775
1779
|
if (n.types.includes("text/html")) {
|
|
1776
1780
|
let t = await (await n.getType("text/html")).text(), r = /<img[^>]+src="(?<src>[^"]+)"[^>]*>/iu.exec(t)?.groups?.src;
|
|
1777
1781
|
if (r) {
|
|
1778
1782
|
let n = /data-width="(?<w>\d+)"/u.exec(t)?.groups?.w, i = /data-height="(?<h>\d+)"/u.exec(t)?.groups?.h, a = n ? Number(n) : 200, o = i ? Number(i) : 200;
|
|
1779
|
-
|
|
1783
|
+
Li(e, r, a || 200, o || 200);
|
|
1780
1784
|
return;
|
|
1781
1785
|
}
|
|
1782
1786
|
}
|
|
@@ -1797,14 +1801,14 @@ async function xi(e) {
|
|
|
1797
1801
|
}
|
|
1798
1802
|
}
|
|
1799
1803
|
}
|
|
1800
|
-
function
|
|
1804
|
+
function zi(e, t) {
|
|
1801
1805
|
let n = e.state.doc.nodeAt(t);
|
|
1802
1806
|
if (!n || n.type.name !== "image") return;
|
|
1803
1807
|
let r = document.createElement("input");
|
|
1804
1808
|
r.type = "file", r.accept = "image/*", r.onchange = async () => {
|
|
1805
1809
|
let i = r.files?.[0];
|
|
1806
1810
|
if (!i) return;
|
|
1807
|
-
let a = await
|
|
1811
|
+
let a = await Fi(i), o = await Ii(a), s = n.attrs.width, c = n.attrs.height, l = typeof s == "number" ? s : o.width, u = typeof c == "number" ? c : o.height, d = Math.min(l / o.width, u / o.height), f = Math.round(o.width * d), p = Math.round(o.height * d);
|
|
1808
1812
|
try {
|
|
1809
1813
|
let r = e.state.tr.setNodeMarkup(t, void 0, {
|
|
1810
1814
|
...n.attrs,
|
|
@@ -1819,7 +1823,7 @@ function Si(e, t) {
|
|
|
1819
1823
|
}
|
|
1820
1824
|
//#endregion
|
|
1821
1825
|
//#region src/composables/useContextMenus.ts
|
|
1822
|
-
var
|
|
1826
|
+
var Bi = /* @__PURE__ */ new Set([
|
|
1823
1827
|
"inline",
|
|
1824
1828
|
"square",
|
|
1825
1829
|
"tight",
|
|
@@ -1828,17 +1832,17 @@ var Ci = new Set([
|
|
|
1828
1832
|
"behind",
|
|
1829
1833
|
"inFront"
|
|
1830
1834
|
]);
|
|
1831
|
-
function
|
|
1832
|
-
return typeof e == "string" &&
|
|
1835
|
+
function Vi(e) {
|
|
1836
|
+
return typeof e == "string" && Bi.has(e);
|
|
1833
1837
|
}
|
|
1834
|
-
function
|
|
1835
|
-
return
|
|
1838
|
+
function Hi(e) {
|
|
1839
|
+
return Vi(e) ? e : "inline";
|
|
1836
1840
|
}
|
|
1837
|
-
function
|
|
1841
|
+
function Ui(e) {
|
|
1838
1842
|
return e === "left" || e === "right" || e === "none" ? e : null;
|
|
1839
1843
|
}
|
|
1840
|
-
function
|
|
1841
|
-
let { t
|
|
1844
|
+
function Wi(e) {
|
|
1845
|
+
let { t } = c(), n = W({
|
|
1842
1846
|
isOpen: !1,
|
|
1843
1847
|
position: {
|
|
1844
1848
|
x: 0,
|
|
@@ -1849,37 +1853,37 @@ function Di(e) {
|
|
|
1849
1853
|
onImage: !1,
|
|
1850
1854
|
canMergeCells: !1,
|
|
1851
1855
|
canSplitCell: !1
|
|
1852
|
-
}),
|
|
1856
|
+
}), r = W(null), i = W({
|
|
1853
1857
|
from: 0,
|
|
1854
1858
|
to: 0
|
|
1855
|
-
}),
|
|
1859
|
+
}), a = N(() => (e.customContextMenuItems?.() ?? []).filter((e) => !e.requiresSelection || n.value.hasSelection)), o = N(() => [
|
|
1856
1860
|
{
|
|
1857
1861
|
action: "cut",
|
|
1858
|
-
label:
|
|
1859
|
-
shortcut:
|
|
1862
|
+
label: t("contextMenu.cut"),
|
|
1863
|
+
shortcut: t("contextMenu.cutShortcut")
|
|
1860
1864
|
},
|
|
1861
1865
|
{
|
|
1862
1866
|
action: "copy",
|
|
1863
|
-
label:
|
|
1864
|
-
shortcut:
|
|
1867
|
+
label: t("contextMenu.copy"),
|
|
1868
|
+
shortcut: t("contextMenu.copyShortcut")
|
|
1865
1869
|
},
|
|
1866
1870
|
{
|
|
1867
1871
|
action: "paste",
|
|
1868
|
-
label:
|
|
1869
|
-
shortcut:
|
|
1872
|
+
label: t("contextMenu.paste"),
|
|
1873
|
+
shortcut: t("contextMenu.pasteShortcut"),
|
|
1870
1874
|
dividerAfter: !0
|
|
1871
1875
|
},
|
|
1872
1876
|
{
|
|
1873
1877
|
action: "delete",
|
|
1874
|
-
label:
|
|
1875
|
-
shortcut:
|
|
1878
|
+
label: t("contextMenu.delete"),
|
|
1879
|
+
shortcut: t("contextMenu.deleteShortcut")
|
|
1876
1880
|
}
|
|
1877
1881
|
]);
|
|
1878
|
-
function
|
|
1882
|
+
function s(e, t) {
|
|
1879
1883
|
t(e.state, (t) => e.dispatch(t), e);
|
|
1880
1884
|
}
|
|
1881
1885
|
function l(t, n, r, i, a) {
|
|
1882
|
-
let o = i === "inline" ?
|
|
1886
|
+
let o = i === "inline" ? rt(t, e.zoom.value) : void 0;
|
|
1883
1887
|
return {
|
|
1884
1888
|
open: !0,
|
|
1885
1889
|
position: r,
|
|
@@ -1890,43 +1894,43 @@ function Di(e) {
|
|
|
1890
1894
|
};
|
|
1891
1895
|
}
|
|
1892
1896
|
function u(t) {
|
|
1893
|
-
let
|
|
1894
|
-
if (!
|
|
1895
|
-
let o =
|
|
1897
|
+
let a = e.editorView.value;
|
|
1898
|
+
if (!a) return;
|
|
1899
|
+
let o = at(t.target);
|
|
1896
1900
|
if (o) {
|
|
1897
|
-
let
|
|
1898
|
-
if (!Number.isNaN(
|
|
1901
|
+
let i = Number(o.dataset.pmStart);
|
|
1902
|
+
if (!Number.isNaN(i)) {
|
|
1899
1903
|
try {
|
|
1900
|
-
let e =
|
|
1901
|
-
|
|
1904
|
+
let e = $e.create(a.state.doc, i);
|
|
1905
|
+
a.dispatch(a.state.tr.setSelection(e));
|
|
1902
1906
|
} catch {}
|
|
1903
1907
|
e.selectedImage.value = {
|
|
1904
1908
|
element: o,
|
|
1905
|
-
pmPos:
|
|
1909
|
+
pmPos: i,
|
|
1906
1910
|
width: o.offsetWidth,
|
|
1907
1911
|
height: o.offsetHeight
|
|
1908
1912
|
}, e.clearOverlay();
|
|
1909
|
-
let s =
|
|
1913
|
+
let s = a.state.doc.nodeAt(i);
|
|
1910
1914
|
if (s && s.type.name === "image") {
|
|
1911
|
-
|
|
1915
|
+
r.value = l(o, i, {
|
|
1912
1916
|
x: t.clientX,
|
|
1913
1917
|
y: t.clientY
|
|
1914
|
-
},
|
|
1918
|
+
}, Hi(s.attrs.wrapType), Ui(s.attrs.cssFloat)), n.value.isOpen = !1;
|
|
1915
1919
|
return;
|
|
1916
1920
|
}
|
|
1917
1921
|
}
|
|
1918
1922
|
}
|
|
1919
1923
|
{
|
|
1920
|
-
let { from:
|
|
1921
|
-
if (
|
|
1922
|
-
e.setPmSelection(
|
|
1924
|
+
let { from: n, to: r } = a.state.selection, i = e.resolvePos(t.clientX, t.clientY);
|
|
1925
|
+
if (i !== null && (i < n || i > r)) try {
|
|
1926
|
+
e.setPmSelection(i);
|
|
1923
1927
|
} catch {}
|
|
1924
1928
|
}
|
|
1925
|
-
let s =
|
|
1926
|
-
|
|
1929
|
+
let s = St(a.state), { empty: c, from: u, to: d } = a.state.selection;
|
|
1930
|
+
i.value = {
|
|
1927
1931
|
from: u,
|
|
1928
1932
|
to: d
|
|
1929
|
-
},
|
|
1933
|
+
}, r.value &&= null, n.value = {
|
|
1930
1934
|
isOpen: !0,
|
|
1931
1935
|
position: {
|
|
1932
1936
|
x: t.clientX,
|
|
@@ -1940,46 +1944,46 @@ function Di(e) {
|
|
|
1940
1944
|
};
|
|
1941
1945
|
}
|
|
1942
1946
|
function d(t) {
|
|
1943
|
-
let
|
|
1944
|
-
if (!
|
|
1945
|
-
let o =
|
|
1946
|
-
!o || o.type.name !== "image" || (
|
|
1947
|
+
let i = e.editorView.value, a = e.selectedImage.value;
|
|
1948
|
+
if (!i || !a) return;
|
|
1949
|
+
let o = i.state.doc.nodeAt(a.pmPos);
|
|
1950
|
+
!o || o.type.name !== "image" || (r.value = l(a.element, a.pmPos, {
|
|
1947
1951
|
x: t.clientX,
|
|
1948
1952
|
y: t.clientY
|
|
1949
|
-
},
|
|
1953
|
+
}, Hi(o.attrs.wrapType), Ui(o.attrs.cssFloat)), n.value.isOpen = !1);
|
|
1950
1954
|
}
|
|
1951
1955
|
function f(t) {
|
|
1952
|
-
let n = e.editorView.value,
|
|
1953
|
-
if (!n || !
|
|
1954
|
-
let a =
|
|
1955
|
-
o && (
|
|
1956
|
+
let n = e.editorView.value, i = r.value;
|
|
1957
|
+
if (!n || !i) return;
|
|
1958
|
+
let a = i.inlinePositionEmu && t !== "inline" ? { initialPositionEmu: i.inlinePositionEmu } : void 0, o = e.getCommands().setImageWrapType;
|
|
1959
|
+
o && (s(n, o(i.pmPos, t, a)), n.focus());
|
|
1956
1960
|
}
|
|
1957
1961
|
function p(t) {
|
|
1958
1962
|
let n = e.editorView.value;
|
|
1959
1963
|
if (!n) return;
|
|
1960
1964
|
let r = e.getCommands();
|
|
1961
1965
|
if (t.startsWith("custom:")) {
|
|
1962
|
-
let r =
|
|
1966
|
+
let r = i.value, a = r.from === r.to ? {
|
|
1963
1967
|
from: n.state.selection.from,
|
|
1964
1968
|
to: n.state.selection.to
|
|
1965
1969
|
} : r;
|
|
1966
|
-
e.onCustomContextAction?.(t.slice(7),
|
|
1970
|
+
e.onCustomContextAction?.(t.slice(7), a), n.focus();
|
|
1967
1971
|
return;
|
|
1968
1972
|
}
|
|
1969
1973
|
switch (t) {
|
|
1970
1974
|
case "cut":
|
|
1971
1975
|
if (e.selectedImage.value) {
|
|
1972
1976
|
let t = e.selectedImage.value.pmPos;
|
|
1973
|
-
|
|
1977
|
+
Pi(n, t);
|
|
1974
1978
|
let r = n.state.doc.nodeAt(t);
|
|
1975
1979
|
r && (n.dispatch(n.state.tr.delete(t, t + r.nodeSize)), e.selectedImage.value = null);
|
|
1976
1980
|
} else n.focus(), document.execCommand("cut");
|
|
1977
1981
|
break;
|
|
1978
1982
|
case "copy":
|
|
1979
|
-
e.selectedImage.value ?
|
|
1983
|
+
e.selectedImage.value ? Pi(n, e.selectedImage.value.pmPos) : (n.focus(), document.execCommand("copy"));
|
|
1980
1984
|
break;
|
|
1981
1985
|
case "paste":
|
|
1982
|
-
|
|
1986
|
+
Ri(n);
|
|
1983
1987
|
break;
|
|
1984
1988
|
case "pasteAsPlainText":
|
|
1985
1989
|
navigator.clipboard.readText().then((e) => {
|
|
@@ -2000,7 +2004,7 @@ function Di(e) {
|
|
|
2000
2004
|
e.selectedImage.value && (e.showImageProperties.value = !0);
|
|
2001
2005
|
break;
|
|
2002
2006
|
case "replaceImage":
|
|
2003
|
-
e.selectedImage.value &&
|
|
2007
|
+
e.selectedImage.value && zi(n, e.selectedImage.value.pmPos);
|
|
2004
2008
|
break;
|
|
2005
2009
|
case "deleteImage":
|
|
2006
2010
|
if (e.selectedImage.value) {
|
|
@@ -2019,17 +2023,17 @@ function Di(e) {
|
|
|
2019
2023
|
case "selectTable":
|
|
2020
2024
|
case "deleteTable": {
|
|
2021
2025
|
let e = r[t];
|
|
2022
|
-
e &&
|
|
2026
|
+
e && s(n, e());
|
|
2023
2027
|
break;
|
|
2024
2028
|
}
|
|
2025
2029
|
}
|
|
2026
2030
|
n.focus();
|
|
2027
2031
|
}
|
|
2028
2032
|
return {
|
|
2029
|
-
contextMenu:
|
|
2030
|
-
imageContextMenu:
|
|
2031
|
-
imageContextMenuTextActions:
|
|
2032
|
-
customTextMenuItems:
|
|
2033
|
+
contextMenu: n,
|
|
2034
|
+
imageContextMenu: r,
|
|
2035
|
+
imageContextMenuTextActions: o,
|
|
2036
|
+
customTextMenuItems: a,
|
|
2033
2037
|
handleContextMenu: u,
|
|
2034
2038
|
handleSelectedImageContextMenu: d,
|
|
2035
2039
|
handleImageWrapSelect: f,
|
|
@@ -2038,61 +2042,26 @@ function Di(e) {
|
|
|
2038
2042
|
}
|
|
2039
2043
|
//#endregion
|
|
2040
2044
|
//#region src/composables/useDocumentLifecycle.ts
|
|
2041
|
-
function
|
|
2045
|
+
function Gi(e) {
|
|
2042
2046
|
async function t(t) {
|
|
2043
2047
|
e.sidebarAutoOpenedRef.value = !1, await e.loadDocumentBuffer(t);
|
|
2044
2048
|
}
|
|
2045
2049
|
function n(t) {
|
|
2046
2050
|
e.sidebarAutoOpenedRef.value = !1, e.loadDocument(t);
|
|
2047
2051
|
}
|
|
2048
|
-
|
|
2052
|
+
J(e.documentBuffer, (e) => {
|
|
2049
2053
|
e && t(e);
|
|
2050
|
-
}),
|
|
2054
|
+
}), J(e.document, (e) => {
|
|
2051
2055
|
e && n(e);
|
|
2052
|
-
}),
|
|
2053
|
-
await
|
|
2056
|
+
}), xe(async () => {
|
|
2057
|
+
await ye();
|
|
2054
2058
|
let r = e.documentBuffer(), i = e.document();
|
|
2055
2059
|
r ? await t(r) : i && n(i);
|
|
2056
2060
|
});
|
|
2057
2061
|
}
|
|
2058
2062
|
//#endregion
|
|
2059
|
-
//#region src/utils/aiEditRange.ts
|
|
2060
|
-
var ki = ({ blockId: e, doc: t, snapshot: n }) => {
|
|
2061
|
-
let r = Yt(e);
|
|
2062
|
-
if (r !== null) {
|
|
2063
|
-
let e = Kt(t, r);
|
|
2064
|
-
if (e !== null) return {
|
|
2065
|
-
from: e.from,
|
|
2066
|
-
to: e.to
|
|
2067
|
-
};
|
|
2068
|
-
}
|
|
2069
|
-
let i = n ?? Gt(t), a = i.anchors[e] ?? Ai(e, i);
|
|
2070
|
-
return a ? ji(t.content.size, a) : null;
|
|
2071
|
-
}, Ai = (e, t) => {
|
|
2072
|
-
let n = Xt(e);
|
|
2073
|
-
if (n === null) return;
|
|
2074
|
-
let r = t.blocks.at(n - 1);
|
|
2075
|
-
return r ? t.anchors[r.id] : void 0;
|
|
2076
|
-
};
|
|
2077
|
-
function ji(e, t) {
|
|
2078
|
-
return {
|
|
2079
|
-
from: Math.min(Math.max(t.from, 0), e),
|
|
2080
|
-
to: Math.min(Math.max(t.to, 0), e)
|
|
2081
|
-
};
|
|
2082
|
-
}
|
|
2083
|
-
//#endregion
|
|
2084
|
-
//#region src/utils/pageText.ts
|
|
2085
|
-
var Mi = (e, t, n) => {
|
|
2086
|
-
if (!e || !Number.isInteger(n) || n < 1) return null;
|
|
2087
|
-
let r = e.pages[n - 1];
|
|
2088
|
-
if (!r) return null;
|
|
2089
|
-
let i = [];
|
|
2090
|
-
for (let e of r.fragments) typeof e.pmStart != "number" || typeof e.pmEnd != "number" || i.push(t.textBetween(e.pmStart, e.pmEnd, "\n"));
|
|
2091
|
-
return i.join("\n");
|
|
2092
|
-
};
|
|
2093
|
-
//#endregion
|
|
2094
2063
|
//#region src/composables/useDocxEditorRefApi.ts
|
|
2095
|
-
function
|
|
2064
|
+
function Ki(e) {
|
|
2096
2065
|
function t() {
|
|
2097
2066
|
e.onPrint?.(), window.print();
|
|
2098
2067
|
}
|
|
@@ -2105,11 +2074,11 @@ function Ni(e) {
|
|
|
2105
2074
|
function r(t, n) {
|
|
2106
2075
|
let r = e.pagesRef.value;
|
|
2107
2076
|
if (!r) return !1;
|
|
2108
|
-
let i =
|
|
2077
|
+
let i = Qt(r, t), a = i.at(0);
|
|
2109
2078
|
return a ? (a.scrollIntoView({
|
|
2110
2079
|
block: "center",
|
|
2111
2080
|
behavior: "smooth"
|
|
2112
|
-
}), n?.highlight &&
|
|
2081
|
+
}), n?.highlight && $t(i, n.highlight), !0) : !1;
|
|
2113
2082
|
}
|
|
2114
2083
|
function i() {
|
|
2115
2084
|
return e.zoom.value;
|
|
@@ -2140,7 +2109,7 @@ function Ni(e) {
|
|
|
2140
2109
|
getPageNumberForPmPos: (t) => {
|
|
2141
2110
|
let n = e.layout.value;
|
|
2142
2111
|
if (!n) return null;
|
|
2143
|
-
let r =
|
|
2112
|
+
let r = Zt(n, t);
|
|
2144
2113
|
return r == null ? null : r + 1;
|
|
2145
2114
|
}
|
|
2146
2115
|
}, a;
|
|
@@ -2151,7 +2120,7 @@ function Ni(e) {
|
|
|
2151
2120
|
function c() {
|
|
2152
2121
|
let t = e.layout.value, n = e.editorView.value;
|
|
2153
2122
|
if (!t || !n) return 0;
|
|
2154
|
-
let r =
|
|
2123
|
+
let r = Zt(t, n.state.selection.from);
|
|
2155
2124
|
return r == null ? 0 : r + 1;
|
|
2156
2125
|
}
|
|
2157
2126
|
function l(t) {
|
|
@@ -2184,11 +2153,38 @@ function Ni(e) {
|
|
|
2184
2153
|
ensureEditorView: () => e.editor.ensureView(),
|
|
2185
2154
|
createAIEditSnapshot: () => {
|
|
2186
2155
|
let t = e.editorView.value;
|
|
2187
|
-
return t ?
|
|
2156
|
+
return t ? Wt(t.state.doc) : null;
|
|
2157
|
+
},
|
|
2158
|
+
applyDocumentOperations: ({ snapshot: t, batch: n, author: r = e.author() }) => {
|
|
2159
|
+
Ht(n.version);
|
|
2160
|
+
let i = e.editorView.value;
|
|
2161
|
+
if (!i) {
|
|
2162
|
+
let e = "committed";
|
|
2163
|
+
n.dryRun === !0 ? e = "previewed" : n.atomic === !0 && (e = "rejected");
|
|
2164
|
+
let t = n.operations.map((e) => ({
|
|
2165
|
+
id: e.id,
|
|
2166
|
+
reason: "unsupportedBlock"
|
|
2167
|
+
}));
|
|
2168
|
+
return {
|
|
2169
|
+
version: zt,
|
|
2170
|
+
status: e,
|
|
2171
|
+
applied: [],
|
|
2172
|
+
skipped: t,
|
|
2173
|
+
issues: qt(n.operations, t),
|
|
2174
|
+
receipts: []
|
|
2175
|
+
};
|
|
2176
|
+
}
|
|
2177
|
+
return Vt({
|
|
2178
|
+
view: i,
|
|
2179
|
+
snapshot: t,
|
|
2180
|
+
batch: n,
|
|
2181
|
+
author: r,
|
|
2182
|
+
createCommentId: e.createAIEditComment
|
|
2183
|
+
});
|
|
2188
2184
|
},
|
|
2189
2185
|
applyAIEditOperations: ({ snapshot: t, operations: n, mode: r = "tracked-changes", author: i = e.author() }) => {
|
|
2190
2186
|
let a = e.editorView.value;
|
|
2191
|
-
return a ?
|
|
2187
|
+
return a ? Bt({
|
|
2192
2188
|
view: a,
|
|
2193
2189
|
snapshot: t,
|
|
2194
2190
|
operations: n,
|
|
@@ -2205,26 +2201,26 @@ function Ni(e) {
|
|
|
2205
2201
|
},
|
|
2206
2202
|
acceptAIEditOperation: (t) => {
|
|
2207
2203
|
let n = e.editorView.value;
|
|
2208
|
-
return n ?
|
|
2204
|
+
return n ? Ot(t)(n.state, n.dispatch) : !1;
|
|
2209
2205
|
},
|
|
2210
2206
|
rejectAIEditOperation: (t) => {
|
|
2211
2207
|
let n = e.editorView.value;
|
|
2212
|
-
return n ?
|
|
2208
|
+
return n ? jt(t)(n.state, n.dispatch) : !1;
|
|
2213
2209
|
},
|
|
2214
2210
|
undo: () => e.editor.undo(),
|
|
2215
2211
|
redo: () => e.editor.redo(),
|
|
2216
2212
|
scrollToAIEditOperation: (t) => {
|
|
2217
2213
|
let n = e.editorView.value;
|
|
2218
2214
|
if (!n) return !1;
|
|
2219
|
-
let r =
|
|
2215
|
+
let r = At(n.state, t);
|
|
2220
2216
|
if (!r) return !1;
|
|
2221
|
-
let { from: i, to: a } =
|
|
2217
|
+
let { from: i, to: a } = cn(n.state.doc.content.size, r), o = n.state.doc.resolve(i), s = n.state.doc.resolve(a);
|
|
2222
2218
|
return n.dispatch(n.state.tr.setSelection(Z.between(o, s))), requestAnimationFrame(() => e.scrollVisiblePositionIntoView(i)), !0;
|
|
2223
2219
|
},
|
|
2224
2220
|
scrollToBlock: (t, n) => {
|
|
2225
2221
|
let r = e.editorView.value;
|
|
2226
2222
|
if (!r) return !1;
|
|
2227
|
-
let i =
|
|
2223
|
+
let i = ln({
|
|
2228
2224
|
blockId: t,
|
|
2229
2225
|
doc: r.state.doc,
|
|
2230
2226
|
snapshot: n
|
|
@@ -2235,24 +2231,24 @@ function Ni(e) {
|
|
|
2235
2231
|
},
|
|
2236
2232
|
getTrackedChanges: () => {
|
|
2237
2233
|
let t = e.editorView.value;
|
|
2238
|
-
return t ?
|
|
2234
|
+
return t ? Jt(t.state.doc) : [];
|
|
2239
2235
|
},
|
|
2240
2236
|
getCommentAnchors: () => {
|
|
2241
2237
|
let t = e.editorView.value;
|
|
2242
|
-
return t ?
|
|
2238
|
+
return t ? Kt(t.state.doc) : [];
|
|
2243
2239
|
},
|
|
2244
2240
|
getSelectionText: () => {
|
|
2245
2241
|
let t = e.editorView.value;
|
|
2246
|
-
return t ?
|
|
2242
|
+
return t ? je(t.state) : "";
|
|
2247
2243
|
},
|
|
2248
2244
|
getPageText: (t) => {
|
|
2249
2245
|
let n = e.editorView.value;
|
|
2250
|
-
return n ?
|
|
2246
|
+
return n ? un(e.layout.value, n.state.doc, t) : null;
|
|
2251
2247
|
},
|
|
2252
2248
|
getContentControls: (t = {}) => {
|
|
2253
2249
|
let n = e.editorView.value;
|
|
2254
|
-
return n ?
|
|
2255
|
-
properties:
|
|
2250
|
+
return n ? nn(n.state.doc, t).map((e) => ({
|
|
2251
|
+
properties: en(e.node),
|
|
2256
2252
|
path: e.path,
|
|
2257
2253
|
pmPos: e.pos
|
|
2258
2254
|
})) : [];
|
|
@@ -2260,7 +2256,7 @@ function Ni(e) {
|
|
|
2260
2256
|
scrollToContentControl: (t) => {
|
|
2261
2257
|
let n = e.editorView.value;
|
|
2262
2258
|
if (!n) return !1;
|
|
2263
|
-
let r =
|
|
2259
|
+
let r = tn(n.state.doc, t);
|
|
2264
2260
|
if (!r) return !1;
|
|
2265
2261
|
let i = r.pos + 1, a = n.state.doc.resolve(i);
|
|
2266
2262
|
return n.dispatch(n.state.tr.setSelection(Z.near(a))), requestAnimationFrame(() => e.scrollVisiblePositionIntoView(i)), !0;
|
|
@@ -2268,52 +2264,52 @@ function Ni(e) {
|
|
|
2268
2264
|
setContentControlContent: (t, n, r = {}) => {
|
|
2269
2265
|
let i = e.editorView.value;
|
|
2270
2266
|
if (!i) return !1;
|
|
2271
|
-
let a = typeof n == "string" ?
|
|
2267
|
+
let a = typeof n == "string" ? an(i.state, t, n, r) : sn(i.state, t, n, r);
|
|
2272
2268
|
return a ? (i.dispatch(a), !0) : !1;
|
|
2273
2269
|
},
|
|
2274
2270
|
setContentControlValue: (t, n, r = {}) => {
|
|
2275
2271
|
let i = e.editorView.value;
|
|
2276
2272
|
if (!i) return !1;
|
|
2277
|
-
let a =
|
|
2273
|
+
let a = on(i.state, t, n, r);
|
|
2278
2274
|
return a ? (i.dispatch(a), !0) : !1;
|
|
2279
2275
|
},
|
|
2280
2276
|
removeContentControl: (t, n = {}) => {
|
|
2281
2277
|
let r = e.editorView.value;
|
|
2282
2278
|
if (!r) return !1;
|
|
2283
|
-
let i =
|
|
2279
|
+
let i = rn(r.state, t, n);
|
|
2284
2280
|
return i ? (r.dispatch(i), !0) : !1;
|
|
2285
2281
|
}
|
|
2286
2282
|
} };
|
|
2287
2283
|
}
|
|
2288
2284
|
//#endregion
|
|
2289
2285
|
//#region src/composables/useFormattingActions.ts
|
|
2290
|
-
function
|
|
2286
|
+
function qi(e) {
|
|
2291
2287
|
let t = () => e.activeView?.value ?? e.editorView.value;
|
|
2292
2288
|
function n() {
|
|
2293
2289
|
let e = t();
|
|
2294
|
-
e && (
|
|
2290
|
+
e && (xt(e.state, e.dispatch, e), e.focus());
|
|
2295
2291
|
}
|
|
2296
2292
|
function r(n) {
|
|
2297
2293
|
let r = t();
|
|
2298
2294
|
if (!r) return;
|
|
2299
2295
|
let i = e.getDocument(), a = i?.package?.styles;
|
|
2300
2296
|
if (a) {
|
|
2301
|
-
let e =
|
|
2302
|
-
e.paragraphFormatting && (t.paragraphFormatting = e.paragraphFormatting), e.runFormatting && (t.runFormatting = e.runFormatting),
|
|
2303
|
-
} else
|
|
2297
|
+
let e = ke(a).resolveParagraphStyle(n), t = { numbering: i?.package?.numbering ? gn(i.package.numbering) : null };
|
|
2298
|
+
e.paragraphFormatting && (t.paragraphFormatting = e.paragraphFormatting), e.runFormatting && (t.runFormatting = e.runFormatting), dn(n, t)(r.state, (e) => r.dispatch(e));
|
|
2299
|
+
} else dn(n)(r.state, (e) => r.dispatch(e));
|
|
2304
2300
|
r.focus();
|
|
2305
2301
|
}
|
|
2306
2302
|
function i() {
|
|
2307
2303
|
let t = e.editorView.value;
|
|
2308
|
-
t && (
|
|
2304
|
+
t && (_n(t.state, (e) => t.dispatch(e), t), t.focus());
|
|
2309
2305
|
}
|
|
2310
2306
|
function a() {
|
|
2311
2307
|
let t = e.editorView.value;
|
|
2312
|
-
t && (
|
|
2308
|
+
t && (yn(t.state, (e) => t.dispatch(e), t), t.focus());
|
|
2313
2309
|
}
|
|
2314
2310
|
function o() {
|
|
2315
2311
|
let t = e.editorView.value;
|
|
2316
|
-
t && (
|
|
2312
|
+
t && (vn(t.state, (e) => t.dispatch(e), t), t.focus());
|
|
2317
2313
|
}
|
|
2318
2314
|
function s(e) {
|
|
2319
2315
|
let n = t();
|
|
@@ -2332,8 +2328,8 @@ function Pi(e) {
|
|
|
2332
2328
|
}
|
|
2333
2329
|
//#endregion
|
|
2334
2330
|
//#region src/composables/useHyperlinkManagement.ts
|
|
2335
|
-
function
|
|
2336
|
-
let t =
|
|
2331
|
+
function Ji(e) {
|
|
2332
|
+
let t = W(null);
|
|
2337
2333
|
function n(e, t) {
|
|
2338
2334
|
t(e.state, (t) => e.dispatch(t), e);
|
|
2339
2335
|
}
|
|
@@ -2363,14 +2359,14 @@ function Fi(e) {
|
|
|
2363
2359
|
}
|
|
2364
2360
|
function o(n, r) {
|
|
2365
2361
|
let i = e.editorView.value;
|
|
2366
|
-
i && (
|
|
2362
|
+
i && (bn(i, {
|
|
2367
2363
|
displayText: n,
|
|
2368
2364
|
href: r
|
|
2369
2365
|
}), t.value = null, i.focus());
|
|
2370
2366
|
}
|
|
2371
2367
|
function s() {
|
|
2372
2368
|
let n = e.editorView.value;
|
|
2373
|
-
n && (
|
|
2369
|
+
n && (xn(n, { popupHref: t.value?.href }), t.value = null, n.focus());
|
|
2374
2370
|
}
|
|
2375
2371
|
return {
|
|
2376
2372
|
hyperlinkPopupData: t,
|
|
@@ -2383,8 +2379,8 @@ function Fi(e) {
|
|
|
2383
2379
|
}
|
|
2384
2380
|
//#endregion
|
|
2385
2381
|
//#region src/composables/useImageActions.ts
|
|
2386
|
-
function
|
|
2387
|
-
let t =
|
|
2382
|
+
function Yi(e) {
|
|
2383
|
+
let t = we(null), n = W(!1), r = N(() => {
|
|
2388
2384
|
e.stateTick.value;
|
|
2389
2385
|
let n = e.editorView.value, r = t.value;
|
|
2390
2386
|
if (!n || !r) return null;
|
|
@@ -2403,9 +2399,9 @@ function Ii(e) {
|
|
|
2403
2399
|
function a(n) {
|
|
2404
2400
|
let r = e.editorView.value, a = t.value;
|
|
2405
2401
|
if (!r || !a) return;
|
|
2406
|
-
let o =
|
|
2402
|
+
let o = st(n);
|
|
2407
2403
|
if (!o) return;
|
|
2408
|
-
let s = r.state.doc.nodeAt(a.pmPos)?.attrs.wrapType === "inline" && o !== "inline" ? { initialPositionEmu:
|
|
2404
|
+
let s = r.state.doc.nodeAt(a.pmPos)?.attrs.wrapType === "inline" && o !== "inline" ? { initialPositionEmu: rt(a.element, e.zoom.value) } : void 0, c = e.getCommands().setImageWrapType;
|
|
2409
2405
|
c && (i(r, c(a.pmPos, o, s)), r.focus());
|
|
2410
2406
|
}
|
|
2411
2407
|
function o(n) {
|
|
@@ -2433,7 +2429,7 @@ function Ii(e) {
|
|
|
2433
2429
|
}
|
|
2434
2430
|
//#endregion
|
|
2435
2431
|
//#region src/composables/useKeyboardShortcuts.ts
|
|
2436
|
-
function
|
|
2432
|
+
function Xi(e) {
|
|
2437
2433
|
function t(t) {
|
|
2438
2434
|
if (t.key === "F1") {
|
|
2439
2435
|
t.preventDefault(), e.showKeyboardShortcuts.value = !0;
|
|
@@ -2448,14 +2444,14 @@ function Li(e) {
|
|
|
2448
2444
|
e.disableFindReplaceShortcuts?.() && (t.key === "f" || t.key === "h") || (t.key === "f" || t.key === "h" ? (t.preventDefault(), e.showFindReplace.value = !0) : t.key === "k" ? (t.preventDefault(), e.showHyperlink.value = !0) : t.key === "/" && (t.preventDefault(), e.showKeyboardShortcuts.value = !e.showKeyboardShortcuts.value));
|
|
2449
2445
|
}
|
|
2450
2446
|
}
|
|
2451
|
-
return
|
|
2447
|
+
return xe(() => window.addEventListener("keydown", t)), be(() => window.removeEventListener("keydown", t)), { handleKeyDown: t };
|
|
2452
2448
|
}
|
|
2453
2449
|
//#endregion
|
|
2454
2450
|
//#region src/composables/useOutlineSidebar.ts
|
|
2455
|
-
function
|
|
2451
|
+
function Zi(e) {
|
|
2456
2452
|
function t() {
|
|
2457
2453
|
let t = e.editorView.value;
|
|
2458
|
-
t && (e.outlineHeadings.value =
|
|
2454
|
+
t && (e.outlineHeadings.value = Sn(t.state.doc));
|
|
2459
2455
|
}
|
|
2460
2456
|
function n() {
|
|
2461
2457
|
e.showOutline.value || t(), e.showOutline.value = !e.showOutline.value;
|
|
@@ -2486,7 +2482,7 @@ function Ri(e) {
|
|
|
2486
2482
|
}
|
|
2487
2483
|
//#endregion
|
|
2488
2484
|
//#region src/composables/usePageSetupControls.ts
|
|
2489
|
-
function
|
|
2485
|
+
function Qi(e) {
|
|
2490
2486
|
function t(t) {
|
|
2491
2487
|
let n = e.getDocument();
|
|
2492
2488
|
if (!n?.package?.document) return;
|
|
@@ -2513,19 +2509,19 @@ function zi(e) {
|
|
|
2513
2509
|
}
|
|
2514
2510
|
function s(t) {
|
|
2515
2511
|
let n = e.editorView.value;
|
|
2516
|
-
n &&
|
|
2512
|
+
n && mn(t)(n.state, n.dispatch);
|
|
2517
2513
|
}
|
|
2518
2514
|
function c(t) {
|
|
2519
2515
|
let n = e.editorView.value;
|
|
2520
|
-
n &&
|
|
2516
|
+
n && hn(t)(n.state, n.dispatch);
|
|
2521
2517
|
}
|
|
2522
2518
|
function l(t) {
|
|
2523
2519
|
let n = e.editorView.value;
|
|
2524
|
-
n && (t < 0 ?
|
|
2520
|
+
n && (t < 0 ? pn(-t, !0)(n.state, n.dispatch) : pn(t, !1)(n.state, n.dispatch));
|
|
2525
2521
|
}
|
|
2526
2522
|
function u(t) {
|
|
2527
2523
|
let n = e.editorView.value;
|
|
2528
|
-
n &&
|
|
2524
|
+
n && fn(t)(n.state, n.dispatch);
|
|
2529
2525
|
}
|
|
2530
2526
|
return {
|
|
2531
2527
|
handlePageSetupApply: t,
|
|
@@ -2541,45 +2537,45 @@ function zi(e) {
|
|
|
2541
2537
|
}
|
|
2542
2538
|
//#endregion
|
|
2543
2539
|
//#region src/utils/textSelection.ts
|
|
2544
|
-
var
|
|
2545
|
-
function
|
|
2546
|
-
return !e || e.length === 0 ? !1 :
|
|
2540
|
+
var $i = /[\p{L}\p{N}\p{M}_''-]/u, ea = /\s/;
|
|
2541
|
+
function ta(e) {
|
|
2542
|
+
return !e || e.length === 0 ? !1 : $i.test(e);
|
|
2547
2543
|
}
|
|
2548
|
-
function
|
|
2549
|
-
return !e || e.length === 0 ? !1 :
|
|
2544
|
+
function na(e) {
|
|
2545
|
+
return !e || e.length === 0 ? !1 : ea.test(e);
|
|
2550
2546
|
}
|
|
2551
|
-
function
|
|
2547
|
+
function ra(e, t) {
|
|
2552
2548
|
if (!e || e.length === 0) return [0, 0];
|
|
2553
2549
|
t = Math.max(0, Math.min(t, e.length - 1));
|
|
2554
2550
|
let n = e[t];
|
|
2555
|
-
if (
|
|
2551
|
+
if (na(n)) {
|
|
2556
2552
|
let n = t, r = t;
|
|
2557
|
-
for (; n > 0 &&
|
|
2558
|
-
for (; r < e.length &&
|
|
2553
|
+
for (; n > 0 && na(e[n - 1]);) n--;
|
|
2554
|
+
for (; r < e.length && na(e[r]);) r++;
|
|
2559
2555
|
return [n, r];
|
|
2560
2556
|
}
|
|
2561
|
-
if (
|
|
2557
|
+
if (ta(n)) {
|
|
2562
2558
|
let n = t, r = t;
|
|
2563
|
-
for (; n > 0 &&
|
|
2564
|
-
for (; r < e.length &&
|
|
2559
|
+
for (; n > 0 && ta(e[n - 1]);) n--;
|
|
2560
|
+
for (; r < e.length && ta(e[r]);) r++;
|
|
2565
2561
|
return [n, r];
|
|
2566
2562
|
}
|
|
2567
2563
|
return [t, t + 1];
|
|
2568
2564
|
}
|
|
2569
2565
|
//#endregion
|
|
2570
2566
|
//#region src/utils/domQueries.ts
|
|
2571
|
-
function
|
|
2572
|
-
let r = n ? Array.from(e.querySelectorAll(`.layout-page-${n} span[data-pm-start][data-pm-end]`)) :
|
|
2567
|
+
function ia(e, t, n) {
|
|
2568
|
+
let r = n ? Array.from(e.querySelectorAll(`.layout-page-${n} span[data-pm-start][data-pm-end]`)) : _t(e);
|
|
2573
2569
|
for (let e of r) {
|
|
2574
2570
|
let n = Number(e.dataset.pmStart), r = Number(e.dataset.pmEnd);
|
|
2575
2571
|
if (!Number.isNaN(n) && !Number.isNaN(r) && t >= n && t <= r) return e;
|
|
2576
2572
|
}
|
|
2577
2573
|
return null;
|
|
2578
2574
|
}
|
|
2579
|
-
function
|
|
2575
|
+
function aa(e, t, n) {
|
|
2580
2576
|
if (!e || !t) return;
|
|
2581
|
-
let r =
|
|
2582
|
-
if (!r) for (let t of
|
|
2577
|
+
let r = gt(e, n);
|
|
2578
|
+
if (!r) for (let t of _t(e)) {
|
|
2583
2579
|
let e = Number(t.dataset.pmStart), i = Number(t.dataset.pmEnd);
|
|
2584
2580
|
if (Number.isFinite(e) && Number.isFinite(i) && n >= e && n <= i) {
|
|
2585
2581
|
r = t;
|
|
@@ -2593,21 +2589,21 @@ function Ki(e, t, n) {
|
|
|
2593
2589
|
behavior: "smooth"
|
|
2594
2590
|
});
|
|
2595
2591
|
}
|
|
2596
|
-
function
|
|
2592
|
+
function oa(e, t, n, r) {
|
|
2597
2593
|
if (!e || !t) return null;
|
|
2598
|
-
let i =
|
|
2594
|
+
let i = ut(e, n, r, 1);
|
|
2599
2595
|
return i === null || i < 0 ? null : Math.min(i, t.state.doc.content.size);
|
|
2600
2596
|
}
|
|
2601
|
-
function
|
|
2597
|
+
function sa(e, t, n, r) {
|
|
2602
2598
|
if (!e) return;
|
|
2603
|
-
let i =
|
|
2599
|
+
let i = ia(e, t, r);
|
|
2604
2600
|
if (!i) return;
|
|
2605
|
-
let a = i.textContent ?? "", o = Number(i.dataset.pmStart) || 0, [s, c] =
|
|
2601
|
+
let a = i.textContent ?? "", o = Number(i.dataset.pmStart) || 0, [s, c] = ra(a, t - o), l = o + s, u = o + c;
|
|
2606
2602
|
l < u && n(l, u);
|
|
2607
2603
|
}
|
|
2608
|
-
function
|
|
2604
|
+
function ca(e, t, n, r) {
|
|
2609
2605
|
if (!e) return;
|
|
2610
|
-
let i =
|
|
2606
|
+
let i = ia(e, t, r);
|
|
2611
2607
|
if (!i) return;
|
|
2612
2608
|
let a = i.closest(".layout-paragraph");
|
|
2613
2609
|
if (!a) return;
|
|
@@ -2616,26 +2612,26 @@ function Yi(e, t, n, r) {
|
|
|
2616
2612
|
}
|
|
2617
2613
|
//#endregion
|
|
2618
2614
|
//#region src/composables/usePagesPointer.ts
|
|
2619
|
-
var
|
|
2620
|
-
function
|
|
2621
|
-
let t =
|
|
2615
|
+
var la = 500;
|
|
2616
|
+
function ua(e) {
|
|
2617
|
+
let t = W(null), n = null;
|
|
2622
2618
|
function r() {
|
|
2623
2619
|
n !== null && (clearTimeout(n), n = null);
|
|
2624
2620
|
}
|
|
2625
|
-
let i =
|
|
2621
|
+
let i = we(null), a = 0, o = null, s = 0, c = !1, l = null, u = Tn(), d = w({
|
|
2626
2622
|
pagesContainer: e.pagesRef,
|
|
2627
2623
|
onScrollExtendSelection: (e, t) => {
|
|
2628
2624
|
if (!c || l === null) return;
|
|
2629
2625
|
let n = m(e, t);
|
|
2630
2626
|
n !== null && n !== l && g(l, n);
|
|
2631
2627
|
}
|
|
2632
|
-
}), f =
|
|
2628
|
+
}), f = W({
|
|
2633
2629
|
currentPage: 1,
|
|
2634
2630
|
totalPages: 1,
|
|
2635
2631
|
visible: !1
|
|
2636
2632
|
}), p = null;
|
|
2637
2633
|
function m(t, n) {
|
|
2638
|
-
return
|
|
2634
|
+
return oa(e.pagesRef.value, e.editorView.value, t, n);
|
|
2639
2635
|
}
|
|
2640
2636
|
function h() {
|
|
2641
2637
|
let t = i.value;
|
|
@@ -2653,13 +2649,13 @@ function Zi(e) {
|
|
|
2653
2649
|
} catch {}
|
|
2654
2650
|
}
|
|
2655
2651
|
function _(t) {
|
|
2656
|
-
|
|
2652
|
+
aa(e.pagesRef.value, e.pagesViewportRef.value, t);
|
|
2657
2653
|
}
|
|
2658
2654
|
function v(t) {
|
|
2659
|
-
|
|
2655
|
+
sa(e.pagesRef.value, t, g, i.value?.position);
|
|
2660
2656
|
}
|
|
2661
2657
|
function y(t) {
|
|
2662
|
-
|
|
2658
|
+
ca(e.pagesRef.value, t, g, i.value?.position);
|
|
2663
2659
|
}
|
|
2664
2660
|
function b(t) {
|
|
2665
2661
|
let n = e.editorView.value;
|
|
@@ -2688,7 +2684,7 @@ function Zi(e) {
|
|
|
2688
2684
|
if (!o) return;
|
|
2689
2685
|
let s = e.pagesViewportRef.value;
|
|
2690
2686
|
if (!s || !(a.target instanceof HTMLElement)) return;
|
|
2691
|
-
let l =
|
|
2687
|
+
let l = wn({
|
|
2692
2688
|
mouseX: a.clientX,
|
|
2693
2689
|
mouseY: a.clientY,
|
|
2694
2690
|
pagesContainer: o,
|
|
@@ -2698,7 +2694,7 @@ function Zi(e) {
|
|
|
2698
2694
|
if (!l) {
|
|
2699
2695
|
n === null && (n = setTimeout(() => {
|
|
2700
2696
|
t.value = null, n = null;
|
|
2701
|
-
},
|
|
2697
|
+
}, Cn));
|
|
2702
2698
|
return;
|
|
2703
2699
|
}
|
|
2704
2700
|
let u = e.zoom.value || 1, d = s.getBoundingClientRect();
|
|
@@ -2709,7 +2705,7 @@ function Zi(e) {
|
|
|
2709
2705
|
cellPmPos: l.cellPmPos
|
|
2710
2706
|
}, r();
|
|
2711
2707
|
}
|
|
2712
|
-
function
|
|
2708
|
+
function S(n) {
|
|
2713
2709
|
n.preventDefault(), n.stopPropagation();
|
|
2714
2710
|
let r = t.value, i = e.editorView.value;
|
|
2715
2711
|
if (!r || !i) return;
|
|
@@ -2718,7 +2714,7 @@ function Zi(e) {
|
|
|
2718
2714
|
let o = e.getCommands(), s = r.type === "row" ? o.addRowBelow : o.addColumnRight;
|
|
2719
2715
|
s && (s()(i.state, (e) => i.dispatch(e), i), t.value = null, i.focus());
|
|
2720
2716
|
}
|
|
2721
|
-
function
|
|
2717
|
+
function C(t) {
|
|
2722
2718
|
let n = t.target, r = n instanceof HTMLElement ? n.closest("a[href]") : null;
|
|
2723
2719
|
if (!r) return;
|
|
2724
2720
|
t.preventDefault();
|
|
@@ -2743,7 +2739,7 @@ function Zi(e) {
|
|
|
2743
2739
|
...l ? { tooltip: l } : {}
|
|
2744
2740
|
};
|
|
2745
2741
|
}
|
|
2746
|
-
function
|
|
2742
|
+
function ee(t) {
|
|
2747
2743
|
if (!(t.target instanceof HTMLElement)) return;
|
|
2748
2744
|
let n = t.target, r = n.closest(".layout-page-header"), a = n.closest(".layout-page-footer"), o = r ?? a;
|
|
2749
2745
|
if (!o) return;
|
|
@@ -2780,7 +2776,7 @@ function Zi(e) {
|
|
|
2780
2776
|
}, y = c.package.document, b = y?.sections?.map((e, t) => t === 0 ? {
|
|
2781
2777
|
...e,
|
|
2782
2778
|
properties: v
|
|
2783
|
-
} : e), x = y?.finalSectionProperties === l ? v : y?.finalSectionProperties,
|
|
2779
|
+
} : e), x = y?.finalSectionProperties === l ? v : y?.finalSectionProperties, S = {
|
|
2784
2780
|
...c,
|
|
2785
2781
|
package: {
|
|
2786
2782
|
...c.package,
|
|
@@ -2793,7 +2789,7 @@ function Zi(e) {
|
|
|
2793
2789
|
}
|
|
2794
2790
|
}
|
|
2795
2791
|
};
|
|
2796
|
-
f = n, p = r, e.setDocument?.(
|
|
2792
|
+
f = n, p = r, e.setDocument?.(S), e.syncHfPMs?.(), e.reLayout(), e.emit("change", S);
|
|
2797
2793
|
}
|
|
2798
2794
|
let m = e.pagesViewportRef.value;
|
|
2799
2795
|
if (!m) return;
|
|
@@ -2810,7 +2806,7 @@ function Zi(e) {
|
|
|
2810
2806
|
}
|
|
2811
2807
|
};
|
|
2812
2808
|
}
|
|
2813
|
-
function
|
|
2809
|
+
function te(t) {
|
|
2814
2810
|
let n = e.getDocument(), r = i.value;
|
|
2815
2811
|
if (!n?.package || !r) return;
|
|
2816
2812
|
let a = r.position === "header" ? n.package.headers : n.package.footers;
|
|
@@ -2818,7 +2814,7 @@ function Zi(e) {
|
|
|
2818
2814
|
let o = a.get(r.rId);
|
|
2819
2815
|
o && (o.content = t), e.syncHfPMs?.(), e.reLayout(), e.emit("change", n);
|
|
2820
2816
|
}
|
|
2821
|
-
function
|
|
2817
|
+
function ne() {
|
|
2822
2818
|
let t = e.getDocument(), n = i.value;
|
|
2823
2819
|
if (!t?.package || !n || !n.rId) {
|
|
2824
2820
|
i.value = null;
|
|
@@ -2850,7 +2846,7 @@ function Zi(e) {
|
|
|
2850
2846
|
};
|
|
2851
2847
|
i.value = null, e.setDocument?.(p), e.syncHfPMs?.(), e.reLayout(), e.emit("change", p);
|
|
2852
2848
|
}
|
|
2853
|
-
function
|
|
2849
|
+
function T(t) {
|
|
2854
2850
|
if (t.button !== 0 || e.imageInteracting.value) return;
|
|
2855
2851
|
let n = e.editorView.value;
|
|
2856
2852
|
if (!n) return;
|
|
@@ -2858,13 +2854,13 @@ function Zi(e) {
|
|
|
2858
2854
|
i.value && d && (d.closest(".layout-page-header") || d.closest(".layout-page-footer") || d.closest(".hf-editor") || (i.value = null, n.focus()));
|
|
2859
2855
|
let f = h() ?? n;
|
|
2860
2856
|
if (!e.readOnly.value && e.tableResize.tryStartResize(t, f)) return;
|
|
2861
|
-
let p =
|
|
2857
|
+
let p = at(r);
|
|
2862
2858
|
if (p) {
|
|
2863
2859
|
t.preventDefault(), t.stopPropagation();
|
|
2864
2860
|
let n = Number(p.dataset.pmStart);
|
|
2865
2861
|
if (!Number.isNaN(n)) {
|
|
2866
2862
|
try {
|
|
2867
|
-
f.dispatch(f.state.tr.setSelection(
|
|
2863
|
+
f.dispatch(f.state.tr.setSelection($e.create(f.state.doc, n)));
|
|
2868
2864
|
} catch {}
|
|
2869
2865
|
e.selectedImage.value = {
|
|
2870
2866
|
element: p,
|
|
@@ -2883,15 +2879,15 @@ function Zi(e) {
|
|
|
2883
2879
|
return;
|
|
2884
2880
|
}
|
|
2885
2881
|
let b = Date.now();
|
|
2886
|
-
if (b - a <
|
|
2882
|
+
if (b - a < la && o === _ ? s++ : s = 1, a = b, o = _, s === 2) v(_);
|
|
2887
2883
|
else if (s >= 3) y(_), s = 0;
|
|
2888
2884
|
else if (t.shiftKey) {
|
|
2889
2885
|
let { from: e } = f.state.selection;
|
|
2890
2886
|
g(e, _);
|
|
2891
|
-
} else g(_), l = _, c = !0, u.begin(
|
|
2887
|
+
} else g(_), l = _, c = !0, u.begin(En(f, _));
|
|
2892
2888
|
f.focus();
|
|
2893
2889
|
}
|
|
2894
|
-
function
|
|
2890
|
+
function re(e) {
|
|
2895
2891
|
if (!c || l === null) return;
|
|
2896
2892
|
let t = m(e.clientX, e.clientY);
|
|
2897
2893
|
if (t !== null) {
|
|
@@ -2904,10 +2900,10 @@ function Zi(e) {
|
|
|
2904
2900
|
}
|
|
2905
2901
|
d.updateMousePosition(e.clientX, e.clientY);
|
|
2906
2902
|
}
|
|
2907
|
-
function
|
|
2903
|
+
function ie() {
|
|
2908
2904
|
c = !1, u.end(), d.stopAutoScroll();
|
|
2909
2905
|
}
|
|
2910
|
-
function
|
|
2906
|
+
function E() {
|
|
2911
2907
|
let t = e.pagesViewportRef.value, n = e.layout.value;
|
|
2912
2908
|
if (!t || !n || n.pages.length === 0) return;
|
|
2913
2909
|
let r = t.scrollTop, i = n.pages.length, a = r + t.clientHeight / 2, o = 24, s = 1;
|
|
@@ -2932,10 +2928,10 @@ function Zi(e) {
|
|
|
2932
2928
|
};
|
|
2933
2929
|
}, 600);
|
|
2934
2930
|
}
|
|
2935
|
-
return
|
|
2936
|
-
window.addEventListener("mousemove",
|
|
2937
|
-
}),
|
|
2938
|
-
r(), window.removeEventListener("mousemove",
|
|
2931
|
+
return xe(() => {
|
|
2932
|
+
window.addEventListener("mousemove", re), window.addEventListener("mouseup", ie), e.pagesViewportRef.value?.addEventListener("scroll", E, { passive: !0 });
|
|
2933
|
+
}), be(() => {
|
|
2934
|
+
r(), window.removeEventListener("mousemove", re), window.removeEventListener("mouseup", ie), e.pagesViewportRef.value?.removeEventListener("scroll", E), p && clearTimeout(p);
|
|
2939
2935
|
}), {
|
|
2940
2936
|
tableInsertButton: t,
|
|
2941
2937
|
hfEdit: i,
|
|
@@ -2944,29 +2940,29 @@ function Zi(e) {
|
|
|
2944
2940
|
setPmSelection: g,
|
|
2945
2941
|
scrollVisiblePositionIntoView: _,
|
|
2946
2942
|
navigateToBookmark: b,
|
|
2947
|
-
handlePagesMouseDown:
|
|
2943
|
+
handlePagesMouseDown: T,
|
|
2948
2944
|
handlePagesMouseMove: x,
|
|
2949
|
-
handlePagesClick:
|
|
2950
|
-
handlePagesDoubleClick:
|
|
2951
|
-
handleTableInsertClick:
|
|
2945
|
+
handlePagesClick: C,
|
|
2946
|
+
handlePagesDoubleClick: ee,
|
|
2947
|
+
handleTableInsertClick: S,
|
|
2952
2948
|
clearTableInsertTimer: r,
|
|
2953
|
-
handleHfSave:
|
|
2954
|
-
handleHfRemove:
|
|
2949
|
+
handleHfSave: te,
|
|
2950
|
+
handleHfRemove: ne
|
|
2955
2951
|
};
|
|
2956
2952
|
}
|
|
2957
2953
|
//#endregion
|
|
2958
2954
|
//#region src/utils/hostFonts.ts
|
|
2959
|
-
function
|
|
2955
|
+
function da(e) {
|
|
2960
2956
|
return typeof e == "string" && e.trim().length > 0;
|
|
2961
2957
|
}
|
|
2962
|
-
function
|
|
2963
|
-
return typeof e != "object" || !e ? !1 :
|
|
2958
|
+
function fa(e) {
|
|
2959
|
+
return typeof e != "object" || !e ? !1 : da(Reflect.get(e, "family")) && da(Reflect.get(e, "src"));
|
|
2964
2960
|
}
|
|
2965
|
-
function
|
|
2961
|
+
function pa(e) {
|
|
2966
2962
|
if (!e) return [];
|
|
2967
2963
|
let t = [];
|
|
2968
2964
|
for (let n of e) {
|
|
2969
|
-
if (
|
|
2965
|
+
if (!fa(n)) continue;
|
|
2970
2966
|
let e = { display: "swap" };
|
|
2971
2967
|
(typeof n.weight == "number" || typeof n.weight == "string") && (e.weight = String(n.weight)), t.push({
|
|
2972
2968
|
family: n.family.trim(),
|
|
@@ -2976,10 +2972,10 @@ function ea(e) {
|
|
|
2976
2972
|
}
|
|
2977
2973
|
return t;
|
|
2978
2974
|
}
|
|
2979
|
-
function
|
|
2975
|
+
function ma() {
|
|
2980
2976
|
return typeof document > "u" || !("fonts" in document) ? null : document.fonts;
|
|
2981
2977
|
}
|
|
2982
|
-
async function
|
|
2978
|
+
async function ha(e, t, n, r) {
|
|
2983
2979
|
let i;
|
|
2984
2980
|
try {
|
|
2985
2981
|
i = new FontFace(t, n, r), e.add(i);
|
|
@@ -2988,39 +2984,39 @@ async function na(e, t, n, r) {
|
|
|
2988
2984
|
}
|
|
2989
2985
|
return await i.load().then(() => !0, () => !1) ? i : (e.delete(i), null);
|
|
2990
2986
|
}
|
|
2991
|
-
async function
|
|
2992
|
-
let t =
|
|
2987
|
+
async function ga(e) {
|
|
2988
|
+
let t = ma();
|
|
2993
2989
|
if (!t) return [];
|
|
2994
|
-
let n =
|
|
2990
|
+
let n = pa(e);
|
|
2995
2991
|
if (n.length === 0) return [];
|
|
2996
2992
|
let r = [];
|
|
2997
2993
|
return await Promise.all(n.map(async ({ family: e, source: n, descriptors: i }) => {
|
|
2998
|
-
let a = await
|
|
2994
|
+
let a = await ha(t, e, n, i);
|
|
2999
2995
|
a && r.push(a);
|
|
3000
2996
|
})), r;
|
|
3001
2997
|
}
|
|
3002
|
-
function
|
|
3003
|
-
let t =
|
|
2998
|
+
function _a(e) {
|
|
2999
|
+
let t = ma();
|
|
3004
3000
|
if (t) for (let n of e) t.delete(n);
|
|
3005
3001
|
}
|
|
3006
3002
|
//#endregion
|
|
3007
3003
|
//#region src/components/DocxEditor.vue?vue&type=script&setup=true&lang.ts
|
|
3008
|
-
var
|
|
3004
|
+
var va = { class: "docx-editor-vue__toolbar-shell" }, ya = {
|
|
3009
3005
|
key: 0,
|
|
3010
3006
|
class: "docx-editor-vue__error"
|
|
3011
|
-
},
|
|
3007
|
+
}, ba = {
|
|
3012
3008
|
key: 1,
|
|
3013
3009
|
class: "docx-editor-vue__loading"
|
|
3014
|
-
},
|
|
3010
|
+
}, xa = {
|
|
3015
3011
|
key: 2,
|
|
3016
3012
|
class: "docx-editor-vue__placeholder"
|
|
3017
|
-
},
|
|
3013
|
+
}, Sa = { class: "docx-editor-vue__editor-area" }, Ca = {
|
|
3018
3014
|
key: 0,
|
|
3019
3015
|
class: "docx-editor-vue__ruler-h"
|
|
3020
|
-
},
|
|
3016
|
+
}, wa = {
|
|
3021
3017
|
key: 1,
|
|
3022
3018
|
class: "docx-editor-vue__ruler-v"
|
|
3023
|
-
},
|
|
3019
|
+
}, Ta = {
|
|
3024
3020
|
class: "docx-editor-vue__editor-content-wrapper",
|
|
3025
3021
|
style: {
|
|
3026
3022
|
position: "relative",
|
|
@@ -3028,14 +3024,15 @@ var aa = { class: "docx-editor-vue__toolbar-shell" }, oa = {
|
|
|
3028
3024
|
flexDirection: "column",
|
|
3029
3025
|
minHeight: "100%"
|
|
3030
3026
|
}
|
|
3031
|
-
},
|
|
3027
|
+
}, Ea = {
|
|
3032
3028
|
"data-testid": "selection-overlay",
|
|
3033
3029
|
class: "docx-editor-vue__decoration-origin",
|
|
3034
3030
|
"aria-hidden": "true"
|
|
3035
|
-
},
|
|
3031
|
+
}, Da = ["aria-label"], Oa = /*#__PURE__*/ t(/* @__PURE__ */ z({
|
|
3036
3032
|
__name: "DocxEditor",
|
|
3037
3033
|
props: {
|
|
3038
3034
|
documentBuffer: { default: null },
|
|
3035
|
+
password: {},
|
|
3039
3036
|
document: { default: null },
|
|
3040
3037
|
documentKey: {},
|
|
3041
3038
|
onSave: {},
|
|
@@ -3149,38 +3146,39 @@ var aa = { class: "docx-editor-vue__toolbar-shell" }, oa = {
|
|
|
3149
3146
|
"mode-change",
|
|
3150
3147
|
"comments-change"
|
|
3151
3148
|
],
|
|
3152
|
-
setup(
|
|
3153
|
-
let o =
|
|
3154
|
-
|
|
3155
|
-
let
|
|
3156
|
-
function
|
|
3157
|
-
dn(
|
|
3149
|
+
setup(t, { expose: n, emit: a }) {
|
|
3150
|
+
let o = t, s = a;
|
|
3151
|
+
e(), i(o.components), xr(W(!1));
|
|
3152
|
+
let l = W(o.mode), u = N(() => o.readOnly || l.value === "viewing"), d = N(() => o.showReviewControls), f = N(() => ct(l.value)), p = W("all-markup");
|
|
3153
|
+
function h() {
|
|
3154
|
+
dn(lt(l.value));
|
|
3158
3155
|
}
|
|
3159
|
-
function
|
|
3156
|
+
function y(e) {
|
|
3160
3157
|
p.value = e;
|
|
3161
3158
|
}
|
|
3162
|
-
let b =
|
|
3163
|
-
|
|
3164
|
-
let te =
|
|
3165
|
-
|
|
3166
|
-
e || (
|
|
3159
|
+
let b = N(() => p.value === "all-markup" ? "" : `folio-root--${p.value}`), { t: x } = c(), C = ({ node: e }) => e;
|
|
3160
|
+
C.props = ["node"];
|
|
3161
|
+
let te = N(() => o.documentBuffer != null || o.document != null), w = W(!1);
|
|
3162
|
+
J(te, (e) => {
|
|
3163
|
+
e || (w.value = !1);
|
|
3167
3164
|
});
|
|
3168
|
-
let
|
|
3169
|
-
function
|
|
3170
|
-
o.enableWheelZoom !== !1 &&
|
|
3165
|
+
let E = W(null), D = W(null), ae = W(null), oe = W(null), se = N(() => o.showRuler ?? !1), O = W(0), k = W(!1), ce = W(!1), le = W(!1), ue = W(!1), de = W(!1), fe = W(!1), A = W(o.showOutline), M = W(!1), pe = W(null), he = we([]), z = we([]), { zoom: B, zoomPercent: _e, isMinZoom: ye, isMaxZoom: Se, setZoom: G, zoomIn: Te, zoomOut: De, handleWheel: Oe, handleKeyDown: ke, ZOOM_PRESETS: je } = ie(o.initialZoom);
|
|
3166
|
+
function Me(e) {
|
|
3167
|
+
o.enableWheelZoom !== !1 && Oe(e);
|
|
3171
3168
|
}
|
|
3172
|
-
|
|
3173
|
-
showKeyboardShortcuts:
|
|
3174
|
-
showFindReplace:
|
|
3175
|
-
showHyperlink:
|
|
3176
|
-
handleZoomKeyDown:
|
|
3169
|
+
Xi({
|
|
3170
|
+
showKeyboardShortcuts: le,
|
|
3171
|
+
showFindReplace: k,
|
|
3172
|
+
showHyperlink: ce,
|
|
3173
|
+
handleZoomKeyDown: ke
|
|
3177
3174
|
});
|
|
3178
|
-
let { editor:
|
|
3179
|
-
hiddenContainer:
|
|
3180
|
-
pagesContainer:
|
|
3181
|
-
readOnly:
|
|
3182
|
-
editorMode:
|
|
3175
|
+
let { editor: Pe, editorView: X, editorState: Le, isReady: Ge, isDirty: Ke, parseError: qe, layout: Je, blocks: Ye, measures: Xe, loadBuffer: Ze, loadDocument: Qe, save: $e, getDocument: et, getCommands: Z, focus: tt, reLayout: nt } = T({
|
|
3176
|
+
hiddenContainer: E,
|
|
3177
|
+
pagesContainer: D,
|
|
3178
|
+
readOnly: u,
|
|
3179
|
+
editorMode: l,
|
|
3183
3180
|
author: () => o.author,
|
|
3181
|
+
password: () => o.password,
|
|
3184
3182
|
documentKey: () => o.documentKey,
|
|
3185
3183
|
externalPlugins: [],
|
|
3186
3184
|
onAnonymizationMatchesChange: (e) => o.onAnonymizationMatchesChange?.(e),
|
|
@@ -3194,7 +3192,7 @@ var aa = { class: "docx-editor-vue__toolbar-shell" }, oa = {
|
|
|
3194
3192
|
o.onError?.(e), s("error", e);
|
|
3195
3193
|
},
|
|
3196
3194
|
onSelectionUpdate: (e) => {
|
|
3197
|
-
if (o.onSelectionChange?.(
|
|
3195
|
+
if (o.onSelectionChange?.(Ae(e)), o.onSelectionTextChange) {
|
|
3198
3196
|
let { from: t, to: n } = e.selection, r = t === n ? "" : e.doc.textBetween(t, n, " ", " ");
|
|
3199
3197
|
o.onSelectionTextChange({
|
|
3200
3198
|
from: t,
|
|
@@ -3207,127 +3205,127 @@ var aa = { class: "docx-editor-vue__toolbar-shell" }, oa = {
|
|
|
3207
3205
|
onReadOnlyEditAttempt: () => o.onReadonlyEditAttempt?.(),
|
|
3208
3206
|
featureFlags: () => o.featureFlags,
|
|
3209
3207
|
onSelectiveSaveTripwire: o.onSelectiveSaveTripwire ? (e) => o.onSelectiveSaveTripwire?.(e) : void 0
|
|
3210
|
-
}),
|
|
3211
|
-
function
|
|
3212
|
-
|
|
3208
|
+
}), rt = N(() => !Ge.value && te.value && !(o.preserveDocumentWhileLoading === !0 && w.value));
|
|
3209
|
+
function it() {
|
|
3210
|
+
X.value && (He(), Ve(), nt());
|
|
3213
3211
|
}
|
|
3214
|
-
|
|
3212
|
+
J(() => o.fonts, (e, t, n) => {
|
|
3215
3213
|
if (!e || e.length === 0) return;
|
|
3216
3214
|
let r = !1, i = [];
|
|
3217
|
-
|
|
3215
|
+
ga(e).then((e) => {
|
|
3218
3216
|
if (r) {
|
|
3219
|
-
|
|
3217
|
+
_a(e);
|
|
3220
3218
|
return;
|
|
3221
3219
|
}
|
|
3222
|
-
i = e, e.length !== 0 &&
|
|
3220
|
+
i = e, e.length !== 0 && it();
|
|
3223
3221
|
}), n(() => {
|
|
3224
|
-
r = !0, i.length !== 0 && (
|
|
3222
|
+
r = !0, i.length !== 0 && (_a(i), it());
|
|
3225
3223
|
});
|
|
3226
3224
|
}, { immediate: !0 });
|
|
3227
|
-
let { selectedImage:
|
|
3228
|
-
editorView:
|
|
3229
|
-
zoom:
|
|
3230
|
-
stateTick:
|
|
3231
|
-
getCommands:
|
|
3232
|
-
}), { hyperlinkPopupData: ft, handleHyperlinkSubmit: pt, handleHyperlinkRemove: mt, handleHyperlinkPopupNavigate: ht, handleHyperlinkPopupEdit: gt, handleHyperlinkPopupRemove: _t } =
|
|
3233
|
-
editorView:
|
|
3234
|
-
getCommands:
|
|
3235
|
-
}), vt =
|
|
3236
|
-
editorView:
|
|
3237
|
-
pagesRef:
|
|
3238
|
-
pagesViewportRef:
|
|
3239
|
-
selectedImage:
|
|
3240
|
-
imageInteracting:
|
|
3225
|
+
let { selectedImage: at, imageInteracting: ot, imageToolbarContext: st, handleToolbarImageWrap: ut, handleImageTransform: dt } = Yi({
|
|
3226
|
+
editorView: X,
|
|
3227
|
+
zoom: B,
|
|
3228
|
+
stateTick: O,
|
|
3229
|
+
getCommands: Z
|
|
3230
|
+
}), { hyperlinkPopupData: ft, handleHyperlinkSubmit: pt, handleHyperlinkRemove: mt, handleHyperlinkPopupNavigate: ht, handleHyperlinkPopupEdit: gt, handleHyperlinkPopupRemove: _t } = Ji({
|
|
3231
|
+
editorView: X,
|
|
3232
|
+
getCommands: Z
|
|
3233
|
+
}), vt = ne(), { tableInsertButton: yt, scrollPageInfo: bt, resolvePos: xt, setPmSelection: St, scrollVisiblePositionIntoView: Ct, handlePagesMouseDown: wt, handlePagesMouseMove: Tt, handlePagesClick: Et, handleTableInsertClick: Dt } = ua({
|
|
3234
|
+
editorView: X,
|
|
3235
|
+
pagesRef: D,
|
|
3236
|
+
pagesViewportRef: ae,
|
|
3237
|
+
selectedImage: at,
|
|
3238
|
+
imageInteracting: ot,
|
|
3241
3239
|
hyperlinkPopupData: ft,
|
|
3242
|
-
readOnly:
|
|
3243
|
-
zoom:
|
|
3244
|
-
layout:
|
|
3240
|
+
readOnly: u,
|
|
3241
|
+
zoom: B,
|
|
3242
|
+
layout: Je,
|
|
3245
3243
|
tableResize: {
|
|
3246
3244
|
tryStartResize: vt.tryStartResize,
|
|
3247
|
-
isResizing:
|
|
3245
|
+
isResizing: N(() => vt.isResizing())
|
|
3248
3246
|
},
|
|
3249
|
-
getCommands:
|
|
3250
|
-
getDocument:
|
|
3251
|
-
reLayout:
|
|
3247
|
+
getCommands: Z,
|
|
3248
|
+
getDocument: et,
|
|
3249
|
+
reLayout: nt,
|
|
3252
3250
|
emit: () => {},
|
|
3253
3251
|
clearOverlay: () => {}
|
|
3254
|
-
}), Ot =
|
|
3255
|
-
editorView:
|
|
3256
|
-
showOutline:
|
|
3257
|
-
showSidebar:
|
|
3258
|
-
outlineHeadings:
|
|
3259
|
-
activeSidebarItem:
|
|
3252
|
+
}), Ot = Zi({
|
|
3253
|
+
editorView: X,
|
|
3254
|
+
showOutline: A,
|
|
3255
|
+
showSidebar: M,
|
|
3256
|
+
outlineHeadings: z,
|
|
3257
|
+
activeSidebarItem: pe,
|
|
3260
3258
|
extractCommentsAndChanges: () => {},
|
|
3261
3259
|
scrollToVisiblePosition: Ct
|
|
3262
|
-
}), { contextMenu: kt, imageContextMenu: At, imageContextMenuTextActions: jt, customTextMenuItems: Mt, handleContextMenu: Nt, handleSelectedImageContextMenu: Pt, handleImageWrapSelect: Ft, handleContextMenuAction: It } =
|
|
3263
|
-
editorView:
|
|
3264
|
-
selectedImage:
|
|
3265
|
-
zoom:
|
|
3266
|
-
showImageProperties:
|
|
3267
|
-
getCommands:
|
|
3260
|
+
}), { contextMenu: kt, imageContextMenu: At, imageContextMenuTextActions: jt, customTextMenuItems: Mt, handleContextMenu: Nt, handleSelectedImageContextMenu: Pt, handleImageWrapSelect: Ft, handleContextMenuAction: It } = Wi({
|
|
3261
|
+
editorView: X,
|
|
3262
|
+
selectedImage: at,
|
|
3263
|
+
zoom: B,
|
|
3264
|
+
showImageProperties: de,
|
|
3265
|
+
getCommands: Z,
|
|
3268
3266
|
clearOverlay: () => {},
|
|
3269
3267
|
setPmSelection: St,
|
|
3270
3268
|
resolvePos: xt,
|
|
3271
|
-
customContextMenuItems: () =>
|
|
3269
|
+
customContextMenuItems: () => u.value ? void 0 : o.customContextMenuItems,
|
|
3272
3270
|
onCustomContextAction: (e, t) => o.onCustomContextAction?.(e, t)
|
|
3273
|
-
}), Lt =
|
|
3274
|
-
editorView:
|
|
3275
|
-
getDocument:
|
|
3271
|
+
}), Lt = re(X, O), Rt = N(() => Lt.value.entries), Q = Mi({
|
|
3272
|
+
editorView: X,
|
|
3273
|
+
getDocument: et,
|
|
3276
3274
|
author: () => o.author,
|
|
3277
3275
|
commentsProp: () => o.comments,
|
|
3278
3276
|
onCommentsChange: (e) => {
|
|
3279
3277
|
o.onCommentsChange?.(e), s("comments-change", e);
|
|
3280
3278
|
},
|
|
3281
|
-
reLayout:
|
|
3282
|
-
}), zt = Q.comments, $ =
|
|
3283
|
-
editorView:
|
|
3284
|
-
pagesViewport:
|
|
3285
|
-
pagesContainer:
|
|
3286
|
-
readOnly:
|
|
3279
|
+
reLayout: nt
|
|
3280
|
+
}), zt = Q.comments, $ = ji({
|
|
3281
|
+
editorView: X,
|
|
3282
|
+
pagesViewport: ae,
|
|
3283
|
+
pagesContainer: D,
|
|
3284
|
+
readOnly: u,
|
|
3287
3285
|
createComment: Q.createComment,
|
|
3288
3286
|
pushComment: Q.pushComment,
|
|
3289
|
-
reLayout:
|
|
3290
|
-
showSidebar:
|
|
3287
|
+
reLayout: nt,
|
|
3288
|
+
showSidebar: M,
|
|
3291
3289
|
setActiveSidebarItem: (e) => {
|
|
3292
|
-
|
|
3290
|
+
pe.value = e;
|
|
3293
3291
|
}
|
|
3294
3292
|
});
|
|
3295
3293
|
function Bt(e) {
|
|
3296
3294
|
navigator.clipboard?.writeText(e), ft.value = null;
|
|
3297
3295
|
}
|
|
3298
|
-
let Vt =
|
|
3299
|
-
|
|
3300
|
-
let e =
|
|
3296
|
+
let Vt = N(() => {
|
|
3297
|
+
O.value;
|
|
3298
|
+
let e = et()?.package.document;
|
|
3301
3299
|
return e ? e.finalSectionProperties ?? e.sections?.[0]?.properties ?? null : null;
|
|
3302
|
-
}), Ht =
|
|
3303
|
-
|
|
3300
|
+
}), Ht = N(() => {
|
|
3301
|
+
O.value;
|
|
3304
3302
|
let e = {};
|
|
3305
3303
|
o.fontFamilies !== void 0 && (e.fontFamilies = o.fontFamilies);
|
|
3306
|
-
let t =
|
|
3304
|
+
let t = et()?.package.styles?.styles;
|
|
3307
3305
|
return t !== void 0 && (e.documentStyles = t), e;
|
|
3308
|
-
}), Ut =
|
|
3306
|
+
}), Ut = N(() => We(Vt.value?.pageWidth ?? 12240) * B.value), Wt = N(() => {
|
|
3309
3307
|
let e = /* @__PURE__ */ new Set();
|
|
3310
3308
|
for (let t of zt.value) t.done && e.add(t.id);
|
|
3311
3309
|
return e;
|
|
3312
|
-
}), Gt =
|
|
3313
|
-
transform:
|
|
3310
|
+
}), Gt = N(() => ({
|
|
3311
|
+
transform: B.value === 1 ? void 0 : `scale(${B.value})`,
|
|
3314
3312
|
transformOrigin: "top center",
|
|
3315
3313
|
transition: "transform 0.2s ease"
|
|
3316
|
-
})), { handleApplyStyle: Kt, handleInsertSymbol: qt, handleInsertSectionBreakNextPage: Jt, handleInsertSectionBreakContinuous: Yt } =
|
|
3317
|
-
editorView:
|
|
3318
|
-
getDocument:
|
|
3314
|
+
})), { handleApplyStyle: Kt, handleInsertSymbol: qt, handleInsertSectionBreakNextPage: Jt, handleInsertSectionBreakContinuous: Yt } = qi({
|
|
3315
|
+
editorView: X,
|
|
3316
|
+
getDocument: et
|
|
3319
3317
|
});
|
|
3320
3318
|
function Xt() {
|
|
3321
3319
|
if (o.onInsertImage) {
|
|
3322
3320
|
o.onInsertImage();
|
|
3323
3321
|
return;
|
|
3324
3322
|
}
|
|
3325
|
-
let e =
|
|
3323
|
+
let e = X.value;
|
|
3326
3324
|
if (!e) return;
|
|
3327
3325
|
let t = document.createElement("input");
|
|
3328
3326
|
t.type = "file", t.accept = "image/*", t.style.display = "none", t.addEventListener("change", () => {
|
|
3329
3327
|
let n = t.files?.[0];
|
|
3330
|
-
n &&
|
|
3328
|
+
n && Ne(e, n, () => e.focus()), t.remove();
|
|
3331
3329
|
}), document.body.appendChild(t), t.click();
|
|
3332
3330
|
}
|
|
3333
3331
|
function Zt(e, t) {
|
|
@@ -3335,37 +3333,37 @@ var aa = { class: "docx-editor-vue__toolbar-shell" }, oa = {
|
|
|
3335
3333
|
o.onInsertTable(e, t);
|
|
3336
3334
|
return;
|
|
3337
3335
|
}
|
|
3338
|
-
let n =
|
|
3339
|
-
n && (
|
|
3336
|
+
let n = X.value;
|
|
3337
|
+
n && (Ie(n, e, t), n.focus());
|
|
3340
3338
|
}
|
|
3341
3339
|
function Qt() {
|
|
3342
3340
|
if (o.onInsertPageBreak) {
|
|
3343
3341
|
o.onInsertPageBreak();
|
|
3344
3342
|
return;
|
|
3345
3343
|
}
|
|
3346
|
-
let e =
|
|
3347
|
-
e && (
|
|
3344
|
+
let e = X.value;
|
|
3345
|
+
e && (Fe(e), e.focus());
|
|
3348
3346
|
}
|
|
3349
3347
|
function $t() {
|
|
3350
3348
|
if (o.onInsertTOC) {
|
|
3351
3349
|
o.onInsertTOC();
|
|
3352
3350
|
return;
|
|
3353
3351
|
}
|
|
3354
|
-
let e =
|
|
3355
|
-
e && (
|
|
3352
|
+
let e = X.value;
|
|
3353
|
+
e && (Re(e), e.focus());
|
|
3356
3354
|
}
|
|
3357
|
-
let { handlePageSetupApply: en, handleLeftMarginChange: tn, handleRightMarginChange: nn, handleTopMarginChange: rn, handleBottomMarginChange: an, handleIndentLeftChange: on, handleIndentRightChange: sn, handleFirstLineIndentChange: cn, handleTabStopRemove: ln } =
|
|
3358
|
-
editorView:
|
|
3359
|
-
getDocument:
|
|
3360
|
-
readOnly:
|
|
3361
|
-
stateTick:
|
|
3362
|
-
reLayout:
|
|
3355
|
+
let { handlePageSetupApply: en, handleLeftMarginChange: tn, handleRightMarginChange: nn, handleTopMarginChange: rn, handleBottomMarginChange: an, handleIndentLeftChange: on, handleIndentRightChange: sn, handleFirstLineIndentChange: cn, handleTabStopRemove: ln } = Qi({
|
|
3356
|
+
editorView: X,
|
|
3357
|
+
getDocument: et,
|
|
3358
|
+
readOnly: u,
|
|
3359
|
+
stateTick: O,
|
|
3360
|
+
reLayout: nt,
|
|
3363
3361
|
onChange: (e) => {
|
|
3364
3362
|
o.onChange?.(e), s("change", e), s("update:document", e);
|
|
3365
3363
|
}
|
|
3366
|
-
}), un =
|
|
3367
|
-
|
|
3368
|
-
let e =
|
|
3364
|
+
}), un = N(() => {
|
|
3365
|
+
O.value;
|
|
3366
|
+
let e = X.value, t = e ? ze(e.state).paragraphFormatting : {};
|
|
3369
3367
|
return {
|
|
3370
3368
|
indentLeft: t.indentLeft ?? 0,
|
|
3371
3369
|
indentRight: t.indentRight ?? 0,
|
|
@@ -3375,28 +3373,28 @@ var aa = { class: "docx-editor-vue__toolbar-shell" }, oa = {
|
|
|
3375
3373
|
};
|
|
3376
3374
|
});
|
|
3377
3375
|
function dn(e) {
|
|
3378
|
-
|
|
3376
|
+
l.value !== e && (l.value = e, o.onModeChange?.(e), s("mode-change", e));
|
|
3379
3377
|
}
|
|
3380
3378
|
function fn(e) {
|
|
3381
3379
|
switch (e) {
|
|
3382
3380
|
case "find":
|
|
3383
3381
|
case "findReplace":
|
|
3384
|
-
|
|
3382
|
+
k.value = !0;
|
|
3385
3383
|
break;
|
|
3386
3384
|
case "insertSymbol":
|
|
3387
|
-
|
|
3385
|
+
ue.value = !0;
|
|
3388
3386
|
break;
|
|
3389
3387
|
case "insertHyperlink":
|
|
3390
|
-
|
|
3388
|
+
ce.value = !0;
|
|
3391
3389
|
break;
|
|
3392
3390
|
case "pageSetup":
|
|
3393
|
-
|
|
3391
|
+
fe.value = !0;
|
|
3394
3392
|
break;
|
|
3395
3393
|
case "toggleOutline":
|
|
3396
3394
|
Ot.handleToggleOutline();
|
|
3397
3395
|
break;
|
|
3398
3396
|
case "toggleSidebar":
|
|
3399
|
-
|
|
3397
|
+
M.value = !M.value;
|
|
3400
3398
|
break;
|
|
3401
3399
|
case "insertImage":
|
|
3402
3400
|
Xt();
|
|
@@ -3420,19 +3418,19 @@ var aa = { class: "docx-editor-vue__toolbar-shell" }, oa = {
|
|
|
3420
3418
|
function pn(e, t) {
|
|
3421
3419
|
Zt(e, t);
|
|
3422
3420
|
}
|
|
3423
|
-
let mn =
|
|
3424
|
-
|
|
3421
|
+
let mn = W(!1);
|
|
3422
|
+
Gi({
|
|
3425
3423
|
documentBuffer: () => o.documentBuffer ?? null,
|
|
3426
3424
|
document: () => o.document ?? null,
|
|
3427
|
-
loadDocumentBuffer:
|
|
3428
|
-
loadDocument:
|
|
3425
|
+
loadDocumentBuffer: Ze,
|
|
3426
|
+
loadDocument: Qe,
|
|
3429
3427
|
sidebarAutoOpenedRef: mn
|
|
3430
|
-
}),
|
|
3431
|
-
e && e !==
|
|
3432
|
-
}),
|
|
3433
|
-
|
|
3428
|
+
}), J(() => o.mode, (e) => {
|
|
3429
|
+
e && e !== l.value && (l.value = e);
|
|
3430
|
+
}), J(() => o.showOutline, (e) => {
|
|
3431
|
+
A.value = !!e, Ot.recomputeHeadingsIfOpen();
|
|
3434
3432
|
});
|
|
3435
|
-
let hn =
|
|
3433
|
+
let hn = W(!1);
|
|
3436
3434
|
function gn(e) {
|
|
3437
3435
|
let t = e.currentTarget;
|
|
3438
3436
|
t instanceof HTMLElement && o.onScrollTopChange?.(t.scrollTop);
|
|
@@ -3442,114 +3440,114 @@ var aa = { class: "docx-editor-vue__toolbar-shell" }, oa = {
|
|
|
3442
3440
|
hn.value = !0;
|
|
3443
3441
|
let e = o.initialScrollTop;
|
|
3444
3442
|
requestAnimationFrame(() => {
|
|
3445
|
-
|
|
3443
|
+
oe.value && (oe.value.scrollTop = e);
|
|
3446
3444
|
});
|
|
3447
3445
|
}
|
|
3448
|
-
|
|
3446
|
+
J(Ge, (e) => {
|
|
3449
3447
|
if (!e) {
|
|
3450
3448
|
hn.value = !1;
|
|
3451
3449
|
return;
|
|
3452
3450
|
}
|
|
3453
|
-
|
|
3454
|
-
let t =
|
|
3455
|
-
t && o.onCompatibilityChange?.(
|
|
3456
|
-
}),
|
|
3457
|
-
let e =
|
|
3458
|
-
|
|
3459
|
-
}), t =
|
|
3460
|
-
|
|
3461
|
-
}), n =
|
|
3462
|
-
|
|
3463
|
-
}), r = vt.install(), i =
|
|
3464
|
-
|
|
3451
|
+
w.value = !0, Ot.recomputeHeadingsIfOpen(), Q.seedFromDocument();
|
|
3452
|
+
let t = et();
|
|
3453
|
+
t && o.onCompatibilityChange?.(Be(t)), o.autoOpenReviewSidebar !== !1 && !mn.value && (zt.value.length > 0 || Rt.value.length > 0) && (mn.value = !0, M.value = !0), _n(), s("ready");
|
|
3454
|
+
}), xe(() => {
|
|
3455
|
+
let e = Pe.on("selectionChange", () => {
|
|
3456
|
+
O.value++, $.updateFloatingButton();
|
|
3457
|
+
}), t = Pe.on("docChange", () => {
|
|
3458
|
+
O.value++, Ot.recomputeHeadingsIfOpen();
|
|
3459
|
+
}), n = Pe.on("layoutComplete", () => {
|
|
3460
|
+
O.value++;
|
|
3461
|
+
}), r = vt.install(), i = Ue(() => o.onFontsLoaded?.());
|
|
3462
|
+
be(() => {
|
|
3465
3463
|
e(), t(), n(), r(), i();
|
|
3466
3464
|
});
|
|
3467
3465
|
});
|
|
3468
|
-
let { exposed: vn } =
|
|
3469
|
-
editor:
|
|
3470
|
-
editorView:
|
|
3471
|
-
isDirty:
|
|
3466
|
+
let { exposed: vn } = Ki({
|
|
3467
|
+
editor: Pe,
|
|
3468
|
+
editorView: X,
|
|
3469
|
+
isDirty: Ke,
|
|
3472
3470
|
commentsDirty: Q.commentsDirty,
|
|
3473
3471
|
clearCommentsDirty: Q.clearCommentsDirty,
|
|
3474
|
-
layout:
|
|
3475
|
-
pagesRef:
|
|
3476
|
-
pagesViewportRef:
|
|
3477
|
-
zoom:
|
|
3472
|
+
layout: Je,
|
|
3473
|
+
pagesRef: D,
|
|
3474
|
+
pagesViewportRef: ae,
|
|
3475
|
+
zoom: B,
|
|
3478
3476
|
scrollVisiblePositionIntoView: Ct,
|
|
3479
3477
|
author: () => o.author,
|
|
3480
3478
|
createAIEditComment: (e) => {
|
|
3481
3479
|
let t = Q.createComment(e);
|
|
3482
3480
|
return Q.pushComment(t), t.id;
|
|
3483
3481
|
},
|
|
3484
|
-
focus:
|
|
3485
|
-
getDocument:
|
|
3486
|
-
setZoom:
|
|
3487
|
-
save:
|
|
3488
|
-
loadDocument:
|
|
3489
|
-
loadDocumentBuffer:
|
|
3482
|
+
focus: tt,
|
|
3483
|
+
getDocument: et,
|
|
3484
|
+
setZoom: G,
|
|
3485
|
+
save: $e,
|
|
3486
|
+
loadDocument: Qe,
|
|
3487
|
+
loadDocumentBuffer: Ze,
|
|
3490
3488
|
onPrint: o.onPrint,
|
|
3491
3489
|
onSave: o.onSave
|
|
3492
3490
|
});
|
|
3493
|
-
return
|
|
3494
|
-
class:
|
|
3491
|
+
return n(vn), (e, n) => (U(), I("div", {
|
|
3492
|
+
class: V([
|
|
3495
3493
|
"docx-editor-vue ep-root paged-editor",
|
|
3496
|
-
|
|
3494
|
+
t.className,
|
|
3497
3495
|
b.value,
|
|
3498
|
-
{ "paged-editor--readonly":
|
|
3496
|
+
{ "paged-editor--readonly": u.value }
|
|
3499
3497
|
]),
|
|
3500
|
-
style:
|
|
3498
|
+
style: H(t.style)
|
|
3501
3499
|
}, [
|
|
3502
|
-
|
|
3500
|
+
L("div", va, [R(yr, {
|
|
3503
3501
|
"show-table-insert": o.showTableInsert !== !1,
|
|
3504
|
-
onRename:
|
|
3502
|
+
onRename: n[0] ||= (e) => s("rename", e),
|
|
3505
3503
|
onMenuAction: fn,
|
|
3506
3504
|
onInsertTable: pn
|
|
3507
3505
|
}, {
|
|
3508
|
-
"title-bar-left":
|
|
3509
|
-
"title-bar-right":
|
|
3506
|
+
"title-bar-left": Ee(() => [Ce(e.$slots, "title-bar-left", {}, void 0, !0)]),
|
|
3507
|
+
"title-bar-right": Ee(() => [Ce(e.$slots, "title-bar-right", {}, void 0, !0)]),
|
|
3510
3508
|
_: 3
|
|
3511
|
-
}, 8, ["show-table-insert"]),
|
|
3509
|
+
}, 8, ["show-table-insert"]), t.showToolbar ? (U(), P(ee, ve({
|
|
3512
3510
|
key: 0,
|
|
3513
|
-
view:
|
|
3514
|
-
"get-commands":
|
|
3515
|
-
"state-tick":
|
|
3516
|
-
"zoom-percent":
|
|
3517
|
-
"is-min-zoom":
|
|
3518
|
-
"is-max-zoom":
|
|
3519
|
-
"zoom-presets":
|
|
3520
|
-
"show-zoom-control":
|
|
3521
|
-
"editor-mode":
|
|
3522
|
-
"show-review-controls":
|
|
3523
|
-
"track-changes-on":
|
|
3511
|
+
view: q(X),
|
|
3512
|
+
"get-commands": q(Z),
|
|
3513
|
+
"state-tick": O.value,
|
|
3514
|
+
"zoom-percent": q(_e),
|
|
3515
|
+
"is-min-zoom": q(ye),
|
|
3516
|
+
"is-max-zoom": q(Se),
|
|
3517
|
+
"zoom-presets": q(je),
|
|
3518
|
+
"show-zoom-control": t.showZoomControl,
|
|
3519
|
+
"editor-mode": l.value,
|
|
3520
|
+
"show-review-controls": d.value,
|
|
3521
|
+
"track-changes-on": f.value,
|
|
3524
3522
|
"display-mode": p.value,
|
|
3525
|
-
"read-only":
|
|
3526
|
-
"comments-sidebar-open":
|
|
3527
|
-
"image-context":
|
|
3528
|
-
theme:
|
|
3523
|
+
"read-only": u.value,
|
|
3524
|
+
"comments-sidebar-open": M.value,
|
|
3525
|
+
"image-context": q(st),
|
|
3526
|
+
theme: t.theme ?? null
|
|
3529
3527
|
}, Ht.value, {
|
|
3530
|
-
onFindReplace:
|
|
3531
|
-
onInsertLink:
|
|
3532
|
-
onInsertSymbol:
|
|
3528
|
+
onFindReplace: n[1] ||= (e) => k.value = !0,
|
|
3529
|
+
onInsertLink: n[2] ||= (e) => ce.value = !0,
|
|
3530
|
+
onInsertSymbol: n[3] ||= (e) => ue.value = !0,
|
|
3533
3531
|
onInsertPageBreak: Qt,
|
|
3534
|
-
onPageSetup:
|
|
3535
|
-
onToggleOutline:
|
|
3536
|
-
onApplyStyle:
|
|
3537
|
-
onZoomIn:
|
|
3538
|
-
onZoomOut:
|
|
3539
|
-
onZoomSet:
|
|
3540
|
-
onToggleSidebar:
|
|
3532
|
+
onPageSetup: n[4] ||= (e) => fe.value = !0,
|
|
3533
|
+
onToggleOutline: q(Ot).handleToggleOutline,
|
|
3534
|
+
onApplyStyle: q(Kt),
|
|
3535
|
+
onZoomIn: q(Te),
|
|
3536
|
+
onZoomOut: q(De),
|
|
3537
|
+
onZoomSet: q(G),
|
|
3538
|
+
onToggleSidebar: n[5] ||= (e) => M.value = !M.value,
|
|
3541
3539
|
onModeChange: dn,
|
|
3542
|
-
onToggleTrackChanges:
|
|
3543
|
-
"onUpdate:displayMode":
|
|
3544
|
-
onImageProperties:
|
|
3545
|
-
onImageWrapType:
|
|
3546
|
-
onImageTransform:
|
|
3547
|
-
}),
|
|
3548
|
-
"table-context":
|
|
3549
|
-
view:
|
|
3550
|
-
"get-commands":
|
|
3551
|
-
"state-tick":
|
|
3552
|
-
theme:
|
|
3540
|
+
onToggleTrackChanges: h,
|
|
3541
|
+
"onUpdate:displayMode": y,
|
|
3542
|
+
onImageProperties: n[6] ||= (e) => de.value = !0,
|
|
3543
|
+
onImageWrapType: q(ut),
|
|
3544
|
+
onImageTransform: q(dt)
|
|
3545
|
+
}), me({
|
|
3546
|
+
"table-context": Ee(() => [R(_, {
|
|
3547
|
+
view: q(X),
|
|
3548
|
+
"get-commands": q(Z),
|
|
3549
|
+
"state-tick": O.value,
|
|
3550
|
+
theme: t.theme ?? null
|
|
3553
3551
|
}, null, 8, [
|
|
3554
3552
|
"view",
|
|
3555
3553
|
"get-commands",
|
|
@@ -3557,12 +3555,12 @@ var aa = { class: "docx-editor-vue__toolbar-shell" }, oa = {
|
|
|
3557
3555
|
"theme"
|
|
3558
3556
|
])]),
|
|
3559
3557
|
_: 2
|
|
3560
|
-
}, [
|
|
3558
|
+
}, [e.$slots["toolbar-extra"] || t.toolbarExtra ? {
|
|
3561
3559
|
name: "toolbar-extra",
|
|
3562
|
-
fn:
|
|
3560
|
+
fn: Ee(() => [Ce(e.$slots, "toolbar-extra", {}, () => [t.toolbarExtra ? (U(), P(C, {
|
|
3563
3561
|
key: 0,
|
|
3564
|
-
node:
|
|
3565
|
-
}, null, 8, ["node"])) :
|
|
3562
|
+
node: t.toolbarExtra
|
|
3563
|
+
}, null, 8, ["node"])) : F("", !0)], !0)]),
|
|
3566
3564
|
key: "0"
|
|
3567
3565
|
} : void 0]), 1040, [
|
|
3568
3566
|
"view",
|
|
@@ -3588,26 +3586,26 @@ var aa = { class: "docx-editor-vue__toolbar-shell" }, oa = {
|
|
|
3588
3586
|
"onZoomSet",
|
|
3589
3587
|
"onImageWrapType",
|
|
3590
3588
|
"onImageTransform"
|
|
3591
|
-
])) :
|
|
3592
|
-
|
|
3593
|
-
"show-find-replace":
|
|
3594
|
-
"onUpdate:showFindReplace":
|
|
3595
|
-
"show-hyperlink":
|
|
3596
|
-
"onUpdate:showHyperlink":
|
|
3597
|
-
"show-insert-symbol":
|
|
3598
|
-
"onUpdate:showInsertSymbol":
|
|
3599
|
-
"show-image-properties":
|
|
3600
|
-
"onUpdate:showImageProperties":
|
|
3601
|
-
"show-page-setup":
|
|
3602
|
-
"onUpdate:showPageSetup":
|
|
3603
|
-
view:
|
|
3604
|
-
bookmarks:
|
|
3605
|
-
"selected-image-pm-pos":
|
|
3589
|
+
])) : F("", !0)]),
|
|
3590
|
+
R(mr, {
|
|
3591
|
+
"show-find-replace": k.value,
|
|
3592
|
+
"onUpdate:showFindReplace": n[7] ||= (e) => k.value = e,
|
|
3593
|
+
"show-hyperlink": ce.value,
|
|
3594
|
+
"onUpdate:showHyperlink": n[8] ||= (e) => ce.value = e,
|
|
3595
|
+
"show-insert-symbol": ue.value,
|
|
3596
|
+
"onUpdate:showInsertSymbol": n[9] ||= (e) => ue.value = e,
|
|
3597
|
+
"show-image-properties": de.value,
|
|
3598
|
+
"onUpdate:showImageProperties": n[10] ||= (e) => de.value = e,
|
|
3599
|
+
"show-page-setup": fe.value,
|
|
3600
|
+
"onUpdate:showPageSetup": n[11] ||= (e) => fe.value = e,
|
|
3601
|
+
view: q(X),
|
|
3602
|
+
bookmarks: he.value,
|
|
3603
|
+
"selected-image-pm-pos": q(at)?.pmPos ?? null,
|
|
3606
3604
|
"section-properties": Vt.value,
|
|
3607
|
-
onInsertSymbol:
|
|
3608
|
-
onHyperlinkSubmit:
|
|
3609
|
-
onHyperlinkRemove:
|
|
3610
|
-
onPageSetupApply:
|
|
3605
|
+
onInsertSymbol: q(qt),
|
|
3606
|
+
onHyperlinkSubmit: q(pt),
|
|
3607
|
+
onHyperlinkRemove: q(mt),
|
|
3608
|
+
onPageSetupApply: q(en)
|
|
3611
3609
|
}, null, 8, [
|
|
3612
3610
|
"show-find-replace",
|
|
3613
3611
|
"show-hyperlink",
|
|
@@ -3623,41 +3621,41 @@ var aa = { class: "docx-editor-vue__toolbar-shell" }, oa = {
|
|
|
3623
3621
|
"onHyperlinkRemove",
|
|
3624
3622
|
"onPageSetupApply"
|
|
3625
3623
|
]),
|
|
3626
|
-
|
|
3624
|
+
q(qe) ? (U(), I("div", ya, K(q(qe)), 1)) : rt.value ? (U(), I("div", ba, [Ce(e.$slots, "loading-indicator", {}, () => [t.loadingIndicator ? (U(), P(C, {
|
|
3627
3625
|
key: 0,
|
|
3628
|
-
node:
|
|
3629
|
-
}, null, 8, ["node"])) : (
|
|
3626
|
+
node: t.loadingIndicator
|
|
3627
|
+
}, null, 8, ["node"])) : (U(), I(j, { key: 1 }, [ge(K(q(x)("loadingDocument")), 1)], 64))], !0)])) : !q(Ge) && !te.value ? (U(), I("div", xa, [Ce(e.$slots, "placeholder", {}, () => [t.placeholder ? (U(), P(C, {
|
|
3630
3628
|
key: 0,
|
|
3631
|
-
node:
|
|
3632
|
-
}, null, 8, ["node"])) : (
|
|
3633
|
-
|
|
3629
|
+
node: t.placeholder
|
|
3630
|
+
}, null, 8, ["node"])) : (U(), I(j, { key: 1 }, [ge("No document loaded")], 64))], !0)])) : F("", !0),
|
|
3631
|
+
L("div", {
|
|
3634
3632
|
ref_key: "hiddenPmRef",
|
|
3635
|
-
ref:
|
|
3633
|
+
ref: E,
|
|
3636
3634
|
class: "docx-editor-vue__hidden-pm paged-editor__hidden-pm"
|
|
3637
3635
|
}, null, 512),
|
|
3638
|
-
|
|
3636
|
+
L("div", {
|
|
3639
3637
|
ref_key: "editorScrollRef",
|
|
3640
|
-
ref:
|
|
3638
|
+
ref: oe,
|
|
3641
3639
|
class: "docx-editor-vue__editor-scroll",
|
|
3642
3640
|
onScroll: gn
|
|
3643
|
-
}, [
|
|
3644
|
-
|
|
3641
|
+
}, [L("div", Sa, [
|
|
3642
|
+
se.value && !u.value ? (U(), I("div", Ca, [R(S, {
|
|
3645
3643
|
"section-props": Vt.value,
|
|
3646
|
-
zoom:
|
|
3647
|
-
unit:
|
|
3648
|
-
editable: !
|
|
3644
|
+
zoom: q(B),
|
|
3645
|
+
unit: t.rulerUnit ?? "inch",
|
|
3646
|
+
editable: !u.value,
|
|
3649
3647
|
"indent-left": un.value.indentLeft,
|
|
3650
3648
|
"indent-right": un.value.indentRight,
|
|
3651
3649
|
"first-line-indent": un.value.firstLineIndent,
|
|
3652
3650
|
"hanging-indent": un.value.hangingIndent,
|
|
3653
3651
|
"show-first-line-indent": !0,
|
|
3654
3652
|
"tab-stops": un.value.tabs,
|
|
3655
|
-
onLeftMarginChange:
|
|
3656
|
-
onRightMarginChange:
|
|
3657
|
-
onIndentLeftChange:
|
|
3658
|
-
onIndentRightChange:
|
|
3659
|
-
onFirstLineIndentChange:
|
|
3660
|
-
onTabStopRemove:
|
|
3653
|
+
onLeftMarginChange: q(tn),
|
|
3654
|
+
onRightMarginChange: q(nn),
|
|
3655
|
+
onIndentLeftChange: q(on),
|
|
3656
|
+
onIndentRightChange: q(sn),
|
|
3657
|
+
onFirstLineIndentChange: q(cn),
|
|
3658
|
+
onTabStopRemove: q(ln)
|
|
3661
3659
|
}, null, 8, [
|
|
3662
3660
|
"section-props",
|
|
3663
3661
|
"zoom",
|
|
@@ -3674,14 +3672,14 @@ var aa = { class: "docx-editor-vue__toolbar-shell" }, oa = {
|
|
|
3674
3672
|
"onIndentRightChange",
|
|
3675
3673
|
"onFirstLineIndentChange",
|
|
3676
3674
|
"onTabStopRemove"
|
|
3677
|
-
])])) :
|
|
3678
|
-
|
|
3675
|
+
])])) : F("", !0),
|
|
3676
|
+
se.value && !u.value ? (U(), I("div", wa, [R(g, {
|
|
3679
3677
|
"section-props": Vt.value,
|
|
3680
|
-
zoom:
|
|
3681
|
-
unit:
|
|
3682
|
-
editable: !
|
|
3683
|
-
onTopMarginChange:
|
|
3684
|
-
onBottomMarginChange:
|
|
3678
|
+
zoom: q(B),
|
|
3679
|
+
unit: t.rulerUnit ?? "inch",
|
|
3680
|
+
editable: !u.value,
|
|
3681
|
+
onTopMarginChange: q(rn),
|
|
3682
|
+
onBottomMarginChange: q(an)
|
|
3685
3683
|
}, null, 8, [
|
|
3686
3684
|
"section-props",
|
|
3687
3685
|
"zoom",
|
|
@@ -3689,30 +3687,30 @@ var aa = { class: "docx-editor-vue__toolbar-shell" }, oa = {
|
|
|
3689
3687
|
"editable",
|
|
3690
3688
|
"onTopMarginChange",
|
|
3691
3689
|
"onBottomMarginChange"
|
|
3692
|
-
])])) :
|
|
3693
|
-
|
|
3690
|
+
])])) : F("", !0),
|
|
3691
|
+
L("div", {
|
|
3694
3692
|
ref_key: "pagesViewportRef",
|
|
3695
|
-
ref:
|
|
3693
|
+
ref: ae,
|
|
3696
3694
|
class: "docx-editor-vue__pages-viewport",
|
|
3697
|
-
onWheel:
|
|
3698
|
-
onMousedown:
|
|
3699
|
-
onMousemove:
|
|
3700
|
-
onClick:
|
|
3701
|
-
onContextmenu:
|
|
3695
|
+
onWheel: Me,
|
|
3696
|
+
onMousedown: n[20] ||= (...e) => q(wt) && q(wt)(...e),
|
|
3697
|
+
onMousemove: n[21] ||= (...e) => q(Tt) && q(Tt)(...e),
|
|
3698
|
+
onClick: n[22] ||= (...e) => q(Et) && q(Et)(...e),
|
|
3699
|
+
onContextmenu: n[23] ||= Y((...e) => q(Nt) && q(Nt)(...e), ["prevent"])
|
|
3702
3700
|
}, [
|
|
3703
|
-
|
|
3701
|
+
L("div", Ta, [L("div", {
|
|
3704
3702
|
ref_key: "pagesRef",
|
|
3705
|
-
ref:
|
|
3703
|
+
ref: D,
|
|
3706
3704
|
class: "docx-editor-vue__pages paged-editor__pages",
|
|
3707
|
-
style:
|
|
3708
|
-
}, null, 4),
|
|
3709
|
-
"get-view": () =>
|
|
3710
|
-
"get-pages-container": () =>
|
|
3711
|
-
"editor-state":
|
|
3712
|
-
zoom:
|
|
3713
|
-
layout:
|
|
3714
|
-
blocks:
|
|
3715
|
-
measures:
|
|
3705
|
+
style: H(Gt.value)
|
|
3706
|
+
}, null, 4), L("div", Ea, [R(lr, {
|
|
3707
|
+
"get-view": () => q(X),
|
|
3708
|
+
"get-pages-container": () => D.value,
|
|
3709
|
+
"editor-state": q(Le),
|
|
3710
|
+
zoom: q(B),
|
|
3711
|
+
layout: q(Je),
|
|
3712
|
+
blocks: q(Ye),
|
|
3713
|
+
measures: q(Xe),
|
|
3716
3714
|
"on-term-click": o.onAnonymizationTermClick,
|
|
3717
3715
|
"selected-canonical": o.selectedAnonymizationCanonical,
|
|
3718
3716
|
"selection-seq": o.anonymizationSelectionSeq
|
|
@@ -3727,15 +3725,15 @@ var aa = { class: "docx-editor-vue__toolbar-shell" }, oa = {
|
|
|
3727
3725
|
"on-term-click",
|
|
3728
3726
|
"selected-canonical",
|
|
3729
3727
|
"selection-seq"
|
|
3730
|
-
]), o.showTemplateDirectives ? (
|
|
3728
|
+
]), o.showTemplateDirectives ? (U(), P(mi, {
|
|
3731
3729
|
key: 0,
|
|
3732
|
-
"get-view": () =>
|
|
3733
|
-
"get-pages-container": () =>
|
|
3734
|
-
"editor-state":
|
|
3735
|
-
zoom:
|
|
3736
|
-
layout:
|
|
3737
|
-
blocks:
|
|
3738
|
-
measures:
|
|
3730
|
+
"get-view": () => q(X),
|
|
3731
|
+
"get-pages-container": () => D.value,
|
|
3732
|
+
"editor-state": q(Le),
|
|
3733
|
+
zoom: q(B),
|
|
3734
|
+
layout: q(Je),
|
|
3735
|
+
blocks: q(Ye),
|
|
3736
|
+
measures: q(Xe)
|
|
3739
3737
|
}, null, 8, [
|
|
3740
3738
|
"get-view",
|
|
3741
3739
|
"get-pages-container",
|
|
@@ -3744,29 +3742,29 @@ var aa = { class: "docx-editor-vue__toolbar-shell" }, oa = {
|
|
|
3744
3742
|
"layout",
|
|
3745
3743
|
"blocks",
|
|
3746
3744
|
"measures"
|
|
3747
|
-
])) :
|
|
3748
|
-
|
|
3749
|
-
"image-info":
|
|
3750
|
-
zoom:
|
|
3751
|
-
view:
|
|
3752
|
-
onDeselect:
|
|
3753
|
-
onInteractStart:
|
|
3754
|
-
onInteractEnd:
|
|
3755
|
-
onContextMenu:
|
|
3745
|
+
])) : F("", !0)])]),
|
|
3746
|
+
R(ri, {
|
|
3747
|
+
"image-info": q(at),
|
|
3748
|
+
zoom: q(B),
|
|
3749
|
+
view: q(X),
|
|
3750
|
+
onDeselect: n[12] ||= (e) => at.value = null,
|
|
3751
|
+
onInteractStart: n[13] ||= (e) => ot.value = !0,
|
|
3752
|
+
onInteractEnd: n[14] ||= (e) => ot.value = !1,
|
|
3753
|
+
onContextMenu: q(Pt)
|
|
3756
3754
|
}, null, 8, [
|
|
3757
3755
|
"image-info",
|
|
3758
3756
|
"zoom",
|
|
3759
3757
|
"view",
|
|
3760
3758
|
"onContextMenu"
|
|
3761
3759
|
]),
|
|
3762
|
-
|
|
3763
|
-
data:
|
|
3764
|
-
"read-only":
|
|
3765
|
-
onNavigate:
|
|
3760
|
+
R(wi, {
|
|
3761
|
+
data: q(ft),
|
|
3762
|
+
"read-only": u.value,
|
|
3763
|
+
onNavigate: q(ht),
|
|
3766
3764
|
onCopy: Bt,
|
|
3767
|
-
onEdit:
|
|
3768
|
-
onRemove:
|
|
3769
|
-
onClose:
|
|
3765
|
+
onEdit: q(gt),
|
|
3766
|
+
onRemove: q(_t),
|
|
3767
|
+
onClose: n[15] ||= (e) => ft.value = null
|
|
3770
3768
|
}, null, 8, [
|
|
3771
3769
|
"data",
|
|
3772
3770
|
"read-only",
|
|
@@ -3774,23 +3772,23 @@ var aa = { class: "docx-editor-vue__toolbar-shell" }, oa = {
|
|
|
3774
3772
|
"onEdit",
|
|
3775
3773
|
"onRemove"
|
|
3776
3774
|
]),
|
|
3777
|
-
|
|
3775
|
+
q(yt) ? (U(), I("button", {
|
|
3778
3776
|
key: 0,
|
|
3779
3777
|
type: "button",
|
|
3780
3778
|
class: "docx-editor-vue__table-insert-btn",
|
|
3781
|
-
style:
|
|
3782
|
-
left:
|
|
3783
|
-
top:
|
|
3779
|
+
style: H({
|
|
3780
|
+
left: q(yt).x + "px",
|
|
3781
|
+
top: q(yt).y + "px"
|
|
3784
3782
|
}),
|
|
3785
|
-
"aria-label":
|
|
3786
|
-
onMousedown:
|
|
3787
|
-
}, " + ", 44,
|
|
3788
|
-
|
|
3789
|
-
comments:
|
|
3790
|
-
"pages-container":
|
|
3791
|
-
zoom:
|
|
3783
|
+
"aria-label": q(yt).type === "row" ? "Insert row" : "Insert column",
|
|
3784
|
+
onMousedown: n[16] ||= (...e) => q(Dt) && q(Dt)(...e)
|
|
3785
|
+
}, " + ", 44, Da)) : F("", !0),
|
|
3786
|
+
R(m, {
|
|
3787
|
+
comments: q(zt),
|
|
3788
|
+
"pages-container": D.value,
|
|
3789
|
+
zoom: q(B),
|
|
3792
3790
|
"page-width-px": Ut.value,
|
|
3793
|
-
"sidebar-open":
|
|
3791
|
+
"sidebar-open": M.value,
|
|
3794
3792
|
"resolved-comment-ids": Wt.value,
|
|
3795
3793
|
onMarkerClick: () => {}
|
|
3796
3794
|
}, null, 8, [
|
|
@@ -3801,30 +3799,30 @@ var aa = { class: "docx-editor-vue__toolbar-shell" }, oa = {
|
|
|
3801
3799
|
"sidebar-open",
|
|
3802
3800
|
"resolved-comment-ids"
|
|
3803
3801
|
]),
|
|
3804
|
-
|
|
3805
|
-
"is-open":
|
|
3806
|
-
comments:
|
|
3802
|
+
R(v, {
|
|
3803
|
+
"is-open": M.value,
|
|
3804
|
+
comments: q(zt),
|
|
3807
3805
|
"tracked-changes": Rt.value,
|
|
3808
3806
|
"show-resolved": !0,
|
|
3809
|
-
"is-adding-comment":
|
|
3810
|
-
"add-comment-y-position":
|
|
3811
|
-
"pages-container":
|
|
3807
|
+
"is-adding-comment": q($).isAddingComment.value,
|
|
3808
|
+
"add-comment-y-position": q($).addCommentYPosition.value,
|
|
3809
|
+
"pages-container": D.value,
|
|
3812
3810
|
"page-width-px": Ut.value,
|
|
3813
|
-
zoom:
|
|
3814
|
-
"active-item-id":
|
|
3815
|
-
onClose:
|
|
3816
|
-
"onUpdate:activeItemId":
|
|
3817
|
-
onAddComment:
|
|
3818
|
-
onCancelAddComment:
|
|
3819
|
-
onCommentReply:
|
|
3820
|
-
onCommentResolve:
|
|
3821
|
-
onCommentUnresolve:
|
|
3822
|
-
onCommentDelete:
|
|
3823
|
-
onAcceptChange:
|
|
3824
|
-
onRejectChange:
|
|
3825
|
-
onAcceptChangeById:
|
|
3826
|
-
onRejectChangeById:
|
|
3827
|
-
onTrackedChangeReply:
|
|
3811
|
+
zoom: q(B),
|
|
3812
|
+
"active-item-id": pe.value,
|
|
3813
|
+
onClose: n[17] ||= (e) => M.value = !1,
|
|
3814
|
+
"onUpdate:activeItemId": n[18] ||= (e) => pe.value = e,
|
|
3815
|
+
onAddComment: q($).handleAddComment,
|
|
3816
|
+
onCancelAddComment: q($).handleCancelAddComment,
|
|
3817
|
+
onCommentReply: q(Q).handleReply,
|
|
3818
|
+
onCommentResolve: q(Q).handleResolve,
|
|
3819
|
+
onCommentUnresolve: q(Q).handleUnresolve,
|
|
3820
|
+
onCommentDelete: q(Q).handleDelete,
|
|
3821
|
+
onAcceptChange: q(Q).handleAcceptChange,
|
|
3822
|
+
onRejectChange: q(Q).handleRejectChange,
|
|
3823
|
+
onAcceptChangeById: q(Q).handleAcceptChangeById,
|
|
3824
|
+
onRejectChangeById: q(Q).handleRejectChangeById,
|
|
3825
|
+
onTrackedChangeReply: q(Q).handleTrackedChangeReply
|
|
3828
3826
|
}, null, 8, [
|
|
3829
3827
|
"is-open",
|
|
3830
3828
|
"comments",
|
|
@@ -3847,43 +3845,43 @@ var aa = { class: "docx-editor-vue__toolbar-shell" }, oa = {
|
|
|
3847
3845
|
"onRejectChangeById",
|
|
3848
3846
|
"onTrackedChangeReply"
|
|
3849
3847
|
]),
|
|
3850
|
-
|
|
3848
|
+
q($).floatingCommentButton.value && !u.value ? (U(), I("button", {
|
|
3851
3849
|
key: 1,
|
|
3852
3850
|
type: "button",
|
|
3853
3851
|
class: "docx-editor-vue__add-comment-btn",
|
|
3854
|
-
style:
|
|
3855
|
-
top:
|
|
3856
|
-
left:
|
|
3852
|
+
style: H({
|
|
3853
|
+
top: q($).floatingCommentButton.value.top + "px",
|
|
3854
|
+
left: q($).floatingCommentButton.value.left + "px"
|
|
3857
3855
|
}),
|
|
3858
3856
|
"aria-label": "Add comment",
|
|
3859
3857
|
title: "Add comment",
|
|
3860
|
-
onMousedown:
|
|
3861
|
-
}, [
|
|
3858
|
+
onMousedown: n[19] ||= Y((...e) => q($).startAddComment && q($).startAddComment(...e), ["prevent", "stop"])
|
|
3859
|
+
}, [R(r, {
|
|
3862
3860
|
name: "add_comment",
|
|
3863
3861
|
size: 18
|
|
3864
|
-
})], 36)) :
|
|
3862
|
+
})], 36)) : F("", !0)
|
|
3865
3863
|
], 544),
|
|
3866
|
-
|
|
3864
|
+
A.value ? F("", !0) : (U(), P(ai, {
|
|
3867
3865
|
key: 2,
|
|
3868
3866
|
"left-offset": 12,
|
|
3869
|
-
onToggle:
|
|
3867
|
+
onToggle: q(Ot).handleToggleOutline
|
|
3870
3868
|
}, null, 8, ["onToggle"])),
|
|
3871
|
-
|
|
3869
|
+
q(bt).totalPages > 1 ? (U(), P(oi, {
|
|
3872
3870
|
key: 3,
|
|
3873
|
-
"current-page":
|
|
3874
|
-
"total-pages":
|
|
3875
|
-
visible:
|
|
3871
|
+
"current-page": q(bt).currentPage,
|
|
3872
|
+
"total-pages": q(bt).totalPages,
|
|
3873
|
+
visible: q(bt).visible
|
|
3876
3874
|
}, null, 8, [
|
|
3877
3875
|
"current-page",
|
|
3878
3876
|
"total-pages",
|
|
3879
3877
|
"visible"
|
|
3880
|
-
])) :
|
|
3881
|
-
|
|
3882
|
-
"is-open":
|
|
3883
|
-
headings:
|
|
3884
|
-
"get-scroll-container": () =>
|
|
3885
|
-
onClose:
|
|
3886
|
-
onNavigate:
|
|
3878
|
+
])) : F("", !0),
|
|
3879
|
+
R(pr, {
|
|
3880
|
+
"is-open": A.value,
|
|
3881
|
+
headings: z.value,
|
|
3882
|
+
"get-scroll-container": () => D.value,
|
|
3883
|
+
onClose: n[24] ||= (e) => A.value = !1,
|
|
3884
|
+
onNavigate: q(Ot).handleOutlineNavigate
|
|
3887
3885
|
}, null, 8, [
|
|
3888
3886
|
"is-open",
|
|
3889
3887
|
"headings",
|
|
@@ -3891,18 +3889,18 @@ var aa = { class: "docx-editor-vue__toolbar-shell" }, oa = {
|
|
|
3891
3889
|
"onNavigate"
|
|
3892
3890
|
])
|
|
3893
3891
|
])], 544),
|
|
3894
|
-
|
|
3895
|
-
"read-only":
|
|
3896
|
-
"context-menu":
|
|
3897
|
-
"image-context-menu":
|
|
3898
|
-
"image-context-menu-text-actions":
|
|
3899
|
-
"custom-text-menu-items":
|
|
3900
|
-
"can-open-image-properties":
|
|
3901
|
-
onContextMenuAction:
|
|
3902
|
-
onCloseContextMenu:
|
|
3903
|
-
onImageWrapSelect:
|
|
3904
|
-
onCloseImageContextMenu:
|
|
3905
|
-
onOpenImageProperties:
|
|
3892
|
+
R(qr, {
|
|
3893
|
+
"read-only": u.value,
|
|
3894
|
+
"context-menu": q(kt),
|
|
3895
|
+
"image-context-menu": q(At),
|
|
3896
|
+
"image-context-menu-text-actions": q(jt),
|
|
3897
|
+
"custom-text-menu-items": q(Mt),
|
|
3898
|
+
"can-open-image-properties": q(at) !== null,
|
|
3899
|
+
onContextMenuAction: q(It),
|
|
3900
|
+
onCloseContextMenu: n[25] ||= (e) => q(kt).isOpen = !1,
|
|
3901
|
+
onImageWrapSelect: q(Ft),
|
|
3902
|
+
onCloseImageContextMenu: n[26] ||= (e) => At.value = null,
|
|
3903
|
+
onOpenImageProperties: n[27] ||= (e) => de.value = !0
|
|
3906
3904
|
}, null, 8, [
|
|
3907
3905
|
"read-only",
|
|
3908
3906
|
"context-menu",
|
|
@@ -3915,30 +3913,42 @@ var aa = { class: "docx-editor-vue__toolbar-shell" }, oa = {
|
|
|
3915
3913
|
])
|
|
3916
3914
|
], 6));
|
|
3917
3915
|
}
|
|
3918
|
-
}), [["__scopeId", "data-v-
|
|
3916
|
+
}), [["__scopeId", "data-v-3d2b5f45"]]);
|
|
3917
|
+
//#endregion
|
|
3918
|
+
//#region src/utils/listState.ts
|
|
3919
|
+
function ka() {
|
|
3920
|
+
return {
|
|
3921
|
+
type: "none",
|
|
3922
|
+
level: 0,
|
|
3923
|
+
isInList: !1
|
|
3924
|
+
};
|
|
3925
|
+
}
|
|
3926
|
+
//#endregion
|
|
3927
|
+
//#region src/components/FormattingBar.vue?vue&type=script&setup=true&lang.ts
|
|
3928
|
+
var Aa = ["aria-label"], ja = ["aria-label"], Ma = [
|
|
3919
3929
|
"disabled",
|
|
3920
3930
|
"title",
|
|
3921
3931
|
"aria-label"
|
|
3922
|
-
],
|
|
3932
|
+
], Na = [
|
|
3923
3933
|
"disabled",
|
|
3924
3934
|
"title",
|
|
3925
3935
|
"aria-label"
|
|
3926
|
-
],
|
|
3936
|
+
], Pa = ["aria-label"], Fa = [
|
|
3927
3937
|
"disabled",
|
|
3928
3938
|
"title",
|
|
3929
3939
|
"aria-label",
|
|
3930
3940
|
"aria-pressed"
|
|
3931
|
-
],
|
|
3941
|
+
], Ia = [
|
|
3932
3942
|
"disabled",
|
|
3933
3943
|
"title",
|
|
3934
3944
|
"aria-label",
|
|
3935
3945
|
"aria-pressed"
|
|
3936
|
-
],
|
|
3946
|
+
], La = [
|
|
3937
3947
|
"disabled",
|
|
3938
3948
|
"title",
|
|
3939
3949
|
"aria-label",
|
|
3940
3950
|
"aria-pressed"
|
|
3941
|
-
],
|
|
3951
|
+
], Ra = /*#__PURE__*/ t(/* @__PURE__ */ z({
|
|
3942
3952
|
__name: "FormattingBar",
|
|
3943
3953
|
props: {
|
|
3944
3954
|
currentFormatting: {},
|
|
@@ -3979,113 +3989,113 @@ var aa = { class: "docx-editor-vue__toolbar-shell" }, oa = {
|
|
|
3979
3989
|
"undo",
|
|
3980
3990
|
"redo"
|
|
3981
3991
|
],
|
|
3982
|
-
setup(e, { emit:
|
|
3983
|
-
let { ColorPicker:
|
|
3984
|
-
let e =
|
|
3992
|
+
setup(e, { emit: t }) {
|
|
3993
|
+
let { ColorPicker: n } = p(), i = e, a = t, { t: o } = c(), s = N(() => i.currentFormatting ?? {}), l = N(() => i.documentStyles ? { styles: i.documentStyles } : {}), u = N(() => s.value.listState ?? ka()), d = N(() => {
|
|
3994
|
+
let e = s.value.color;
|
|
3985
3995
|
return e ? e.replace(/^#/, "").toUpperCase() : void 0;
|
|
3986
|
-
}),
|
|
3996
|
+
}), f = N(() => {
|
|
3987
3997
|
let e = u.value;
|
|
3988
|
-
return e.isInList && e.level > 0 || (
|
|
3998
|
+
return e.isInList && e.level > 0 || (s.value.indentLeft ?? 0) > 0;
|
|
3989
3999
|
});
|
|
3990
4000
|
function m(e) {
|
|
3991
|
-
|
|
4001
|
+
a("format", {
|
|
3992
4002
|
type: "textColor",
|
|
3993
4003
|
value: e
|
|
3994
4004
|
});
|
|
3995
4005
|
}
|
|
3996
|
-
return (t,
|
|
3997
|
-
class:
|
|
4006
|
+
return (t, i) => (U(), I("div", {
|
|
4007
|
+
class: V(["docx-formatting-bar", e.className]),
|
|
3998
4008
|
role: "toolbar",
|
|
3999
|
-
"aria-label":
|
|
4009
|
+
"aria-label": q(o)("formattingToolbar"),
|
|
4000
4010
|
"data-folio-toolbar": "true"
|
|
4001
4011
|
}, [
|
|
4002
|
-
|
|
4012
|
+
L("span", {
|
|
4003
4013
|
class: "docx-formatting-bar__group",
|
|
4004
4014
|
role: "group",
|
|
4005
|
-
"aria-label":
|
|
4006
|
-
}, [
|
|
4015
|
+
"aria-label": q(o)("historyGroup")
|
|
4016
|
+
}, [L("button", {
|
|
4007
4017
|
type: "button",
|
|
4008
4018
|
class: "docx-formatting-bar__btn",
|
|
4009
4019
|
disabled: e.disabled || !e.canUndo,
|
|
4010
|
-
title:
|
|
4011
|
-
"aria-label":
|
|
4012
|
-
onMousedown:
|
|
4013
|
-
}, [
|
|
4020
|
+
title: q(o)("undoShortcut"),
|
|
4021
|
+
"aria-label": q(o)("undo"),
|
|
4022
|
+
onMousedown: i[0] ||= Y((e) => a("undo"), ["prevent"])
|
|
4023
|
+
}, [R(r, {
|
|
4014
4024
|
name: "undo",
|
|
4015
4025
|
size: 18
|
|
4016
|
-
})], 40,
|
|
4026
|
+
})], 40, Ma), L("button", {
|
|
4017
4027
|
type: "button",
|
|
4018
4028
|
class: "docx-formatting-bar__btn",
|
|
4019
4029
|
disabled: e.disabled || !e.canRedo,
|
|
4020
|
-
title:
|
|
4021
|
-
"aria-label":
|
|
4022
|
-
onMousedown:
|
|
4023
|
-
}, [
|
|
4030
|
+
title: q(o)("redoShortcut"),
|
|
4031
|
+
"aria-label": q(o)("redo"),
|
|
4032
|
+
onMousedown: i[1] ||= Y((e) => a("redo"), ["prevent"])
|
|
4033
|
+
}, [R(r, {
|
|
4024
4034
|
name: "redo",
|
|
4025
4035
|
size: 18
|
|
4026
|
-
})], 40,
|
|
4027
|
-
|
|
4036
|
+
})], 40, Na)], 8, ja),
|
|
4037
|
+
i[13] ||= L("span", {
|
|
4028
4038
|
class: "docx-formatting-bar__divider",
|
|
4029
4039
|
role: "separator"
|
|
4030
4040
|
}, null, -1),
|
|
4031
|
-
e.showStylePicker ? (
|
|
4041
|
+
e.showStylePicker ? (U(), I(j, { key: 0 }, [R(b, ve({ value: s.value.styleId ?? "Normal" }, l.value, {
|
|
4032
4042
|
disabled: e.disabled,
|
|
4033
|
-
onChange:
|
|
4043
|
+
onChange: i[2] ||= (e) => a("format", {
|
|
4034
4044
|
type: "applyStyle",
|
|
4035
4045
|
value: e
|
|
4036
4046
|
})
|
|
4037
|
-
}), null, 16, ["value", "disabled"]),
|
|
4047
|
+
}), null, 16, ["value", "disabled"]), i[11] ||= L("span", {
|
|
4038
4048
|
class: "docx-formatting-bar__divider",
|
|
4039
4049
|
role: "separator"
|
|
4040
|
-
}, null, -1)], 64)) :
|
|
4041
|
-
|
|
4050
|
+
}, null, -1)], 64)) : F("", !0),
|
|
4051
|
+
L("span", {
|
|
4042
4052
|
class: "docx-formatting-bar__group",
|
|
4043
4053
|
role: "group",
|
|
4044
|
-
"aria-label":
|
|
4054
|
+
"aria-label": q(o)("textFormattingGroup")
|
|
4045
4055
|
}, [
|
|
4046
|
-
|
|
4056
|
+
L("button", {
|
|
4047
4057
|
type: "button",
|
|
4048
|
-
class:
|
|
4058
|
+
class: V(["docx-formatting-bar__btn", { "docx-formatting-bar__btn--active": s.value.bold }]),
|
|
4049
4059
|
disabled: e.disabled,
|
|
4050
|
-
title:
|
|
4051
|
-
"aria-label":
|
|
4052
|
-
"aria-pressed": !!
|
|
4053
|
-
onMousedown:
|
|
4054
|
-
}, [
|
|
4060
|
+
title: q(o)("boldShortcut"),
|
|
4061
|
+
"aria-label": q(o)("bold"),
|
|
4062
|
+
"aria-pressed": !!s.value.bold,
|
|
4063
|
+
onMousedown: i[3] ||= Y((e) => a("format", "bold"), ["prevent"])
|
|
4064
|
+
}, [R(r, {
|
|
4055
4065
|
name: "format_bold",
|
|
4056
4066
|
size: 18
|
|
4057
|
-
})], 42,
|
|
4058
|
-
|
|
4067
|
+
})], 42, Fa),
|
|
4068
|
+
L("button", {
|
|
4059
4069
|
type: "button",
|
|
4060
|
-
class:
|
|
4070
|
+
class: V(["docx-formatting-bar__btn", { "docx-formatting-bar__btn--active": s.value.italic }]),
|
|
4061
4071
|
disabled: e.disabled,
|
|
4062
|
-
title:
|
|
4063
|
-
"aria-label":
|
|
4064
|
-
"aria-pressed": !!
|
|
4065
|
-
onMousedown:
|
|
4066
|
-
}, [
|
|
4072
|
+
title: q(o)("italicShortcut"),
|
|
4073
|
+
"aria-label": q(o)("italic"),
|
|
4074
|
+
"aria-pressed": !!s.value.italic,
|
|
4075
|
+
onMousedown: i[4] ||= Y((e) => a("format", "italic"), ["prevent"])
|
|
4076
|
+
}, [R(r, {
|
|
4067
4077
|
name: "format_italic",
|
|
4068
4078
|
size: 18
|
|
4069
|
-
})], 42,
|
|
4070
|
-
|
|
4079
|
+
})], 42, Ia),
|
|
4080
|
+
L("button", {
|
|
4071
4081
|
type: "button",
|
|
4072
|
-
class:
|
|
4082
|
+
class: V(["docx-formatting-bar__btn", { "docx-formatting-bar__btn--active": s.value.underline }]),
|
|
4073
4083
|
disabled: e.disabled,
|
|
4074
|
-
title:
|
|
4075
|
-
"aria-label":
|
|
4076
|
-
"aria-pressed": !!
|
|
4077
|
-
onMousedown:
|
|
4078
|
-
}, [
|
|
4084
|
+
title: q(o)("underlineShortcut"),
|
|
4085
|
+
"aria-label": q(o)("underline"),
|
|
4086
|
+
"aria-pressed": !!s.value.underline,
|
|
4087
|
+
onMousedown: i[5] ||= Y((e) => a("format", "underline"), ["prevent"])
|
|
4088
|
+
}, [R(r, {
|
|
4079
4089
|
name: "format_underlined",
|
|
4080
4090
|
size: 18
|
|
4081
|
-
})], 42,
|
|
4082
|
-
], 8,
|
|
4083
|
-
e.showTextColorPicker ? (
|
|
4091
|
+
})], 42, La)
|
|
4092
|
+
], 8, Pa),
|
|
4093
|
+
e.showTextColorPicker ? (U(), I(j, { key: 1 }, [i[12] ||= L("span", {
|
|
4084
4094
|
class: "docx-formatting-bar__divider",
|
|
4085
4095
|
role: "separator"
|
|
4086
|
-
}, null, -1),
|
|
4096
|
+
}, null, -1), R(q(n), {
|
|
4087
4097
|
mode: "text",
|
|
4088
|
-
value:
|
|
4098
|
+
value: d.value,
|
|
4089
4099
|
theme: e.theme ?? null,
|
|
4090
4100
|
disabled: e.disabled,
|
|
4091
4101
|
onChange: m
|
|
@@ -4093,37 +4103,37 @@ var aa = { class: "docx-editor-vue__toolbar-shell" }, oa = {
|
|
|
4093
4103
|
"value",
|
|
4094
4104
|
"theme",
|
|
4095
4105
|
"disabled"
|
|
4096
|
-
])], 64)) :
|
|
4097
|
-
|
|
4106
|
+
])], 64)) : F("", !0),
|
|
4107
|
+
i[14] ||= L("span", {
|
|
4098
4108
|
class: "docx-formatting-bar__divider",
|
|
4099
4109
|
role: "separator"
|
|
4100
4110
|
}, null, -1),
|
|
4101
|
-
e.showAlignmentButtons ? (
|
|
4111
|
+
e.showAlignmentButtons ? (U(), P(y, {
|
|
4102
4112
|
key: 2,
|
|
4103
|
-
value:
|
|
4113
|
+
value: s.value.alignment ?? "left",
|
|
4104
4114
|
disabled: e.disabled,
|
|
4105
|
-
onChange:
|
|
4115
|
+
onChange: i[6] ||= (e) => a("format", {
|
|
4106
4116
|
type: "alignment",
|
|
4107
4117
|
value: e
|
|
4108
4118
|
})
|
|
4109
|
-
}, null, 8, ["value", "disabled"])) :
|
|
4110
|
-
e.showListButtons ? (
|
|
4119
|
+
}, null, 8, ["value", "disabled"])) : F("", !0),
|
|
4120
|
+
e.showListButtons ? (U(), P(x, {
|
|
4111
4121
|
key: 3,
|
|
4112
4122
|
"list-state": u.value,
|
|
4113
4123
|
disabled: e.disabled,
|
|
4114
|
-
"can-outdent":
|
|
4115
|
-
onBulletList:
|
|
4116
|
-
onNumberedList:
|
|
4117
|
-
onIndent:
|
|
4118
|
-
onOutdent:
|
|
4124
|
+
"can-outdent": f.value,
|
|
4125
|
+
onBulletList: i[7] ||= (e) => a("format", "bulletList"),
|
|
4126
|
+
onNumberedList: i[8] ||= (e) => a("format", "numberedList"),
|
|
4127
|
+
onIndent: i[9] ||= (e) => a("format", "indent"),
|
|
4128
|
+
onOutdent: i[10] ||= (e) => a("format", "outdent")
|
|
4119
4129
|
}, null, 8, [
|
|
4120
4130
|
"list-state",
|
|
4121
4131
|
"disabled",
|
|
4122
4132
|
"can-outdent"
|
|
4123
|
-
])) :
|
|
4124
|
-
], 10,
|
|
4133
|
+
])) : F("", !0)
|
|
4134
|
+
], 10, Aa));
|
|
4125
4135
|
}
|
|
4126
|
-
}), [["__scopeId", "data-v-
|
|
4136
|
+
}), [["__scopeId", "data-v-fc03de2e"]]), za = [
|
|
4127
4137
|
{
|
|
4128
4138
|
value: .5,
|
|
4129
4139
|
label: "50%"
|
|
@@ -4148,7 +4158,7 @@ var aa = { class: "docx-editor-vue__toolbar-shell" }, oa = {
|
|
|
4148
4158
|
value: 2,
|
|
4149
4159
|
label: "200%"
|
|
4150
4160
|
}
|
|
4151
|
-
],
|
|
4161
|
+
], Ba = /*#__PURE__*/ t(/* @__PURE__ */ z({
|
|
4152
4162
|
__name: "ZoomControl",
|
|
4153
4163
|
props: {
|
|
4154
4164
|
value: { default: 1 },
|
|
@@ -4165,7 +4175,7 @@ var aa = { class: "docx-editor-vue__toolbar-shell" }, oa = {
|
|
|
4165
4175
|
},
|
|
4166
4176
|
emits: ["change"],
|
|
4167
4177
|
setup(e, { emit: t }) {
|
|
4168
|
-
let { Select: n } =
|
|
4178
|
+
let { Select: n } = p(), r = e, i = t, a = N(() => r.levels ?? za), o = N(() => a.value.find((e) => Math.abs(e.value - r.value) < .001)), s = N(() => o.value ? o.value.label : `${Math.round(r.value * 100)}%`), c = N(() => o.value ? String(o.value.value) : String(r.value)), l = N(() => {
|
|
4169
4179
|
let e = a.value.map((e) => ({
|
|
4170
4180
|
value: String(e.value),
|
|
4171
4181
|
label: e.label
|
|
@@ -4179,8 +4189,8 @@ var aa = { class: "docx-editor-vue__toolbar-shell" }, oa = {
|
|
|
4179
4189
|
let t = Number.parseFloat(e);
|
|
4180
4190
|
Number.isNaN(t) || i("change", t);
|
|
4181
4191
|
}
|
|
4182
|
-
return (t, r) => (
|
|
4183
|
-
class:
|
|
4192
|
+
return (t, r) => (U(), P(q(n), {
|
|
4193
|
+
class: V(["docx-zoom-control", [{ "docx-zoom-control--compact": e.compact }, e.className]]),
|
|
4184
4194
|
value: c.value,
|
|
4185
4195
|
items: l.value,
|
|
4186
4196
|
disabled: e.disabled,
|
|
@@ -4193,45 +4203,45 @@ var aa = { class: "docx-editor-vue__toolbar-shell" }, oa = {
|
|
|
4193
4203
|
"disabled"
|
|
4194
4204
|
]));
|
|
4195
4205
|
}
|
|
4196
|
-
}), [["__scopeId", "data-v-8079e07f"]]),
|
|
4197
|
-
let { locale: r = "en", ...
|
|
4198
|
-
return new Promise((n,
|
|
4199
|
-
let
|
|
4206
|
+
}), [["__scopeId", "data-v-8079e07f"]]), Va = (e, t, n = {}) => {
|
|
4207
|
+
let { locale: r = "en", ...i } = n;
|
|
4208
|
+
return new Promise((n, a) => {
|
|
4209
|
+
let o = W(null), s = null, c = !1, u = {
|
|
4200
4210
|
save: async () => {
|
|
4201
|
-
let e = await (
|
|
4211
|
+
let e = await (o.value?.save() ?? Promise.resolve(null));
|
|
4202
4212
|
return e ? new Blob([e], { type: "application/vnd.openxmlformats-officedocument.wordprocessingml.document" }) : null;
|
|
4203
4213
|
},
|
|
4204
|
-
getDocument: () =>
|
|
4214
|
+
getDocument: () => o.value?.getDocument() ?? null,
|
|
4205
4215
|
focus: () => {
|
|
4206
|
-
|
|
4216
|
+
o.value?.focus();
|
|
4207
4217
|
},
|
|
4208
4218
|
setZoom: (e) => {
|
|
4209
|
-
|
|
4219
|
+
o.value?.setZoom(e);
|
|
4210
4220
|
},
|
|
4211
4221
|
scrollToPosition: (e) => {
|
|
4212
|
-
|
|
4222
|
+
o.value?.getEditorRef()?.scrollToPosition(e);
|
|
4213
4223
|
},
|
|
4214
4224
|
scrollToPage: (e) => {
|
|
4215
|
-
|
|
4225
|
+
o.value?.scrollToPage(e);
|
|
4216
4226
|
},
|
|
4217
4227
|
destroy: () => {
|
|
4218
|
-
|
|
4228
|
+
c || (c = !0, a(/* @__PURE__ */ Error("Editor was destroyed before mounting completed."))), s?.unmount(), s = null;
|
|
4219
4229
|
}
|
|
4220
4230
|
};
|
|
4221
|
-
|
|
4222
|
-
return () =>
|
|
4223
|
-
...
|
|
4231
|
+
s = pe({ setup() {
|
|
4232
|
+
return () => B(Oa, {
|
|
4233
|
+
...i,
|
|
4224
4234
|
documentBuffer: e,
|
|
4225
|
-
ref:
|
|
4235
|
+
ref: o,
|
|
4226
4236
|
onReady: () => {
|
|
4227
|
-
|
|
4237
|
+
c || (c = !0, n(u));
|
|
4228
4238
|
},
|
|
4229
4239
|
onError: (e) => {
|
|
4230
|
-
|
|
4240
|
+
i.onError?.(e), c || (c = !0, s?.unmount(), s = null, a(e));
|
|
4231
4241
|
}
|
|
4232
4242
|
});
|
|
4233
|
-
} }),
|
|
4243
|
+
} }), s.use(l, r), s.mount(t);
|
|
4234
4244
|
});
|
|
4235
4245
|
};
|
|
4236
4246
|
//#endregion
|
|
4237
|
-
export {
|
|
4247
|
+
export { Fn as DEFAULT_AI_SUGGESTION_PRESETS, Jn as DEFAULT_AUTOCOMPLETE_DEAD_ZONE_NODES, Oa as DocxEditor, E as FindReplaceDialog, s as FolioUIProvider, D as FootnotePropertiesDialog, Ra as FormattingBar, ae as HyperlinkDialog, oe as ImagePositionDialog, se as ImagePropertiesDialog, O as InsertImageDialog, k as InsertSymbolDialog, ce as InsertTableDialog, le as PageSetupDialog, ue as PasteSpecialDialog, de as SplitCellDialog, fe as TablePropertiesDialog, A as WatermarkDialog, Ba as ZoomControl, Yn as acceptAutocompleteSuggestion, Xn as acceptAutocompleteWord, Je as anonymizationDecorationsKey, Zn as appendAutocompleteToken, $ as applyFolioAIEditOperations, In as applySuggestions, Qn as autocompleteSuggestionKey, $n as autocompleteSuggestionPlugin, zn as buildPositionalText, er as clearAutocompleteSuggestion, Ft as clearTemplateSlashMenu, It as consumeTemplateSlashQuery, Gn as createAICitationDecorationsPlugin, An as createDocx, kn as createEmptyDocument, Ut as createFolioAIEditSnapshot, n as defaultLocale, jn as deriveBlockId, Gt as diffWordSegments, tr as finishAutocompleteSuggestion, ar as fromMarkdown, Ye as getAnonymizationMatches, nr as getAutocompleteSuggestion, Dn as getDocumentWatermark, Un as getFolioCaretViewportRect, Mn as getFolioParaIdFromBlockId, Wn as getFolioSelectionViewportRect, vt as getTemplateDirectives, Lt as getTemplateSlashMenu, Yt as hashFolioAIBlockText, l as i18nPlugin, Me as insertImageFromFile, Pe as insertPageBreakInView, X as insertTableInView, Le as insertTableOfContentsInView, Nn as isFolioBlockId, Pn as isSequentialFolioBlockId, Ln as isSuggestionStale, Xt as normalizeFolioAIBlockText, e as provideLocale, Va as renderAsync, Rt as resetTemplateSlashQuery, Rn as resolveSuggestionAnchor, bt as scanDirectives, Hn as scrollFolioPositionIntoView, Kn as setAICitationsMeta, Bn as setAISuggestionsMeta, qn as setActiveCitationMeta, Ze as setAnonymizationTermsMeta, On as setDocumentWatermark, Vn as setFocusedSuggestionMeta, Pt as setTemplatePreviewValues, rr as shouldTriggerAutocomplete, ir as startAutocompleteSuggestion, Q as templateSlashMenuKey, or as toMarkdown, sr as toMarkdownResult, c as useTranslation, ie as useWheelZoom };
|