@stll/folio-vue 0.4.0 → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{ListButtons-CC7_7-e3.cjs → ListButtons-BvsV1yti.cjs} +2 -2
- package/dist/{ListButtons-BaILr4AO.js → ListButtons-DXqMvba3.js} +37 -49
- package/dist/WatermarkDialog-DHfk8jrg.cjs +15 -0
- package/dist/{WatermarkDialog-D-uTab0-.js → WatermarkDialog-r4wmldt4.js} +674 -1176
- package/dist/components/DocxEditor/types.d.ts +8 -1
- package/dist/components/sidebar/cardStyles.d.ts +1 -1
- package/dist/composables.cjs +1 -1
- package/dist/composables.js +1 -1
- package/dist/dialogs.cjs +1 -1
- package/dist/dialogs.js +1 -1
- package/dist/folio-vue.css +1 -1
- package/dist/index.cjs +1 -3
- package/dist/index.d.ts +1 -1
- package/dist/index.js +716 -710
- package/dist/ui.cjs +1 -1
- package/dist/ui.js +14 -14
- package/dist/useZoom-BB6hSMvM.cjs +1 -0
- package/dist/{useZoom-BR--m9w3.js → useZoom-BxDANpqb.js} +178 -175
- package/package.json +11 -6
- package/dist/WatermarkDialog-SzyoSZmL.cjs +0 -15
- package/dist/useZoom-8M2AQIMJ.cjs +0 -1
- package/dist/utils/aiEditRange.d.ts +0 -26
- package/dist/utils/pageText.d.ts +0 -14
package/dist/index.js
CHANGED
|
@@ -1,71 +1,71 @@
|
|
|
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-
|
|
2
|
-
import { D as m,
|
|
3
|
-
import { t as
|
|
4
|
-
import { a as
|
|
5
|
-
import { FindReplaceDialog as
|
|
6
|
-
import { Fragment as
|
|
7
|
-
import { createStyleResolver as
|
|
8
|
-
import { extractSelectionContext as
|
|
9
|
-
import { inspectDocxCompatibility as
|
|
10
|
-
import { clearAllCaches as
|
|
11
|
-
import { onFontsLoaded as
|
|
12
|
-
import { twipsToPixels as
|
|
13
|
-
import { measureDirectiveGutter as
|
|
14
|
-
import { prefersReducedMotionBehavior as
|
|
15
|
-
import { anonymizationDecorationsKey as
|
|
16
|
-
import { NodeSelection as
|
|
17
|
-
import { pixelsToEmu as
|
|
18
|
-
import { IMAGE_LAYOUT_OPTIONS as
|
|
19
|
-
import { isTrackChangesMode as
|
|
20
|
-
import { clickToPositionDom as
|
|
21
|
-
import { calculateResizedImageDimensions as
|
|
22
|
-
import { findBodyPmAnchor as
|
|
23
|
-
import { getTemplateDirectives as
|
|
24
|
-
import { clearFormatting as
|
|
25
|
-
import { getTableContext as
|
|
26
|
-
import { PENDING_COMMENT_ID as
|
|
27
|
-
import { createComment as
|
|
28
|
-
import { findChangeRange as
|
|
29
|
-
import { acceptAIEditRevision as
|
|
30
|
-
import { makeRevisionInfo as
|
|
31
|
-
import { setTemplatePreviewValues as
|
|
32
|
-
import { clearTemplateSlashMenu as
|
|
33
|
-
import { applyFolioAIEditOperations as $, applyFolioAIEditOperations as Bt,
|
|
34
|
-
import { findPageIndexContainingPmPos as
|
|
35
|
-
import { findParagraphFragmentsByParaId as
|
|
36
|
-
import { blockSdtAttrsToSdtProperties as
|
|
37
|
-
import { setContentControlContentBlocksTr as
|
|
38
|
-
import {
|
|
39
|
-
import {
|
|
40
|
-
import {
|
|
41
|
-
import {
|
|
42
|
-
import {
|
|
43
|
-
import {
|
|
44
|
-
import {
|
|
45
|
-
import {
|
|
46
|
-
import {
|
|
47
|
-
import {
|
|
48
|
-
import {
|
|
49
|
-
import {
|
|
50
|
-
import {
|
|
51
|
-
import {
|
|
52
|
-
import { DEFAULT_AI_SUGGESTION_PRESETS as
|
|
53
|
-
import { applySuggestions as
|
|
54
|
-
import { isSuggestionStale as
|
|
55
|
-
import { buildPositionalText as
|
|
56
|
-
import { setAISuggestionsMeta as
|
|
57
|
-
import { scrollFolioPositionIntoView as
|
|
58
|
-
import { getFolioCaretViewportRect as
|
|
59
|
-
import { createAICitationDecorationsPlugin as
|
|
60
|
-
import { DEFAULT_AUTOCOMPLETE_DEAD_ZONE_NODES as
|
|
61
|
-
import { fromMarkdown as
|
|
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";
|
|
62
62
|
//#region src/components/AnonymizationRectsOverlay.vue?vue&type=script&setup=true&lang.ts
|
|
63
|
-
var
|
|
63
|
+
var cr = [
|
|
64
64
|
"data-folio-anonymization-label",
|
|
65
65
|
"data-folio-anonymization-canonical",
|
|
66
66
|
"data-folio-anonymization-selected",
|
|
67
67
|
"title"
|
|
68
|
-
],
|
|
68
|
+
], lr = /*#__PURE__*/ t(/* @__PURE__ */ z({
|
|
69
69
|
__name: "AnonymizationRectsOverlay",
|
|
70
70
|
props: {
|
|
71
71
|
getView: { type: Function },
|
|
@@ -92,12 +92,12 @@ var or = [
|
|
|
92
92
|
r.value = [];
|
|
93
93
|
return;
|
|
94
94
|
}
|
|
95
|
-
let s =
|
|
95
|
+
let s = Xe(o);
|
|
96
96
|
if (s.length === 0) {
|
|
97
97
|
r.value = [];
|
|
98
98
|
return;
|
|
99
99
|
}
|
|
100
|
-
let c = await
|
|
100
|
+
let c = await Ke(s, {
|
|
101
101
|
pagesContainer: a,
|
|
102
102
|
zoom: t.zoom,
|
|
103
103
|
layout: t.layout,
|
|
@@ -139,7 +139,7 @@ var or = [
|
|
|
139
139
|
index: a
|
|
140
140
|
}, i.item(a)?.scrollIntoView({
|
|
141
141
|
block: "center",
|
|
142
|
-
behavior:
|
|
142
|
+
behavior: qe()
|
|
143
143
|
});
|
|
144
144
|
}
|
|
145
145
|
J(() => [t.selectedCanonical, t.selectionSeq], () => l(), { flush: "post" });
|
|
@@ -159,18 +159,18 @@ var or = [
|
|
|
159
159
|
}
|
|
160
160
|
}
|
|
161
161
|
}
|
|
162
|
-
return
|
|
162
|
+
return xe(() => {
|
|
163
163
|
document.addEventListener("click", u), o();
|
|
164
|
-
}),
|
|
164
|
+
}), be(() => {
|
|
165
165
|
document.removeEventListener("click", u), a !== null && (cancelAnimationFrame(a), a = null);
|
|
166
166
|
}), (t, i) => (U(), I("div", {
|
|
167
167
|
ref_key: "rootRef",
|
|
168
168
|
ref: n,
|
|
169
169
|
class: "folio-anonymization-overlay",
|
|
170
170
|
"data-folio-anonymization-overlay": ""
|
|
171
|
-
}, [(U(!0), I(
|
|
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", {
|
|
172
172
|
key: `${t.canonical}:${r}:${n.left}:${n.top}`,
|
|
173
|
-
class: V(["folio-anonymization-term", `folio-anonymization-term--${q(
|
|
173
|
+
class: V(["folio-anonymization-term", `folio-anonymization-term--${q(Qe)(t.label)}`]),
|
|
174
174
|
"data-folio-anonymization-label": t.label,
|
|
175
175
|
"data-folio-anonymization-canonical": t.canonical,
|
|
176
176
|
"data-folio-anonymization-selected": t.canonical === e.selectedCanonical ? "true" : void 0,
|
|
@@ -182,12 +182,12 @@ var or = [
|
|
|
182
182
|
width: `${n.width}px`,
|
|
183
183
|
height: `${n.height}px`
|
|
184
184
|
})
|
|
185
|
-
}, null, 14,
|
|
185
|
+
}, null, 14, cr))), 128))], 64))), 128))], 512));
|
|
186
186
|
}
|
|
187
|
-
}), [["__scopeId", "data-v-c7db88e1"]]),
|
|
187
|
+
}), [["__scopeId", "data-v-c7db88e1"]]), ur = { class: "doc-outline__header" }, dr = { class: "doc-outline__body" }, fr = {
|
|
188
188
|
key: 0,
|
|
189
189
|
class: "doc-outline__empty"
|
|
190
|
-
},
|
|
190
|
+
}, pr = /*#__PURE__*/ t(/* @__PURE__ */ z({
|
|
191
191
|
__name: "DocumentOutline",
|
|
192
192
|
props: {
|
|
193
193
|
isOpen: { type: Boolean },
|
|
@@ -216,15 +216,15 @@ var or = [
|
|
|
216
216
|
role: "navigation",
|
|
217
217
|
"aria-label": "Document outline",
|
|
218
218
|
onMousedown: n[1] ||= Y(() => {}, ["stop"])
|
|
219
|
-
}, [L("div",
|
|
219
|
+
}, [L("div", ur, [L("button", {
|
|
220
220
|
class: "doc-outline__back",
|
|
221
221
|
title: "Close outline",
|
|
222
222
|
"aria-label": "Close outline",
|
|
223
223
|
onClick: n[0] ||= (e) => t.$emit("close")
|
|
224
|
-
}, [
|
|
224
|
+
}, [R(r, {
|
|
225
225
|
name: "arrow_back",
|
|
226
226
|
size: 20
|
|
227
|
-
})]), n[2] ||= L("span", { class: "doc-outline__title" }, "Document Outline", -1)]), L("div",
|
|
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), {
|
|
228
228
|
key: 1,
|
|
229
229
|
items: o.value,
|
|
230
230
|
"get-scroll-container": e.getScrollContainer ?? (() => null),
|
|
@@ -232,7 +232,7 @@ var or = [
|
|
|
232
232
|
"aria-label": "Document outline"
|
|
233
233
|
}, null, 8, ["items", "get-scroll-container"]))])], 36)) : F("", !0);
|
|
234
234
|
}
|
|
235
|
-
}), [["__scopeId", "data-v-
|
|
235
|
+
}), [["__scopeId", "data-v-0797b3b1"]]), mr = /* @__PURE__ */ z({
|
|
236
236
|
__name: "DocxEditorDialogs",
|
|
237
237
|
props: {
|
|
238
238
|
view: {},
|
|
@@ -258,13 +258,13 @@ var or = [
|
|
|
258
258
|
],
|
|
259
259
|
setup(e, { emit: t }) {
|
|
260
260
|
let n = t;
|
|
261
|
-
return (t, r) => (U(), I(
|
|
262
|
-
|
|
261
|
+
return (t, r) => (U(), I(j, null, [
|
|
262
|
+
R(u, {
|
|
263
263
|
"is-open": e.showFindReplace,
|
|
264
264
|
view: e.view,
|
|
265
265
|
onClose: r[0] ||= (e) => n("update:showFindReplace", !1)
|
|
266
266
|
}, null, 8, ["is-open", "view"]),
|
|
267
|
-
|
|
267
|
+
R(d, {
|
|
268
268
|
"is-open": e.showHyperlink,
|
|
269
269
|
view: e.view,
|
|
270
270
|
bookmarks: e.bookmarks,
|
|
@@ -276,12 +276,12 @@ var or = [
|
|
|
276
276
|
"view",
|
|
277
277
|
"bookmarks"
|
|
278
278
|
]),
|
|
279
|
-
|
|
279
|
+
R(a, {
|
|
280
280
|
"is-open": e.showInsertSymbol,
|
|
281
281
|
onClose: r[4] ||= (e) => n("update:showInsertSymbol", !1),
|
|
282
282
|
onInsert: r[5] ||= (e) => n("insert-symbol", e)
|
|
283
283
|
}, null, 8, ["is-open"]),
|
|
284
|
-
|
|
284
|
+
R(o, {
|
|
285
285
|
"is-open": e.showImageProperties,
|
|
286
286
|
view: e.view,
|
|
287
287
|
"pm-pos": e.selectedImagePmPos,
|
|
@@ -291,7 +291,7 @@ var or = [
|
|
|
291
291
|
"view",
|
|
292
292
|
"pm-pos"
|
|
293
293
|
]),
|
|
294
|
-
|
|
294
|
+
R(f, {
|
|
295
295
|
"is-open": e.showPageSetup,
|
|
296
296
|
"section-properties": e.sectionProperties,
|
|
297
297
|
onClose: r[7] ||= (e) => n("update:showPageSetup", !1),
|
|
@@ -299,10 +299,10 @@ var or = [
|
|
|
299
299
|
}, null, 8, ["is-open", "section-properties"])
|
|
300
300
|
], 64));
|
|
301
301
|
}
|
|
302
|
-
}),
|
|
302
|
+
}), hr = {
|
|
303
303
|
key: 0,
|
|
304
304
|
class: "docx-editor-vue__title-bar"
|
|
305
|
-
},
|
|
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({
|
|
306
306
|
__name: "DocxEditorMenuBar",
|
|
307
307
|
props: {
|
|
308
308
|
showMenuBar: {
|
|
@@ -334,13 +334,13 @@ var or = [
|
|
|
334
334
|
],
|
|
335
335
|
setup(e, { emit: t }) {
|
|
336
336
|
let n = t;
|
|
337
|
-
return (t, r) => e.showMenuBar ? (U(), I("div",
|
|
338
|
-
L("div",
|
|
339
|
-
L("div",
|
|
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, {
|
|
340
340
|
"model-value": e.documentName,
|
|
341
341
|
editable: e.documentNameEditable,
|
|
342
342
|
"onUpdate:modelValue": r[0] ||= (e) => n("rename", e)
|
|
343
|
-
}, null, 8, ["model-value", "editable"]),
|
|
343
|
+
}, null, 8, ["model-value", "editable"]), R(C, {
|
|
344
344
|
"show-file-open": e.showFileOpen,
|
|
345
345
|
"show-help-menu": e.showHelpMenu,
|
|
346
346
|
"show-table-insert": e.showTableInsert,
|
|
@@ -351,40 +351,40 @@ var or = [
|
|
|
351
351
|
"show-help-menu",
|
|
352
352
|
"show-table-insert"
|
|
353
353
|
])]),
|
|
354
|
-
L("div",
|
|
354
|
+
L("div", vr, [Ce(t.$slots, "title-bar-right")])
|
|
355
355
|
])) : F("", !0);
|
|
356
356
|
}
|
|
357
|
-
}),
|
|
358
|
-
function
|
|
359
|
-
|
|
357
|
+
}), br = Symbol("docx-portal-class");
|
|
358
|
+
function xr(e) {
|
|
359
|
+
Se(br, N(() => ({
|
|
360
360
|
"ep-root": !0,
|
|
361
361
|
dark: !!q(e)
|
|
362
362
|
})));
|
|
363
363
|
}
|
|
364
|
-
function
|
|
365
|
-
return
|
|
364
|
+
function Sr() {
|
|
365
|
+
return _e(br, N(() => ({ "ep-root": !0 })));
|
|
366
366
|
}
|
|
367
367
|
//#endregion
|
|
368
368
|
//#region src/components/ImageContextMenu.vue?vue&type=script&setup=true&lang.ts
|
|
369
|
-
var
|
|
369
|
+
var Cr = ["aria-label"], wr = { class: "image-ctx-menu__icon" }, Tr = { class: "image-ctx-menu__label" }, Er = {
|
|
370
370
|
key: 1,
|
|
371
371
|
class: "image-ctx-menu__divider",
|
|
372
372
|
role: "separator"
|
|
373
|
-
},
|
|
373
|
+
}, Dr = [
|
|
374
374
|
"data-wrap-type",
|
|
375
375
|
"data-current",
|
|
376
376
|
"data-disabled",
|
|
377
377
|
"disabled",
|
|
378
378
|
"title",
|
|
379
379
|
"onClick"
|
|
380
|
-
],
|
|
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 = {
|
|
381
381
|
key: 0,
|
|
382
382
|
class: "image-ctx-menu__shortcut"
|
|
383
|
-
},
|
|
383
|
+
}, Pr = {
|
|
384
384
|
key: 0,
|
|
385
385
|
class: "image-ctx-menu__divider",
|
|
386
386
|
role: "separator"
|
|
387
|
-
},
|
|
387
|
+
}, Fr = 18, Ir = 260, Lr = 10, Rr = /*#__PURE__*/ t(/* @__PURE__ */ z({
|
|
388
388
|
__name: "ImageContextMenu",
|
|
389
389
|
props: {
|
|
390
390
|
state: {},
|
|
@@ -405,7 +405,7 @@ var xr = ["aria-label"], Sr = { class: "image-ctx-menu__icon" }, Cr = { class: "
|
|
|
405
405
|
function a() {
|
|
406
406
|
i("open-properties"), i("close");
|
|
407
407
|
}
|
|
408
|
-
let { t: o } = c(), s =
|
|
408
|
+
let { t: o } = c(), s = Sr(), l = nt, u = N(() => n.state ? it(n.state.currentWrapType, n.state.currentCssFloat ?? null) : null), d = {
|
|
409
409
|
inline: "wrap_text",
|
|
410
410
|
squareLeft: "format_image_left",
|
|
411
411
|
squareRight: "format_image_right",
|
|
@@ -417,17 +417,17 @@ var xr = ["aria-label"], Sr = { class: "image-ctx-menu__icon" }, Cr = { class: "
|
|
|
417
417
|
}
|
|
418
418
|
let p = N(() => {
|
|
419
419
|
if (!n.state) return {};
|
|
420
|
-
let e =
|
|
421
|
-
return typeof window < "u" && (t +
|
|
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)), {
|
|
422
422
|
position: "fixed",
|
|
423
423
|
left: `${t}px`,
|
|
424
424
|
top: `${r}px`,
|
|
425
|
-
minWidth: `${
|
|
425
|
+
minWidth: `${Ir}px`,
|
|
426
426
|
zIndex: 400
|
|
427
427
|
};
|
|
428
428
|
});
|
|
429
429
|
function m(e) {
|
|
430
|
-
return n.state ?
|
|
430
|
+
return n.state ? ot(e, n.state.currentWrapType) : !1;
|
|
431
431
|
}
|
|
432
432
|
function h(e) {
|
|
433
433
|
m(e) && (i("select", e.choice), i("close"));
|
|
@@ -441,7 +441,7 @@ var xr = ["aria-label"], Sr = { class: "image-ctx-menu__icon" }, Cr = { class: "
|
|
|
441
441
|
function v(e) {
|
|
442
442
|
e.key === "Escape" && (e.preventDefault(), i("close"));
|
|
443
443
|
}
|
|
444
|
-
return (t, n) => (U(), P(
|
|
444
|
+
return (t, n) => (U(), P(M, { to: "body" }, [e.state && e.state.open ? (U(), I("div", {
|
|
445
445
|
key: 0,
|
|
446
446
|
class: "image-ctx-menu-backdrop",
|
|
447
447
|
onMousedown: _,
|
|
@@ -464,12 +464,12 @@ var xr = ["aria-label"], Sr = { class: "image-ctx-menu__icon" }, Cr = { class: "
|
|
|
464
464
|
"data-action": "open-properties",
|
|
465
465
|
onMousedown: n[1] ||= Y(() => {}, ["prevent"]),
|
|
466
466
|
onClick: a
|
|
467
|
-
}, [L("span",
|
|
467
|
+
}, [L("span", wr, [R(r, {
|
|
468
468
|
name: "settings",
|
|
469
|
-
size:
|
|
470
|
-
})]), L("span",
|
|
471
|
-
e.canOpenProperties ? (U(), I("div",
|
|
472
|
-
(U(!0), I(
|
|
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", {
|
|
473
473
|
key: e.choice,
|
|
474
474
|
type: "button",
|
|
475
475
|
role: "menuitem",
|
|
@@ -482,37 +482,37 @@ var xr = ["aria-label"], Sr = { class: "image-ctx-menu__icon" }, Cr = { class: "
|
|
|
482
482
|
onMousedown: n[2] ||= Y(() => {}, ["prevent"]),
|
|
483
483
|
onClick: (t) => h(e)
|
|
484
484
|
}, [
|
|
485
|
-
L("span",
|
|
485
|
+
L("span", Or, [R(r, {
|
|
486
486
|
name: f(e.iconHint),
|
|
487
|
-
size:
|
|
487
|
+
size: Fr
|
|
488
488
|
}, null, 8, ["name"])]),
|
|
489
|
-
L("span",
|
|
489
|
+
L("span", kr, K(q(o)(`imageWrap.menu.${e.i18nLabelKey}`)), 1),
|
|
490
490
|
e.choice === u.value ? (U(), I("span", {
|
|
491
491
|
key: 0,
|
|
492
492
|
class: "image-ctx-menu__current-dot",
|
|
493
493
|
"aria-label": q(o)("imageWrap.menu.ariaLabel")
|
|
494
|
-
}, "●", 8,
|
|
495
|
-
], 42,
|
|
496
|
-
e.textActions && e.textActions.length > 0 ? (U(), I(
|
|
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", {
|
|
497
497
|
class: "image-ctx-menu__divider",
|
|
498
498
|
role: "separator"
|
|
499
|
-
}, null, -1), (U(!0), I(
|
|
499
|
+
}, null, -1), (U(!0), I(j, null, G(e.textActions, (e, t) => (U(), I(j, { key: `${e.action}-${t}` }, [L("button", {
|
|
500
500
|
type: "button",
|
|
501
501
|
role: "menuitem",
|
|
502
502
|
class: "image-ctx-menu__item image-ctx-menu__item--text",
|
|
503
503
|
disabled: e.disabled,
|
|
504
504
|
onMousedown: n[3] ||= Y(() => {}, ["prevent"]),
|
|
505
505
|
onClick: (t) => g(e)
|
|
506
|
-
}, [L("span",
|
|
507
|
-
], 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)]));
|
|
508
508
|
}
|
|
509
|
-
}), [["__scopeId", "data-v-
|
|
509
|
+
}), [["__scopeId", "data-v-fc8f35bc"]]), zr = ["disabled", "onMousedown"], Br = {
|
|
510
510
|
key: 0,
|
|
511
511
|
class: "ctx-menu__icon"
|
|
512
|
-
},
|
|
512
|
+
}, Vr = { class: "ctx-menu__label" }, Hr = {
|
|
513
513
|
key: 1,
|
|
514
514
|
class: "ctx-menu__shortcut"
|
|
515
|
-
},
|
|
515
|
+
}, Ur = 220, Wr = 32, Gr = 10, Kr = /*#__PURE__*/ t(/* @__PURE__ */ z({
|
|
516
516
|
__name: "TextContextMenu",
|
|
517
517
|
props: {
|
|
518
518
|
isOpen: { type: Boolean },
|
|
@@ -529,7 +529,7 @@ var xr = ["aria-label"], Sr = { class: "image-ctx-menu__icon" }, Cr = { class: "
|
|
|
529
529
|
setup(e, { emit: t }) {
|
|
530
530
|
let n = e, r = ({ node: e }) => e;
|
|
531
531
|
r.props = ["node"];
|
|
532
|
-
let i = t, { t: a } = c(), o =
|
|
532
|
+
let i = t, { t: a } = c(), o = Sr(), s = W(null), l = N(() => {
|
|
533
533
|
let e = [], t = n.customItems ?? [];
|
|
534
534
|
for (let [n, r] of t.entries()) e.push({
|
|
535
535
|
id: `custom-${r.id}`,
|
|
@@ -665,8 +665,8 @@ var xr = ["aria-label"], Sr = { class: "image-ctx-menu__icon" }, Cr = { class: "
|
|
|
665
665
|
action: "deleteTable"
|
|
666
666
|
}), e;
|
|
667
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 *
|
|
669
|
-
return typeof window < "u" && (e +
|
|
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)), {
|
|
670
670
|
position: "fixed",
|
|
671
671
|
left: `${e}px`,
|
|
672
672
|
top: `${t}px`,
|
|
@@ -680,8 +680,8 @@ var xr = ["aria-label"], Sr = { class: "image-ctx-menu__icon" }, Cr = { class: "
|
|
|
680
680
|
e.key === "Escape" && i("close");
|
|
681
681
|
}
|
|
682
682
|
return J(() => n.isOpen, (e) => {
|
|
683
|
-
e &&
|
|
684
|
-
}), (t, n) => (U(), P(
|
|
683
|
+
e && ye(() => s.value?.focus());
|
|
684
|
+
}), (t, n) => (U(), P(M, { to: "body" }, [e.isOpen ? (U(), I("div", {
|
|
685
685
|
key: 0,
|
|
686
686
|
class: "ctx-menu-backdrop",
|
|
687
687
|
onMousedown: n[0] ||= (e) => t.$emit("close"),
|
|
@@ -694,7 +694,7 @@ var xr = ["aria-label"], Sr = { class: "image-ctx-menu__icon" }, Cr = { class: "
|
|
|
694
694
|
style: H(u.value),
|
|
695
695
|
onContextmenu: n[2] ||= Y(() => {}, ["prevent"]),
|
|
696
696
|
onKeydown: f
|
|
697
|
-
}, [(U(!0), I(
|
|
697
|
+
}, [(U(!0), I(j, null, G(l.value, (e, t) => (U(), I("button", {
|
|
698
698
|
key: e.id || t,
|
|
699
699
|
class: V(["ctx-menu__item", {
|
|
700
700
|
"ctx-menu__item--disabled": e.disabled,
|
|
@@ -704,12 +704,12 @@ var xr = ["aria-label"], Sr = { class: "image-ctx-menu__icon" }, Cr = { class: "
|
|
|
704
704
|
disabled: e.disabled,
|
|
705
705
|
onMousedown: Y((t) => d(e.action), ["prevent"])
|
|
706
706
|
}, [
|
|
707
|
-
e.icon ? (U(), I("span",
|
|
708
|
-
L("span",
|
|
709
|
-
e.shortcut ? (U(), I("span",
|
|
710
|
-
], 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)]));
|
|
711
711
|
}
|
|
712
|
-
}), [["__scopeId", "data-v-
|
|
712
|
+
}), [["__scopeId", "data-v-c1416e84"]]), qr = /* @__PURE__ */ z({
|
|
713
713
|
__name: "DocxEditorOverlays",
|
|
714
714
|
props: {
|
|
715
715
|
readOnly: { type: Boolean },
|
|
@@ -728,7 +728,7 @@ var xr = ["aria-label"], Sr = { class: "image-ctx-menu__icon" }, Cr = { class: "
|
|
|
728
728
|
],
|
|
729
729
|
setup(e, { emit: t }) {
|
|
730
730
|
let n = t;
|
|
731
|
-
return (t, r) => (U(), I(
|
|
731
|
+
return (t, r) => (U(), I(j, null, [R(Kr, {
|
|
732
732
|
"is-open": e.contextMenu.isOpen,
|
|
733
733
|
position: e.contextMenu.position,
|
|
734
734
|
"has-selection": e.contextMenu.hasSelection,
|
|
@@ -750,7 +750,7 @@ var xr = ["aria-label"], Sr = { class: "image-ctx-menu__icon" }, Cr = { class: "
|
|
|
750
750
|
"can-merge-cells",
|
|
751
751
|
"can-split-cell",
|
|
752
752
|
"custom-items"
|
|
753
|
-
]),
|
|
753
|
+
]), R(Rr, {
|
|
754
754
|
state: e.imageContextMenu,
|
|
755
755
|
"text-actions": e.imageContextMenuTextActions,
|
|
756
756
|
"can-open-properties": e.canOpenImageProperties,
|
|
@@ -767,7 +767,7 @@ var xr = ["aria-label"], Sr = { class: "image-ctx-menu__icon" }, Cr = { class: "
|
|
|
767
767
|
});
|
|
768
768
|
//#endregion
|
|
769
769
|
//#region src/composables/imageOverlayRect.ts
|
|
770
|
-
function
|
|
770
|
+
function Jr(e) {
|
|
771
771
|
let t = Math.max(0, e.parentOffsetWidth - e.parentClientWidth) / 2, n = e.zoom || 1;
|
|
772
772
|
return {
|
|
773
773
|
left: (e.imageRect.left - e.parentRect.left - t + e.scrollLeft) / n,
|
|
@@ -778,13 +778,13 @@ function Kr(e) {
|
|
|
778
778
|
}
|
|
779
779
|
//#endregion
|
|
780
780
|
//#region src/components/ImageSelectionOverlay.vue?vue&type=script&setup=true&lang.ts
|
|
781
|
-
var
|
|
781
|
+
var Yr = ["data-handle", "onMousedown"], Xr = ["title"], Zr = {
|
|
782
782
|
key: 0,
|
|
783
783
|
class: "image-overlay__dim"
|
|
784
|
-
},
|
|
784
|
+
}, Qr = {
|
|
785
785
|
key: 1,
|
|
786
786
|
class: "image-overlay__dim image-overlay__dim--rotate"
|
|
787
|
-
},
|
|
787
|
+
}, $r = 4, ei = 15, ti = 250, ni = 700, ri = /*#__PURE__*/ t(/* @__PURE__ */ z({
|
|
788
788
|
__name: "ImageSelectionOverlay",
|
|
789
789
|
props: {
|
|
790
790
|
imageInfo: {},
|
|
@@ -798,8 +798,8 @@ var qr = ["data-handle", "onMousedown"], Jr = ["title"], Yr = {
|
|
|
798
798
|
"context-menu"
|
|
799
799
|
],
|
|
800
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,
|
|
802
|
-
function
|
|
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) {
|
|
803
803
|
if (!e) return null;
|
|
804
804
|
try {
|
|
805
805
|
let n = e.state.doc.nodeAt(t);
|
|
@@ -808,25 +808,25 @@ var qr = ["data-handle", "onMousedown"], Jr = ["title"], Yr = {
|
|
|
808
808
|
return null;
|
|
809
809
|
}
|
|
810
810
|
}
|
|
811
|
-
function
|
|
811
|
+
function ee(e) {
|
|
812
812
|
if (!e) return null;
|
|
813
813
|
let t = e.attrs.transform;
|
|
814
814
|
return typeof t == "string" ? t : null;
|
|
815
815
|
}
|
|
816
|
-
function
|
|
816
|
+
function w() {
|
|
817
817
|
return a.value?.closest(".docx-editor-vue__pages-viewport")?.querySelector(".docx-editor-vue__pages") ?? null;
|
|
818
818
|
}
|
|
819
|
-
function
|
|
819
|
+
function ne() {
|
|
820
820
|
let e = r.imageInfo;
|
|
821
821
|
if (!e) return null;
|
|
822
822
|
if (e.element.isConnected) return e.element;
|
|
823
|
-
let t =
|
|
823
|
+
let t = w();
|
|
824
824
|
if (!t) return null;
|
|
825
|
-
let n =
|
|
826
|
-
return n ?
|
|
825
|
+
let n = gt(t, e.pmPos);
|
|
826
|
+
return n ? at(n) : null;
|
|
827
827
|
}
|
|
828
|
-
function
|
|
829
|
-
let e =
|
|
828
|
+
function T() {
|
|
829
|
+
let e = ne();
|
|
830
830
|
if (!e || !a.value) {
|
|
831
831
|
p.value = null;
|
|
832
832
|
return;
|
|
@@ -836,9 +836,9 @@ var qr = ["data-handle", "onMousedown"], Jr = ["title"], Yr = {
|
|
|
836
836
|
p.value = null;
|
|
837
837
|
return;
|
|
838
838
|
}
|
|
839
|
-
let n = t.getBoundingClientRect();
|
|
840
|
-
p.value =
|
|
841
|
-
imageRect:
|
|
839
|
+
let n = t.getBoundingClientRect(), i = e.getBoundingClientRect();
|
|
840
|
+
p.value = Jr({
|
|
841
|
+
imageRect: i,
|
|
842
842
|
parentRect: n,
|
|
843
843
|
scrollLeft: t.scrollLeft,
|
|
844
844
|
scrollTop: t.scrollTop,
|
|
@@ -847,19 +847,19 @@ var qr = ["data-handle", "onMousedown"], Jr = ["title"], Yr = {
|
|
|
847
847
|
zoom: r.zoom
|
|
848
848
|
});
|
|
849
849
|
}
|
|
850
|
-
let
|
|
851
|
-
function
|
|
852
|
-
|
|
850
|
+
let re = null;
|
|
851
|
+
function ie() {
|
|
852
|
+
re?.();
|
|
853
853
|
let e = 0, t = "", n = 0, r = 0, i = (a) => {
|
|
854
854
|
r === 0 && (r = a);
|
|
855
855
|
let o = a - r;
|
|
856
|
-
|
|
856
|
+
T();
|
|
857
857
|
let s = p.value, c = s ? `${s.left}|${s.top}|${s.width}|${s.height}` : "";
|
|
858
|
-
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));
|
|
859
859
|
};
|
|
860
860
|
e = requestAnimationFrame(i);
|
|
861
|
-
let a = setTimeout(
|
|
862
|
-
|
|
861
|
+
let a = setTimeout(T, ti);
|
|
862
|
+
re = () => {
|
|
863
863
|
cancelAnimationFrame(e), clearTimeout(a);
|
|
864
864
|
};
|
|
865
865
|
}
|
|
@@ -868,20 +868,20 @@ var qr = ["data-handle", "onMousedown"], Jr = ["title"], Yr = {
|
|
|
868
868
|
p.value = null;
|
|
869
869
|
return;
|
|
870
870
|
}
|
|
871
|
-
|
|
871
|
+
ie(), n(() => re?.());
|
|
872
872
|
}, { immediate: !0 }), J(() => r.zoom, () => {
|
|
873
|
-
r.imageInfo &&
|
|
873
|
+
r.imageInfo && ie();
|
|
874
874
|
}), J(() => r.imageInfo, (e, t, n) => {
|
|
875
875
|
if (!r.imageInfo) return;
|
|
876
876
|
let i = () => {
|
|
877
|
-
b && cancelAnimationFrame(b), b = requestAnimationFrame(
|
|
877
|
+
b && cancelAnimationFrame(b), b = requestAnimationFrame(T);
|
|
878
878
|
}, o = a.value?.closest(".docx-editor-vue__pages-viewport");
|
|
879
879
|
o?.addEventListener("scroll", i, { passive: !0 }), window.addEventListener("resize", i, { passive: !0 });
|
|
880
880
|
let s = null, c = !1;
|
|
881
|
-
|
|
881
|
+
ye(() => {
|
|
882
882
|
if (c || !r.imageInfo) return;
|
|
883
|
-
let e =
|
|
884
|
-
e && (s = new MutationObserver(() =>
|
|
883
|
+
let e = w();
|
|
884
|
+
e && (s = new MutationObserver(() => ie()), s.observe(e, {
|
|
885
885
|
attributes: !0,
|
|
886
886
|
attributeFilter: ["style"]
|
|
887
887
|
}));
|
|
@@ -889,7 +889,7 @@ var qr = ["data-handle", "onMousedown"], Jr = ["title"], Yr = {
|
|
|
889
889
|
c = !0, o?.removeEventListener("scroll", i), window.removeEventListener("resize", i), s?.disconnect(), b && cancelAnimationFrame(b);
|
|
890
890
|
});
|
|
891
891
|
}, { immediate: !0 });
|
|
892
|
-
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(() => {
|
|
893
893
|
let e = p.value;
|
|
894
894
|
if (!e) return {
|
|
895
895
|
position: "absolute",
|
|
@@ -907,11 +907,11 @@ var qr = ["data-handle", "onMousedown"], Jr = ["title"], Yr = {
|
|
|
907
907
|
height: `${n}px`,
|
|
908
908
|
transform: i === 1 ? void 0 : `scale(${i})`,
|
|
909
909
|
transformOrigin: "top left",
|
|
910
|
-
zIndex:
|
|
910
|
+
zIndex: te.imageOverlay,
|
|
911
911
|
pointerEvents: "auto"
|
|
912
912
|
};
|
|
913
|
-
}),
|
|
914
|
-
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";
|
|
915
915
|
return [
|
|
916
916
|
{
|
|
917
917
|
pos: "nw",
|
|
@@ -979,32 +979,35 @@ var qr = ["data-handle", "onMousedown"], Jr = ["title"], Yr = {
|
|
|
979
979
|
}
|
|
980
980
|
];
|
|
981
981
|
});
|
|
982
|
-
function
|
|
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",
|
|
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));
|
|
984
984
|
}
|
|
985
|
-
function
|
|
986
|
-
let t = r.zoom, n = (e.clientX - h) / t, i = (e.clientY - g) / t, a = !e.shiftKey, o =
|
|
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);
|
|
987
987
|
u.value = Math.round(o.width), d.value = Math.round(o.height);
|
|
988
988
|
let s = y;
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
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
|
+
}
|
|
995
998
|
}
|
|
996
|
-
function
|
|
997
|
-
document.removeEventListener("mousemove",
|
|
999
|
+
function k() {
|
|
1000
|
+
document.removeEventListener("mousemove", O), document.removeEventListener("mouseup", k), o.value = !1, y = null, i("interact-end");
|
|
998
1001
|
let e = r.view, t = r.imageInfo;
|
|
999
1002
|
if (!e || !t) {
|
|
1000
|
-
|
|
1003
|
+
T();
|
|
1001
1004
|
return;
|
|
1002
1005
|
}
|
|
1003
|
-
let n =
|
|
1004
|
-
n !== null && _e(n),
|
|
1006
|
+
let n = mt(e, t.pmPos, u.value, d.value);
|
|
1007
|
+
n !== null && _e(n), ye(() => T());
|
|
1005
1008
|
}
|
|
1006
|
-
let
|
|
1007
|
-
function
|
|
1009
|
+
let ce = 0, le = 0, ue = 0, de = 0, fe = null, A = null;
|
|
1010
|
+
function M(e) {
|
|
1008
1011
|
if (!e) return 0;
|
|
1009
1012
|
let t = e.match(/rotate\((-?\d+(?:\.\d+)?)deg\)/)?.[1];
|
|
1010
1013
|
return t ? parseFloat(t) : 0;
|
|
@@ -1013,38 +1016,38 @@ var qr = ["data-handle", "onMousedown"], Jr = ["title"], Yr = {
|
|
|
1013
1016
|
let n = /scaleX\(-1\)/.test(e || ""), r = /scaleY\(-1\)/.test(e || ""), i = [], a = (t % 360 + 360) % 360;
|
|
1014
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;
|
|
1015
1018
|
}
|
|
1016
|
-
function
|
|
1017
|
-
return Math.atan2(e -
|
|
1019
|
+
function P(e, t) {
|
|
1020
|
+
return Math.atan2(e - ce, -(t - le)) * 180 / Math.PI;
|
|
1018
1021
|
}
|
|
1019
|
-
function
|
|
1022
|
+
function me(e) {
|
|
1020
1023
|
if (!r.imageInfo) return;
|
|
1021
1024
|
let t = r.imageInfo.element.getBoundingClientRect();
|
|
1022
|
-
|
|
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);
|
|
1023
1026
|
}
|
|
1024
1027
|
function he(e) {
|
|
1025
|
-
let t =
|
|
1026
|
-
e.shiftKey || (n = Math.round(n /
|
|
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) || "");
|
|
1027
1030
|
}
|
|
1028
1031
|
function ge() {
|
|
1029
1032
|
document.removeEventListener("mousemove", he), document.removeEventListener("mouseup", ge), l.value = !1, i("interact-end");
|
|
1030
1033
|
let e = r.view, t = r.imageInfo;
|
|
1031
1034
|
try {
|
|
1032
|
-
let n = e && t ?
|
|
1035
|
+
let n = e && t ? C(e, t.pmPos) : null;
|
|
1033
1036
|
e && t && n && (e.dispatch(e.state.tr.setNodeMarkup(t.pmPos, void 0, {
|
|
1034
1037
|
...n.attrs,
|
|
1035
|
-
transform: pe(
|
|
1038
|
+
transform: pe(ee(n), f.value)
|
|
1036
1039
|
})), _e(t.pmPos));
|
|
1037
1040
|
} catch {} finally {
|
|
1038
|
-
A && (A.style.transform = ""), A = null,
|
|
1041
|
+
A && (A.style.transform = ""), A = null, fe = null;
|
|
1039
1042
|
}
|
|
1040
|
-
|
|
1043
|
+
ye(() => T());
|
|
1041
1044
|
}
|
|
1042
1045
|
let R = null;
|
|
1043
1046
|
function z(e) {
|
|
1044
1047
|
if (!r.imageInfo || !p.value) return;
|
|
1045
1048
|
let t = e.clientX, n = e.clientY, a = p.value, o = !1, c = (e) => {
|
|
1046
1049
|
let c = e.clientX - t, l = e.clientY - n;
|
|
1047
|
-
if (!(!o && Math.sqrt(c * c + l * l) <
|
|
1050
|
+
if (!(!o && Math.sqrt(c * c + l * l) < $r)) {
|
|
1048
1051
|
if (!o) {
|
|
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);";
|
|
1050
1053
|
let e = r.zoom;
|
|
@@ -1056,59 +1059,58 @@ var qr = ["data-handle", "onMousedown"], Jr = ["title"], Yr = {
|
|
|
1056
1059
|
}
|
|
1057
1060
|
}
|
|
1058
1061
|
}, l = (e) => {
|
|
1059
|
-
document.removeEventListener("mousemove", c), document.removeEventListener("mouseup", l), x = null,
|
|
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));
|
|
1060
1063
|
};
|
|
1061
|
-
x = c,
|
|
1064
|
+
x = c, S = l, document.addEventListener("mousemove", c), document.addEventListener("mouseup", l);
|
|
1062
1065
|
}
|
|
1063
1066
|
function B(e, t) {
|
|
1064
1067
|
let n = r.view, i = r.imageInfo;
|
|
1065
1068
|
if (!n || !i) return;
|
|
1066
|
-
let o =
|
|
1067
|
-
if (o)
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
}
|
|
1079
|
-
if (!s) {
|
|
1080
|
-
let e = o.item(o.length - 1);
|
|
1081
|
-
s = e ? e.querySelector(".layout-page-content") : null;
|
|
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;
|
|
1082
1081
|
}
|
|
1083
|
-
if (!s) return;
|
|
1084
|
-
let c = s.getBoundingClientRect(), l = r.zoom, u = nt((e - c.left) / l), d = nt((t - c.top) / l), f = pt(n, i.pmPos, u, d);
|
|
1085
|
-
f !== null && _e(f);
|
|
1086
|
-
} else {
|
|
1087
|
-
let r = ne();
|
|
1088
|
-
if (!r) return;
|
|
1089
|
-
let a = dt(r, e, t, 1);
|
|
1090
|
-
if (a == null || a < 0) return;
|
|
1091
|
-
let o = mt(n, i.pmPos, a);
|
|
1092
|
-
o !== null && _e(o);
|
|
1093
1082
|
}
|
|
1094
|
-
|
|
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);
|
|
1095
1096
|
}
|
|
1097
|
+
s !== null && _e(s), ye(() => T());
|
|
1096
1098
|
}
|
|
1097
1099
|
function _e(e) {
|
|
1098
1100
|
let t = r.view;
|
|
1099
1101
|
if (t) try {
|
|
1100
|
-
let n =
|
|
1102
|
+
let n = $e.create(t.state.doc, e);
|
|
1101
1103
|
t.dispatch(t.state.tr.setSelection(n));
|
|
1102
1104
|
} catch {}
|
|
1103
1105
|
}
|
|
1104
|
-
return
|
|
1105
|
-
document.removeEventListener("mousemove",
|
|
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?.();
|
|
1106
1108
|
}), (t, r) => e.imageInfo ? (U(), I("div", {
|
|
1107
1109
|
key: 0,
|
|
1108
1110
|
ref_key: "overlayRootRef",
|
|
1109
1111
|
ref: a,
|
|
1110
1112
|
class: "image-overlay",
|
|
1111
|
-
style: H(
|
|
1113
|
+
style: H(ae.value),
|
|
1112
1114
|
onMousedown: r[3] ||= Y(() => {}, ["stop"])
|
|
1113
1115
|
}, [
|
|
1114
1116
|
r[4] ||= L("div", { class: "image-overlay__border" }, null, -1),
|
|
@@ -1118,25 +1120,25 @@ var qr = ["data-handle", "onMousedown"], Jr = ["title"], Yr = {
|
|
|
1118
1120
|
onMousedown: r[0] ||= Y((e) => z(e), ["prevent", "stop"]),
|
|
1119
1121
|
onContextmenu: r[1] ||= Y((e) => t.$emit("context-menu", e), ["prevent", "stop"])
|
|
1120
1122
|
}, null, 36),
|
|
1121
|
-
(U(!0), I(
|
|
1123
|
+
(U(!0), I(j, null, G(oe.value, (e) => (U(), I("div", {
|
|
1122
1124
|
key: e.pos,
|
|
1123
1125
|
class: "image-overlay__handle",
|
|
1124
1126
|
style: H(e.style),
|
|
1125
1127
|
"data-handle": e.pos,
|
|
1126
|
-
onMousedown: Y((t) =>
|
|
1127
|
-
}, null, 44,
|
|
1128
|
+
onMousedown: Y((t) => se(t, e.pos), ["prevent", "stop"])
|
|
1129
|
+
}, null, 44, Yr))), 128)),
|
|
1128
1130
|
r[5] ||= L("div", { class: "image-overlay__rotate-line" }, null, -1),
|
|
1129
1131
|
L("div", {
|
|
1130
1132
|
class: "image-overlay__rotate-handle",
|
|
1131
|
-
style: H({ left: `${
|
|
1133
|
+
style: H({ left: `${E.value / 2 - 7}px` }),
|
|
1132
1134
|
title: q(n)("imageOverlay.rotate"),
|
|
1133
|
-
onMousedown: r[2] ||= Y((e) =>
|
|
1134
|
-
}, null, 44,
|
|
1135
|
-
o.value ? (U(), I("div",
|
|
1136
|
-
l.value ? (U(), I("div",
|
|
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)
|
|
1137
1139
|
], 36)) : F("", !0);
|
|
1138
1140
|
}
|
|
1139
|
-
}), [["__scopeId", "data-v-
|
|
1141
|
+
}), [["__scopeId", "data-v-4c3d1a1d"]]), ii = ["title", "aria-label"], ai = /* @__PURE__ */ z({
|
|
1140
1142
|
__name: "OutlineToggleButton",
|
|
1141
1143
|
props: {
|
|
1142
1144
|
leftOffset: {},
|
|
@@ -1156,12 +1158,12 @@ var qr = ["data-handle", "onMousedown"], Jr = ["title"], Yr = {
|
|
|
1156
1158
|
"aria-label": q(t)("editor.showDocumentOutline"),
|
|
1157
1159
|
onClick: i[0] ||= (e) => n.$emit("toggle"),
|
|
1158
1160
|
onMousedown: i[1] ||= Y(() => {}, ["stop"])
|
|
1159
|
-
}, [
|
|
1161
|
+
}, [R(r, {
|
|
1160
1162
|
name: "format_list_bulleted",
|
|
1161
1163
|
size: 20
|
|
1162
|
-
})], 44,
|
|
1164
|
+
})], 44, ii));
|
|
1163
1165
|
}
|
|
1164
|
-
}),
|
|
1166
|
+
}), oi = /*#__PURE__*/ t(/* @__PURE__ */ z({
|
|
1165
1167
|
__name: "PageIndicator",
|
|
1166
1168
|
props: {
|
|
1167
1169
|
currentPage: {},
|
|
@@ -1180,7 +1182,7 @@ var qr = ["data-handle", "onMousedown"], Jr = ["title"], Yr = {
|
|
|
1180
1182
|
total: e.totalPages
|
|
1181
1183
|
})), 5));
|
|
1182
1184
|
}
|
|
1183
|
-
}), [["__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({
|
|
1184
1186
|
__name: "TemplateDirectivesOverlay",
|
|
1185
1187
|
props: {
|
|
1186
1188
|
getView: { type: Function },
|
|
@@ -1192,21 +1194,21 @@ var qr = ["data-handle", "onMousedown"], Jr = ["title"], Yr = {
|
|
|
1192
1194
|
measures: {}
|
|
1193
1195
|
},
|
|
1194
1196
|
setup(e) {
|
|
1195
|
-
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";
|
|
1196
1198
|
function a(e) {
|
|
1197
|
-
let t = e -
|
|
1198
|
-
return t <= 0 ? 0 : Math.floor(t /
|
|
1199
|
+
let t = e - di - li - fi;
|
|
1200
|
+
return t <= 0 ? 0 : Math.floor(t / ui);
|
|
1199
1201
|
}
|
|
1200
1202
|
function o(e, t, n) {
|
|
1201
1203
|
let r = a(n), i = Math.min(Math.max(0, e), r);
|
|
1202
|
-
return t -
|
|
1204
|
+
return t - di - li - (r - i) * ui;
|
|
1203
1205
|
}
|
|
1204
1206
|
function s(e, t) {
|
|
1205
|
-
if (t.length === 0) return e.bottom - e.top >=
|
|
1207
|
+
if (t.length === 0) return e.bottom - e.top >= pi ? [e] : [];
|
|
1206
1208
|
let n = [];
|
|
1207
1209
|
for (let r of t) {
|
|
1208
1210
|
let t = Math.max(e.top, r.top), i = Math.min(e.bottom, r.bottom);
|
|
1209
|
-
i - t >=
|
|
1211
|
+
i - t >= pi && n.push({
|
|
1210
1212
|
top: t,
|
|
1211
1213
|
bottom: i
|
|
1212
1214
|
});
|
|
@@ -1283,12 +1285,12 @@ var qr = ["data-handle", "onMousedown"], Jr = ["title"], Yr = {
|
|
|
1283
1285
|
f.value = [], p.value = [], m.value = null, h.value = null;
|
|
1284
1286
|
return;
|
|
1285
1287
|
}
|
|
1286
|
-
let a =
|
|
1288
|
+
let a = yt(i);
|
|
1287
1289
|
if (a.length === 0) {
|
|
1288
1290
|
f.value = [], p.value = [], m.value = null, h.value = null;
|
|
1289
1291
|
return;
|
|
1290
1292
|
}
|
|
1291
|
-
let o =
|
|
1293
|
+
let o = Ge(r, t.zoom), s = await Ke(a, {
|
|
1292
1294
|
pagesContainer: r,
|
|
1293
1295
|
zoom: t.zoom,
|
|
1294
1296
|
layout: t.layout,
|
|
@@ -1304,78 +1306,78 @@ var qr = ["data-handle", "onMousedown"], Jr = ["title"], Yr = {
|
|
|
1304
1306
|
t.blocks,
|
|
1305
1307
|
t.measures
|
|
1306
1308
|
], () => y());
|
|
1307
|
-
let x = N(() => c(f.value)),
|
|
1309
|
+
let x = N(() => c(f.value)), S = N(() => m.value ? d(x.value, p.value, m.value) : []), C = N(() => {
|
|
1308
1310
|
let e = /* @__PURE__ */ new Map();
|
|
1309
1311
|
for (let t of x.value) e.set(t.openerFrom, t.blockId), e.set(t.closerFrom, t.blockId);
|
|
1310
1312
|
return e;
|
|
1311
|
-
}),
|
|
1313
|
+
}), ee = N(() => {
|
|
1312
1314
|
let e = /* @__PURE__ */ new Map();
|
|
1313
1315
|
for (let t of x.value) e.set(t.closerFrom, l(t.kind, t.openerExpr));
|
|
1314
1316
|
return e;
|
|
1315
|
-
}),
|
|
1316
|
-
function
|
|
1317
|
-
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;
|
|
1318
1320
|
}
|
|
1319
|
-
function
|
|
1321
|
+
function ne(e) {
|
|
1320
1322
|
return e.block && (n.has(e.kind) || r.has(e.kind));
|
|
1321
1323
|
}
|
|
1322
|
-
function
|
|
1323
|
-
return e.block ?
|
|
1324
|
+
function T(e) {
|
|
1325
|
+
return e.block ? C.value.get(e.from) : void 0;
|
|
1324
1326
|
}
|
|
1325
|
-
function
|
|
1326
|
-
return e.block ?
|
|
1327
|
+
function re(e) {
|
|
1328
|
+
return e.block ? ee.value.get(e.from) : void 0;
|
|
1327
1329
|
}
|
|
1328
|
-
function
|
|
1329
|
-
let t =
|
|
1330
|
+
function ie(e) {
|
|
1331
|
+
let t = T(e), n = t !== void 0 && w(t);
|
|
1330
1332
|
return [
|
|
1331
1333
|
"folio-template-directive",
|
|
1332
1334
|
`folio-template-directive--${e.kind}`,
|
|
1333
|
-
{ "folio-template-directive--block":
|
|
1335
|
+
{ "folio-template-directive--block": ne(e) },
|
|
1334
1336
|
{ "folio-template-directive--active": n }
|
|
1335
1337
|
];
|
|
1336
1338
|
}
|
|
1337
|
-
function
|
|
1339
|
+
function E(e) {
|
|
1338
1340
|
if (!(e instanceof HTMLElement)) return null;
|
|
1339
1341
|
let t = e.dataset.folioBlockId;
|
|
1340
1342
|
return t === void 0 ? null : Number(t);
|
|
1341
1343
|
}
|
|
1342
|
-
function
|
|
1343
|
-
let t =
|
|
1344
|
+
function D(e) {
|
|
1345
|
+
let t = E(e.target);
|
|
1344
1346
|
t !== null && (g.value = t);
|
|
1345
1347
|
}
|
|
1346
|
-
function
|
|
1347
|
-
let t =
|
|
1348
|
+
function ae(e) {
|
|
1349
|
+
let t = E(e.target);
|
|
1348
1350
|
if (t === null) return;
|
|
1349
|
-
let n =
|
|
1351
|
+
let n = E(e.relatedTarget);
|
|
1350
1352
|
n !== t && g.value === t && (g.value = n);
|
|
1351
1353
|
}
|
|
1352
|
-
return
|
|
1354
|
+
return xe(() => y()), be(() => {
|
|
1353
1355
|
v !== null && (cancelAnimationFrame(v), v = null);
|
|
1354
1356
|
}), (t, n) => (U(), I("div", {
|
|
1355
1357
|
class: "folio-template-directives-overlay",
|
|
1356
1358
|
"data-folio-template-directives-overlay": "",
|
|
1357
|
-
onPointerover:
|
|
1358
|
-
onPointerout:
|
|
1359
|
-
}, [(U(!0), I(
|
|
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", {
|
|
1360
1362
|
key: `rail:${t.blockId}:${r}`,
|
|
1361
1363
|
class: V([
|
|
1362
1364
|
"folio-template-band-rail",
|
|
1363
1365
|
`folio-template-band-rail--${t.kind}`,
|
|
1364
|
-
{ "folio-template-band-rail--active":
|
|
1366
|
+
{ "folio-template-band-rail--active": w(t.blockId) }
|
|
1365
1367
|
]),
|
|
1366
1368
|
"data-folio-block-id": t.blockId,
|
|
1367
1369
|
style: H({
|
|
1368
1370
|
position: "absolute",
|
|
1369
1371
|
left: `${t.railX * e.zoom}px`,
|
|
1370
1372
|
top: `${n.top * e.zoom}px`,
|
|
1371
|
-
width: `${
|
|
1373
|
+
width: `${li * e.zoom}px`,
|
|
1372
1374
|
height: `${Math.max(0, n.bottom - n.top) * e.zoom}px`
|
|
1373
1375
|
})
|
|
1374
|
-
}, 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", {
|
|
1375
1377
|
key: `d:${n}:${i}`,
|
|
1376
|
-
class: V(
|
|
1377
|
-
"data-folio-block-id":
|
|
1378
|
-
title:
|
|
1378
|
+
class: V(ie(t.range)),
|
|
1379
|
+
"data-folio-block-id": T(t.range),
|
|
1380
|
+
title: re(t.range),
|
|
1379
1381
|
style: H({
|
|
1380
1382
|
position: "absolute",
|
|
1381
1383
|
left: `${(r.x - 1) * e.zoom}px`,
|
|
@@ -1383,9 +1385,9 @@ var qr = ["data-handle", "onMousedown"], Jr = ["title"], Yr = {
|
|
|
1383
1385
|
width: `${(r.width + 2) * e.zoom}px`,
|
|
1384
1386
|
height: `${Math.max(0, r.height - 2) * e.zoom}px`
|
|
1385
1387
|
})
|
|
1386
|
-
}, null, 14,
|
|
1388
|
+
}, null, 14, ci))), 128))], 64))), 128))], 32));
|
|
1387
1389
|
}
|
|
1388
|
-
}), [["__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({
|
|
1389
1391
|
__name: "HyperlinkPopup",
|
|
1390
1392
|
props: {
|
|
1391
1393
|
data: {},
|
|
@@ -1417,7 +1419,7 @@ var qr = ["data-handle", "onMousedown"], Jr = ["title"], Yr = {
|
|
|
1417
1419
|
}, f = setTimeout(() => {
|
|
1418
1420
|
d && document.addEventListener("mousedown", d);
|
|
1419
1421
|
}, 0));
|
|
1420
|
-
}, { immediate: !0 }),
|
|
1422
|
+
}, { immediate: !0 }), be(p);
|
|
1421
1423
|
function m() {
|
|
1422
1424
|
r.data && (o.value = r.data.displayText, s.value = r.data.href, a.value = !0);
|
|
1423
1425
|
}
|
|
@@ -1434,28 +1436,28 @@ var qr = ["data-handle", "onMousedown"], Jr = ["title"], Yr = {
|
|
|
1434
1436
|
class: V(["docx-hyperlink-popup", { "docx-hyperlink-popup--edit": a.value }]),
|
|
1435
1437
|
style: H(u.value),
|
|
1436
1438
|
onMousedown: r[6] ||= Y(() => {}, ["stop"])
|
|
1437
|
-
}, [a.value ? (U(), I(
|
|
1439
|
+
}, [a.value ? (U(), I(j, { key: 1 }, [L("div", yi, [De(L("input", {
|
|
1438
1440
|
class: "docx-hyperlink-popup__input",
|
|
1439
1441
|
placeholder: q(n)("displayText"),
|
|
1440
1442
|
"onUpdate:modelValue": r[2] ||= (e) => o.value = e,
|
|
1441
|
-
onKeydown: [
|
|
1442
|
-
}, null, 40,
|
|
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", {
|
|
1443
1445
|
class: "docx-hyperlink-popup__input",
|
|
1444
1446
|
placeholder: "https://...",
|
|
1445
1447
|
"onUpdate:modelValue": r[4] ||= (e) => s.value = e,
|
|
1446
|
-
onKeydown: [
|
|
1447
|
-
}, null, 40,
|
|
1448
|
+
onKeydown: [Oe(Y(h, ["prevent"]), ["enter"]), r[5] ||= Oe((e) => t.$emit("close"), ["esc"])]
|
|
1449
|
+
}, null, 40, Si), [[Te, s.value]]), L("button", {
|
|
1448
1450
|
class: "docx-hyperlink-popup__apply",
|
|
1449
1451
|
disabled: !s.value.trim(),
|
|
1450
1452
|
onClick: Y(h, ["prevent"])
|
|
1451
|
-
}, K(q(n)("common.apply")), 9,
|
|
1452
|
-
r[10] ||=
|
|
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),
|
|
1453
1455
|
L("a", {
|
|
1454
1456
|
class: "docx-hyperlink-popup__url",
|
|
1455
1457
|
href: e.data.href,
|
|
1456
1458
|
title: e.data.href,
|
|
1457
1459
|
onClick: r[0] ||= Y((n) => t.$emit("navigate", e.data.href), ["prevent"])
|
|
1458
|
-
}, K(e.data.href), 9,
|
|
1460
|
+
}, K(e.data.href), 9, hi),
|
|
1459
1461
|
r[11] ||= L("span", { class: "docx-hyperlink-popup__sep" }, null, -1),
|
|
1460
1462
|
L("button", {
|
|
1461
1463
|
class: "docx-hyperlink-popup__btn",
|
|
@@ -1477,7 +1479,7 @@ var qr = ["data-handle", "onMousedown"], Jr = ["title"], Yr = {
|
|
|
1477
1479
|
height: "13",
|
|
1478
1480
|
rx: "2",
|
|
1479
1481
|
ry: "2"
|
|
1480
|
-
}), 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,
|
|
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),
|
|
1481
1483
|
e.readOnly ? F("", !0) : (U(), I("button", {
|
|
1482
1484
|
key: 0,
|
|
1483
1485
|
class: "docx-hyperlink-popup__btn",
|
|
@@ -1492,43 +1494,43 @@ var qr = ["data-handle", "onMousedown"], Jr = ["title"], Yr = {
|
|
|
1492
1494
|
"stroke-width": "2",
|
|
1493
1495
|
"stroke-linecap": "round",
|
|
1494
1496
|
"stroke-linejoin": "round"
|
|
1495
|
-
}, [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,
|
|
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)),
|
|
1496
1498
|
e.readOnly ? F("", !0) : (U(), I("button", {
|
|
1497
1499
|
key: 1,
|
|
1498
1500
|
class: "docx-hyperlink-popup__btn",
|
|
1499
1501
|
title: q(n)("removeLink"),
|
|
1500
1502
|
onClick: r[1] ||= Y((e) => t.$emit("remove"), ["prevent"])
|
|
1501
|
-
}, [...r[9] ||= [
|
|
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))
|
|
1502
1504
|
], 64))], 38)) : F("", !0);
|
|
1503
1505
|
}
|
|
1504
|
-
}), [["__scopeId", "data-v-
|
|
1506
|
+
}), [["__scopeId", "data-v-366df18c"]]);
|
|
1505
1507
|
//#endregion
|
|
1506
1508
|
//#region src/composables/commentMarks.ts
|
|
1507
|
-
function
|
|
1509
|
+
function Ti(e, t) {
|
|
1508
1510
|
let n = Math.max(0, Math.min(t.from, e)), r = Math.max(n, Math.min(t.to, e));
|
|
1509
1511
|
return n === r ? null : {
|
|
1510
1512
|
from: n,
|
|
1511
1513
|
to: r
|
|
1512
1514
|
};
|
|
1513
1515
|
}
|
|
1514
|
-
function
|
|
1516
|
+
function Ei({ docSize: e, capturedRange: t, currentRange: n, savedRange: r }) {
|
|
1515
1517
|
let i = t.from === t.to ? n.from === n.to ? r && r.from !== r.to ? r : null : n : t;
|
|
1516
|
-
return i ?
|
|
1518
|
+
return i ? Ti(e, i) : null;
|
|
1517
1519
|
}
|
|
1518
|
-
function
|
|
1519
|
-
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);
|
|
1520
1522
|
if (!i || !a) return !1;
|
|
1521
1523
|
let o = e.state.tr;
|
|
1522
|
-
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;
|
|
1523
1525
|
}
|
|
1524
|
-
function
|
|
1525
|
-
let n = e.state.schema.marks.comment, r =
|
|
1526
|
-
!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 })));
|
|
1527
1529
|
}
|
|
1528
1530
|
//#endregion
|
|
1529
1531
|
//#region src/composables/useCommentLifecycle.ts
|
|
1530
|
-
var
|
|
1531
|
-
function
|
|
1532
|
+
var ki = 408, Ai = 12;
|
|
1533
|
+
function ji(e) {
|
|
1532
1534
|
let t = W(!1), n = W(null), r = W(null), i = W(null), a = W(null);
|
|
1533
1535
|
function o(t) {
|
|
1534
1536
|
let n = e.editorView.value, r = e.pagesContainer.value;
|
|
@@ -1561,7 +1563,7 @@ function ki(e) {
|
|
|
1561
1563
|
r.value = null;
|
|
1562
1564
|
return;
|
|
1563
1565
|
}
|
|
1564
|
-
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;
|
|
1565
1567
|
r.value = {
|
|
1566
1568
|
top: c.top - l.top,
|
|
1567
1569
|
left: Math.max(16, Math.min(d, l.width - 16)),
|
|
@@ -1572,7 +1574,7 @@ function ki(e) {
|
|
|
1572
1574
|
function c() {
|
|
1573
1575
|
let s = e.editorView.value;
|
|
1574
1576
|
if (!s) return;
|
|
1575
|
-
let c = r.value, l = s.state.selection, u =
|
|
1577
|
+
let c = r.value, l = s.state.selection, u = Ei({
|
|
1576
1578
|
docSize: s.state.doc.content.size,
|
|
1577
1579
|
capturedRange: c ? {
|
|
1578
1580
|
from: c.from,
|
|
@@ -1591,7 +1593,7 @@ function ki(e) {
|
|
|
1591
1593
|
r.value = null;
|
|
1592
1594
|
return;
|
|
1593
1595
|
}
|
|
1594
|
-
if (!
|
|
1596
|
+
if (!Di(s, u, Ct, { selectEnd: !0 })) {
|
|
1595
1597
|
r.value = null, i.value = null;
|
|
1596
1598
|
return;
|
|
1597
1599
|
}
|
|
@@ -1604,11 +1606,11 @@ function ki(e) {
|
|
|
1604
1606
|
let n = e.editorView.value, r = i.value;
|
|
1605
1607
|
if (!n || !r) return !1;
|
|
1606
1608
|
let a = e.createComment(t);
|
|
1607
|
-
return
|
|
1609
|
+
return Di(n, r, a.id, { replacePending: !0 }) ? (e.pushComment(a), e.reLayout(), e.setActiveSidebarItem(`comment-${a.id}`), l(), !0) : !1;
|
|
1608
1610
|
}
|
|
1609
1611
|
function d() {
|
|
1610
1612
|
let t = e.editorView.value;
|
|
1611
|
-
t && i.value &&
|
|
1613
|
+
t && i.value && Oi(t, i.value), l();
|
|
1612
1614
|
}
|
|
1613
1615
|
return {
|
|
1614
1616
|
isAddingComment: t,
|
|
@@ -1622,8 +1624,8 @@ function ki(e) {
|
|
|
1622
1624
|
}
|
|
1623
1625
|
//#endregion
|
|
1624
1626
|
//#region src/composables/useCommentManagement.ts
|
|
1625
|
-
function
|
|
1626
|
-
let t =
|
|
1627
|
+
function Mi(e) {
|
|
1628
|
+
let t = wt(), n = W([]), r = W(!1);
|
|
1627
1629
|
function i() {
|
|
1628
1630
|
r.value = !0;
|
|
1629
1631
|
}
|
|
@@ -1638,12 +1640,12 @@ function Ai(e) {
|
|
|
1638
1640
|
i(), c([...s.value, e]);
|
|
1639
1641
|
}
|
|
1640
1642
|
function u(n, r) {
|
|
1641
|
-
return
|
|
1643
|
+
return Tt(t, s.value, e.editorView.value), Et(t, n, e.author(), r);
|
|
1642
1644
|
}
|
|
1643
1645
|
function d() {
|
|
1644
1646
|
if (a(), o.value) return;
|
|
1645
1647
|
let n = e.getDocument()?.package.document.comments;
|
|
1646
|
-
|
|
1648
|
+
Tt(t, n, e.editorView.value), c(n && n.length > 0 ? n : []);
|
|
1647
1649
|
}
|
|
1648
1650
|
function f(e, t) {
|
|
1649
1651
|
l(u(t, e));
|
|
@@ -1669,8 +1671,8 @@ function Ai(e) {
|
|
|
1669
1671
|
function _(t, n) {
|
|
1670
1672
|
let r = e.editorView.value;
|
|
1671
1673
|
if (!r) return;
|
|
1672
|
-
let i =
|
|
1673
|
-
i && (n ?
|
|
1674
|
+
let i = Dt(r, t);
|
|
1675
|
+
i && (n ? kt : Mt)(i.from, i.to)(r.state, r.dispatch);
|
|
1674
1676
|
}
|
|
1675
1677
|
function v(e) {
|
|
1676
1678
|
_(e, !0);
|
|
@@ -1680,11 +1682,11 @@ function Ai(e) {
|
|
|
1680
1682
|
}
|
|
1681
1683
|
function b(t, n) {
|
|
1682
1684
|
let r = e.editorView.value;
|
|
1683
|
-
r &&
|
|
1685
|
+
r && kt(t, n)(r.state, r.dispatch);
|
|
1684
1686
|
}
|
|
1685
1687
|
function x(t, n) {
|
|
1686
1688
|
let r = e.editorView.value;
|
|
1687
|
-
r &&
|
|
1689
|
+
r && Mt(t, n)(r.state, r.dispatch);
|
|
1688
1690
|
}
|
|
1689
1691
|
return {
|
|
1690
1692
|
comments: s,
|
|
@@ -1707,8 +1709,8 @@ function Ai(e) {
|
|
|
1707
1709
|
}
|
|
1708
1710
|
//#endregion
|
|
1709
1711
|
//#region src/utils/imageClipboard.ts
|
|
1710
|
-
function
|
|
1711
|
-
let r =
|
|
1712
|
+
function Ni(e, t, n) {
|
|
1713
|
+
let r = Nt(e.state), i = e.state.schema.marks.insertion;
|
|
1712
1714
|
if (!r || !i) return;
|
|
1713
1715
|
let a = t.selection.from, o = a - n.nodeSize;
|
|
1714
1716
|
o < 0 || t.addMark(o, a, i.create({
|
|
@@ -1717,7 +1719,7 @@ function ji(e, t, n) {
|
|
|
1717
1719
|
date: r.date
|
|
1718
1720
|
}));
|
|
1719
1721
|
}
|
|
1720
|
-
function
|
|
1722
|
+
function Pi(e, t) {
|
|
1721
1723
|
let n = e.state.doc.nodeAt(t);
|
|
1722
1724
|
if (!n || n.type.name !== "image") return;
|
|
1723
1725
|
let r = n.attrs.src;
|
|
@@ -1731,7 +1733,7 @@ function Mi(e, t) {
|
|
|
1731
1733
|
e.value = i, document.body.appendChild(e), e.select(), document.execCommand("copy"), document.body.removeChild(e);
|
|
1732
1734
|
});
|
|
1733
1735
|
}
|
|
1734
|
-
function
|
|
1736
|
+
function Fi(e) {
|
|
1735
1737
|
return new Promise((t, n) => {
|
|
1736
1738
|
let r = new FileReader();
|
|
1737
1739
|
r.onload = () => {
|
|
@@ -1739,7 +1741,7 @@ function Ni(e) {
|
|
|
1739
1741
|
}, r.onerror = () => n(r.error ?? /* @__PURE__ */ Error("Failed to read blob")), r.readAsDataURL(e);
|
|
1740
1742
|
});
|
|
1741
1743
|
}
|
|
1742
|
-
function
|
|
1744
|
+
function Ii(e) {
|
|
1743
1745
|
return new Promise((t) => {
|
|
1744
1746
|
let n = new Image();
|
|
1745
1747
|
n.onload = () => t({
|
|
@@ -1751,7 +1753,7 @@ function Pi(e) {
|
|
|
1751
1753
|
}), n.src = e;
|
|
1752
1754
|
});
|
|
1753
1755
|
}
|
|
1754
|
-
function
|
|
1756
|
+
function Li(e, t, n, r) {
|
|
1755
1757
|
let i = e.state.schema.nodes.image;
|
|
1756
1758
|
if (!i) return;
|
|
1757
1759
|
let a = i.create({
|
|
@@ -1762,23 +1764,23 @@ function Fi(e, t, n, r) {
|
|
|
1762
1764
|
wrapType: "inline",
|
|
1763
1765
|
displayMode: "inline"
|
|
1764
1766
|
}), o = e.state.tr.replaceSelectionWith(a);
|
|
1765
|
-
|
|
1767
|
+
Ni(e, o, a), e.dispatch(o);
|
|
1766
1768
|
}
|
|
1767
|
-
async function
|
|
1769
|
+
async function Ri(e) {
|
|
1768
1770
|
try {
|
|
1769
1771
|
let t = await navigator.clipboard.read();
|
|
1770
1772
|
for (let n of t) {
|
|
1771
1773
|
let t = n.types.find((e) => e.startsWith("image/"));
|
|
1772
1774
|
if (t) {
|
|
1773
|
-
let r = await
|
|
1774
|
-
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);
|
|
1775
1777
|
return;
|
|
1776
1778
|
}
|
|
1777
1779
|
if (n.types.includes("text/html")) {
|
|
1778
1780
|
let t = await (await n.getType("text/html")).text(), r = /<img[^>]+src="(?<src>[^"]+)"[^>]*>/iu.exec(t)?.groups?.src;
|
|
1779
1781
|
if (r) {
|
|
1780
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;
|
|
1781
|
-
|
|
1783
|
+
Li(e, r, a || 200, o || 200);
|
|
1782
1784
|
return;
|
|
1783
1785
|
}
|
|
1784
1786
|
}
|
|
@@ -1799,14 +1801,14 @@ async function Ii(e) {
|
|
|
1799
1801
|
}
|
|
1800
1802
|
}
|
|
1801
1803
|
}
|
|
1802
|
-
function
|
|
1804
|
+
function zi(e, t) {
|
|
1803
1805
|
let n = e.state.doc.nodeAt(t);
|
|
1804
1806
|
if (!n || n.type.name !== "image") return;
|
|
1805
1807
|
let r = document.createElement("input");
|
|
1806
1808
|
r.type = "file", r.accept = "image/*", r.onchange = async () => {
|
|
1807
1809
|
let i = r.files?.[0];
|
|
1808
1810
|
if (!i) return;
|
|
1809
|
-
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);
|
|
1810
1812
|
try {
|
|
1811
1813
|
let r = e.state.tr.setNodeMarkup(t, void 0, {
|
|
1812
1814
|
...n.attrs,
|
|
@@ -1821,7 +1823,7 @@ function Li(e, t) {
|
|
|
1821
1823
|
}
|
|
1822
1824
|
//#endregion
|
|
1823
1825
|
//#region src/composables/useContextMenus.ts
|
|
1824
|
-
var
|
|
1826
|
+
var Bi = /* @__PURE__ */ new Set([
|
|
1825
1827
|
"inline",
|
|
1826
1828
|
"square",
|
|
1827
1829
|
"tight",
|
|
@@ -1830,16 +1832,16 @@ var Ri = new Set([
|
|
|
1830
1832
|
"behind",
|
|
1831
1833
|
"inFront"
|
|
1832
1834
|
]);
|
|
1833
|
-
function
|
|
1834
|
-
return typeof e == "string" &&
|
|
1835
|
+
function Vi(e) {
|
|
1836
|
+
return typeof e == "string" && Bi.has(e);
|
|
1835
1837
|
}
|
|
1836
|
-
function
|
|
1837
|
-
return
|
|
1838
|
+
function Hi(e) {
|
|
1839
|
+
return Vi(e) ? e : "inline";
|
|
1838
1840
|
}
|
|
1839
|
-
function
|
|
1841
|
+
function Ui(e) {
|
|
1840
1842
|
return e === "left" || e === "right" || e === "none" ? e : null;
|
|
1841
1843
|
}
|
|
1842
|
-
function
|
|
1844
|
+
function Wi(e) {
|
|
1843
1845
|
let { t } = c(), n = W({
|
|
1844
1846
|
isOpen: !1,
|
|
1845
1847
|
position: {
|
|
@@ -1881,7 +1883,7 @@ function Hi(e) {
|
|
|
1881
1883
|
t(e.state, (t) => e.dispatch(t), e);
|
|
1882
1884
|
}
|
|
1883
1885
|
function l(t, n, r, i, a) {
|
|
1884
|
-
let o = i === "inline" ?
|
|
1886
|
+
let o = i === "inline" ? rt(t, e.zoom.value) : void 0;
|
|
1885
1887
|
return {
|
|
1886
1888
|
open: !0,
|
|
1887
1889
|
position: r,
|
|
@@ -1894,12 +1896,12 @@ function Hi(e) {
|
|
|
1894
1896
|
function u(t) {
|
|
1895
1897
|
let a = e.editorView.value;
|
|
1896
1898
|
if (!a) return;
|
|
1897
|
-
let o =
|
|
1899
|
+
let o = at(t.target);
|
|
1898
1900
|
if (o) {
|
|
1899
1901
|
let i = Number(o.dataset.pmStart);
|
|
1900
1902
|
if (!Number.isNaN(i)) {
|
|
1901
1903
|
try {
|
|
1902
|
-
let e =
|
|
1904
|
+
let e = $e.create(a.state.doc, i);
|
|
1903
1905
|
a.dispatch(a.state.tr.setSelection(e));
|
|
1904
1906
|
} catch {}
|
|
1905
1907
|
e.selectedImage.value = {
|
|
@@ -1913,7 +1915,7 @@ function Hi(e) {
|
|
|
1913
1915
|
r.value = l(o, i, {
|
|
1914
1916
|
x: t.clientX,
|
|
1915
1917
|
y: t.clientY
|
|
1916
|
-
},
|
|
1918
|
+
}, Hi(s.attrs.wrapType), Ui(s.attrs.cssFloat)), n.value.isOpen = !1;
|
|
1917
1919
|
return;
|
|
1918
1920
|
}
|
|
1919
1921
|
}
|
|
@@ -1924,7 +1926,7 @@ function Hi(e) {
|
|
|
1924
1926
|
e.setPmSelection(i);
|
|
1925
1927
|
} catch {}
|
|
1926
1928
|
}
|
|
1927
|
-
let s =
|
|
1929
|
+
let s = St(a.state), { empty: c, from: u, to: d } = a.state.selection;
|
|
1928
1930
|
i.value = {
|
|
1929
1931
|
from: u,
|
|
1930
1932
|
to: d
|
|
@@ -1948,7 +1950,7 @@ function Hi(e) {
|
|
|
1948
1950
|
!o || o.type.name !== "image" || (r.value = l(a.element, a.pmPos, {
|
|
1949
1951
|
x: t.clientX,
|
|
1950
1952
|
y: t.clientY
|
|
1951
|
-
},
|
|
1953
|
+
}, Hi(o.attrs.wrapType), Ui(o.attrs.cssFloat)), n.value.isOpen = !1);
|
|
1952
1954
|
}
|
|
1953
1955
|
function f(t) {
|
|
1954
1956
|
let n = e.editorView.value, i = r.value;
|
|
@@ -1972,16 +1974,16 @@ function Hi(e) {
|
|
|
1972
1974
|
case "cut":
|
|
1973
1975
|
if (e.selectedImage.value) {
|
|
1974
1976
|
let t = e.selectedImage.value.pmPos;
|
|
1975
|
-
|
|
1977
|
+
Pi(n, t);
|
|
1976
1978
|
let r = n.state.doc.nodeAt(t);
|
|
1977
1979
|
r && (n.dispatch(n.state.tr.delete(t, t + r.nodeSize)), e.selectedImage.value = null);
|
|
1978
1980
|
} else n.focus(), document.execCommand("cut");
|
|
1979
1981
|
break;
|
|
1980
1982
|
case "copy":
|
|
1981
|
-
e.selectedImage.value ?
|
|
1983
|
+
e.selectedImage.value ? Pi(n, e.selectedImage.value.pmPos) : (n.focus(), document.execCommand("copy"));
|
|
1982
1984
|
break;
|
|
1983
1985
|
case "paste":
|
|
1984
|
-
|
|
1986
|
+
Ri(n);
|
|
1985
1987
|
break;
|
|
1986
1988
|
case "pasteAsPlainText":
|
|
1987
1989
|
navigator.clipboard.readText().then((e) => {
|
|
@@ -1994,7 +1996,7 @@ function Hi(e) {
|
|
|
1994
1996
|
break;
|
|
1995
1997
|
}
|
|
1996
1998
|
case "selectAll": {
|
|
1997
|
-
let e =
|
|
1999
|
+
let e = Z.create(n.state.doc, 0, n.state.doc.content.size);
|
|
1998
2000
|
n.dispatch(n.state.tr.setSelection(e));
|
|
1999
2001
|
break;
|
|
2000
2002
|
}
|
|
@@ -2002,7 +2004,7 @@ function Hi(e) {
|
|
|
2002
2004
|
e.selectedImage.value && (e.showImageProperties.value = !0);
|
|
2003
2005
|
break;
|
|
2004
2006
|
case "replaceImage":
|
|
2005
|
-
e.selectedImage.value &&
|
|
2007
|
+
e.selectedImage.value && zi(n, e.selectedImage.value.pmPos);
|
|
2006
2008
|
break;
|
|
2007
2009
|
case "deleteImage":
|
|
2008
2010
|
if (e.selectedImage.value) {
|
|
@@ -2040,7 +2042,7 @@ function Hi(e) {
|
|
|
2040
2042
|
}
|
|
2041
2043
|
//#endregion
|
|
2042
2044
|
//#region src/composables/useDocumentLifecycle.ts
|
|
2043
|
-
function
|
|
2045
|
+
function Gi(e) {
|
|
2044
2046
|
async function t(t) {
|
|
2045
2047
|
e.sidebarAutoOpenedRef.value = !1, await e.loadDocumentBuffer(t);
|
|
2046
2048
|
}
|
|
@@ -2051,50 +2053,15 @@ function Ui(e) {
|
|
|
2051
2053
|
e && t(e);
|
|
2052
2054
|
}), J(e.document, (e) => {
|
|
2053
2055
|
e && n(e);
|
|
2054
|
-
}),
|
|
2055
|
-
await
|
|
2056
|
+
}), xe(async () => {
|
|
2057
|
+
await ye();
|
|
2056
2058
|
let r = e.documentBuffer(), i = e.document();
|
|
2057
2059
|
r ? await t(r) : i && n(i);
|
|
2058
2060
|
});
|
|
2059
2061
|
}
|
|
2060
2062
|
//#endregion
|
|
2061
|
-
//#region src/utils/aiEditRange.ts
|
|
2062
|
-
var Wi = ({ blockId: e, doc: t, snapshot: n }) => {
|
|
2063
|
-
let r = ln(e);
|
|
2064
|
-
if (r !== null) {
|
|
2065
|
-
let e = on(t, r);
|
|
2066
|
-
if (e !== null) return {
|
|
2067
|
-
from: e.from,
|
|
2068
|
-
to: e.to
|
|
2069
|
-
};
|
|
2070
|
-
}
|
|
2071
|
-
let i = n ?? an(t), a = i.anchors[e] ?? Gi(e, i);
|
|
2072
|
-
return a ? Ki(t.content.size, a) : null;
|
|
2073
|
-
}, Gi = (e, t) => {
|
|
2074
|
-
let n = un(e);
|
|
2075
|
-
if (n === null) return;
|
|
2076
|
-
let r = t.blocks.at(n - 1);
|
|
2077
|
-
return r ? t.anchors[r.id] : void 0;
|
|
2078
|
-
};
|
|
2079
|
-
function Ki(e, t) {
|
|
2080
|
-
return {
|
|
2081
|
-
from: Math.min(Math.max(t.from, 0), e),
|
|
2082
|
-
to: Math.min(Math.max(t.to, 0), e)
|
|
2083
|
-
};
|
|
2084
|
-
}
|
|
2085
|
-
//#endregion
|
|
2086
|
-
//#region src/utils/pageText.ts
|
|
2087
|
-
var qi = (e, t, n) => {
|
|
2088
|
-
if (!e || !Number.isInteger(n) || n < 1) return null;
|
|
2089
|
-
let r = e.pages[n - 1];
|
|
2090
|
-
if (!r) return null;
|
|
2091
|
-
let i = [];
|
|
2092
|
-
for (let e of r.fragments) typeof e.pmStart != "number" || typeof e.pmEnd != "number" || i.push(t.textBetween(e.pmStart, e.pmEnd, "\n"));
|
|
2093
|
-
return i.join("\n");
|
|
2094
|
-
};
|
|
2095
|
-
//#endregion
|
|
2096
2063
|
//#region src/composables/useDocxEditorRefApi.ts
|
|
2097
|
-
function
|
|
2064
|
+
function Ki(e) {
|
|
2098
2065
|
function t() {
|
|
2099
2066
|
e.onPrint?.(), window.print();
|
|
2100
2067
|
}
|
|
@@ -2107,11 +2074,11 @@ function Ji(e) {
|
|
|
2107
2074
|
function r(t, n) {
|
|
2108
2075
|
let r = e.pagesRef.value;
|
|
2109
2076
|
if (!r) return !1;
|
|
2110
|
-
let i =
|
|
2077
|
+
let i = Qt(r, t), a = i.at(0);
|
|
2111
2078
|
return a ? (a.scrollIntoView({
|
|
2112
2079
|
block: "center",
|
|
2113
2080
|
behavior: "smooth"
|
|
2114
|
-
}), n?.highlight &&
|
|
2081
|
+
}), n?.highlight && $t(i, n.highlight), !0) : !1;
|
|
2115
2082
|
}
|
|
2116
2083
|
function i() {
|
|
2117
2084
|
return e.zoom.value;
|
|
@@ -2142,7 +2109,7 @@ function Ji(e) {
|
|
|
2142
2109
|
getPageNumberForPmPos: (t) => {
|
|
2143
2110
|
let n = e.layout.value;
|
|
2144
2111
|
if (!n) return null;
|
|
2145
|
-
let r =
|
|
2112
|
+
let r = Zt(n, t);
|
|
2146
2113
|
return r == null ? null : r + 1;
|
|
2147
2114
|
}
|
|
2148
2115
|
}, a;
|
|
@@ -2153,7 +2120,7 @@ function Ji(e) {
|
|
|
2153
2120
|
function c() {
|
|
2154
2121
|
let t = e.layout.value, n = e.editorView.value;
|
|
2155
2122
|
if (!t || !n) return 0;
|
|
2156
|
-
let r =
|
|
2123
|
+
let r = Zt(t, n.state.selection.from);
|
|
2157
2124
|
return r == null ? 0 : r + 1;
|
|
2158
2125
|
}
|
|
2159
2126
|
function l(t) {
|
|
@@ -2186,7 +2153,34 @@ function Ji(e) {
|
|
|
2186
2153
|
ensureEditorView: () => e.editor.ensureView(),
|
|
2187
2154
|
createAIEditSnapshot: () => {
|
|
2188
2155
|
let t = e.editorView.value;
|
|
2189
|
-
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
|
+
});
|
|
2190
2184
|
},
|
|
2191
2185
|
applyAIEditOperations: ({ snapshot: t, operations: n, mode: r = "tracked-changes", author: i = e.author() }) => {
|
|
2192
2186
|
let a = e.editorView.value;
|
|
@@ -2207,54 +2201,54 @@ function Ji(e) {
|
|
|
2207
2201
|
},
|
|
2208
2202
|
acceptAIEditOperation: (t) => {
|
|
2209
2203
|
let n = e.editorView.value;
|
|
2210
|
-
return n ?
|
|
2204
|
+
return n ? Ot(t)(n.state, n.dispatch) : !1;
|
|
2211
2205
|
},
|
|
2212
2206
|
rejectAIEditOperation: (t) => {
|
|
2213
2207
|
let n = e.editorView.value;
|
|
2214
|
-
return n ?
|
|
2208
|
+
return n ? jt(t)(n.state, n.dispatch) : !1;
|
|
2215
2209
|
},
|
|
2216
2210
|
undo: () => e.editor.undo(),
|
|
2217
2211
|
redo: () => e.editor.redo(),
|
|
2218
2212
|
scrollToAIEditOperation: (t) => {
|
|
2219
2213
|
let n = e.editorView.value;
|
|
2220
2214
|
if (!n) return !1;
|
|
2221
|
-
let r =
|
|
2215
|
+
let r = At(n.state, t);
|
|
2222
2216
|
if (!r) return !1;
|
|
2223
|
-
let { from: i, to: a } =
|
|
2224
|
-
return n.dispatch(n.state.tr.setSelection(
|
|
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);
|
|
2218
|
+
return n.dispatch(n.state.tr.setSelection(Z.between(o, s))), requestAnimationFrame(() => e.scrollVisiblePositionIntoView(i)), !0;
|
|
2225
2219
|
},
|
|
2226
2220
|
scrollToBlock: (t, n) => {
|
|
2227
2221
|
let r = e.editorView.value;
|
|
2228
2222
|
if (!r) return !1;
|
|
2229
|
-
let i =
|
|
2223
|
+
let i = ln({
|
|
2230
2224
|
blockId: t,
|
|
2231
2225
|
doc: r.state.doc,
|
|
2232
2226
|
snapshot: n
|
|
2233
2227
|
});
|
|
2234
2228
|
if (i === null) return !1;
|
|
2235
2229
|
let { from: a, to: o } = i, s = r.state.doc.resolve(a), c = r.state.doc.resolve(o);
|
|
2236
|
-
return r.dispatch(r.state.tr.setSelection(
|
|
2230
|
+
return r.dispatch(r.state.tr.setSelection(Z.between(s, c))), requestAnimationFrame(() => e.scrollVisiblePositionIntoView(a)), !0;
|
|
2237
2231
|
},
|
|
2238
2232
|
getTrackedChanges: () => {
|
|
2239
2233
|
let t = e.editorView.value;
|
|
2240
|
-
return t ?
|
|
2234
|
+
return t ? Jt(t.state.doc) : [];
|
|
2241
2235
|
},
|
|
2242
2236
|
getCommentAnchors: () => {
|
|
2243
2237
|
let t = e.editorView.value;
|
|
2244
|
-
return t ?
|
|
2238
|
+
return t ? Kt(t.state.doc) : [];
|
|
2245
2239
|
},
|
|
2246
2240
|
getSelectionText: () => {
|
|
2247
2241
|
let t = e.editorView.value;
|
|
2248
|
-
return t ?
|
|
2242
|
+
return t ? je(t.state) : "";
|
|
2249
2243
|
},
|
|
2250
2244
|
getPageText: (t) => {
|
|
2251
2245
|
let n = e.editorView.value;
|
|
2252
|
-
return n ?
|
|
2246
|
+
return n ? un(e.layout.value, n.state.doc, t) : null;
|
|
2253
2247
|
},
|
|
2254
2248
|
getContentControls: (t = {}) => {
|
|
2255
2249
|
let n = e.editorView.value;
|
|
2256
|
-
return n ?
|
|
2257
|
-
properties:
|
|
2250
|
+
return n ? nn(n.state.doc, t).map((e) => ({
|
|
2251
|
+
properties: en(e.node),
|
|
2258
2252
|
path: e.path,
|
|
2259
2253
|
pmPos: e.pos
|
|
2260
2254
|
})) : [];
|
|
@@ -2262,60 +2256,60 @@ function Ji(e) {
|
|
|
2262
2256
|
scrollToContentControl: (t) => {
|
|
2263
2257
|
let n = e.editorView.value;
|
|
2264
2258
|
if (!n) return !1;
|
|
2265
|
-
let r =
|
|
2259
|
+
let r = tn(n.state.doc, t);
|
|
2266
2260
|
if (!r) return !1;
|
|
2267
2261
|
let i = r.pos + 1, a = n.state.doc.resolve(i);
|
|
2268
|
-
return n.dispatch(n.state.tr.setSelection(
|
|
2262
|
+
return n.dispatch(n.state.tr.setSelection(Z.near(a))), requestAnimationFrame(() => e.scrollVisiblePositionIntoView(i)), !0;
|
|
2269
2263
|
},
|
|
2270
2264
|
setContentControlContent: (t, n, r = {}) => {
|
|
2271
2265
|
let i = e.editorView.value;
|
|
2272
2266
|
if (!i) return !1;
|
|
2273
|
-
let a = typeof n == "string" ?
|
|
2267
|
+
let a = typeof n == "string" ? an(i.state, t, n, r) : sn(i.state, t, n, r);
|
|
2274
2268
|
return a ? (i.dispatch(a), !0) : !1;
|
|
2275
2269
|
},
|
|
2276
2270
|
setContentControlValue: (t, n, r = {}) => {
|
|
2277
2271
|
let i = e.editorView.value;
|
|
2278
2272
|
if (!i) return !1;
|
|
2279
|
-
let a =
|
|
2273
|
+
let a = on(i.state, t, n, r);
|
|
2280
2274
|
return a ? (i.dispatch(a), !0) : !1;
|
|
2281
2275
|
},
|
|
2282
2276
|
removeContentControl: (t, n = {}) => {
|
|
2283
2277
|
let r = e.editorView.value;
|
|
2284
2278
|
if (!r) return !1;
|
|
2285
|
-
let i =
|
|
2279
|
+
let i = rn(r.state, t, n);
|
|
2286
2280
|
return i ? (r.dispatch(i), !0) : !1;
|
|
2287
2281
|
}
|
|
2288
2282
|
} };
|
|
2289
2283
|
}
|
|
2290
2284
|
//#endregion
|
|
2291
2285
|
//#region src/composables/useFormattingActions.ts
|
|
2292
|
-
function
|
|
2286
|
+
function qi(e) {
|
|
2293
2287
|
let t = () => e.activeView?.value ?? e.editorView.value;
|
|
2294
2288
|
function n() {
|
|
2295
2289
|
let e = t();
|
|
2296
|
-
e && (
|
|
2290
|
+
e && (xt(e.state, e.dispatch, e), e.focus());
|
|
2297
2291
|
}
|
|
2298
2292
|
function r(n) {
|
|
2299
2293
|
let r = t();
|
|
2300
2294
|
if (!r) return;
|
|
2301
2295
|
let i = e.getDocument(), a = i?.package?.styles;
|
|
2302
2296
|
if (a) {
|
|
2303
|
-
let e =
|
|
2304
|
-
e.paragraphFormatting && (t.paragraphFormatting = e.paragraphFormatting), e.runFormatting && (t.runFormatting = e.runFormatting),
|
|
2305
|
-
} 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));
|
|
2306
2300
|
r.focus();
|
|
2307
2301
|
}
|
|
2308
2302
|
function i() {
|
|
2309
2303
|
let t = e.editorView.value;
|
|
2310
|
-
t && (
|
|
2304
|
+
t && (_n(t.state, (e) => t.dispatch(e), t), t.focus());
|
|
2311
2305
|
}
|
|
2312
2306
|
function a() {
|
|
2313
2307
|
let t = e.editorView.value;
|
|
2314
|
-
t && (
|
|
2308
|
+
t && (yn(t.state, (e) => t.dispatch(e), t), t.focus());
|
|
2315
2309
|
}
|
|
2316
2310
|
function o() {
|
|
2317
2311
|
let t = e.editorView.value;
|
|
2318
|
-
t && (
|
|
2312
|
+
t && (vn(t.state, (e) => t.dispatch(e), t), t.focus());
|
|
2319
2313
|
}
|
|
2320
2314
|
function s(e) {
|
|
2321
2315
|
let n = t();
|
|
@@ -2334,7 +2328,7 @@ function Yi(e) {
|
|
|
2334
2328
|
}
|
|
2335
2329
|
//#endregion
|
|
2336
2330
|
//#region src/composables/useHyperlinkManagement.ts
|
|
2337
|
-
function
|
|
2331
|
+
function Ji(e) {
|
|
2338
2332
|
let t = W(null);
|
|
2339
2333
|
function n(e, t) {
|
|
2340
2334
|
t(e.state, (t) => e.dispatch(t), e);
|
|
@@ -2365,14 +2359,14 @@ function Xi(e) {
|
|
|
2365
2359
|
}
|
|
2366
2360
|
function o(n, r) {
|
|
2367
2361
|
let i = e.editorView.value;
|
|
2368
|
-
i && (
|
|
2362
|
+
i && (bn(i, {
|
|
2369
2363
|
displayText: n,
|
|
2370
2364
|
href: r
|
|
2371
2365
|
}), t.value = null, i.focus());
|
|
2372
2366
|
}
|
|
2373
2367
|
function s() {
|
|
2374
2368
|
let n = e.editorView.value;
|
|
2375
|
-
n && (
|
|
2369
|
+
n && (xn(n, { popupHref: t.value?.href }), t.value = null, n.focus());
|
|
2376
2370
|
}
|
|
2377
2371
|
return {
|
|
2378
2372
|
hyperlinkPopupData: t,
|
|
@@ -2385,8 +2379,8 @@ function Xi(e) {
|
|
|
2385
2379
|
}
|
|
2386
2380
|
//#endregion
|
|
2387
2381
|
//#region src/composables/useImageActions.ts
|
|
2388
|
-
function
|
|
2389
|
-
let t =
|
|
2382
|
+
function Yi(e) {
|
|
2383
|
+
let t = we(null), n = W(!1), r = N(() => {
|
|
2390
2384
|
e.stateTick.value;
|
|
2391
2385
|
let n = e.editorView.value, r = t.value;
|
|
2392
2386
|
if (!n || !r) return null;
|
|
@@ -2405,9 +2399,9 @@ function Zi(e) {
|
|
|
2405
2399
|
function a(n) {
|
|
2406
2400
|
let r = e.editorView.value, a = t.value;
|
|
2407
2401
|
if (!r || !a) return;
|
|
2408
|
-
let o =
|
|
2402
|
+
let o = st(n);
|
|
2409
2403
|
if (!o) return;
|
|
2410
|
-
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;
|
|
2411
2405
|
c && (i(r, c(a.pmPos, o, s)), r.focus());
|
|
2412
2406
|
}
|
|
2413
2407
|
function o(n) {
|
|
@@ -2435,7 +2429,7 @@ function Zi(e) {
|
|
|
2435
2429
|
}
|
|
2436
2430
|
//#endregion
|
|
2437
2431
|
//#region src/composables/useKeyboardShortcuts.ts
|
|
2438
|
-
function
|
|
2432
|
+
function Xi(e) {
|
|
2439
2433
|
function t(t) {
|
|
2440
2434
|
if (t.key === "F1") {
|
|
2441
2435
|
t.preventDefault(), e.showKeyboardShortcuts.value = !0;
|
|
@@ -2450,14 +2444,14 @@ function Qi(e) {
|
|
|
2450
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));
|
|
2451
2445
|
}
|
|
2452
2446
|
}
|
|
2453
|
-
return
|
|
2447
|
+
return xe(() => window.addEventListener("keydown", t)), be(() => window.removeEventListener("keydown", t)), { handleKeyDown: t };
|
|
2454
2448
|
}
|
|
2455
2449
|
//#endregion
|
|
2456
2450
|
//#region src/composables/useOutlineSidebar.ts
|
|
2457
|
-
function
|
|
2451
|
+
function Zi(e) {
|
|
2458
2452
|
function t() {
|
|
2459
2453
|
let t = e.editorView.value;
|
|
2460
|
-
t && (e.outlineHeadings.value =
|
|
2454
|
+
t && (e.outlineHeadings.value = Sn(t.state.doc));
|
|
2461
2455
|
}
|
|
2462
2456
|
function n() {
|
|
2463
2457
|
e.showOutline.value || t(), e.showOutline.value = !e.showOutline.value;
|
|
@@ -2468,7 +2462,7 @@ function $i(e) {
|
|
|
2468
2462
|
function i(t) {
|
|
2469
2463
|
let n = e.editorView.value;
|
|
2470
2464
|
if (!n) return;
|
|
2471
|
-
let r = n.state.doc.resolve(Math.min(t + 1, n.state.doc.content.size)), i =
|
|
2465
|
+
let r = n.state.doc.resolve(Math.min(t + 1, n.state.doc.content.size)), i = Z.near(r);
|
|
2472
2466
|
n.dispatch(n.state.tr.setSelection(i)), e.scrollToVisiblePosition(t), n.focus();
|
|
2473
2467
|
}
|
|
2474
2468
|
function a() {
|
|
@@ -2488,7 +2482,7 @@ function $i(e) {
|
|
|
2488
2482
|
}
|
|
2489
2483
|
//#endregion
|
|
2490
2484
|
//#region src/composables/usePageSetupControls.ts
|
|
2491
|
-
function
|
|
2485
|
+
function Qi(e) {
|
|
2492
2486
|
function t(t) {
|
|
2493
2487
|
let n = e.getDocument();
|
|
2494
2488
|
if (!n?.package?.document) return;
|
|
@@ -2515,19 +2509,19 @@ function ea(e) {
|
|
|
2515
2509
|
}
|
|
2516
2510
|
function s(t) {
|
|
2517
2511
|
let n = e.editorView.value;
|
|
2518
|
-
n &&
|
|
2512
|
+
n && mn(t)(n.state, n.dispatch);
|
|
2519
2513
|
}
|
|
2520
2514
|
function c(t) {
|
|
2521
2515
|
let n = e.editorView.value;
|
|
2522
|
-
n &&
|
|
2516
|
+
n && hn(t)(n.state, n.dispatch);
|
|
2523
2517
|
}
|
|
2524
2518
|
function l(t) {
|
|
2525
2519
|
let n = e.editorView.value;
|
|
2526
|
-
n && (t < 0 ?
|
|
2520
|
+
n && (t < 0 ? pn(-t, !0)(n.state, n.dispatch) : pn(t, !1)(n.state, n.dispatch));
|
|
2527
2521
|
}
|
|
2528
2522
|
function u(t) {
|
|
2529
2523
|
let n = e.editorView.value;
|
|
2530
|
-
n &&
|
|
2524
|
+
n && fn(t)(n.state, n.dispatch);
|
|
2531
2525
|
}
|
|
2532
2526
|
return {
|
|
2533
2527
|
handlePageSetupApply: t,
|
|
@@ -2543,45 +2537,45 @@ function ea(e) {
|
|
|
2543
2537
|
}
|
|
2544
2538
|
//#endregion
|
|
2545
2539
|
//#region src/utils/textSelection.ts
|
|
2546
|
-
var
|
|
2547
|
-
function
|
|
2548
|
-
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);
|
|
2549
2543
|
}
|
|
2550
|
-
function
|
|
2551
|
-
return !e || e.length === 0 ? !1 :
|
|
2544
|
+
function na(e) {
|
|
2545
|
+
return !e || e.length === 0 ? !1 : ea.test(e);
|
|
2552
2546
|
}
|
|
2553
|
-
function
|
|
2547
|
+
function ra(e, t) {
|
|
2554
2548
|
if (!e || e.length === 0) return [0, 0];
|
|
2555
2549
|
t = Math.max(0, Math.min(t, e.length - 1));
|
|
2556
2550
|
let n = e[t];
|
|
2557
|
-
if (
|
|
2551
|
+
if (na(n)) {
|
|
2558
2552
|
let n = t, r = t;
|
|
2559
|
-
for (; n > 0 &&
|
|
2560
|
-
for (; r < e.length &&
|
|
2553
|
+
for (; n > 0 && na(e[n - 1]);) n--;
|
|
2554
|
+
for (; r < e.length && na(e[r]);) r++;
|
|
2561
2555
|
return [n, r];
|
|
2562
2556
|
}
|
|
2563
|
-
if (
|
|
2557
|
+
if (ta(n)) {
|
|
2564
2558
|
let n = t, r = t;
|
|
2565
|
-
for (; n > 0 &&
|
|
2566
|
-
for (; r < e.length &&
|
|
2559
|
+
for (; n > 0 && ta(e[n - 1]);) n--;
|
|
2560
|
+
for (; r < e.length && ta(e[r]);) r++;
|
|
2567
2561
|
return [n, r];
|
|
2568
2562
|
}
|
|
2569
2563
|
return [t, t + 1];
|
|
2570
2564
|
}
|
|
2571
2565
|
//#endregion
|
|
2572
2566
|
//#region src/utils/domQueries.ts
|
|
2573
|
-
function
|
|
2574
|
-
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);
|
|
2575
2569
|
for (let e of r) {
|
|
2576
2570
|
let n = Number(e.dataset.pmStart), r = Number(e.dataset.pmEnd);
|
|
2577
2571
|
if (!Number.isNaN(n) && !Number.isNaN(r) && t >= n && t <= r) return e;
|
|
2578
2572
|
}
|
|
2579
2573
|
return null;
|
|
2580
2574
|
}
|
|
2581
|
-
function
|
|
2575
|
+
function aa(e, t, n) {
|
|
2582
2576
|
if (!e || !t) return;
|
|
2583
|
-
let r =
|
|
2584
|
-
if (!r) for (let t of
|
|
2577
|
+
let r = gt(e, n);
|
|
2578
|
+
if (!r) for (let t of _t(e)) {
|
|
2585
2579
|
let e = Number(t.dataset.pmStart), i = Number(t.dataset.pmEnd);
|
|
2586
2580
|
if (Number.isFinite(e) && Number.isFinite(i) && n >= e && n <= i) {
|
|
2587
2581
|
r = t;
|
|
@@ -2595,21 +2589,21 @@ function sa(e, t, n) {
|
|
|
2595
2589
|
behavior: "smooth"
|
|
2596
2590
|
});
|
|
2597
2591
|
}
|
|
2598
|
-
function
|
|
2592
|
+
function oa(e, t, n, r) {
|
|
2599
2593
|
if (!e || !t) return null;
|
|
2600
|
-
let i =
|
|
2594
|
+
let i = ut(e, n, r, 1);
|
|
2601
2595
|
return i === null || i < 0 ? null : Math.min(i, t.state.doc.content.size);
|
|
2602
2596
|
}
|
|
2603
|
-
function
|
|
2597
|
+
function sa(e, t, n, r) {
|
|
2604
2598
|
if (!e) return;
|
|
2605
|
-
let i =
|
|
2599
|
+
let i = ia(e, t, r);
|
|
2606
2600
|
if (!i) return;
|
|
2607
|
-
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;
|
|
2608
2602
|
l < u && n(l, u);
|
|
2609
2603
|
}
|
|
2610
|
-
function
|
|
2604
|
+
function ca(e, t, n, r) {
|
|
2611
2605
|
if (!e) return;
|
|
2612
|
-
let i =
|
|
2606
|
+
let i = ia(e, t, r);
|
|
2613
2607
|
if (!i) return;
|
|
2614
2608
|
let a = i.closest(".layout-paragraph");
|
|
2615
2609
|
if (!a) return;
|
|
@@ -2618,13 +2612,13 @@ function ua(e, t, n, r) {
|
|
|
2618
2612
|
}
|
|
2619
2613
|
//#endregion
|
|
2620
2614
|
//#region src/composables/usePagesPointer.ts
|
|
2621
|
-
var
|
|
2622
|
-
function
|
|
2615
|
+
var la = 500;
|
|
2616
|
+
function ua(e) {
|
|
2623
2617
|
let t = W(null), n = null;
|
|
2624
2618
|
function r() {
|
|
2625
2619
|
n !== null && (clearTimeout(n), n = null);
|
|
2626
2620
|
}
|
|
2627
|
-
let i =
|
|
2621
|
+
let i = we(null), a = 0, o = null, s = 0, c = !1, l = null, u = Tn(), d = w({
|
|
2628
2622
|
pagesContainer: e.pagesRef,
|
|
2629
2623
|
onScrollExtendSelection: (e, t) => {
|
|
2630
2624
|
if (!c || l === null) return;
|
|
@@ -2637,7 +2631,7 @@ function fa(e) {
|
|
|
2637
2631
|
visible: !1
|
|
2638
2632
|
}), p = null;
|
|
2639
2633
|
function m(t, n) {
|
|
2640
|
-
return
|
|
2634
|
+
return oa(e.pagesRef.value, e.editorView.value, t, n);
|
|
2641
2635
|
}
|
|
2642
2636
|
function h() {
|
|
2643
2637
|
let t = i.value;
|
|
@@ -2650,18 +2644,18 @@ function fa(e) {
|
|
|
2650
2644
|
function g(e, t) {
|
|
2651
2645
|
let n = h();
|
|
2652
2646
|
if (n) try {
|
|
2653
|
-
let r = n.state.doc.resolve(e), i = t === void 0 ? r : n.state.doc.resolve(t), a =
|
|
2647
|
+
let r = n.state.doc.resolve(e), i = t === void 0 ? r : n.state.doc.resolve(t), a = Z.between(r, i);
|
|
2654
2648
|
n.dispatch(n.state.tr.setSelection(a));
|
|
2655
2649
|
} catch {}
|
|
2656
2650
|
}
|
|
2657
2651
|
function _(t) {
|
|
2658
|
-
|
|
2652
|
+
aa(e.pagesRef.value, e.pagesViewportRef.value, t);
|
|
2659
2653
|
}
|
|
2660
2654
|
function v(t) {
|
|
2661
|
-
|
|
2655
|
+
sa(e.pagesRef.value, t, g, i.value?.position);
|
|
2662
2656
|
}
|
|
2663
2657
|
function y(t) {
|
|
2664
|
-
|
|
2658
|
+
ca(e.pagesRef.value, t, g, i.value?.position);
|
|
2665
2659
|
}
|
|
2666
2660
|
function b(t) {
|
|
2667
2661
|
let n = e.editorView.value;
|
|
@@ -2690,7 +2684,7 @@ function fa(e) {
|
|
|
2690
2684
|
if (!o) return;
|
|
2691
2685
|
let s = e.pagesViewportRef.value;
|
|
2692
2686
|
if (!s || !(a.target instanceof HTMLElement)) return;
|
|
2693
|
-
let l =
|
|
2687
|
+
let l = wn({
|
|
2694
2688
|
mouseX: a.clientX,
|
|
2695
2689
|
mouseY: a.clientY,
|
|
2696
2690
|
pagesContainer: o,
|
|
@@ -2700,7 +2694,7 @@ function fa(e) {
|
|
|
2700
2694
|
if (!l) {
|
|
2701
2695
|
n === null && (n = setTimeout(() => {
|
|
2702
2696
|
t.value = null, n = null;
|
|
2703
|
-
},
|
|
2697
|
+
}, Cn));
|
|
2704
2698
|
return;
|
|
2705
2699
|
}
|
|
2706
2700
|
let u = e.zoom.value || 1, d = s.getBoundingClientRect();
|
|
@@ -2711,16 +2705,16 @@ function fa(e) {
|
|
|
2711
2705
|
cellPmPos: l.cellPmPos
|
|
2712
2706
|
}, r();
|
|
2713
2707
|
}
|
|
2714
|
-
function
|
|
2708
|
+
function S(n) {
|
|
2715
2709
|
n.preventDefault(), n.stopPropagation();
|
|
2716
2710
|
let r = t.value, i = e.editorView.value;
|
|
2717
2711
|
if (!r || !i) return;
|
|
2718
|
-
let a = i.state.tr.setSelection(
|
|
2712
|
+
let a = i.state.tr.setSelection(Z.create(i.state.doc, r.cellPmPos + 1));
|
|
2719
2713
|
i.dispatch(a);
|
|
2720
2714
|
let o = e.getCommands(), s = r.type === "row" ? o.addRowBelow : o.addColumnRight;
|
|
2721
2715
|
s && (s()(i.state, (e) => i.dispatch(e), i), t.value = null, i.focus());
|
|
2722
2716
|
}
|
|
2723
|
-
function
|
|
2717
|
+
function C(t) {
|
|
2724
2718
|
let n = t.target, r = n instanceof HTMLElement ? n.closest("a[href]") : null;
|
|
2725
2719
|
if (!r) return;
|
|
2726
2720
|
t.preventDefault();
|
|
@@ -2745,7 +2739,7 @@ function fa(e) {
|
|
|
2745
2739
|
...l ? { tooltip: l } : {}
|
|
2746
2740
|
};
|
|
2747
2741
|
}
|
|
2748
|
-
function
|
|
2742
|
+
function ee(t) {
|
|
2749
2743
|
if (!(t.target instanceof HTMLElement)) return;
|
|
2750
2744
|
let n = t.target, r = n.closest(".layout-page-header"), a = n.closest(".layout-page-footer"), o = r ?? a;
|
|
2751
2745
|
if (!o) return;
|
|
@@ -2782,7 +2776,7 @@ function fa(e) {
|
|
|
2782
2776
|
}, y = c.package.document, b = y?.sections?.map((e, t) => t === 0 ? {
|
|
2783
2777
|
...e,
|
|
2784
2778
|
properties: v
|
|
2785
|
-
} : e), x = y?.finalSectionProperties === l ? v : y?.finalSectionProperties,
|
|
2779
|
+
} : e), x = y?.finalSectionProperties === l ? v : y?.finalSectionProperties, S = {
|
|
2786
2780
|
...c,
|
|
2787
2781
|
package: {
|
|
2788
2782
|
...c.package,
|
|
@@ -2795,7 +2789,7 @@ function fa(e) {
|
|
|
2795
2789
|
}
|
|
2796
2790
|
}
|
|
2797
2791
|
};
|
|
2798
|
-
f = n, p = r, e.setDocument?.(
|
|
2792
|
+
f = n, p = r, e.setDocument?.(S), e.syncHfPMs?.(), e.reLayout(), e.emit("change", S);
|
|
2799
2793
|
}
|
|
2800
2794
|
let m = e.pagesViewportRef.value;
|
|
2801
2795
|
if (!m) return;
|
|
@@ -2812,7 +2806,7 @@ function fa(e) {
|
|
|
2812
2806
|
}
|
|
2813
2807
|
};
|
|
2814
2808
|
}
|
|
2815
|
-
function
|
|
2809
|
+
function te(t) {
|
|
2816
2810
|
let n = e.getDocument(), r = i.value;
|
|
2817
2811
|
if (!n?.package || !r) return;
|
|
2818
2812
|
let a = r.position === "header" ? n.package.headers : n.package.footers;
|
|
@@ -2820,7 +2814,7 @@ function fa(e) {
|
|
|
2820
2814
|
let o = a.get(r.rId);
|
|
2821
2815
|
o && (o.content = t), e.syncHfPMs?.(), e.reLayout(), e.emit("change", n);
|
|
2822
2816
|
}
|
|
2823
|
-
function
|
|
2817
|
+
function ne() {
|
|
2824
2818
|
let t = e.getDocument(), n = i.value;
|
|
2825
2819
|
if (!t?.package || !n || !n.rId) {
|
|
2826
2820
|
i.value = null;
|
|
@@ -2852,7 +2846,7 @@ function fa(e) {
|
|
|
2852
2846
|
};
|
|
2853
2847
|
i.value = null, e.setDocument?.(p), e.syncHfPMs?.(), e.reLayout(), e.emit("change", p);
|
|
2854
2848
|
}
|
|
2855
|
-
function
|
|
2849
|
+
function T(t) {
|
|
2856
2850
|
if (t.button !== 0 || e.imageInteracting.value) return;
|
|
2857
2851
|
let n = e.editorView.value;
|
|
2858
2852
|
if (!n) return;
|
|
@@ -2860,13 +2854,13 @@ function fa(e) {
|
|
|
2860
2854
|
i.value && d && (d.closest(".layout-page-header") || d.closest(".layout-page-footer") || d.closest(".hf-editor") || (i.value = null, n.focus()));
|
|
2861
2855
|
let f = h() ?? n;
|
|
2862
2856
|
if (!e.readOnly.value && e.tableResize.tryStartResize(t, f)) return;
|
|
2863
|
-
let p =
|
|
2857
|
+
let p = at(r);
|
|
2864
2858
|
if (p) {
|
|
2865
2859
|
t.preventDefault(), t.stopPropagation();
|
|
2866
2860
|
let n = Number(p.dataset.pmStart);
|
|
2867
2861
|
if (!Number.isNaN(n)) {
|
|
2868
2862
|
try {
|
|
2869
|
-
f.dispatch(f.state.tr.setSelection(
|
|
2863
|
+
f.dispatch(f.state.tr.setSelection($e.create(f.state.doc, n)));
|
|
2870
2864
|
} catch {}
|
|
2871
2865
|
e.selectedImage.value = {
|
|
2872
2866
|
element: p,
|
|
@@ -2885,15 +2879,15 @@ function fa(e) {
|
|
|
2885
2879
|
return;
|
|
2886
2880
|
}
|
|
2887
2881
|
let b = Date.now();
|
|
2888
|
-
if (b - a <
|
|
2882
|
+
if (b - a < la && o === _ ? s++ : s = 1, a = b, o = _, s === 2) v(_);
|
|
2889
2883
|
else if (s >= 3) y(_), s = 0;
|
|
2890
2884
|
else if (t.shiftKey) {
|
|
2891
2885
|
let { from: e } = f.state.selection;
|
|
2892
2886
|
g(e, _);
|
|
2893
|
-
} else g(_), l = _, c = !0, u.begin(
|
|
2887
|
+
} else g(_), l = _, c = !0, u.begin(En(f, _));
|
|
2894
2888
|
f.focus();
|
|
2895
2889
|
}
|
|
2896
|
-
function
|
|
2890
|
+
function re(e) {
|
|
2897
2891
|
if (!c || l === null) return;
|
|
2898
2892
|
let t = m(e.clientX, e.clientY);
|
|
2899
2893
|
if (t !== null) {
|
|
@@ -2906,10 +2900,10 @@ function fa(e) {
|
|
|
2906
2900
|
}
|
|
2907
2901
|
d.updateMousePosition(e.clientX, e.clientY);
|
|
2908
2902
|
}
|
|
2909
|
-
function
|
|
2903
|
+
function ie() {
|
|
2910
2904
|
c = !1, u.end(), d.stopAutoScroll();
|
|
2911
2905
|
}
|
|
2912
|
-
function
|
|
2906
|
+
function E() {
|
|
2913
2907
|
let t = e.pagesViewportRef.value, n = e.layout.value;
|
|
2914
2908
|
if (!t || !n || n.pages.length === 0) return;
|
|
2915
2909
|
let r = t.scrollTop, i = n.pages.length, a = r + t.clientHeight / 2, o = 24, s = 1;
|
|
@@ -2934,10 +2928,10 @@ function fa(e) {
|
|
|
2934
2928
|
};
|
|
2935
2929
|
}, 600);
|
|
2936
2930
|
}
|
|
2937
|
-
return
|
|
2938
|
-
window.addEventListener("mousemove",
|
|
2939
|
-
}),
|
|
2940
|
-
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);
|
|
2941
2935
|
}), {
|
|
2942
2936
|
tableInsertButton: t,
|
|
2943
2937
|
hfEdit: i,
|
|
@@ -2946,29 +2940,29 @@ function fa(e) {
|
|
|
2946
2940
|
setPmSelection: g,
|
|
2947
2941
|
scrollVisiblePositionIntoView: _,
|
|
2948
2942
|
navigateToBookmark: b,
|
|
2949
|
-
handlePagesMouseDown:
|
|
2943
|
+
handlePagesMouseDown: T,
|
|
2950
2944
|
handlePagesMouseMove: x,
|
|
2951
|
-
handlePagesClick:
|
|
2952
|
-
handlePagesDoubleClick:
|
|
2953
|
-
handleTableInsertClick:
|
|
2945
|
+
handlePagesClick: C,
|
|
2946
|
+
handlePagesDoubleClick: ee,
|
|
2947
|
+
handleTableInsertClick: S,
|
|
2954
2948
|
clearTableInsertTimer: r,
|
|
2955
|
-
handleHfSave:
|
|
2956
|
-
handleHfRemove:
|
|
2949
|
+
handleHfSave: te,
|
|
2950
|
+
handleHfRemove: ne
|
|
2957
2951
|
};
|
|
2958
2952
|
}
|
|
2959
2953
|
//#endregion
|
|
2960
2954
|
//#region src/utils/hostFonts.ts
|
|
2961
|
-
function
|
|
2955
|
+
function da(e) {
|
|
2962
2956
|
return typeof e == "string" && e.trim().length > 0;
|
|
2963
2957
|
}
|
|
2964
|
-
function
|
|
2965
|
-
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"));
|
|
2966
2960
|
}
|
|
2967
|
-
function
|
|
2961
|
+
function pa(e) {
|
|
2968
2962
|
if (!e) return [];
|
|
2969
2963
|
let t = [];
|
|
2970
2964
|
for (let n of e) {
|
|
2971
|
-
if (!
|
|
2965
|
+
if (!fa(n)) continue;
|
|
2972
2966
|
let e = { display: "swap" };
|
|
2973
2967
|
(typeof n.weight == "number" || typeof n.weight == "string") && (e.weight = String(n.weight)), t.push({
|
|
2974
2968
|
family: n.family.trim(),
|
|
@@ -2978,10 +2972,10 @@ function ha(e) {
|
|
|
2978
2972
|
}
|
|
2979
2973
|
return t;
|
|
2980
2974
|
}
|
|
2981
|
-
function
|
|
2975
|
+
function ma() {
|
|
2982
2976
|
return typeof document > "u" || !("fonts" in document) ? null : document.fonts;
|
|
2983
2977
|
}
|
|
2984
|
-
async function
|
|
2978
|
+
async function ha(e, t, n, r) {
|
|
2985
2979
|
let i;
|
|
2986
2980
|
try {
|
|
2987
2981
|
i = new FontFace(t, n, r), e.add(i);
|
|
@@ -2990,39 +2984,39 @@ async function _a(e, t, n, r) {
|
|
|
2990
2984
|
}
|
|
2991
2985
|
return await i.load().then(() => !0, () => !1) ? i : (e.delete(i), null);
|
|
2992
2986
|
}
|
|
2993
|
-
async function
|
|
2994
|
-
let t =
|
|
2987
|
+
async function ga(e) {
|
|
2988
|
+
let t = ma();
|
|
2995
2989
|
if (!t) return [];
|
|
2996
|
-
let n =
|
|
2990
|
+
let n = pa(e);
|
|
2997
2991
|
if (n.length === 0) return [];
|
|
2998
2992
|
let r = [];
|
|
2999
2993
|
return await Promise.all(n.map(async ({ family: e, source: n, descriptors: i }) => {
|
|
3000
|
-
let a = await
|
|
2994
|
+
let a = await ha(t, e, n, i);
|
|
3001
2995
|
a && r.push(a);
|
|
3002
2996
|
})), r;
|
|
3003
2997
|
}
|
|
3004
|
-
function
|
|
3005
|
-
let t =
|
|
2998
|
+
function _a(e) {
|
|
2999
|
+
let t = ma();
|
|
3006
3000
|
if (t) for (let n of e) t.delete(n);
|
|
3007
3001
|
}
|
|
3008
3002
|
//#endregion
|
|
3009
3003
|
//#region src/components/DocxEditor.vue?vue&type=script&setup=true&lang.ts
|
|
3010
|
-
var
|
|
3004
|
+
var va = { class: "docx-editor-vue__toolbar-shell" }, ya = {
|
|
3011
3005
|
key: 0,
|
|
3012
3006
|
class: "docx-editor-vue__error"
|
|
3013
|
-
},
|
|
3007
|
+
}, ba = {
|
|
3014
3008
|
key: 1,
|
|
3015
3009
|
class: "docx-editor-vue__loading"
|
|
3016
|
-
},
|
|
3010
|
+
}, xa = {
|
|
3017
3011
|
key: 2,
|
|
3018
3012
|
class: "docx-editor-vue__placeholder"
|
|
3019
|
-
},
|
|
3013
|
+
}, Sa = { class: "docx-editor-vue__editor-area" }, Ca = {
|
|
3020
3014
|
key: 0,
|
|
3021
3015
|
class: "docx-editor-vue__ruler-h"
|
|
3022
|
-
},
|
|
3016
|
+
}, wa = {
|
|
3023
3017
|
key: 1,
|
|
3024
3018
|
class: "docx-editor-vue__ruler-v"
|
|
3025
|
-
},
|
|
3019
|
+
}, Ta = {
|
|
3026
3020
|
class: "docx-editor-vue__editor-content-wrapper",
|
|
3027
3021
|
style: {
|
|
3028
3022
|
position: "relative",
|
|
@@ -3030,11 +3024,11 @@ var ba = { class: "docx-editor-vue__toolbar-shell" }, xa = {
|
|
|
3030
3024
|
flexDirection: "column",
|
|
3031
3025
|
minHeight: "100%"
|
|
3032
3026
|
}
|
|
3033
|
-
},
|
|
3027
|
+
}, Ea = {
|
|
3034
3028
|
"data-testid": "selection-overlay",
|
|
3035
3029
|
class: "docx-editor-vue__decoration-origin",
|
|
3036
3030
|
"aria-hidden": "true"
|
|
3037
|
-
},
|
|
3031
|
+
}, Da = ["aria-label"], Oa = /*#__PURE__*/ t(/* @__PURE__ */ z({
|
|
3038
3032
|
__name: "DocxEditor",
|
|
3039
3033
|
props: {
|
|
3040
3034
|
documentBuffer: { default: null },
|
|
@@ -3154,33 +3148,33 @@ var ba = { class: "docx-editor-vue__toolbar-shell" }, xa = {
|
|
|
3154
3148
|
],
|
|
3155
3149
|
setup(t, { expose: n, emit: a }) {
|
|
3156
3150
|
let o = t, s = a;
|
|
3157
|
-
e(), i(o.components),
|
|
3158
|
-
let l = W(o.mode), u = N(() => o.readOnly || l.value === "viewing"), d = N(() => o.showReviewControls), f = N(() =>
|
|
3159
|
-
function
|
|
3160
|
-
dn(
|
|
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));
|
|
3161
3155
|
}
|
|
3162
|
-
function
|
|
3156
|
+
function y(e) {
|
|
3163
3157
|
p.value = e;
|
|
3164
3158
|
}
|
|
3165
|
-
let b = N(() => p.value === "all-markup" ? "" : `folio-root--${p.value}`), { t: x } = c(),
|
|
3166
|
-
|
|
3167
|
-
let te = N(() => o.documentBuffer != null || o.document != null),
|
|
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);
|
|
3168
3162
|
J(te, (e) => {
|
|
3169
|
-
e || (
|
|
3163
|
+
e || (w.value = !1);
|
|
3170
3164
|
});
|
|
3171
|
-
let
|
|
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);
|
|
3172
3166
|
function Me(e) {
|
|
3173
3167
|
o.enableWheelZoom !== !1 && Oe(e);
|
|
3174
3168
|
}
|
|
3175
|
-
|
|
3176
|
-
showKeyboardShortcuts:
|
|
3177
|
-
showFindReplace:
|
|
3178
|
-
showHyperlink:
|
|
3169
|
+
Xi({
|
|
3170
|
+
showKeyboardShortcuts: le,
|
|
3171
|
+
showFindReplace: k,
|
|
3172
|
+
showHyperlink: ce,
|
|
3179
3173
|
handleZoomKeyDown: ke
|
|
3180
3174
|
});
|
|
3181
|
-
let { editor:
|
|
3182
|
-
hiddenContainer:
|
|
3183
|
-
pagesContainer:
|
|
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,
|
|
3184
3178
|
readOnly: u,
|
|
3185
3179
|
editorMode: l,
|
|
3186
3180
|
author: () => o.author,
|
|
@@ -3198,7 +3192,7 @@ var ba = { class: "docx-editor-vue__toolbar-shell" }, xa = {
|
|
|
3198
3192
|
o.onError?.(e), s("error", e);
|
|
3199
3193
|
},
|
|
3200
3194
|
onSelectionUpdate: (e) => {
|
|
3201
|
-
if (o.onSelectionChange?.(
|
|
3195
|
+
if (o.onSelectionChange?.(Ae(e)), o.onSelectionTextChange) {
|
|
3202
3196
|
let { from: t, to: n } = e.selection, r = t === n ? "" : e.doc.textBetween(t, n, " ", " ");
|
|
3203
3197
|
o.onSelectionTextChange({
|
|
3204
3198
|
from: t,
|
|
@@ -3211,35 +3205,35 @@ var ba = { class: "docx-editor-vue__toolbar-shell" }, xa = {
|
|
|
3211
3205
|
onReadOnlyEditAttempt: () => o.onReadonlyEditAttempt?.(),
|
|
3212
3206
|
featureFlags: () => o.featureFlags,
|
|
3213
3207
|
onSelectiveSaveTripwire: o.onSelectiveSaveTripwire ? (e) => o.onSelectiveSaveTripwire?.(e) : void 0
|
|
3214
|
-
}), rt = N(() => !
|
|
3208
|
+
}), rt = N(() => !Ge.value && te.value && !(o.preserveDocumentWhileLoading === !0 && w.value));
|
|
3215
3209
|
function it() {
|
|
3216
|
-
X.value && (
|
|
3210
|
+
X.value && (He(), Ve(), nt());
|
|
3217
3211
|
}
|
|
3218
3212
|
J(() => o.fonts, (e, t, n) => {
|
|
3219
3213
|
if (!e || e.length === 0) return;
|
|
3220
3214
|
let r = !1, i = [];
|
|
3221
|
-
|
|
3215
|
+
ga(e).then((e) => {
|
|
3222
3216
|
if (r) {
|
|
3223
|
-
|
|
3217
|
+
_a(e);
|
|
3224
3218
|
return;
|
|
3225
3219
|
}
|
|
3226
3220
|
i = e, e.length !== 0 && it();
|
|
3227
3221
|
}), n(() => {
|
|
3228
|
-
r = !0, i.length !== 0 && (
|
|
3222
|
+
r = !0, i.length !== 0 && (_a(i), it());
|
|
3229
3223
|
});
|
|
3230
3224
|
}, { immediate: !0 });
|
|
3231
|
-
let { selectedImage: at, imageInteracting: ot, imageToolbarContext: st, handleToolbarImageWrap:
|
|
3225
|
+
let { selectedImage: at, imageInteracting: ot, imageToolbarContext: st, handleToolbarImageWrap: ut, handleImageTransform: dt } = Yi({
|
|
3232
3226
|
editorView: X,
|
|
3233
3227
|
zoom: B,
|
|
3234
|
-
stateTick:
|
|
3235
|
-
getCommands:
|
|
3236
|
-
}), { hyperlinkPopupData: ft, handleHyperlinkSubmit: pt, handleHyperlinkRemove: mt, handleHyperlinkPopupNavigate: ht, handleHyperlinkPopupEdit: gt, handleHyperlinkPopupRemove: _t } =
|
|
3228
|
+
stateTick: O,
|
|
3229
|
+
getCommands: Z
|
|
3230
|
+
}), { hyperlinkPopupData: ft, handleHyperlinkSubmit: pt, handleHyperlinkRemove: mt, handleHyperlinkPopupNavigate: ht, handleHyperlinkPopupEdit: gt, handleHyperlinkPopupRemove: _t } = Ji({
|
|
3237
3231
|
editorView: X,
|
|
3238
|
-
getCommands:
|
|
3239
|
-
}), vt =
|
|
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({
|
|
3240
3234
|
editorView: X,
|
|
3241
|
-
pagesRef:
|
|
3242
|
-
pagesViewportRef:
|
|
3235
|
+
pagesRef: D,
|
|
3236
|
+
pagesViewportRef: ae,
|
|
3243
3237
|
selectedImage: at,
|
|
3244
3238
|
imageInteracting: ot,
|
|
3245
3239
|
hyperlinkPopupData: ft,
|
|
@@ -3250,48 +3244,48 @@ var ba = { class: "docx-editor-vue__toolbar-shell" }, xa = {
|
|
|
3250
3244
|
tryStartResize: vt.tryStartResize,
|
|
3251
3245
|
isResizing: N(() => vt.isResizing())
|
|
3252
3246
|
},
|
|
3253
|
-
getCommands:
|
|
3254
|
-
getDocument:
|
|
3247
|
+
getCommands: Z,
|
|
3248
|
+
getDocument: et,
|
|
3255
3249
|
reLayout: nt,
|
|
3256
3250
|
emit: () => {},
|
|
3257
3251
|
clearOverlay: () => {}
|
|
3258
|
-
}), Ot =
|
|
3252
|
+
}), Ot = Zi({
|
|
3259
3253
|
editorView: X,
|
|
3260
3254
|
showOutline: A,
|
|
3261
|
-
showSidebar:
|
|
3262
|
-
outlineHeadings:
|
|
3255
|
+
showSidebar: M,
|
|
3256
|
+
outlineHeadings: z,
|
|
3263
3257
|
activeSidebarItem: pe,
|
|
3264
3258
|
extractCommentsAndChanges: () => {},
|
|
3265
3259
|
scrollToVisiblePosition: Ct
|
|
3266
|
-
}), { contextMenu: kt, imageContextMenu: At, imageContextMenuTextActions: jt, customTextMenuItems: Mt, handleContextMenu: Nt, handleSelectedImageContextMenu: Pt, handleImageWrapSelect: Ft, handleContextMenuAction: It } =
|
|
3260
|
+
}), { contextMenu: kt, imageContextMenu: At, imageContextMenuTextActions: jt, customTextMenuItems: Mt, handleContextMenu: Nt, handleSelectedImageContextMenu: Pt, handleImageWrapSelect: Ft, handleContextMenuAction: It } = Wi({
|
|
3267
3261
|
editorView: X,
|
|
3268
3262
|
selectedImage: at,
|
|
3269
3263
|
zoom: B,
|
|
3270
|
-
showImageProperties:
|
|
3271
|
-
getCommands:
|
|
3264
|
+
showImageProperties: de,
|
|
3265
|
+
getCommands: Z,
|
|
3272
3266
|
clearOverlay: () => {},
|
|
3273
3267
|
setPmSelection: St,
|
|
3274
3268
|
resolvePos: xt,
|
|
3275
3269
|
customContextMenuItems: () => u.value ? void 0 : o.customContextMenuItems,
|
|
3276
3270
|
onCustomContextAction: (e, t) => o.onCustomContextAction?.(e, t)
|
|
3277
|
-
}), Lt =
|
|
3271
|
+
}), Lt = re(X, O), Rt = N(() => Lt.value.entries), Q = Mi({
|
|
3278
3272
|
editorView: X,
|
|
3279
|
-
getDocument:
|
|
3273
|
+
getDocument: et,
|
|
3280
3274
|
author: () => o.author,
|
|
3281
3275
|
commentsProp: () => o.comments,
|
|
3282
3276
|
onCommentsChange: (e) => {
|
|
3283
3277
|
o.onCommentsChange?.(e), s("comments-change", e);
|
|
3284
3278
|
},
|
|
3285
3279
|
reLayout: nt
|
|
3286
|
-
}), zt = Q.comments, $ =
|
|
3280
|
+
}), zt = Q.comments, $ = ji({
|
|
3287
3281
|
editorView: X,
|
|
3288
|
-
pagesViewport:
|
|
3289
|
-
pagesContainer:
|
|
3282
|
+
pagesViewport: ae,
|
|
3283
|
+
pagesContainer: D,
|
|
3290
3284
|
readOnly: u,
|
|
3291
3285
|
createComment: Q.createComment,
|
|
3292
3286
|
pushComment: Q.pushComment,
|
|
3293
3287
|
reLayout: nt,
|
|
3294
|
-
showSidebar:
|
|
3288
|
+
showSidebar: M,
|
|
3295
3289
|
setActiveSidebarItem: (e) => {
|
|
3296
3290
|
pe.value = e;
|
|
3297
3291
|
}
|
|
@@ -3300,16 +3294,16 @@ var ba = { class: "docx-editor-vue__toolbar-shell" }, xa = {
|
|
|
3300
3294
|
navigator.clipboard?.writeText(e), ft.value = null;
|
|
3301
3295
|
}
|
|
3302
3296
|
let Vt = N(() => {
|
|
3303
|
-
|
|
3304
|
-
let e =
|
|
3297
|
+
O.value;
|
|
3298
|
+
let e = et()?.package.document;
|
|
3305
3299
|
return e ? e.finalSectionProperties ?? e.sections?.[0]?.properties ?? null : null;
|
|
3306
3300
|
}), Ht = N(() => {
|
|
3307
|
-
|
|
3301
|
+
O.value;
|
|
3308
3302
|
let e = {};
|
|
3309
3303
|
o.fontFamilies !== void 0 && (e.fontFamilies = o.fontFamilies);
|
|
3310
|
-
let t =
|
|
3304
|
+
let t = et()?.package.styles?.styles;
|
|
3311
3305
|
return t !== void 0 && (e.documentStyles = t), e;
|
|
3312
|
-
}), Ut = N(() =>
|
|
3306
|
+
}), Ut = N(() => We(Vt.value?.pageWidth ?? 12240) * B.value), Wt = N(() => {
|
|
3313
3307
|
let e = /* @__PURE__ */ new Set();
|
|
3314
3308
|
for (let t of zt.value) t.done && e.add(t.id);
|
|
3315
3309
|
return e;
|
|
@@ -3317,9 +3311,9 @@ var ba = { class: "docx-editor-vue__toolbar-shell" }, xa = {
|
|
|
3317
3311
|
transform: B.value === 1 ? void 0 : `scale(${B.value})`,
|
|
3318
3312
|
transformOrigin: "top center",
|
|
3319
3313
|
transition: "transform 0.2s ease"
|
|
3320
|
-
})), { handleApplyStyle: Kt, handleInsertSymbol: qt, handleInsertSectionBreakNextPage: Jt, handleInsertSectionBreakContinuous: Yt } =
|
|
3314
|
+
})), { handleApplyStyle: Kt, handleInsertSymbol: qt, handleInsertSectionBreakNextPage: Jt, handleInsertSectionBreakContinuous: Yt } = qi({
|
|
3321
3315
|
editorView: X,
|
|
3322
|
-
getDocument:
|
|
3316
|
+
getDocument: et
|
|
3323
3317
|
});
|
|
3324
3318
|
function Xt() {
|
|
3325
3319
|
if (o.onInsertImage) {
|
|
@@ -3331,7 +3325,7 @@ var ba = { class: "docx-editor-vue__toolbar-shell" }, xa = {
|
|
|
3331
3325
|
let t = document.createElement("input");
|
|
3332
3326
|
t.type = "file", t.accept = "image/*", t.style.display = "none", t.addEventListener("change", () => {
|
|
3333
3327
|
let n = t.files?.[0];
|
|
3334
|
-
n &&
|
|
3328
|
+
n && Ne(e, n, () => e.focus()), t.remove();
|
|
3335
3329
|
}), document.body.appendChild(t), t.click();
|
|
3336
3330
|
}
|
|
3337
3331
|
function Zt(e, t) {
|
|
@@ -3340,7 +3334,7 @@ var ba = { class: "docx-editor-vue__toolbar-shell" }, xa = {
|
|
|
3340
3334
|
return;
|
|
3341
3335
|
}
|
|
3342
3336
|
let n = X.value;
|
|
3343
|
-
n && (
|
|
3337
|
+
n && (Ie(n, e, t), n.focus());
|
|
3344
3338
|
}
|
|
3345
3339
|
function Qt() {
|
|
3346
3340
|
if (o.onInsertPageBreak) {
|
|
@@ -3356,20 +3350,20 @@ var ba = { class: "docx-editor-vue__toolbar-shell" }, xa = {
|
|
|
3356
3350
|
return;
|
|
3357
3351
|
}
|
|
3358
3352
|
let e = X.value;
|
|
3359
|
-
e && (
|
|
3353
|
+
e && (Re(e), e.focus());
|
|
3360
3354
|
}
|
|
3361
|
-
let { handlePageSetupApply: en, handleLeftMarginChange: tn, handleRightMarginChange: nn, handleTopMarginChange: rn, handleBottomMarginChange: an, handleIndentLeftChange: on, handleIndentRightChange: sn, handleFirstLineIndentChange: cn, handleTabStopRemove: ln } =
|
|
3355
|
+
let { handlePageSetupApply: en, handleLeftMarginChange: tn, handleRightMarginChange: nn, handleTopMarginChange: rn, handleBottomMarginChange: an, handleIndentLeftChange: on, handleIndentRightChange: sn, handleFirstLineIndentChange: cn, handleTabStopRemove: ln } = Qi({
|
|
3362
3356
|
editorView: X,
|
|
3363
|
-
getDocument:
|
|
3357
|
+
getDocument: et,
|
|
3364
3358
|
readOnly: u,
|
|
3365
|
-
stateTick:
|
|
3359
|
+
stateTick: O,
|
|
3366
3360
|
reLayout: nt,
|
|
3367
3361
|
onChange: (e) => {
|
|
3368
3362
|
o.onChange?.(e), s("change", e), s("update:document", e);
|
|
3369
3363
|
}
|
|
3370
3364
|
}), un = N(() => {
|
|
3371
|
-
|
|
3372
|
-
let e = X.value, t = e ?
|
|
3365
|
+
O.value;
|
|
3366
|
+
let e = X.value, t = e ? ze(e.state).paragraphFormatting : {};
|
|
3373
3367
|
return {
|
|
3374
3368
|
indentLeft: t.indentLeft ?? 0,
|
|
3375
3369
|
indentRight: t.indentRight ?? 0,
|
|
@@ -3385,22 +3379,22 @@ var ba = { class: "docx-editor-vue__toolbar-shell" }, xa = {
|
|
|
3385
3379
|
switch (e) {
|
|
3386
3380
|
case "find":
|
|
3387
3381
|
case "findReplace":
|
|
3388
|
-
|
|
3382
|
+
k.value = !0;
|
|
3389
3383
|
break;
|
|
3390
3384
|
case "insertSymbol":
|
|
3391
|
-
|
|
3385
|
+
ue.value = !0;
|
|
3392
3386
|
break;
|
|
3393
3387
|
case "insertHyperlink":
|
|
3394
|
-
|
|
3388
|
+
ce.value = !0;
|
|
3395
3389
|
break;
|
|
3396
3390
|
case "pageSetup":
|
|
3397
|
-
|
|
3391
|
+
fe.value = !0;
|
|
3398
3392
|
break;
|
|
3399
3393
|
case "toggleOutline":
|
|
3400
3394
|
Ot.handleToggleOutline();
|
|
3401
3395
|
break;
|
|
3402
3396
|
case "toggleSidebar":
|
|
3403
|
-
|
|
3397
|
+
M.value = !M.value;
|
|
3404
3398
|
break;
|
|
3405
3399
|
case "insertImage":
|
|
3406
3400
|
Xt();
|
|
@@ -3425,7 +3419,7 @@ var ba = { class: "docx-editor-vue__toolbar-shell" }, xa = {
|
|
|
3425
3419
|
Zt(e, t);
|
|
3426
3420
|
}
|
|
3427
3421
|
let mn = W(!1);
|
|
3428
|
-
|
|
3422
|
+
Gi({
|
|
3429
3423
|
documentBuffer: () => o.documentBuffer ?? null,
|
|
3430
3424
|
document: () => o.document ?? null,
|
|
3431
3425
|
loadDocumentBuffer: Ze,
|
|
@@ -3446,38 +3440,38 @@ var ba = { class: "docx-editor-vue__toolbar-shell" }, xa = {
|
|
|
3446
3440
|
hn.value = !0;
|
|
3447
3441
|
let e = o.initialScrollTop;
|
|
3448
3442
|
requestAnimationFrame(() => {
|
|
3449
|
-
|
|
3443
|
+
oe.value && (oe.value.scrollTop = e);
|
|
3450
3444
|
});
|
|
3451
3445
|
}
|
|
3452
|
-
J(
|
|
3446
|
+
J(Ge, (e) => {
|
|
3453
3447
|
if (!e) {
|
|
3454
3448
|
hn.value = !1;
|
|
3455
3449
|
return;
|
|
3456
3450
|
}
|
|
3457
|
-
|
|
3458
|
-
let t =
|
|
3459
|
-
t && o.onCompatibilityChange?.(
|
|
3460
|
-
}),
|
|
3461
|
-
let e =
|
|
3462
|
-
|
|
3463
|
-
}), t =
|
|
3464
|
-
|
|
3465
|
-
}), n =
|
|
3466
|
-
|
|
3467
|
-
}), r = vt.install(), i =
|
|
3468
|
-
|
|
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(() => {
|
|
3469
3463
|
e(), t(), n(), r(), i();
|
|
3470
3464
|
});
|
|
3471
3465
|
});
|
|
3472
|
-
let { exposed: vn } =
|
|
3473
|
-
editor:
|
|
3466
|
+
let { exposed: vn } = Ki({
|
|
3467
|
+
editor: Pe,
|
|
3474
3468
|
editorView: X,
|
|
3475
3469
|
isDirty: Ke,
|
|
3476
3470
|
commentsDirty: Q.commentsDirty,
|
|
3477
3471
|
clearCommentsDirty: Q.clearCommentsDirty,
|
|
3478
3472
|
layout: Je,
|
|
3479
|
-
pagesRef:
|
|
3480
|
-
pagesViewportRef:
|
|
3473
|
+
pagesRef: D,
|
|
3474
|
+
pagesViewportRef: ae,
|
|
3481
3475
|
zoom: B,
|
|
3482
3476
|
scrollVisiblePositionIntoView: Ct,
|
|
3483
3477
|
author: () => o.author,
|
|
@@ -3486,8 +3480,8 @@ var ba = { class: "docx-editor-vue__toolbar-shell" }, xa = {
|
|
|
3486
3480
|
return Q.pushComment(t), t.id;
|
|
3487
3481
|
},
|
|
3488
3482
|
focus: tt,
|
|
3489
|
-
getDocument:
|
|
3490
|
-
setZoom:
|
|
3483
|
+
getDocument: et,
|
|
3484
|
+
setZoom: G,
|
|
3491
3485
|
save: $e,
|
|
3492
3486
|
loadDocument: Qe,
|
|
3493
3487
|
loadDocumentBuffer: Ze,
|
|
@@ -3503,56 +3497,56 @@ var ba = { class: "docx-editor-vue__toolbar-shell" }, xa = {
|
|
|
3503
3497
|
]),
|
|
3504
3498
|
style: H(t.style)
|
|
3505
3499
|
}, [
|
|
3506
|
-
L("div",
|
|
3500
|
+
L("div", va, [R(yr, {
|
|
3507
3501
|
"show-table-insert": o.showTableInsert !== !1,
|
|
3508
3502
|
onRename: n[0] ||= (e) => s("rename", e),
|
|
3509
3503
|
onMenuAction: fn,
|
|
3510
3504
|
onInsertTable: pn
|
|
3511
3505
|
}, {
|
|
3512
|
-
"title-bar-left":
|
|
3513
|
-
"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)]),
|
|
3514
3508
|
_: 3
|
|
3515
|
-
}, 8, ["show-table-insert"]), t.showToolbar ? (U(), P(
|
|
3509
|
+
}, 8, ["show-table-insert"]), t.showToolbar ? (U(), P(ee, ve({
|
|
3516
3510
|
key: 0,
|
|
3517
3511
|
view: q(X),
|
|
3518
|
-
"get-commands": q(
|
|
3519
|
-
"state-tick":
|
|
3512
|
+
"get-commands": q(Z),
|
|
3513
|
+
"state-tick": O.value,
|
|
3520
3514
|
"zoom-percent": q(_e),
|
|
3521
|
-
"is-min-zoom": q(
|
|
3522
|
-
"is-max-zoom": q(
|
|
3523
|
-
"zoom-presets": q(
|
|
3515
|
+
"is-min-zoom": q(ye),
|
|
3516
|
+
"is-max-zoom": q(Se),
|
|
3517
|
+
"zoom-presets": q(je),
|
|
3524
3518
|
"show-zoom-control": t.showZoomControl,
|
|
3525
3519
|
"editor-mode": l.value,
|
|
3526
3520
|
"show-review-controls": d.value,
|
|
3527
3521
|
"track-changes-on": f.value,
|
|
3528
3522
|
"display-mode": p.value,
|
|
3529
3523
|
"read-only": u.value,
|
|
3530
|
-
"comments-sidebar-open":
|
|
3524
|
+
"comments-sidebar-open": M.value,
|
|
3531
3525
|
"image-context": q(st),
|
|
3532
3526
|
theme: t.theme ?? null
|
|
3533
3527
|
}, Ht.value, {
|
|
3534
|
-
onFindReplace: n[1] ||= (e) =>
|
|
3535
|
-
onInsertLink: n[2] ||= (e) =>
|
|
3536
|
-
onInsertSymbol: n[3] ||= (e) =>
|
|
3528
|
+
onFindReplace: n[1] ||= (e) => k.value = !0,
|
|
3529
|
+
onInsertLink: n[2] ||= (e) => ce.value = !0,
|
|
3530
|
+
onInsertSymbol: n[3] ||= (e) => ue.value = !0,
|
|
3537
3531
|
onInsertPageBreak: Qt,
|
|
3538
|
-
onPageSetup: n[4] ||= (e) =>
|
|
3532
|
+
onPageSetup: n[4] ||= (e) => fe.value = !0,
|
|
3539
3533
|
onToggleOutline: q(Ot).handleToggleOutline,
|
|
3540
3534
|
onApplyStyle: q(Kt),
|
|
3541
|
-
onZoomIn: q(
|
|
3542
|
-
onZoomOut: q(
|
|
3543
|
-
onZoomSet: q(
|
|
3544
|
-
onToggleSidebar: n[5] ||= (e) =>
|
|
3535
|
+
onZoomIn: q(Te),
|
|
3536
|
+
onZoomOut: q(De),
|
|
3537
|
+
onZoomSet: q(G),
|
|
3538
|
+
onToggleSidebar: n[5] ||= (e) => M.value = !M.value,
|
|
3545
3539
|
onModeChange: dn,
|
|
3546
|
-
onToggleTrackChanges:
|
|
3547
|
-
"onUpdate:displayMode":
|
|
3548
|
-
onImageProperties: n[6] ||= (e) =>
|
|
3549
|
-
onImageWrapType: q(
|
|
3540
|
+
onToggleTrackChanges: h,
|
|
3541
|
+
"onUpdate:displayMode": y,
|
|
3542
|
+
onImageProperties: n[6] ||= (e) => de.value = !0,
|
|
3543
|
+
onImageWrapType: q(ut),
|
|
3550
3544
|
onImageTransform: q(dt)
|
|
3551
|
-
}),
|
|
3552
|
-
"table-context":
|
|
3545
|
+
}), me({
|
|
3546
|
+
"table-context": Ee(() => [R(_, {
|
|
3553
3547
|
view: q(X),
|
|
3554
|
-
"get-commands": q(
|
|
3555
|
-
"state-tick":
|
|
3548
|
+
"get-commands": q(Z),
|
|
3549
|
+
"state-tick": O.value,
|
|
3556
3550
|
theme: t.theme ?? null
|
|
3557
3551
|
}, null, 8, [
|
|
3558
3552
|
"view",
|
|
@@ -3563,7 +3557,7 @@ var ba = { class: "docx-editor-vue__toolbar-shell" }, xa = {
|
|
|
3563
3557
|
_: 2
|
|
3564
3558
|
}, [e.$slots["toolbar-extra"] || t.toolbarExtra ? {
|
|
3565
3559
|
name: "toolbar-extra",
|
|
3566
|
-
fn:
|
|
3560
|
+
fn: Ee(() => [Ce(e.$slots, "toolbar-extra", {}, () => [t.toolbarExtra ? (U(), P(C, {
|
|
3567
3561
|
key: 0,
|
|
3568
3562
|
node: t.toolbarExtra
|
|
3569
3563
|
}, null, 8, ["node"])) : F("", !0)], !0)]),
|
|
@@ -3593,19 +3587,19 @@ var ba = { class: "docx-editor-vue__toolbar-shell" }, xa = {
|
|
|
3593
3587
|
"onImageWrapType",
|
|
3594
3588
|
"onImageTransform"
|
|
3595
3589
|
])) : F("", !0)]),
|
|
3596
|
-
|
|
3597
|
-
"show-find-replace":
|
|
3598
|
-
"onUpdate:showFindReplace": n[7] ||= (e) =>
|
|
3599
|
-
"show-hyperlink":
|
|
3600
|
-
"onUpdate:showHyperlink": n[8] ||= (e) =>
|
|
3601
|
-
"show-insert-symbol":
|
|
3602
|
-
"onUpdate:showInsertSymbol": n[9] ||= (e) =>
|
|
3603
|
-
"show-image-properties":
|
|
3604
|
-
"onUpdate:showImageProperties": n[10] ||= (e) =>
|
|
3605
|
-
"show-page-setup":
|
|
3606
|
-
"onUpdate:showPageSetup": n[11] ||= (e) =>
|
|
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,
|
|
3607
3601
|
view: q(X),
|
|
3608
|
-
bookmarks:
|
|
3602
|
+
bookmarks: he.value,
|
|
3609
3603
|
"selected-image-pm-pos": q(at)?.pmPos ?? null,
|
|
3610
3604
|
"section-properties": Vt.value,
|
|
3611
3605
|
onInsertSymbol: q(qt),
|
|
@@ -3627,25 +3621,25 @@ var ba = { class: "docx-editor-vue__toolbar-shell" }, xa = {
|
|
|
3627
3621
|
"onHyperlinkRemove",
|
|
3628
3622
|
"onPageSetupApply"
|
|
3629
3623
|
]),
|
|
3630
|
-
q(qe) ? (U(), I("div",
|
|
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, {
|
|
3631
3625
|
key: 0,
|
|
3632
3626
|
node: t.loadingIndicator
|
|
3633
|
-
}, null, 8, ["node"])) : (U(), I(
|
|
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, {
|
|
3634
3628
|
key: 0,
|
|
3635
3629
|
node: t.placeholder
|
|
3636
|
-
}, null, 8, ["node"])) : (U(), I(
|
|
3630
|
+
}, null, 8, ["node"])) : (U(), I(j, { key: 1 }, [ge("No document loaded")], 64))], !0)])) : F("", !0),
|
|
3637
3631
|
L("div", {
|
|
3638
3632
|
ref_key: "hiddenPmRef",
|
|
3639
|
-
ref:
|
|
3633
|
+
ref: E,
|
|
3640
3634
|
class: "docx-editor-vue__hidden-pm paged-editor__hidden-pm"
|
|
3641
3635
|
}, null, 512),
|
|
3642
3636
|
L("div", {
|
|
3643
3637
|
ref_key: "editorScrollRef",
|
|
3644
|
-
ref:
|
|
3638
|
+
ref: oe,
|
|
3645
3639
|
class: "docx-editor-vue__editor-scroll",
|
|
3646
3640
|
onScroll: gn
|
|
3647
|
-
}, [L("div",
|
|
3648
|
-
|
|
3641
|
+
}, [L("div", Sa, [
|
|
3642
|
+
se.value && !u.value ? (U(), I("div", Ca, [R(S, {
|
|
3649
3643
|
"section-props": Vt.value,
|
|
3650
3644
|
zoom: q(B),
|
|
3651
3645
|
unit: t.rulerUnit ?? "inch",
|
|
@@ -3679,7 +3673,7 @@ var ba = { class: "docx-editor-vue__toolbar-shell" }, xa = {
|
|
|
3679
3673
|
"onFirstLineIndentChange",
|
|
3680
3674
|
"onTabStopRemove"
|
|
3681
3675
|
])])) : F("", !0),
|
|
3682
|
-
|
|
3676
|
+
se.value && !u.value ? (U(), I("div", wa, [R(g, {
|
|
3683
3677
|
"section-props": Vt.value,
|
|
3684
3678
|
zoom: q(B),
|
|
3685
3679
|
unit: t.rulerUnit ?? "inch",
|
|
@@ -3696,7 +3690,7 @@ var ba = { class: "docx-editor-vue__toolbar-shell" }, xa = {
|
|
|
3696
3690
|
])])) : F("", !0),
|
|
3697
3691
|
L("div", {
|
|
3698
3692
|
ref_key: "pagesViewportRef",
|
|
3699
|
-
ref:
|
|
3693
|
+
ref: ae,
|
|
3700
3694
|
class: "docx-editor-vue__pages-viewport",
|
|
3701
3695
|
onWheel: Me,
|
|
3702
3696
|
onMousedown: n[20] ||= (...e) => q(wt) && q(wt)(...e),
|
|
@@ -3704,15 +3698,15 @@ var ba = { class: "docx-editor-vue__toolbar-shell" }, xa = {
|
|
|
3704
3698
|
onClick: n[22] ||= (...e) => q(Et) && q(Et)(...e),
|
|
3705
3699
|
onContextmenu: n[23] ||= Y((...e) => q(Nt) && q(Nt)(...e), ["prevent"])
|
|
3706
3700
|
}, [
|
|
3707
|
-
L("div",
|
|
3701
|
+
L("div", Ta, [L("div", {
|
|
3708
3702
|
ref_key: "pagesRef",
|
|
3709
|
-
ref:
|
|
3703
|
+
ref: D,
|
|
3710
3704
|
class: "docx-editor-vue__pages paged-editor__pages",
|
|
3711
3705
|
style: H(Gt.value)
|
|
3712
|
-
}, null, 4), L("div",
|
|
3706
|
+
}, null, 4), L("div", Ea, [R(lr, {
|
|
3713
3707
|
"get-view": () => q(X),
|
|
3714
|
-
"get-pages-container": () =>
|
|
3715
|
-
"editor-state": q(
|
|
3708
|
+
"get-pages-container": () => D.value,
|
|
3709
|
+
"editor-state": q(Le),
|
|
3716
3710
|
zoom: q(B),
|
|
3717
3711
|
layout: q(Je),
|
|
3718
3712
|
blocks: q(Ye),
|
|
@@ -3731,11 +3725,11 @@ var ba = { class: "docx-editor-vue__toolbar-shell" }, xa = {
|
|
|
3731
3725
|
"on-term-click",
|
|
3732
3726
|
"selected-canonical",
|
|
3733
3727
|
"selection-seq"
|
|
3734
|
-
]), o.showTemplateDirectives ? (U(), P(
|
|
3728
|
+
]), o.showTemplateDirectives ? (U(), P(mi, {
|
|
3735
3729
|
key: 0,
|
|
3736
3730
|
"get-view": () => q(X),
|
|
3737
|
-
"get-pages-container": () =>
|
|
3738
|
-
"editor-state": q(
|
|
3731
|
+
"get-pages-container": () => D.value,
|
|
3732
|
+
"editor-state": q(Le),
|
|
3739
3733
|
zoom: q(B),
|
|
3740
3734
|
layout: q(Je),
|
|
3741
3735
|
blocks: q(Ye),
|
|
@@ -3749,7 +3743,7 @@ var ba = { class: "docx-editor-vue__toolbar-shell" }, xa = {
|
|
|
3749
3743
|
"blocks",
|
|
3750
3744
|
"measures"
|
|
3751
3745
|
])) : F("", !0)])]),
|
|
3752
|
-
|
|
3746
|
+
R(ri, {
|
|
3753
3747
|
"image-info": q(at),
|
|
3754
3748
|
zoom: q(B),
|
|
3755
3749
|
view: q(X),
|
|
@@ -3763,7 +3757,7 @@ var ba = { class: "docx-editor-vue__toolbar-shell" }, xa = {
|
|
|
3763
3757
|
"view",
|
|
3764
3758
|
"onContextMenu"
|
|
3765
3759
|
]),
|
|
3766
|
-
|
|
3760
|
+
R(wi, {
|
|
3767
3761
|
data: q(ft),
|
|
3768
3762
|
"read-only": u.value,
|
|
3769
3763
|
onNavigate: q(ht),
|
|
@@ -3788,13 +3782,13 @@ var ba = { class: "docx-editor-vue__toolbar-shell" }, xa = {
|
|
|
3788
3782
|
}),
|
|
3789
3783
|
"aria-label": q(yt).type === "row" ? "Insert row" : "Insert column",
|
|
3790
3784
|
onMousedown: n[16] ||= (...e) => q(Dt) && q(Dt)(...e)
|
|
3791
|
-
}, " + ", 44,
|
|
3792
|
-
|
|
3785
|
+
}, " + ", 44, Da)) : F("", !0),
|
|
3786
|
+
R(m, {
|
|
3793
3787
|
comments: q(zt),
|
|
3794
|
-
"pages-container":
|
|
3788
|
+
"pages-container": D.value,
|
|
3795
3789
|
zoom: q(B),
|
|
3796
3790
|
"page-width-px": Ut.value,
|
|
3797
|
-
"sidebar-open":
|
|
3791
|
+
"sidebar-open": M.value,
|
|
3798
3792
|
"resolved-comment-ids": Wt.value,
|
|
3799
3793
|
onMarkerClick: () => {}
|
|
3800
3794
|
}, null, 8, [
|
|
@@ -3805,18 +3799,18 @@ var ba = { class: "docx-editor-vue__toolbar-shell" }, xa = {
|
|
|
3805
3799
|
"sidebar-open",
|
|
3806
3800
|
"resolved-comment-ids"
|
|
3807
3801
|
]),
|
|
3808
|
-
|
|
3809
|
-
"is-open":
|
|
3802
|
+
R(v, {
|
|
3803
|
+
"is-open": M.value,
|
|
3810
3804
|
comments: q(zt),
|
|
3811
3805
|
"tracked-changes": Rt.value,
|
|
3812
3806
|
"show-resolved": !0,
|
|
3813
3807
|
"is-adding-comment": q($).isAddingComment.value,
|
|
3814
3808
|
"add-comment-y-position": q($).addCommentYPosition.value,
|
|
3815
|
-
"pages-container":
|
|
3809
|
+
"pages-container": D.value,
|
|
3816
3810
|
"page-width-px": Ut.value,
|
|
3817
3811
|
zoom: q(B),
|
|
3818
3812
|
"active-item-id": pe.value,
|
|
3819
|
-
onClose: n[17] ||= (e) =>
|
|
3813
|
+
onClose: n[17] ||= (e) => M.value = !1,
|
|
3820
3814
|
"onUpdate:activeItemId": n[18] ||= (e) => pe.value = e,
|
|
3821
3815
|
onAddComment: q($).handleAddComment,
|
|
3822
3816
|
onCancelAddComment: q($).handleCancelAddComment,
|
|
@@ -3862,17 +3856,17 @@ var ba = { class: "docx-editor-vue__toolbar-shell" }, xa = {
|
|
|
3862
3856
|
"aria-label": "Add comment",
|
|
3863
3857
|
title: "Add comment",
|
|
3864
3858
|
onMousedown: n[19] ||= Y((...e) => q($).startAddComment && q($).startAddComment(...e), ["prevent", "stop"])
|
|
3865
|
-
}, [
|
|
3859
|
+
}, [R(r, {
|
|
3866
3860
|
name: "add_comment",
|
|
3867
3861
|
size: 18
|
|
3868
3862
|
})], 36)) : F("", !0)
|
|
3869
3863
|
], 544),
|
|
3870
|
-
A.value ? F("", !0) : (U(), P(
|
|
3864
|
+
A.value ? F("", !0) : (U(), P(ai, {
|
|
3871
3865
|
key: 2,
|
|
3872
3866
|
"left-offset": 12,
|
|
3873
3867
|
onToggle: q(Ot).handleToggleOutline
|
|
3874
3868
|
}, null, 8, ["onToggle"])),
|
|
3875
|
-
q(bt).totalPages > 1 ? (U(), P(
|
|
3869
|
+
q(bt).totalPages > 1 ? (U(), P(oi, {
|
|
3876
3870
|
key: 3,
|
|
3877
3871
|
"current-page": q(bt).currentPage,
|
|
3878
3872
|
"total-pages": q(bt).totalPages,
|
|
@@ -3882,10 +3876,10 @@ var ba = { class: "docx-editor-vue__toolbar-shell" }, xa = {
|
|
|
3882
3876
|
"total-pages",
|
|
3883
3877
|
"visible"
|
|
3884
3878
|
])) : F("", !0),
|
|
3885
|
-
|
|
3879
|
+
R(pr, {
|
|
3886
3880
|
"is-open": A.value,
|
|
3887
|
-
headings:
|
|
3888
|
-
"get-scroll-container": () =>
|
|
3881
|
+
headings: z.value,
|
|
3882
|
+
"get-scroll-container": () => D.value,
|
|
3889
3883
|
onClose: n[24] ||= (e) => A.value = !1,
|
|
3890
3884
|
onNavigate: q(Ot).handleOutlineNavigate
|
|
3891
3885
|
}, null, 8, [
|
|
@@ -3895,7 +3889,7 @@ var ba = { class: "docx-editor-vue__toolbar-shell" }, xa = {
|
|
|
3895
3889
|
"onNavigate"
|
|
3896
3890
|
])
|
|
3897
3891
|
])], 544),
|
|
3898
|
-
|
|
3892
|
+
R(qr, {
|
|
3899
3893
|
"read-only": u.value,
|
|
3900
3894
|
"context-menu": q(kt),
|
|
3901
3895
|
"image-context-menu": q(At),
|
|
@@ -3906,7 +3900,7 @@ var ba = { class: "docx-editor-vue__toolbar-shell" }, xa = {
|
|
|
3906
3900
|
onCloseContextMenu: n[25] ||= (e) => q(kt).isOpen = !1,
|
|
3907
3901
|
onImageWrapSelect: q(Ft),
|
|
3908
3902
|
onCloseImageContextMenu: n[26] ||= (e) => At.value = null,
|
|
3909
|
-
onOpenImageProperties: n[27] ||= (e) =>
|
|
3903
|
+
onOpenImageProperties: n[27] ||= (e) => de.value = !0
|
|
3910
3904
|
}, null, 8, [
|
|
3911
3905
|
"read-only",
|
|
3912
3906
|
"context-menu",
|
|
@@ -3919,30 +3913,42 @@ var ba = { class: "docx-editor-vue__toolbar-shell" }, xa = {
|
|
|
3919
3913
|
])
|
|
3920
3914
|
], 6));
|
|
3921
3915
|
}
|
|
3922
|
-
}), [["__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 = [
|
|
3923
3929
|
"disabled",
|
|
3924
3930
|
"title",
|
|
3925
3931
|
"aria-label"
|
|
3926
|
-
],
|
|
3932
|
+
], Na = [
|
|
3927
3933
|
"disabled",
|
|
3928
3934
|
"title",
|
|
3929
3935
|
"aria-label"
|
|
3930
|
-
],
|
|
3936
|
+
], Pa = ["aria-label"], Fa = [
|
|
3931
3937
|
"disabled",
|
|
3932
3938
|
"title",
|
|
3933
3939
|
"aria-label",
|
|
3934
3940
|
"aria-pressed"
|
|
3935
|
-
],
|
|
3941
|
+
], Ia = [
|
|
3936
3942
|
"disabled",
|
|
3937
3943
|
"title",
|
|
3938
3944
|
"aria-label",
|
|
3939
3945
|
"aria-pressed"
|
|
3940
|
-
],
|
|
3946
|
+
], La = [
|
|
3941
3947
|
"disabled",
|
|
3942
3948
|
"title",
|
|
3943
3949
|
"aria-label",
|
|
3944
3950
|
"aria-pressed"
|
|
3945
|
-
],
|
|
3951
|
+
], Ra = /*#__PURE__*/ t(/* @__PURE__ */ z({
|
|
3946
3952
|
__name: "FormattingBar",
|
|
3947
3953
|
props: {
|
|
3948
3954
|
currentFormatting: {},
|
|
@@ -3984,7 +3990,7 @@ var ba = { class: "docx-editor-vue__toolbar-shell" }, xa = {
|
|
|
3984
3990
|
"redo"
|
|
3985
3991
|
],
|
|
3986
3992
|
setup(e, { emit: t }) {
|
|
3987
|
-
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 ??
|
|
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(() => {
|
|
3988
3994
|
let e = s.value.color;
|
|
3989
3995
|
return e ? e.replace(/^#/, "").toUpperCase() : void 0;
|
|
3990
3996
|
}), f = N(() => {
|
|
@@ -4014,25 +4020,25 @@ var ba = { class: "docx-editor-vue__toolbar-shell" }, xa = {
|
|
|
4014
4020
|
title: q(o)("undoShortcut"),
|
|
4015
4021
|
"aria-label": q(o)("undo"),
|
|
4016
4022
|
onMousedown: i[0] ||= Y((e) => a("undo"), ["prevent"])
|
|
4017
|
-
}, [
|
|
4023
|
+
}, [R(r, {
|
|
4018
4024
|
name: "undo",
|
|
4019
4025
|
size: 18
|
|
4020
|
-
})], 40,
|
|
4026
|
+
})], 40, Ma), L("button", {
|
|
4021
4027
|
type: "button",
|
|
4022
4028
|
class: "docx-formatting-bar__btn",
|
|
4023
4029
|
disabled: e.disabled || !e.canRedo,
|
|
4024
4030
|
title: q(o)("redoShortcut"),
|
|
4025
4031
|
"aria-label": q(o)("redo"),
|
|
4026
4032
|
onMousedown: i[1] ||= Y((e) => a("redo"), ["prevent"])
|
|
4027
|
-
}, [
|
|
4033
|
+
}, [R(r, {
|
|
4028
4034
|
name: "redo",
|
|
4029
4035
|
size: 18
|
|
4030
|
-
})], 40,
|
|
4036
|
+
})], 40, Na)], 8, ja),
|
|
4031
4037
|
i[13] ||= L("span", {
|
|
4032
4038
|
class: "docx-formatting-bar__divider",
|
|
4033
4039
|
role: "separator"
|
|
4034
4040
|
}, null, -1),
|
|
4035
|
-
e.showStylePicker ? (U(), I(
|
|
4041
|
+
e.showStylePicker ? (U(), I(j, { key: 0 }, [R(b, ve({ value: s.value.styleId ?? "Normal" }, l.value, {
|
|
4036
4042
|
disabled: e.disabled,
|
|
4037
4043
|
onChange: i[2] ||= (e) => a("format", {
|
|
4038
4044
|
type: "applyStyle",
|
|
@@ -4055,10 +4061,10 @@ var ba = { class: "docx-editor-vue__toolbar-shell" }, xa = {
|
|
|
4055
4061
|
"aria-label": q(o)("bold"),
|
|
4056
4062
|
"aria-pressed": !!s.value.bold,
|
|
4057
4063
|
onMousedown: i[3] ||= Y((e) => a("format", "bold"), ["prevent"])
|
|
4058
|
-
}, [
|
|
4064
|
+
}, [R(r, {
|
|
4059
4065
|
name: "format_bold",
|
|
4060
4066
|
size: 18
|
|
4061
|
-
})], 42,
|
|
4067
|
+
})], 42, Fa),
|
|
4062
4068
|
L("button", {
|
|
4063
4069
|
type: "button",
|
|
4064
4070
|
class: V(["docx-formatting-bar__btn", { "docx-formatting-bar__btn--active": s.value.italic }]),
|
|
@@ -4067,10 +4073,10 @@ var ba = { class: "docx-editor-vue__toolbar-shell" }, xa = {
|
|
|
4067
4073
|
"aria-label": q(o)("italic"),
|
|
4068
4074
|
"aria-pressed": !!s.value.italic,
|
|
4069
4075
|
onMousedown: i[4] ||= Y((e) => a("format", "italic"), ["prevent"])
|
|
4070
|
-
}, [
|
|
4076
|
+
}, [R(r, {
|
|
4071
4077
|
name: "format_italic",
|
|
4072
4078
|
size: 18
|
|
4073
|
-
})], 42,
|
|
4079
|
+
})], 42, Ia),
|
|
4074
4080
|
L("button", {
|
|
4075
4081
|
type: "button",
|
|
4076
4082
|
class: V(["docx-formatting-bar__btn", { "docx-formatting-bar__btn--active": s.value.underline }]),
|
|
@@ -4079,15 +4085,15 @@ var ba = { class: "docx-editor-vue__toolbar-shell" }, xa = {
|
|
|
4079
4085
|
"aria-label": q(o)("underline"),
|
|
4080
4086
|
"aria-pressed": !!s.value.underline,
|
|
4081
4087
|
onMousedown: i[5] ||= Y((e) => a("format", "underline"), ["prevent"])
|
|
4082
|
-
}, [
|
|
4088
|
+
}, [R(r, {
|
|
4083
4089
|
name: "format_underlined",
|
|
4084
4090
|
size: 18
|
|
4085
|
-
})], 42,
|
|
4086
|
-
], 8,
|
|
4087
|
-
e.showTextColorPicker ? (U(), I(
|
|
4091
|
+
})], 42, La)
|
|
4092
|
+
], 8, Pa),
|
|
4093
|
+
e.showTextColorPicker ? (U(), I(j, { key: 1 }, [i[12] ||= L("span", {
|
|
4088
4094
|
class: "docx-formatting-bar__divider",
|
|
4089
4095
|
role: "separator"
|
|
4090
|
-
}, null, -1),
|
|
4096
|
+
}, null, -1), R(q(n), {
|
|
4091
4097
|
mode: "text",
|
|
4092
4098
|
value: d.value,
|
|
4093
4099
|
theme: e.theme ?? null,
|
|
@@ -4102,7 +4108,7 @@ var ba = { class: "docx-editor-vue__toolbar-shell" }, xa = {
|
|
|
4102
4108
|
class: "docx-formatting-bar__divider",
|
|
4103
4109
|
role: "separator"
|
|
4104
4110
|
}, null, -1),
|
|
4105
|
-
e.showAlignmentButtons ? (U(), P(
|
|
4111
|
+
e.showAlignmentButtons ? (U(), P(y, {
|
|
4106
4112
|
key: 2,
|
|
4107
4113
|
value: s.value.alignment ?? "left",
|
|
4108
4114
|
disabled: e.disabled,
|
|
@@ -4111,7 +4117,7 @@ var ba = { class: "docx-editor-vue__toolbar-shell" }, xa = {
|
|
|
4111
4117
|
value: e
|
|
4112
4118
|
})
|
|
4113
4119
|
}, null, 8, ["value", "disabled"])) : F("", !0),
|
|
4114
|
-
e.showListButtons ? (U(), P(
|
|
4120
|
+
e.showListButtons ? (U(), P(x, {
|
|
4115
4121
|
key: 3,
|
|
4116
4122
|
"list-state": u.value,
|
|
4117
4123
|
disabled: e.disabled,
|
|
@@ -4125,9 +4131,9 @@ var ba = { class: "docx-editor-vue__toolbar-shell" }, xa = {
|
|
|
4125
4131
|
"disabled",
|
|
4126
4132
|
"can-outdent"
|
|
4127
4133
|
])) : F("", !0)
|
|
4128
|
-
], 10,
|
|
4134
|
+
], 10, Aa));
|
|
4129
4135
|
}
|
|
4130
|
-
}), [["__scopeId", "data-v-
|
|
4136
|
+
}), [["__scopeId", "data-v-fc03de2e"]]), za = [
|
|
4131
4137
|
{
|
|
4132
4138
|
value: .5,
|
|
4133
4139
|
label: "50%"
|
|
@@ -4152,7 +4158,7 @@ var ba = { class: "docx-editor-vue__toolbar-shell" }, xa = {
|
|
|
4152
4158
|
value: 2,
|
|
4153
4159
|
label: "200%"
|
|
4154
4160
|
}
|
|
4155
|
-
],
|
|
4161
|
+
], Ba = /*#__PURE__*/ t(/* @__PURE__ */ z({
|
|
4156
4162
|
__name: "ZoomControl",
|
|
4157
4163
|
props: {
|
|
4158
4164
|
value: { default: 1 },
|
|
@@ -4169,7 +4175,7 @@ var ba = { class: "docx-editor-vue__toolbar-shell" }, xa = {
|
|
|
4169
4175
|
},
|
|
4170
4176
|
emits: ["change"],
|
|
4171
4177
|
setup(e, { emit: t }) {
|
|
4172
|
-
let { Select: n } = p(), r = e, i = t, a = N(() => r.levels ??
|
|
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(() => {
|
|
4173
4179
|
let e = a.value.map((e) => ({
|
|
4174
4180
|
value: String(e.value),
|
|
4175
4181
|
label: e.label
|
|
@@ -4197,7 +4203,7 @@ var ba = { class: "docx-editor-vue__toolbar-shell" }, xa = {
|
|
|
4197
4203
|
"disabled"
|
|
4198
4204
|
]));
|
|
4199
4205
|
}
|
|
4200
|
-
}), [["__scopeId", "data-v-8079e07f"]]),
|
|
4206
|
+
}), [["__scopeId", "data-v-8079e07f"]]), Va = (e, t, n = {}) => {
|
|
4201
4207
|
let { locale: r = "en", ...i } = n;
|
|
4202
4208
|
return new Promise((n, a) => {
|
|
4203
4209
|
let o = W(null), s = null, c = !1, u = {
|
|
@@ -4222,8 +4228,8 @@ var ba = { class: "docx-editor-vue__toolbar-shell" }, xa = {
|
|
|
4222
4228
|
c || (c = !0, a(/* @__PURE__ */ Error("Editor was destroyed before mounting completed."))), s?.unmount(), s = null;
|
|
4223
4229
|
}
|
|
4224
4230
|
};
|
|
4225
|
-
s =
|
|
4226
|
-
return () =>
|
|
4231
|
+
s = pe({ setup() {
|
|
4232
|
+
return () => B(Oa, {
|
|
4227
4233
|
...i,
|
|
4228
4234
|
documentBuffer: e,
|
|
4229
4235
|
ref: o,
|
|
@@ -4238,4 +4244,4 @@ var ba = { class: "docx-editor-vue__toolbar-shell" }, xa = {
|
|
|
4238
4244
|
});
|
|
4239
4245
|
};
|
|
4240
4246
|
//#endregion
|
|
4241
|
-
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 };
|