@stll/folio-react 0.7.0 → 0.8.1
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/{CommentsSidebar-B8X5a8JW.js → CommentsSidebar-Byn5lyrt.js} +2 -2
- package/dist/{FindReplaceDialog-Bx7QaFQ_.js → FindReplaceDialog-CqKK82nE.js} +1 -1
- package/dist/FootnotePropertiesDialog-CixRdIiT.js +822 -0
- package/dist/ImagePositionDialog-DNodkoI2.js +1065 -0
- package/dist/ImagePropertiesDialog-CLsDIUWb.js +613 -0
- package/dist/{InsertSymbolDialog-Df9dyLvn.js → InsertSymbolDialog-DCFLmfzn.js} +1 -1
- package/dist/PageSetupDialog-COkgeOQn.js +820 -0
- package/dist/TablePropertiesDialog-B_AGrPR8.js +434 -0
- package/dist/compat/eigenpal.d.ts +1 -1
- package/dist/compat/eigenpal.js +1 -1
- package/dist/{dialogs-DsHnfN0g.js → dialogs-Bj2PdycR.js} +265 -201
- package/dist/dialogs.js +8 -8
- package/dist/{folio-ui-C-85DSuK.js → folio-ui-BgDDRsUX.js} +5 -3
- package/dist/index.d.ts +1 -1
- package/dist/index.js +10 -10
- package/dist/{renderAsync-ChQI9UJG.d.ts → renderAsync-BmxQE7iO.d.ts} +3 -2
- package/dist/{renderAsync-evdyE_GW.js → renderAsync-BtWYvQMT.js} +378 -273
- package/package.json +2 -2
- package/dist/FootnotePropertiesDialog-2lmpg9m8.js +0 -646
- package/dist/ImagePositionDialog-D3MileYL.js +0 -842
- package/dist/ImagePropertiesDialog-CzK8HCaW.js +0 -465
- package/dist/PageSetupDialog-PSs9YdPb.js +0 -684
- package/dist/TablePropertiesDialog-PQxKKM0Y.js +0 -344
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import { i as cn, n as FolioUIProvider, r as useFolioUI, t as DEFAULT_COMPONENTS } from "./folio-ui-
|
|
1
|
+
import { i as cn, n as FolioUIProvider, r as useFolioUI, t as DEFAULT_COMPONENTS } from "./folio-ui-BgDDRsUX.js";
|
|
2
2
|
import { t as messages_exports } from "./messages.js";
|
|
3
3
|
import { c } from "react-compiler-runtime";
|
|
4
4
|
import * as React$1 from "react";
|
|
5
5
|
import React, { Component, Suspense, cloneElement, createContext, forwardRef, isValidElement, lazy, memo, useCallback, useEffect, useImperativeHandle, useLayoutEffect, useMemo, useRef, useState, useSyncExternalStore } from "react";
|
|
6
6
|
import { AlertCircleIcon, AlertTriangleIcon, AlignCenterIcon, AlignJustifyIcon, AlignLeftIcon, AlignRightIcon, BaselineIcon, BoldIcon, CheckIcon, ChevronDownIcon, ChevronLeftIcon, ChevronRightIcon, ClipboardCopyIcon, EyeIcon, FileIcon, GlobeIcon, ImageIcon, IndentDecreaseIcon, IndentIncreaseIcon, InfoIcon, ItalicIcon, LinkIcon, ListIcon, ListOrderedIcon, MoreHorizontalIcon, OmegaIcon, PaintbrushIcon, PenLineIcon, PencilIcon, PilcrowIcon, Redo2Icon, RulerIcon, SeparatorHorizontalIcon, SquarePenIcon, StickyNoteIcon, TableIcon, TableOfContentsIcon, TypeIcon, UnderlineIcon, Undo2Icon, UnlinkIcon, XIcon } from "lucide-react";
|
|
7
|
+
import { closeHistory, redo, undo } from "prosemirror-history";
|
|
7
8
|
import { IntlProvider, useTranslations } from "use-intl";
|
|
8
9
|
import { FOLIO_DOCUMENT_OPERATION_CONTRACT_VERSION, applyFolioDocumentOperations, assertSupportedFolioDocumentOperationVersion, createFolioAIEditSnapshot, getCommentAnchorsFromDoc, getFolioDocumentOperationIssues, getTrackedChangesFromDoc } from "@stll/folio-core/ai-edits";
|
|
9
10
|
import { normalizeBaseDirection } from "@stll/folio-core/docx/normalizeBaseDirection";
|
|
@@ -92,7 +93,6 @@ import { applyImagePosition, applyImageProperties, applyImageTransform, applyIma
|
|
|
92
93
|
import { classifyEditorKeydown, deleteSelectedTable, isFocusInInputLike, isMacPlatform } from "@stll/folio-core/managers/editorShortcuts";
|
|
93
94
|
import { getScrollTopForZoomAnchor, getViewportCenterZoomAnchorForZoomChange } from "@stll/folio-core/paged-layout/zoomScrollAnchor";
|
|
94
95
|
import { ZOOM_MAX, ZOOM_MIN, ZOOM_STEP } from "@stll/folio-core/utils/zoom";
|
|
95
|
-
import { redo, undo } from "prosemirror-history";
|
|
96
96
|
import { createRoot } from "react-dom/client";
|
|
97
97
|
//#region src/hooks/useHistory.ts
|
|
98
98
|
/**
|
|
@@ -7716,13 +7716,13 @@ function _temp2$3(a, b) {
|
|
|
7716
7716
|
}
|
|
7717
7717
|
//#endregion
|
|
7718
7718
|
//#region src/components/DocxEditorDialogs.tsx
|
|
7719
|
-
const FindReplaceDialog = lazy(() => import("./FindReplaceDialog-
|
|
7720
|
-
const TablePropertiesDialog = lazy(() => import("./TablePropertiesDialog-
|
|
7721
|
-
const ImagePositionDialog = lazy(() => import("./ImagePositionDialog-
|
|
7722
|
-
const ImagePropertiesDialog = lazy(() => import("./ImagePropertiesDialog-
|
|
7723
|
-
const FootnotePropertiesDialog = lazy(() => import("./FootnotePropertiesDialog-
|
|
7724
|
-
const PageSetupDialog = lazy(() => import("./PageSetupDialog-
|
|
7725
|
-
const InsertSymbolDialog = lazy(() => import("./InsertSymbolDialog-
|
|
7719
|
+
const FindReplaceDialog = lazy(() => import("./FindReplaceDialog-CqKK82nE.js").then((n) => n.n).then((m) => ({ default: m.FindReplaceDialog })));
|
|
7720
|
+
const TablePropertiesDialog = lazy(() => import("./TablePropertiesDialog-B_AGrPR8.js").then((n) => n.n).then((m) => ({ default: m.TablePropertiesDialog })));
|
|
7721
|
+
const ImagePositionDialog = lazy(() => import("./ImagePositionDialog-DNodkoI2.js").then((n) => n.n).then((m) => ({ default: m.ImagePositionDialog })));
|
|
7722
|
+
const ImagePropertiesDialog = lazy(() => import("./ImagePropertiesDialog-CLsDIUWb.js").then((n) => n.n).then((m) => ({ default: m.ImagePropertiesDialog })));
|
|
7723
|
+
const FootnotePropertiesDialog = lazy(() => import("./FootnotePropertiesDialog-CixRdIiT.js").then((n) => n.n).then((m) => ({ default: m.FootnotePropertiesDialog })));
|
|
7724
|
+
const PageSetupDialog = lazy(() => import("./PageSetupDialog-COkgeOQn.js").then((n) => n.n).then((m) => ({ default: m.PageSetupDialog })));
|
|
7725
|
+
const InsertSymbolDialog = lazy(() => import("./InsertSymbolDialog-DCFLmfzn.js").then((n) => n.n).then((m) => ({ default: m.InsertSymbolDialog })));
|
|
7726
7726
|
function DocxEditorDialogs(t0) {
|
|
7727
7727
|
const $ = c(47);
|
|
7728
7728
|
const { findReplace, tableProperties, imagePosition, imageProperties, pageSetup, footnoteProperties, insertSymbol } = t0;
|
|
@@ -7891,61 +7891,88 @@ function DefaultLoadingIndicator() {
|
|
|
7891
7891
|
return t2;
|
|
7892
7892
|
}
|
|
7893
7893
|
function DefaultPlaceholder() {
|
|
7894
|
-
const $ = c(
|
|
7894
|
+
const $ = c(5);
|
|
7895
|
+
const t = useTranslations("folio");
|
|
7895
7896
|
let t0;
|
|
7896
7897
|
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
|
|
7897
|
-
t0 = /* @__PURE__ */
|
|
7898
|
+
t0 = /* @__PURE__ */ jsx(FileIcon, {
|
|
7899
|
+
size: 48,
|
|
7900
|
+
strokeWidth: 1.5
|
|
7901
|
+
});
|
|
7902
|
+
$[0] = t0;
|
|
7903
|
+
} else t0 = $[0];
|
|
7904
|
+
let t1;
|
|
7905
|
+
if ($[1] !== t) {
|
|
7906
|
+
t1 = t("noDocumentLoaded");
|
|
7907
|
+
$[1] = t;
|
|
7908
|
+
$[2] = t1;
|
|
7909
|
+
} else t1 = $[2];
|
|
7910
|
+
let t2;
|
|
7911
|
+
if ($[3] !== t1) {
|
|
7912
|
+
t2 = /* @__PURE__ */ jsxs("div", {
|
|
7898
7913
|
className: "flex h-full flex-col items-center justify-center text-[var(--doc-text-subtle)]",
|
|
7899
|
-
children: [/* @__PURE__ */ jsx(
|
|
7900
|
-
size: 48,
|
|
7901
|
-
strokeWidth: 1.5
|
|
7902
|
-
}), /* @__PURE__ */ jsx("span", {
|
|
7914
|
+
children: [t0, /* @__PURE__ */ jsx("span", {
|
|
7903
7915
|
className: "mt-4 text-sm",
|
|
7904
|
-
children:
|
|
7916
|
+
children: t1
|
|
7905
7917
|
})]
|
|
7906
7918
|
});
|
|
7907
|
-
$[
|
|
7908
|
-
|
|
7909
|
-
|
|
7919
|
+
$[3] = t1;
|
|
7920
|
+
$[4] = t2;
|
|
7921
|
+
} else t2 = $[4];
|
|
7922
|
+
return t2;
|
|
7910
7923
|
}
|
|
7911
7924
|
function ParseError(t0) {
|
|
7912
|
-
const $ = c(
|
|
7925
|
+
const $ = c(10);
|
|
7913
7926
|
const { message } = t0;
|
|
7927
|
+
const t = useTranslations("folio");
|
|
7914
7928
|
let t1;
|
|
7915
|
-
let t2;
|
|
7916
7929
|
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
|
|
7917
7930
|
t1 = /* @__PURE__ */ jsx(AlertCircleIcon, {
|
|
7918
7931
|
size: 48,
|
|
7919
7932
|
strokeWidth: 1.5,
|
|
7920
7933
|
className: "text-[var(--doc-error)]"
|
|
7921
7934
|
});
|
|
7922
|
-
t2 = /* @__PURE__ */ jsx("h3", {
|
|
7923
|
-
className: "mt-4 text-base font-semibold text-[var(--doc-error)]",
|
|
7924
|
-
children: "Failed to Load Document"
|
|
7925
|
-
});
|
|
7926
7935
|
$[0] = t1;
|
|
7927
|
-
|
|
7928
|
-
|
|
7929
|
-
|
|
7930
|
-
t2 =
|
|
7931
|
-
|
|
7936
|
+
} else t1 = $[0];
|
|
7937
|
+
let t2;
|
|
7938
|
+
if ($[1] !== t) {
|
|
7939
|
+
t2 = t("loadDocumentFailedTitle");
|
|
7940
|
+
$[1] = t;
|
|
7941
|
+
$[2] = t2;
|
|
7942
|
+
} else t2 = $[2];
|
|
7932
7943
|
let t3;
|
|
7933
|
-
if ($[
|
|
7934
|
-
t3 = /* @__PURE__ */
|
|
7944
|
+
if ($[3] !== t2) {
|
|
7945
|
+
t3 = /* @__PURE__ */ jsx("h3", {
|
|
7946
|
+
className: "mt-4 text-base font-semibold text-[var(--doc-error)]",
|
|
7947
|
+
children: t2
|
|
7948
|
+
});
|
|
7949
|
+
$[3] = t2;
|
|
7950
|
+
$[4] = t3;
|
|
7951
|
+
} else t3 = $[4];
|
|
7952
|
+
let t4;
|
|
7953
|
+
if ($[5] !== message) {
|
|
7954
|
+
t4 = /* @__PURE__ */ jsx("p", {
|
|
7955
|
+
className: "mt-2 max-w-[400px] text-sm text-[var(--doc-text-muted)]",
|
|
7956
|
+
children: message
|
|
7957
|
+
});
|
|
7958
|
+
$[5] = message;
|
|
7959
|
+
$[6] = t4;
|
|
7960
|
+
} else t4 = $[6];
|
|
7961
|
+
let t5;
|
|
7962
|
+
if ($[7] !== t3 || $[8] !== t4) {
|
|
7963
|
+
t5 = /* @__PURE__ */ jsxs("div", {
|
|
7935
7964
|
className: "flex h-full flex-col items-center justify-center p-5 text-center",
|
|
7936
7965
|
children: [
|
|
7937
7966
|
t1,
|
|
7938
|
-
|
|
7939
|
-
|
|
7940
|
-
className: "mt-2 max-w-[400px] text-sm text-[var(--doc-text-muted)]",
|
|
7941
|
-
children: message
|
|
7942
|
-
})
|
|
7967
|
+
t3,
|
|
7968
|
+
t4
|
|
7943
7969
|
]
|
|
7944
7970
|
});
|
|
7945
|
-
$[
|
|
7946
|
-
$[
|
|
7947
|
-
|
|
7948
|
-
|
|
7971
|
+
$[7] = t3;
|
|
7972
|
+
$[8] = t4;
|
|
7973
|
+
$[9] = t5;
|
|
7974
|
+
} else t5 = $[9];
|
|
7975
|
+
return t5;
|
|
7949
7976
|
}
|
|
7950
7977
|
//#endregion
|
|
7951
7978
|
//#region src/components/ErrorBoundary.tsx
|
|
@@ -11010,6 +11037,7 @@ const labelStyle = {
|
|
|
11010
11037
|
letterSpacing: .3
|
|
11011
11038
|
};
|
|
11012
11039
|
const InlineHeaderFooterEditor = forwardRef(function InlineHeaderFooterEditor({ position, targetElement, parentElement, getActiveView, onClose, onRemove }, ref) {
|
|
11040
|
+
const t = useTranslations("folio");
|
|
11013
11041
|
const [showOptions, setShowOptions] = useState(false);
|
|
11014
11042
|
const optionsRef = useRef(null);
|
|
11015
11043
|
const [overlayPos, setOverlayPos] = useState(null);
|
|
@@ -11089,7 +11117,7 @@ const InlineHeaderFooterEditor = forwardRef(function InlineHeaderFooterEditor({
|
|
|
11089
11117
|
return redo(view.state, view.dispatch);
|
|
11090
11118
|
}
|
|
11091
11119
|
}));
|
|
11092
|
-
const label = position === "header" ? "
|
|
11120
|
+
const label = position === "header" ? t("headerFooter.header") : t("headerFooter.footer");
|
|
11093
11121
|
if (!overlayPos) return null;
|
|
11094
11122
|
return /* @__PURE__ */ jsxs("div", {
|
|
11095
11123
|
role: "presentation",
|
|
@@ -11111,7 +11139,6 @@ const InlineHeaderFooterEditor = forwardRef(function InlineHeaderFooterEditor({
|
|
|
11111
11139
|
children: label
|
|
11112
11140
|
}), /* @__PURE__ */ jsx(OptionsMenu, {
|
|
11113
11141
|
position,
|
|
11114
|
-
label,
|
|
11115
11142
|
showOptions,
|
|
11116
11143
|
setShowOptions,
|
|
11117
11144
|
optionsRef,
|
|
@@ -11127,7 +11154,6 @@ const InlineHeaderFooterEditor = forwardRef(function InlineHeaderFooterEditor({
|
|
|
11127
11154
|
children: label
|
|
11128
11155
|
}), /* @__PURE__ */ jsx(OptionsMenu, {
|
|
11129
11156
|
position,
|
|
11130
|
-
label,
|
|
11131
11157
|
showOptions,
|
|
11132
11158
|
setShowOptions,
|
|
11133
11159
|
optionsRef,
|
|
@@ -11139,8 +11165,9 @@ const InlineHeaderFooterEditor = forwardRef(function InlineHeaderFooterEditor({
|
|
|
11139
11165
|
});
|
|
11140
11166
|
});
|
|
11141
11167
|
function OptionsMenu(t0) {
|
|
11142
|
-
const $ = c(
|
|
11143
|
-
const { position,
|
|
11168
|
+
const $ = c(22);
|
|
11169
|
+
const { position, showOptions, setShowOptions, optionsRef, onRemove, onClose, getActiveView } = t0;
|
|
11170
|
+
const t = useTranslations("folio");
|
|
11144
11171
|
let t1;
|
|
11145
11172
|
if ($[0] !== getActiveView) {
|
|
11146
11173
|
t1 = (fieldType) => {
|
|
@@ -11169,22 +11196,35 @@ function OptionsMenu(t0) {
|
|
|
11169
11196
|
} else t2 = $[2];
|
|
11170
11197
|
let t3;
|
|
11171
11198
|
if ($[3] !== setShowOptions) {
|
|
11172
|
-
t3 =
|
|
11173
|
-
|
|
11174
|
-
|
|
11175
|
-
|
|
11176
|
-
e.stopPropagation();
|
|
11177
|
-
setShowOptions(_temp$1);
|
|
11178
|
-
},
|
|
11179
|
-
onMouseDown: _temp2$1,
|
|
11180
|
-
children: "Options ▾"
|
|
11181
|
-
});
|
|
11199
|
+
t3 = (e) => {
|
|
11200
|
+
e.stopPropagation();
|
|
11201
|
+
setShowOptions(_temp$1);
|
|
11202
|
+
};
|
|
11182
11203
|
$[3] = setShowOptions;
|
|
11183
11204
|
$[4] = t3;
|
|
11184
11205
|
} else t3 = $[4];
|
|
11185
11206
|
let t4;
|
|
11186
|
-
if ($[5] !==
|
|
11187
|
-
t4 =
|
|
11207
|
+
if ($[5] !== t) {
|
|
11208
|
+
t4 = t("headerFooter.options");
|
|
11209
|
+
$[5] = t;
|
|
11210
|
+
$[6] = t4;
|
|
11211
|
+
} else t4 = $[6];
|
|
11212
|
+
let t5;
|
|
11213
|
+
if ($[7] !== t3 || $[8] !== t4) {
|
|
11214
|
+
t5 = /* @__PURE__ */ jsxs("button", {
|
|
11215
|
+
type: "button",
|
|
11216
|
+
className: "hf-options-button",
|
|
11217
|
+
onClick: t3,
|
|
11218
|
+
onMouseDown: _temp2$1,
|
|
11219
|
+
children: [t4, " ▾"]
|
|
11220
|
+
});
|
|
11221
|
+
$[7] = t3;
|
|
11222
|
+
$[8] = t4;
|
|
11223
|
+
$[9] = t5;
|
|
11224
|
+
} else t5 = $[9];
|
|
11225
|
+
let t6;
|
|
11226
|
+
if ($[10] !== insertField || $[11] !== onClose || $[12] !== onRemove || $[13] !== position || $[14] !== setShowOptions || $[15] !== showOptions || $[16] !== t) {
|
|
11227
|
+
t6 = showOptions && /* @__PURE__ */ jsxs("div", {
|
|
11188
11228
|
className: `hf-options-dropdown${position === "footer" ? " hf-options-dropdown--up" : ""}`,
|
|
11189
11229
|
children: [
|
|
11190
11230
|
/* @__PURE__ */ jsx("button", {
|
|
@@ -11194,7 +11234,7 @@ function OptionsMenu(t0) {
|
|
|
11194
11234
|
setShowOptions(false);
|
|
11195
11235
|
insertField("PAGE");
|
|
11196
11236
|
},
|
|
11197
|
-
children: "
|
|
11237
|
+
children: t("headerFooter.insertPageNumber")
|
|
11198
11238
|
}),
|
|
11199
11239
|
/* @__PURE__ */ jsx("button", {
|
|
11200
11240
|
type: "button",
|
|
@@ -11203,55 +11243,51 @@ function OptionsMenu(t0) {
|
|
|
11203
11243
|
setShowOptions(false);
|
|
11204
11244
|
insertField("NUMPAGES");
|
|
11205
11245
|
},
|
|
11206
|
-
children: "
|
|
11246
|
+
children: t("headerFooter.insertPageCount")
|
|
11207
11247
|
}),
|
|
11208
11248
|
/* @__PURE__ */ jsx("div", { className: "hf-options-divider" }),
|
|
11209
|
-
onRemove && /* @__PURE__ */
|
|
11249
|
+
onRemove && /* @__PURE__ */ jsx("button", {
|
|
11210
11250
|
type: "button",
|
|
11211
11251
|
className: "hf-options-item",
|
|
11212
11252
|
onClick: () => {
|
|
11213
11253
|
setShowOptions(false);
|
|
11214
11254
|
onRemove();
|
|
11215
11255
|
},
|
|
11216
|
-
children:
|
|
11256
|
+
children: position === "header" ? t("headerFooter.removeHeader") : t("headerFooter.removeFooter")
|
|
11217
11257
|
}),
|
|
11218
|
-
/* @__PURE__ */
|
|
11258
|
+
/* @__PURE__ */ jsx("button", {
|
|
11219
11259
|
type: "button",
|
|
11220
11260
|
className: "hf-options-item",
|
|
11221
11261
|
onClick: () => {
|
|
11222
11262
|
setShowOptions(false);
|
|
11223
11263
|
onClose();
|
|
11224
11264
|
},
|
|
11225
|
-
children:
|
|
11226
|
-
"Close ",
|
|
11227
|
-
label.toLowerCase(),
|
|
11228
|
-
" editing"
|
|
11229
|
-
]
|
|
11265
|
+
children: position === "header" ? t("headerFooter.closeHeaderEditing") : t("headerFooter.closeFooterEditing")
|
|
11230
11266
|
})
|
|
11231
11267
|
]
|
|
11232
11268
|
});
|
|
11233
|
-
$[
|
|
11234
|
-
$[
|
|
11235
|
-
$[
|
|
11236
|
-
$[
|
|
11237
|
-
$[
|
|
11238
|
-
$[
|
|
11239
|
-
$[
|
|
11240
|
-
$[
|
|
11241
|
-
} else
|
|
11242
|
-
let
|
|
11243
|
-
if ($[
|
|
11244
|
-
|
|
11269
|
+
$[10] = insertField;
|
|
11270
|
+
$[11] = onClose;
|
|
11271
|
+
$[12] = onRemove;
|
|
11272
|
+
$[13] = position;
|
|
11273
|
+
$[14] = setShowOptions;
|
|
11274
|
+
$[15] = showOptions;
|
|
11275
|
+
$[16] = t;
|
|
11276
|
+
$[17] = t6;
|
|
11277
|
+
} else t6 = $[17];
|
|
11278
|
+
let t7;
|
|
11279
|
+
if ($[18] !== optionsRef || $[19] !== t5 || $[20] !== t6) {
|
|
11280
|
+
t7 = /* @__PURE__ */ jsxs("div", {
|
|
11245
11281
|
style: t2,
|
|
11246
11282
|
ref: optionsRef,
|
|
11247
|
-
children: [
|
|
11283
|
+
children: [t5, t6]
|
|
11248
11284
|
});
|
|
11249
|
-
$[
|
|
11250
|
-
$[
|
|
11251
|
-
$[
|
|
11252
|
-
$[
|
|
11253
|
-
} else
|
|
11254
|
-
return
|
|
11285
|
+
$[18] = optionsRef;
|
|
11286
|
+
$[19] = t5;
|
|
11287
|
+
$[20] = t6;
|
|
11288
|
+
$[21] = t7;
|
|
11289
|
+
} else t7 = $[21];
|
|
11290
|
+
return t7;
|
|
11255
11291
|
}
|
|
11256
11292
|
function _temp2$1(e_0) {
|
|
11257
11293
|
return e_0.stopPropagation();
|
|
@@ -11360,7 +11396,7 @@ function areSelectionFormattingEqual(a, b) {
|
|
|
11360
11396
|
* Edit mode: text + URL inputs with Apply.
|
|
11361
11397
|
*/
|
|
11362
11398
|
function HyperlinkPopup(t0) {
|
|
11363
|
-
const $ = c(
|
|
11399
|
+
const $ = c(88);
|
|
11364
11400
|
const { data, onNavigate, onCopy, onEdit, onRemove, onClose, readOnly } = t0;
|
|
11365
11401
|
const t = useTranslations("folio");
|
|
11366
11402
|
const [mode, setMode] = useState("view");
|
|
@@ -11610,81 +11646,88 @@ function HyperlinkPopup(t0) {
|
|
|
11610
11646
|
} else t22 = $[42];
|
|
11611
11647
|
const t23 = !t22;
|
|
11612
11648
|
let t24;
|
|
11613
|
-
if ($[43] !==
|
|
11614
|
-
t24 =
|
|
11649
|
+
if ($[43] !== t) {
|
|
11650
|
+
t24 = t("common.apply");
|
|
11651
|
+
$[43] = t;
|
|
11652
|
+
$[44] = t24;
|
|
11653
|
+
} else t24 = $[44];
|
|
11654
|
+
let t25;
|
|
11655
|
+
if ($[45] !== handleApply || $[46] !== t23 || $[47] !== t24) {
|
|
11656
|
+
t25 = /* @__PURE__ */ jsx("button", {
|
|
11615
11657
|
className: "text-primary shrink-0 rounded px-3 py-1 text-sm font-semibold disabled:opacity-40",
|
|
11616
11658
|
disabled: t23,
|
|
11617
11659
|
onClick: handleApply,
|
|
11618
11660
|
type: "button",
|
|
11619
|
-
children:
|
|
11661
|
+
children: t24
|
|
11620
11662
|
});
|
|
11621
|
-
$[
|
|
11622
|
-
$[
|
|
11623
|
-
$[
|
|
11624
|
-
|
|
11625
|
-
|
|
11626
|
-
|
|
11627
|
-
|
|
11663
|
+
$[45] = handleApply;
|
|
11664
|
+
$[46] = t23;
|
|
11665
|
+
$[47] = t24;
|
|
11666
|
+
$[48] = t25;
|
|
11667
|
+
} else t25 = $[48];
|
|
11668
|
+
let t26;
|
|
11669
|
+
if ($[49] !== t21 || $[50] !== t25) {
|
|
11670
|
+
t26 = /* @__PURE__ */ jsxs("div", {
|
|
11628
11671
|
className: "flex items-center gap-2",
|
|
11629
11672
|
children: [
|
|
11630
11673
|
t19,
|
|
11631
11674
|
t21,
|
|
11632
|
-
|
|
11675
|
+
t25
|
|
11633
11676
|
]
|
|
11634
11677
|
});
|
|
11635
|
-
$[
|
|
11636
|
-
$[
|
|
11637
|
-
$[
|
|
11638
|
-
} else
|
|
11639
|
-
let
|
|
11640
|
-
if ($[
|
|
11641
|
-
|
|
11678
|
+
$[49] = t21;
|
|
11679
|
+
$[50] = t25;
|
|
11680
|
+
$[51] = t26;
|
|
11681
|
+
} else t26 = $[51];
|
|
11682
|
+
let t27;
|
|
11683
|
+
if ($[52] !== t14 || $[53] !== t18 || $[54] !== t26) {
|
|
11684
|
+
t27 = /* @__PURE__ */ jsxs("div", {
|
|
11642
11685
|
ref: popupRef,
|
|
11643
11686
|
className: "fixed z-[10000] w-80 rounded-lg border border-[var(--doc-border)] bg-[var(--doc-page)] p-3 shadow-lg",
|
|
11644
11687
|
onMouseDown: t13,
|
|
11645
11688
|
role: "presentation",
|
|
11646
11689
|
style: t14,
|
|
11647
|
-
children: [t18,
|
|
11690
|
+
children: [t18, t26]
|
|
11648
11691
|
});
|
|
11649
|
-
$[
|
|
11650
|
-
$[
|
|
11651
|
-
$[
|
|
11652
|
-
$[
|
|
11653
|
-
} else
|
|
11654
|
-
return
|
|
11692
|
+
$[52] = t14;
|
|
11693
|
+
$[53] = t18;
|
|
11694
|
+
$[54] = t26;
|
|
11695
|
+
$[55] = t27;
|
|
11696
|
+
} else t27 = $[55];
|
|
11697
|
+
return t27;
|
|
11655
11698
|
}
|
|
11656
11699
|
let t13;
|
|
11657
|
-
if ($[
|
|
11700
|
+
if ($[56] === Symbol.for("react.memo_cache_sentinel")) {
|
|
11658
11701
|
t13 = containedHandler(_temp2);
|
|
11659
|
-
$[
|
|
11660
|
-
} else t13 = $[
|
|
11702
|
+
$[56] = t13;
|
|
11703
|
+
} else t13 = $[56];
|
|
11661
11704
|
let t14;
|
|
11662
|
-
if ($[
|
|
11705
|
+
if ($[57] !== left || $[58] !== top) {
|
|
11663
11706
|
t14 = {
|
|
11664
11707
|
top,
|
|
11665
11708
|
left
|
|
11666
11709
|
};
|
|
11667
|
-
$[
|
|
11668
|
-
$[
|
|
11669
|
-
$[
|
|
11670
|
-
} else t14 = $[
|
|
11710
|
+
$[57] = left;
|
|
11711
|
+
$[58] = top;
|
|
11712
|
+
$[59] = t14;
|
|
11713
|
+
} else t14 = $[59];
|
|
11671
11714
|
let t15;
|
|
11672
|
-
if ($[
|
|
11715
|
+
if ($[60] === Symbol.for("react.memo_cache_sentinel")) {
|
|
11673
11716
|
t15 = /* @__PURE__ */ jsx(GlobeIcon, { className: "text-muted-foreground size-4.5 shrink-0" });
|
|
11674
|
-
$[
|
|
11675
|
-
} else t15 = $[
|
|
11717
|
+
$[60] = t15;
|
|
11718
|
+
} else t15 = $[60];
|
|
11676
11719
|
let t16;
|
|
11677
|
-
if ($[
|
|
11720
|
+
if ($[61] !== data.href || $[62] !== onNavigate) {
|
|
11678
11721
|
t16 = (e_6) => {
|
|
11679
11722
|
e_6.preventDefault();
|
|
11680
11723
|
onNavigate(data.href);
|
|
11681
11724
|
};
|
|
11682
|
-
$[
|
|
11683
|
-
$[
|
|
11684
|
-
$[
|
|
11685
|
-
} else t16 = $[
|
|
11725
|
+
$[61] = data.href;
|
|
11726
|
+
$[62] = onNavigate;
|
|
11727
|
+
$[63] = t16;
|
|
11728
|
+
} else t16 = $[63];
|
|
11686
11729
|
let t17;
|
|
11687
|
-
if ($[
|
|
11730
|
+
if ($[64] !== data.href || $[65] !== t16) {
|
|
11688
11731
|
t17 = /* @__PURE__ */ jsx("a", {
|
|
11689
11732
|
className: "text-primary truncate text-sm hover:underline",
|
|
11690
11733
|
href: data.href,
|
|
@@ -11694,35 +11737,35 @@ function HyperlinkPopup(t0) {
|
|
|
11694
11737
|
title: data.href,
|
|
11695
11738
|
children: data.href
|
|
11696
11739
|
});
|
|
11697
|
-
$[
|
|
11698
|
-
$[
|
|
11699
|
-
$[
|
|
11700
|
-
} else t17 = $[
|
|
11740
|
+
$[64] = data.href;
|
|
11741
|
+
$[65] = t16;
|
|
11742
|
+
$[66] = t17;
|
|
11743
|
+
} else t17 = $[66];
|
|
11701
11744
|
let t18;
|
|
11702
|
-
if ($[
|
|
11745
|
+
if ($[67] === Symbol.for("react.memo_cache_sentinel")) {
|
|
11703
11746
|
t18 = /* @__PURE__ */ jsx("span", { className: "bg-border h-5 w-px shrink-0" });
|
|
11704
|
-
$[
|
|
11705
|
-
} else t18 = $[
|
|
11747
|
+
$[67] = t18;
|
|
11748
|
+
} else t18 = $[67];
|
|
11706
11749
|
let t19;
|
|
11707
|
-
if ($[
|
|
11750
|
+
if ($[68] !== data.href || $[69] !== onCopy) {
|
|
11708
11751
|
t19 = () => onCopy(data.href);
|
|
11709
|
-
$[
|
|
11710
|
-
$[
|
|
11711
|
-
$[
|
|
11712
|
-
} else t19 = $[
|
|
11752
|
+
$[68] = data.href;
|
|
11753
|
+
$[69] = onCopy;
|
|
11754
|
+
$[70] = t19;
|
|
11755
|
+
} else t19 = $[70];
|
|
11713
11756
|
let t20;
|
|
11714
|
-
if ($[
|
|
11757
|
+
if ($[71] !== t) {
|
|
11715
11758
|
t20 = t("copyLink");
|
|
11716
|
-
$[
|
|
11717
|
-
$[
|
|
11718
|
-
} else t20 = $[
|
|
11759
|
+
$[71] = t;
|
|
11760
|
+
$[72] = t20;
|
|
11761
|
+
} else t20 = $[72];
|
|
11719
11762
|
let t21;
|
|
11720
|
-
if ($[
|
|
11763
|
+
if ($[73] === Symbol.for("react.memo_cache_sentinel")) {
|
|
11721
11764
|
t21 = /* @__PURE__ */ jsx(ClipboardCopyIcon, { size: 16 });
|
|
11722
|
-
$[
|
|
11723
|
-
} else t21 = $[
|
|
11765
|
+
$[73] = t21;
|
|
11766
|
+
} else t21 = $[73];
|
|
11724
11767
|
let t22;
|
|
11725
|
-
if ($[
|
|
11768
|
+
if ($[74] !== t19 || $[75] !== t20) {
|
|
11726
11769
|
t22 = /* @__PURE__ */ jsx("button", {
|
|
11727
11770
|
className: "flex size-7 items-center justify-center rounded text-[var(--doc-text-muted)] hover:bg-[var(--doc-bg-hover)] transition-colors",
|
|
11728
11771
|
onClick: t19,
|
|
@@ -11730,12 +11773,12 @@ function HyperlinkPopup(t0) {
|
|
|
11730
11773
|
type: "button",
|
|
11731
11774
|
children: t21
|
|
11732
11775
|
});
|
|
11733
|
-
$[
|
|
11734
|
-
$[
|
|
11735
|
-
$[
|
|
11736
|
-
} else t22 = $[
|
|
11776
|
+
$[74] = t19;
|
|
11777
|
+
$[75] = t20;
|
|
11778
|
+
$[76] = t22;
|
|
11779
|
+
} else t22 = $[76];
|
|
11737
11780
|
let t23;
|
|
11738
|
-
if ($[
|
|
11781
|
+
if ($[77] !== data.displayText || $[78] !== data.href || $[79] !== onRemove || $[80] !== readOnly || $[81] !== t) {
|
|
11739
11782
|
t23 = !readOnly && /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx("button", {
|
|
11740
11783
|
className: "flex size-7 items-center justify-center rounded text-[var(--doc-text-muted)] hover:bg-[var(--doc-bg-hover)] transition-colors",
|
|
11741
11784
|
onClick: () => {
|
|
@@ -11753,15 +11796,15 @@ function HyperlinkPopup(t0) {
|
|
|
11753
11796
|
type: "button",
|
|
11754
11797
|
children: /* @__PURE__ */ jsx(UnlinkIcon, { size: 16 })
|
|
11755
11798
|
})] });
|
|
11756
|
-
$[
|
|
11757
|
-
$[
|
|
11758
|
-
$[
|
|
11759
|
-
$[
|
|
11760
|
-
$[
|
|
11761
|
-
$[
|
|
11762
|
-
} else t23 = $[
|
|
11799
|
+
$[77] = data.displayText;
|
|
11800
|
+
$[78] = data.href;
|
|
11801
|
+
$[79] = onRemove;
|
|
11802
|
+
$[80] = readOnly;
|
|
11803
|
+
$[81] = t;
|
|
11804
|
+
$[82] = t23;
|
|
11805
|
+
} else t23 = $[82];
|
|
11763
11806
|
let t24;
|
|
11764
|
-
if ($[
|
|
11807
|
+
if ($[83] !== t14 || $[84] !== t17 || $[85] !== t22 || $[86] !== t23) {
|
|
11765
11808
|
t24 = /* @__PURE__ */ jsxs("div", {
|
|
11766
11809
|
ref: popupRef,
|
|
11767
11810
|
className: "fixed z-[10000] flex max-w-[400px] items-center gap-2 rounded-lg border border-[var(--doc-border)] bg-[var(--doc-page)] px-3 py-2 shadow-lg",
|
|
@@ -11776,12 +11819,12 @@ function HyperlinkPopup(t0) {
|
|
|
11776
11819
|
t23
|
|
11777
11820
|
]
|
|
11778
11821
|
});
|
|
11779
|
-
$[
|
|
11780
|
-
$[
|
|
11781
|
-
$[
|
|
11782
|
-
$[
|
|
11783
|
-
$[
|
|
11784
|
-
} else t24 = $[
|
|
11822
|
+
$[83] = t14;
|
|
11823
|
+
$[84] = t17;
|
|
11824
|
+
$[85] = t22;
|
|
11825
|
+
$[86] = t23;
|
|
11826
|
+
$[87] = t24;
|
|
11827
|
+
} else t24 = $[87];
|
|
11785
11828
|
return t24;
|
|
11786
11829
|
}
|
|
11787
11830
|
function _temp2(e_5) {
|
|
@@ -12263,7 +12306,7 @@ function useFolioComments({ doc, autoOpenReviewSidebar, anchorPositions, editorC
|
|
|
12263
12306
|
* - Error boundary
|
|
12264
12307
|
* - Loading states
|
|
12265
12308
|
*/
|
|
12266
|
-
const CommentsSidebar = lazy(() => import("./CommentsSidebar-
|
|
12309
|
+
const CommentsSidebar = lazy(() => import("./CommentsSidebar-Byn5lyrt.js").then((m) => ({ default: m.CommentsSidebar })));
|
|
12267
12310
|
const TextContextMenu = lazy(() => import("./TextContextMenu-Ci7-M4oU.js").then((m) => ({ default: m.TextContextMenu })));
|
|
12268
12311
|
const loadAttemptSelectiveSave = async () => {
|
|
12269
12312
|
const { attemptSelectiveSave } = await import("@stll/folio-core/docx/selectiveSave");
|
|
@@ -12281,6 +12324,7 @@ const DISPLAY_MODE_LABEL_KEYS = {
|
|
|
12281
12324
|
original: "markupView.original"
|
|
12282
12325
|
};
|
|
12283
12326
|
const preventMouseDownDefault = (event) => event.preventDefault();
|
|
12327
|
+
let documentOperationUndoHandleCursor = Date.now();
|
|
12284
12328
|
function isDisplayMode(value) {
|
|
12285
12329
|
return typeof value === "string" && DISPLAY_MODES.some((mode) => mode === value);
|
|
12286
12330
|
}
|
|
@@ -12544,6 +12588,7 @@ const DocxEditor = forwardRef(function DocxEditor({ documentBuffer, password, do
|
|
|
12544
12588
|
commentsProp,
|
|
12545
12589
|
onCommentsChange
|
|
12546
12590
|
});
|
|
12591
|
+
const documentOperationUndoEntriesRef = useRef([]);
|
|
12547
12592
|
const styleResolverCacheRef = useRef(null);
|
|
12548
12593
|
const getCachedStyleResolver = useCallback((styles) => {
|
|
12549
12594
|
const cached = styleResolverCacheRef.current;
|
|
@@ -13835,12 +13880,23 @@ const DocxEditor = forwardRef(function DocxEditor({ documentBuffer, password, do
|
|
|
13835
13880
|
applied: [],
|
|
13836
13881
|
skipped,
|
|
13837
13882
|
issues: getFolioDocumentOperationIssues(batch.operations, skipped),
|
|
13838
|
-
receipts: []
|
|
13883
|
+
receipts: [],
|
|
13884
|
+
undoHandle: null
|
|
13839
13885
|
};
|
|
13840
13886
|
}
|
|
13887
|
+
const existingUndoEntry = documentOperationUndoEntriesRef.current.at(-1);
|
|
13888
|
+
if (existingUndoEntry && (!view_20.state.doc.eq(existingUndoEntry.afterState.doc) || commentsRef.current !== existingUndoEntry.commentsAfter)) documentOperationUndoEntriesRef.current.length = 0;
|
|
13889
|
+
const commentsBefore = commentsRef.current;
|
|
13841
13890
|
const createdComments = [];
|
|
13891
|
+
const operationView = {
|
|
13892
|
+
state: view_20.state,
|
|
13893
|
+
dispatch: (transaction) => {
|
|
13894
|
+
view_20.dispatch(closeHistory(transaction));
|
|
13895
|
+
operationView.state = view_20.state;
|
|
13896
|
+
}
|
|
13897
|
+
};
|
|
13842
13898
|
const result = applyFolioDocumentOperations({
|
|
13843
|
-
view:
|
|
13899
|
+
view: operationView,
|
|
13844
13900
|
snapshot,
|
|
13845
13901
|
batch,
|
|
13846
13902
|
author: operationAuthor,
|
|
@@ -13848,14 +13904,62 @@ const DocxEditor = forwardRef(function DocxEditor({ documentBuffer, password, do
|
|
|
13848
13904
|
const comment = createComment(text_3, operationAuthor);
|
|
13849
13905
|
createdComments.push(comment);
|
|
13850
13906
|
return comment.id;
|
|
13851
|
-
}
|
|
13907
|
+
},
|
|
13908
|
+
createUndoHandle: () => ({
|
|
13909
|
+
type: "documentOperationUndo",
|
|
13910
|
+
id: `react-${String(documentOperationUndoHandleCursor++)}`
|
|
13911
|
+
})
|
|
13852
13912
|
});
|
|
13853
13913
|
if (createdComments.length > 0) updateComments((currentComments_0) => [...currentComments_0, ...createdComments]);
|
|
13914
|
+
if (result.undoHandle !== null) documentOperationUndoEntriesRef.current.push({
|
|
13915
|
+
undoHandle: result.undoHandle,
|
|
13916
|
+
afterState: view_20.state,
|
|
13917
|
+
commentsBefore,
|
|
13918
|
+
commentsAfter: commentsRef.current
|
|
13919
|
+
});
|
|
13854
13920
|
return result;
|
|
13855
13921
|
},
|
|
13856
|
-
|
|
13922
|
+
undoDocumentOperations: (undoHandle) => {
|
|
13923
|
+
const entries = documentOperationUndoEntriesRef.current;
|
|
13924
|
+
const entryIndex = entries.findIndex((entry_2) => entry_2.undoHandle.type === undoHandle.type && entry_2.undoHandle.id === undoHandle.id);
|
|
13925
|
+
if (entryIndex === -1) return {
|
|
13926
|
+
status: "rejected",
|
|
13927
|
+
undoHandle,
|
|
13928
|
+
reason: "unknownHandle"
|
|
13929
|
+
};
|
|
13930
|
+
if (entryIndex !== entries.length - 1) return {
|
|
13931
|
+
status: "rejected",
|
|
13932
|
+
undoHandle,
|
|
13933
|
+
reason: "notLatest"
|
|
13934
|
+
};
|
|
13935
|
+
const entry_3 = entries.at(-1);
|
|
13857
13936
|
const view_21 = pagedEditorRef.current?.getView();
|
|
13858
|
-
if (!view_21) return {
|
|
13937
|
+
if (!entry_3 || !view_21) return {
|
|
13938
|
+
status: "rejected",
|
|
13939
|
+
undoHandle,
|
|
13940
|
+
reason: "unknownHandle"
|
|
13941
|
+
};
|
|
13942
|
+
if (!view_21.state.doc.eq(entry_3.afterState.doc) || commentsRef.current !== entry_3.commentsAfter) return {
|
|
13943
|
+
status: "rejected",
|
|
13944
|
+
undoHandle,
|
|
13945
|
+
reason: "documentChanged"
|
|
13946
|
+
};
|
|
13947
|
+
if (!(pagedEditorRef.current?.undo() ?? false)) return {
|
|
13948
|
+
status: "rejected",
|
|
13949
|
+
undoHandle,
|
|
13950
|
+
reason: "documentChanged"
|
|
13951
|
+
};
|
|
13952
|
+
replaceComments(entry_3.commentsBefore);
|
|
13953
|
+
entries.pop();
|
|
13954
|
+
requestAnimationFrame(refreshBodyHistoryAvailability);
|
|
13955
|
+
return {
|
|
13956
|
+
status: "undone",
|
|
13957
|
+
undoHandle
|
|
13958
|
+
};
|
|
13959
|
+
},
|
|
13960
|
+
applyAIEditOperations: ({ snapshot: snapshot_0, operations, mode = "tracked-changes", author: operationAuthor_0 = author }) => {
|
|
13961
|
+
const view_22 = pagedEditorRef.current?.getView();
|
|
13962
|
+
if (!view_22) return {
|
|
13859
13963
|
applied: [],
|
|
13860
13964
|
skipped: operations.map((operation_0) => ({
|
|
13861
13965
|
id: operation_0.id,
|
|
@@ -13864,7 +13968,7 @@ const DocxEditor = forwardRef(function DocxEditor({ documentBuffer, password, do
|
|
|
13864
13968
|
};
|
|
13865
13969
|
const createdComments_0 = [];
|
|
13866
13970
|
const { applied: applied_0, skipped: skipped_0 } = applyFolioDocumentOperations({
|
|
13867
|
-
view:
|
|
13971
|
+
view: view_22,
|
|
13868
13972
|
snapshot: snapshot_0,
|
|
13869
13973
|
batch: {
|
|
13870
13974
|
version: FOLIO_DOCUMENT_OPERATION_CONTRACT_VERSION,
|
|
@@ -13885,14 +13989,14 @@ const DocxEditor = forwardRef(function DocxEditor({ documentBuffer, password, do
|
|
|
13885
13989
|
};
|
|
13886
13990
|
},
|
|
13887
13991
|
acceptAIEditOperation: (revisionId) => {
|
|
13888
|
-
const view_22 = pagedEditorRef.current?.getView();
|
|
13889
|
-
if (!view_22) return false;
|
|
13890
|
-
return acceptAIEditRevision(revisionId)(view_22.state, view_22.dispatch);
|
|
13891
|
-
},
|
|
13892
|
-
rejectAIEditOperation: (revisionId_0) => {
|
|
13893
13992
|
const view_23 = pagedEditorRef.current?.getView();
|
|
13894
13993
|
if (!view_23) return false;
|
|
13895
|
-
return
|
|
13994
|
+
return acceptAIEditRevision(revisionId)(view_23.state, view_23.dispatch);
|
|
13995
|
+
},
|
|
13996
|
+
rejectAIEditOperation: (revisionId_0) => {
|
|
13997
|
+
const view_24 = pagedEditorRef.current?.getView();
|
|
13998
|
+
if (!view_24) return false;
|
|
13999
|
+
return rejectAIEditRevision(revisionId_0)(view_24.state, view_24.dispatch);
|
|
13896
14000
|
},
|
|
13897
14001
|
undo: () => {
|
|
13898
14002
|
if (hfEditPosition && hfEditorRef.current) return hfEditorRef.current.undo();
|
|
@@ -13907,98 +14011,98 @@ const DocxEditor = forwardRef(function DocxEditor({ documentBuffer, password, do
|
|
|
13907
14011
|
return redone;
|
|
13908
14012
|
},
|
|
13909
14013
|
scrollToAIEditOperation: (revisionId_1) => {
|
|
13910
|
-
const
|
|
13911
|
-
if (!
|
|
13912
|
-
const range_2 = findAIEditRevisionRange(
|
|
14014
|
+
const view_25 = pagedEditorRef.current?.getView();
|
|
14015
|
+
if (!view_25) return false;
|
|
14016
|
+
const range_2 = findAIEditRevisionRange(view_25.state, revisionId_1);
|
|
13913
14017
|
if (!range_2) return false;
|
|
13914
|
-
const { from: from_8, to: to_8 } = clampRangeToDocSize(
|
|
13915
|
-
const $from =
|
|
13916
|
-
const $to =
|
|
13917
|
-
|
|
14018
|
+
const { from: from_8, to: to_8 } = clampRangeToDocSize(view_25.state.doc.content.size, range_2);
|
|
14019
|
+
const $from = view_25.state.doc.resolve(from_8);
|
|
14020
|
+
const $to = view_25.state.doc.resolve(to_8);
|
|
14021
|
+
view_25.dispatch(view_25.state.tr.setSelection(TextSelection.between($from, $to)));
|
|
13918
14022
|
requestAnimationFrame(() => {
|
|
13919
14023
|
pagedEditorRef.current?.scrollToPosition(from_8);
|
|
13920
14024
|
});
|
|
13921
14025
|
return true;
|
|
13922
14026
|
},
|
|
13923
14027
|
scrollToBlock: (blockId, snapshot_1) => {
|
|
13924
|
-
const
|
|
13925
|
-
if (!
|
|
14028
|
+
const view_26 = pagedEditorRef.current?.getView();
|
|
14029
|
+
if (!view_26) return false;
|
|
13926
14030
|
const range_3 = resolveFolioAIBlockRange({
|
|
13927
14031
|
blockId,
|
|
13928
|
-
doc:
|
|
14032
|
+
doc: view_26.state.doc,
|
|
13929
14033
|
snapshot: snapshot_1
|
|
13930
14034
|
});
|
|
13931
14035
|
if (range_3 === null) return false;
|
|
13932
14036
|
const { from: from_9, to: to_9 } = range_3;
|
|
13933
|
-
const $from_0 =
|
|
13934
|
-
const $to_0 =
|
|
13935
|
-
|
|
14037
|
+
const $from_0 = view_26.state.doc.resolve(from_9);
|
|
14038
|
+
const $to_0 = view_26.state.doc.resolve(to_9);
|
|
14039
|
+
view_26.dispatch(view_26.state.tr.setSelection(TextSelection.between($from_0, $to_0)));
|
|
13936
14040
|
requestAnimationFrame(() => {
|
|
13937
14041
|
pagedEditorRef.current?.scrollToPosition(from_9);
|
|
13938
14042
|
});
|
|
13939
14043
|
return true;
|
|
13940
14044
|
},
|
|
13941
14045
|
getTrackedChanges: () => {
|
|
13942
|
-
const
|
|
13943
|
-
return
|
|
14046
|
+
const view_27 = pagedEditorRef.current?.getView();
|
|
14047
|
+
return view_27 ? getTrackedChangesFromDoc(view_27.state.doc) : [];
|
|
13944
14048
|
},
|
|
13945
14049
|
getCommentAnchors: () => {
|
|
13946
|
-
const
|
|
13947
|
-
return
|
|
14050
|
+
const view_28 = pagedEditorRef.current?.getView();
|
|
14051
|
+
return view_28 ? getCommentAnchorsFromDoc(view_28.state.doc) : [];
|
|
13948
14052
|
},
|
|
13949
14053
|
getSelectionText: () => {
|
|
13950
|
-
const
|
|
13951
|
-
return
|
|
14054
|
+
const view_29 = pagedEditorRef.current?.getView();
|
|
14055
|
+
return view_29 ? getSelectedText(view_29.state) : "";
|
|
13952
14056
|
},
|
|
13953
14057
|
getPageText: (page_0) => {
|
|
13954
|
-
const
|
|
13955
|
-
if (!
|
|
13956
|
-
return getPageTextFromLayout(pagedEditorRef.current?.getEditor()?.getLayout() ?? null,
|
|
14058
|
+
const view_30 = pagedEditorRef.current?.getView();
|
|
14059
|
+
if (!view_30) return null;
|
|
14060
|
+
return getPageTextFromLayout(pagedEditorRef.current?.getEditor()?.getLayout() ?? null, view_30.state.doc, page_0);
|
|
13957
14061
|
},
|
|
13958
14062
|
getContentControls: (filter = {}) => {
|
|
13959
|
-
const
|
|
13960
|
-
if (!
|
|
13961
|
-
return findBlockSdtMatches(
|
|
14063
|
+
const view_31 = pagedEditorRef.current?.getView();
|
|
14064
|
+
if (!view_31) return [];
|
|
14065
|
+
return findBlockSdtMatches(view_31.state.doc, filter).map((match_0) => ({
|
|
13962
14066
|
properties: blockSdtAttrsToSdtProperties(match_0.node),
|
|
13963
14067
|
path: match_0.path,
|
|
13964
14068
|
pmPos: match_0.pos
|
|
13965
14069
|
}));
|
|
13966
14070
|
},
|
|
13967
14071
|
scrollToContentControl: (filter_0) => {
|
|
13968
|
-
const
|
|
13969
|
-
if (!
|
|
13970
|
-
const match_1 = findBlockSdtMatch(
|
|
14072
|
+
const view_32 = pagedEditorRef.current?.getView();
|
|
14073
|
+
if (!view_32) return false;
|
|
14074
|
+
const match_1 = findBlockSdtMatch(view_32.state.doc, filter_0);
|
|
13971
14075
|
if (!match_1) return false;
|
|
13972
14076
|
const inside = match_1.pos + 1;
|
|
13973
|
-
const $pos =
|
|
13974
|
-
|
|
14077
|
+
const $pos = view_32.state.doc.resolve(inside);
|
|
14078
|
+
view_32.dispatch(view_32.state.tr.setSelection(TextSelection.near($pos)));
|
|
13975
14079
|
requestAnimationFrame(() => {
|
|
13976
14080
|
pagedEditorRef.current?.scrollToPosition(inside);
|
|
13977
14081
|
});
|
|
13978
14082
|
return true;
|
|
13979
14083
|
},
|
|
13980
14084
|
setContentControlContent: (filter_1, input, options_2 = {}) => {
|
|
13981
|
-
const
|
|
13982
|
-
if (!
|
|
13983
|
-
const tr_0 = typeof input === "string" ? setContentControlContentTr(
|
|
14085
|
+
const view_33 = pagedEditorRef.current?.getView();
|
|
14086
|
+
if (!view_33) return false;
|
|
14087
|
+
const tr_0 = typeof input === "string" ? setContentControlContentTr(view_33.state, filter_1, input, options_2) : setContentControlContentBlocksTr(view_33.state, filter_1, input, options_2);
|
|
13984
14088
|
if (!tr_0) return false;
|
|
13985
|
-
|
|
14089
|
+
view_33.dispatch(tr_0);
|
|
13986
14090
|
return true;
|
|
13987
14091
|
},
|
|
13988
14092
|
setContentControlValue: (filter_2, input_0, options_3 = {}) => {
|
|
13989
|
-
const
|
|
13990
|
-
if (!
|
|
13991
|
-
const tr_1 = setContentControlValueTr(
|
|
14093
|
+
const view_34 = pagedEditorRef.current?.getView();
|
|
14094
|
+
if (!view_34) return false;
|
|
14095
|
+
const tr_1 = setContentControlValueTr(view_34.state, filter_2, input_0, options_3);
|
|
13992
14096
|
if (!tr_1) return false;
|
|
13993
|
-
|
|
14097
|
+
view_34.dispatch(tr_1);
|
|
13994
14098
|
return true;
|
|
13995
14099
|
},
|
|
13996
14100
|
removeContentControl: (filter_3, options_4 = {}) => {
|
|
13997
|
-
const
|
|
13998
|
-
if (!
|
|
13999
|
-
const tr_2 = removeContentControlTr(
|
|
14101
|
+
const view_35 = pagedEditorRef.current?.getView();
|
|
14102
|
+
if (!view_35) return false;
|
|
14103
|
+
const tr_2 = removeContentControlTr(view_35.state, filter_3, options_4);
|
|
14000
14104
|
if (!tr_2) return false;
|
|
14001
|
-
|
|
14105
|
+
view_35.dispatch(tr_2);
|
|
14002
14106
|
return true;
|
|
14003
14107
|
}
|
|
14004
14108
|
}), [
|
|
@@ -14012,6 +14116,8 @@ const DocxEditor = forwardRef(function DocxEditor({ documentBuffer, password, do
|
|
|
14012
14116
|
loadParsedDocument,
|
|
14013
14117
|
loadBuffer,
|
|
14014
14118
|
updateComments,
|
|
14119
|
+
replaceComments,
|
|
14120
|
+
commentsRef,
|
|
14015
14121
|
commentsDirtyRef,
|
|
14016
14122
|
hfEditPosition,
|
|
14017
14123
|
refreshBodyHistoryAvailability
|
|
@@ -14067,39 +14173,39 @@ const DocxEditor = forwardRef(function DocxEditor({ documentBuffer, password, do
|
|
|
14067
14173
|
if (isDisplayMode(value)) setDisplayMode(value);
|
|
14068
14174
|
}, [setDisplayMode]);
|
|
14069
14175
|
const handleAcceptActiveChange = useCallback(() => {
|
|
14070
|
-
const view_35 = pagedEditorRef.current?.getView();
|
|
14071
|
-
if (!view_35) return;
|
|
14072
|
-
const { from: from_10, to: to_10 } = view_35.state.selection;
|
|
14073
|
-
const range_4 = findChangeAtPosition(view_35.state, from_10, to_10);
|
|
14074
|
-
acceptChange(range_4.from, range_4.to)(view_35.state, view_35.dispatch);
|
|
14075
|
-
}, []);
|
|
14076
|
-
const handleRejectActiveChange = useCallback(() => {
|
|
14077
14176
|
const view_36 = pagedEditorRef.current?.getView();
|
|
14078
14177
|
if (!view_36) return;
|
|
14079
|
-
const { from:
|
|
14080
|
-
const
|
|
14081
|
-
|
|
14178
|
+
const { from: from_10, to: to_10 } = view_36.state.selection;
|
|
14179
|
+
const range_4 = findChangeAtPosition(view_36.state, from_10, to_10);
|
|
14180
|
+
acceptChange(range_4.from, range_4.to)(view_36.state, view_36.dispatch);
|
|
14082
14181
|
}, []);
|
|
14083
|
-
const
|
|
14182
|
+
const handleRejectActiveChange = useCallback(() => {
|
|
14084
14183
|
const view_37 = pagedEditorRef.current?.getView();
|
|
14085
14184
|
if (!view_37) return;
|
|
14086
|
-
const { from:
|
|
14087
|
-
const
|
|
14185
|
+
const { from: from_11, to: to_11 } = view_37.state.selection;
|
|
14186
|
+
const range_5 = findChangeAtPosition(view_37.state, from_11, to_11);
|
|
14187
|
+
rejectChange(range_5.from, range_5.to)(view_37.state, view_37.dispatch);
|
|
14188
|
+
}, []);
|
|
14189
|
+
const handlePreviousChange = useCallback(() => {
|
|
14190
|
+
const view_38 = pagedEditorRef.current?.getView();
|
|
14191
|
+
if (!view_38) return;
|
|
14192
|
+
const { from: from_12 } = view_38.state.selection;
|
|
14193
|
+
const change = findPreviousChange(view_38.state, from_12);
|
|
14088
14194
|
if (!change) return;
|
|
14089
|
-
|
|
14090
|
-
|
|
14195
|
+
view_38.dispatch(view_38.state.tr.setSelection(TextSelection.create(view_38.state.doc, change.from, change.to)));
|
|
14196
|
+
view_38.focus();
|
|
14091
14197
|
requestAnimationFrame(() => {
|
|
14092
14198
|
pagedEditorRef.current?.scrollToPosition(change.from);
|
|
14093
14199
|
});
|
|
14094
14200
|
}, []);
|
|
14095
14201
|
const handleNextChange = useCallback(() => {
|
|
14096
|
-
const
|
|
14097
|
-
if (!
|
|
14098
|
-
const { to: to_12 } =
|
|
14099
|
-
const change_0 = findNextChange(
|
|
14202
|
+
const view_39 = pagedEditorRef.current?.getView();
|
|
14203
|
+
if (!view_39) return;
|
|
14204
|
+
const { to: to_12 } = view_39.state.selection;
|
|
14205
|
+
const change_0 = findNextChange(view_39.state, to_12);
|
|
14100
14206
|
if (!change_0) return;
|
|
14101
|
-
|
|
14102
|
-
|
|
14207
|
+
view_39.dispatch(view_39.state.tr.setSelection(TextSelection.create(view_39.state.doc, change_0.from, change_0.to)));
|
|
14208
|
+
view_39.focus();
|
|
14103
14209
|
requestAnimationFrame(() => {
|
|
14104
14210
|
pagedEditorRef.current?.scrollToPosition(change_0.from);
|
|
14105
14211
|
});
|
|
@@ -14269,8 +14375,8 @@ const DocxEditor = forwardRef(function DocxEditor({ documentBuffer, password, do
|
|
|
14269
14375
|
requestAnimationFrame(syncCommentHighlightStyles);
|
|
14270
14376
|
}, [onScrollTopChange, syncCommentHighlightStyles]);
|
|
14271
14377
|
const handlePagedSelectionChange = useCallback((_from, _to) => {
|
|
14272
|
-
const
|
|
14273
|
-
handleSelectionChange(
|
|
14378
|
+
const view_40 = getActiveEditorView() ?? pagedEditorRef.current?.getView() ?? null;
|
|
14379
|
+
handleSelectionChange(view_40 ? extractSelectionState(view_40.state) : null);
|
|
14274
14380
|
}, [getActiveEditorView, handleSelectionChange]);
|
|
14275
14381
|
const handleTotalPagesChange = useCallback((totalPages) => {
|
|
14276
14382
|
setScrollPageInfo((previous) => updateScrollPageTotal(previous, totalPages));
|
|
@@ -14295,9 +14401,9 @@ const DocxEditor = forwardRef(function DocxEditor({ documentBuffer, password, do
|
|
|
14295
14401
|
}, [author, updateComments]);
|
|
14296
14402
|
const handleAddComment = useCallback((addText) => {
|
|
14297
14403
|
const comment_3 = createComment(addText, author);
|
|
14298
|
-
const
|
|
14299
|
-
if (!
|
|
14300
|
-
if (!applyCommentMarkRange(
|
|
14404
|
+
const view_41 = pagedEditorRef.current?.getView();
|
|
14405
|
+
if (!view_41 || !commentSelectionRange) return false;
|
|
14406
|
+
if (!applyCommentMarkRange(view_41, commentSelectionRange, comment_3.id, { replacePending: true })) return false;
|
|
14301
14407
|
const commentAuthor_2 = getCommentAuthorKey(comment_3.author);
|
|
14302
14408
|
setVisibleCommentAuthors((current) => {
|
|
14303
14409
|
if (current === null) return null;
|
|
@@ -14331,8 +14437,8 @@ const DocxEditor = forwardRef(function DocxEditor({ documentBuffer, password, do
|
|
|
14331
14437
|
updateComments((previous_4) => [...previous_4, createComment(text_6, author, revisionId_2)]);
|
|
14332
14438
|
}, [author, updateComments]);
|
|
14333
14439
|
const handleCancelAddComment = useCallback(() => {
|
|
14334
|
-
const
|
|
14335
|
-
if (
|
|
14440
|
+
const view_42 = pagedEditorRef.current?.getView();
|
|
14441
|
+
if (view_42 && commentSelectionRange) removePendingCommentMarkRange(view_42, commentSelectionRange);
|
|
14336
14442
|
setIsAddingComment(false);
|
|
14337
14443
|
setCommentSelectionRange(null);
|
|
14338
14444
|
setAddCommentYPosition(null);
|
|
@@ -14343,15 +14449,15 @@ const DocxEditor = forwardRef(function DocxEditor({ documentBuffer, password, do
|
|
|
14343
14449
|
setIsAddingComment
|
|
14344
14450
|
]);
|
|
14345
14451
|
const handleSidebarAcceptChange = useCallback((from_13, to_13) => {
|
|
14346
|
-
const
|
|
14347
|
-
if (!
|
|
14348
|
-
acceptChange(from_13, to_13)(
|
|
14452
|
+
const view_43 = pagedEditorRef.current?.getView();
|
|
14453
|
+
if (!view_43) return;
|
|
14454
|
+
acceptChange(from_13, to_13)(view_43.state, view_43.dispatch);
|
|
14349
14455
|
extractTrackedChanges();
|
|
14350
14456
|
}, [extractTrackedChanges]);
|
|
14351
14457
|
const handleSidebarRejectChange = useCallback((from_14, to_14) => {
|
|
14352
|
-
const
|
|
14353
|
-
if (!
|
|
14354
|
-
rejectChange(from_14, to_14)(
|
|
14458
|
+
const view_44 = pagedEditorRef.current?.getView();
|
|
14459
|
+
if (!view_44) return;
|
|
14460
|
+
rejectChange(from_14, to_14)(view_44.state, view_44.dispatch);
|
|
14355
14461
|
extractTrackedChanges();
|
|
14356
14462
|
}, [extractTrackedChanges]);
|
|
14357
14463
|
const commentsPageWidth = history.state?.package.document.finalSectionProperties?.pageWidth;
|
|
@@ -14424,8 +14530,8 @@ const DocxEditor = forwardRef(function DocxEditor({ documentBuffer, password, do
|
|
|
14424
14530
|
const getBodyEditorView = useCallback(() => pagedEditorRef.current?.getView() ?? null, []);
|
|
14425
14531
|
const closeTableProperties = useCallback(() => setTablePropsOpen(false), []);
|
|
14426
14532
|
const applyTableProperties = useCallback((props_0) => {
|
|
14427
|
-
const
|
|
14428
|
-
if (
|
|
14533
|
+
const view_45 = getActiveEditorView();
|
|
14534
|
+
if (view_45) setTableProperties(props_0)(view_45.state, view_45.dispatch);
|
|
14429
14535
|
}, [getActiveEditorView]);
|
|
14430
14536
|
const closeImagePosition = useCallback(() => setImagePositionOpen(false), [setImagePositionOpen]);
|
|
14431
14537
|
const closeImageProperties = useCallback(() => setImagePropsOpen(false), [setImagePropsOpen]);
|
|
@@ -14433,8 +14539,8 @@ const DocxEditor = forwardRef(function DocxEditor({ documentBuffer, password, do
|
|
|
14433
14539
|
const closeFootnoteProperties = useCallback(() => setFootnotePropsOpen(false), []);
|
|
14434
14540
|
const closeInsertSymbol = useCallback(() => setShowInsertSymbol(false), []);
|
|
14435
14541
|
const insertSymbol = useCallback((symbol) => {
|
|
14436
|
-
const
|
|
14437
|
-
if (
|
|
14542
|
+
const view_46 = getActiveEditorView();
|
|
14543
|
+
if (view_46) view_46.dispatch(view_46.state.tr.insertText(symbol).scrollIntoView());
|
|
14438
14544
|
}, [getActiveEditorView]);
|
|
14439
14545
|
const imagePropertiesCurrentData = useMemo(() => buildImagePropertiesData(state.pmImageContext), [state.pmImageContext]);
|
|
14440
14546
|
const currentFindResult = findResultRef.current;
|
|
@@ -14760,8 +14866,8 @@ const DocxEditor = forwardRef(function DocxEditor({ documentBuffer, password, do
|
|
|
14760
14866
|
onMouseDown: (e_1) => {
|
|
14761
14867
|
e_1.preventDefault();
|
|
14762
14868
|
e_1.stopPropagation();
|
|
14763
|
-
const
|
|
14764
|
-
if (!
|
|
14869
|
+
const view_47 = pagedEditorRef.current?.getView();
|
|
14870
|
+
if (!view_47) {
|
|
14765
14871
|
setFloatingCommentBtn(null);
|
|
14766
14872
|
return;
|
|
14767
14873
|
}
|
|
@@ -14769,9 +14875,9 @@ const DocxEditor = forwardRef(function DocxEditor({ documentBuffer, password, do
|
|
|
14769
14875
|
from: floatingCommentBtn.from,
|
|
14770
14876
|
to: floatingCommentBtn.to
|
|
14771
14877
|
};
|
|
14772
|
-
const currentSelection =
|
|
14878
|
+
const currentSelection = view_47.state.selection;
|
|
14773
14879
|
const safeRange = resolveCommentCreationRange({
|
|
14774
|
-
docSize:
|
|
14880
|
+
docSize: view_47.state.doc.content.size,
|
|
14775
14881
|
capturedRange,
|
|
14776
14882
|
currentRange: {
|
|
14777
14883
|
from: currentSelection.from,
|
|
@@ -14785,7 +14891,7 @@ const DocxEditor = forwardRef(function DocxEditor({ documentBuffer, password, do
|
|
|
14785
14891
|
return;
|
|
14786
14892
|
}
|
|
14787
14893
|
setCommentSelectionRange(safeRange);
|
|
14788
|
-
if (!applyCommentMarkRange(
|
|
14894
|
+
if (!applyCommentMarkRange(view_47, safeRange, -1, { selectEnd: true })) {
|
|
14789
14895
|
setCommentSelectionRange(null);
|
|
14790
14896
|
setFloatingCommentBtn(null);
|
|
14791
14897
|
return;
|
|
@@ -14858,7 +14964,7 @@ const DocxEditor = forwardRef(function DocxEditor({ documentBuffer, password, do
|
|
|
14858
14964
|
})
|
|
14859
14965
|
})]
|
|
14860
14966
|
}),
|
|
14861
|
-
scrollPageInfo.totalPages > 1 && /* @__PURE__ */
|
|
14967
|
+
scrollPageInfo.totalPages > 1 && /* @__PURE__ */ jsx("div", {
|
|
14862
14968
|
style: {
|
|
14863
14969
|
position: "absolute",
|
|
14864
14970
|
right: 24,
|
|
@@ -14879,11 +14985,10 @@ const DocxEditor = forwardRef(function DocxEditor({ documentBuffer, password, do
|
|
|
14879
14985
|
},
|
|
14880
14986
|
"aria-live": "polite",
|
|
14881
14987
|
role: "status",
|
|
14882
|
-
children:
|
|
14883
|
-
scrollPageInfo.currentPage,
|
|
14884
|
-
|
|
14885
|
-
|
|
14886
|
-
]
|
|
14988
|
+
children: t("viewer.pageOfTotal", {
|
|
14989
|
+
current: String(scrollPageInfo.currentPage),
|
|
14990
|
+
total: String(scrollPageInfo.totalPages)
|
|
14991
|
+
})
|
|
14887
14992
|
}),
|
|
14888
14993
|
showOutline && outlineHeadings.length > 1 && /* @__PURE__ */ jsx(DocumentOutline, {
|
|
14889
14994
|
headings: outlineHeadings,
|