@stll/folio-react 0.32.3 → 0.33.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/README.md +8 -1
- package/dist/{CommentsSidebar-DnxzLs1o.js → CommentsSidebar-CUCUQpXb.js} +1 -1
- package/dist/{FindReplaceDialog-B446W1cL.js → FindReplaceDialog-DbbzquBV.js} +1 -1
- package/dist/{FootnotePropertiesDialog-J5zg-K3w.js → FootnotePropertiesDialog-BBq9iBzN.js} +1 -1
- package/dist/{ImagePositionDialog-DdokSGoN.js → ImagePositionDialog-CznMopDr.js} +1 -1
- package/dist/{ImagePropertiesDialog-C-xQU8Eq.js → ImagePropertiesDialog-TAm7NKLM.js} +1 -1
- package/dist/{InsertSymbolDialog-p7UOS4me.js → InsertSymbolDialog-CrHgjUTz.js} +1 -1
- package/dist/{PageSetupDialog-BXK9tKw5.js → PageSetupDialog-DpTPXo9U.js} +1 -1
- package/dist/{SetNumberingValueDialog-DZUrre78.js → SetNumberingValueDialog-BzUWmoaZ.js} +1 -1
- package/dist/{TablePropertiesDialog-edzovlyc.js → TablePropertiesDialog-fDJc5_NR.js} +1 -1
- package/dist/compat/eigenpal.d.ts +1 -1
- package/dist/compat/eigenpal.js +1 -1
- package/dist/{dialogs-CahXRDm_.js → dialogs-BQ-7aAfV.js} +1 -1
- package/dist/dialogs.js +8 -8
- package/dist/editor.css +1 -1
- package/dist/{folio-ui-B8i_O5aS.js → folio-ui-CEFqJgCh.js} +3 -8
- package/dist/index.d.ts +1 -1
- package/dist/index.js +10 -10
- package/dist/{renderAsync-BCste7wu.js → renderAsync-Bvosattm.js} +61 -46
- package/dist/{renderAsync-fuEtQwqD.d.ts → renderAsync-CRk3aj3J.d.ts} +12 -5
- package/dist/standalone.css +1 -1
- package/package.json +4 -4
|
@@ -1,4 +1,4 @@
|
|
|
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-CEFqJgCh.js";
|
|
2
2
|
import { t as messages_exports } from "./messages-DjrCTI3y.js";
|
|
3
3
|
import { c } from "react-compiler-runtime";
|
|
4
4
|
import * as React$1 from "react";
|
|
@@ -29,7 +29,7 @@ import { acceptAIEditRevision, acceptChange, acceptSuggestion, findAIEditRevisio
|
|
|
29
29
|
import { blockSdtAttrsToSdtProperties, findBlockSdtMatch, findBlockSdtMatches, removeContentControlTr, setContentControlContentTr, setContentControlValueTr } from "@stll/folio-core/prosemirror/commands/contentControls";
|
|
30
30
|
import { setContentControlContentBlocksTr } from "@stll/folio-core/prosemirror/commands/contentControlsBlockFill";
|
|
31
31
|
import { insertPageBreak } from "@stll/folio-core/prosemirror/commands/pageBreak";
|
|
32
|
-
import { CLIPBOARD_READ_ERROR_EVENT, buildPlainTextSlice } from "@stll/folio-core/prosemirror/commands/pastePlainText";
|
|
32
|
+
import { CLIPBOARD_READ_ERROR_EVENT, buildPlainTextSlice, pastePlainTextSlice } from "@stll/folio-core/prosemirror/commands/pastePlainText";
|
|
33
33
|
import { proseDocToBlocks } from "@stll/folio-core/prosemirror/conversion/fromProseDoc";
|
|
34
34
|
import { executeEditorCommand, executeFirstEditorCommand } from "@stll/folio-core/prosemirror/executeEditorCommand";
|
|
35
35
|
import { ExtensionManager } from "@stll/folio-core/prosemirror/extensions/ExtensionManager";
|
|
@@ -1358,7 +1358,7 @@ const HIDDEN_HOST_STYLES = {
|
|
|
1358
1358
|
* HiddenProseMirror - Off-screen ProseMirror editor for keyboard input
|
|
1359
1359
|
*/
|
|
1360
1360
|
const HiddenProseMirror = forwardRef((props, ref) => {
|
|
1361
|
-
const { document, documentIdentity, experimentalSession, suggestionModeActive = false, suggestionAuthor = "User", onSessionRefusal, styles, theme: _theme, widthPx = 612, readOnly = false, onTransaction, onSelectionChange, externalPlugins = EMPTY_EXTERNAL_PLUGINS, collaboration, extensionManager, onEditorViewReady, onEditorViewDestroy, onKeyDown, onCopy, onCut, onPaste, onReadOnlyEditAttempt, onRemoteSelectionsChange, precomputedInitialState } = props;
|
|
1361
|
+
const { document, documentIdentity, experimentalSession, suggestionModeActive = false, suggestionAuthor = "User", onSessionRefusal, styles, theme: _theme, widthPx = 612, readOnly = false, onTransaction, onCanonicalCompositionEnd, onSelectionChange, externalPlugins = EMPTY_EXTERNAL_PLUGINS, collaboration, extensionManager, onEditorViewReady, onEditorViewDestroy, onKeyDown, onCopy, onCut, onPaste, onReadOnlyEditAttempt, onRemoteSelectionsChange, precomputedInitialState } = props;
|
|
1362
1362
|
const hasCollaboration = collaboration !== void 0;
|
|
1363
1363
|
const [collaborationLoad, setCollaborationLoad] = useState(() => ({ status: hasCollaboration ? "loading" : "disabled" }));
|
|
1364
1364
|
if (hasCollaboration !== (collaborationLoad.status !== "disabled")) setCollaborationLoad({ status: hasCollaboration ? "loading" : "disabled" });
|
|
@@ -1379,6 +1379,7 @@ const HiddenProseMirror = forwardRef((props, ref) => {
|
|
|
1379
1379
|
const collaborationRef = useRef(collaboration);
|
|
1380
1380
|
const collaborationModulesRef = useRef(collaborationModules);
|
|
1381
1381
|
const onTransactionRef = useRef(onTransaction);
|
|
1382
|
+
const onCanonicalCompositionEndRef = useRef(onCanonicalCompositionEnd);
|
|
1382
1383
|
const onSelectionChangeRef = useRef(onSelectionChange);
|
|
1383
1384
|
const onEditorViewReadyRef = useRef(onEditorViewReady);
|
|
1384
1385
|
const onEditorViewDestroyRef = useRef(onEditorViewDestroy);
|
|
@@ -1400,6 +1401,7 @@ const HiddenProseMirror = forwardRef((props, ref) => {
|
|
|
1400
1401
|
externalPluginsRef.current = externalPlugins;
|
|
1401
1402
|
precomputedInitialStateRef.current = precomputedInitialState;
|
|
1402
1403
|
onTransactionRef.current = onTransaction;
|
|
1404
|
+
onCanonicalCompositionEndRef.current = onCanonicalCompositionEnd;
|
|
1403
1405
|
onSelectionChangeRef.current = onSelectionChange;
|
|
1404
1406
|
onEditorViewReadyRef.current = onEditorViewReady;
|
|
1405
1407
|
onEditorViewDestroyRef.current = onEditorViewDestroy;
|
|
@@ -1430,6 +1432,7 @@ const HiddenProseMirror = forwardRef((props, ref) => {
|
|
|
1430
1432
|
getDocumentIdentity: () => documentIdentityRef.current,
|
|
1431
1433
|
getDocumentContext: () => documentRef.current,
|
|
1432
1434
|
onTransaction: (update) => onTransactionRef.current?.(update),
|
|
1435
|
+
onCanonicalCompositionEnd: () => onCanonicalCompositionEndRef.current?.(),
|
|
1433
1436
|
onSelectionChange: (state) => onSelectionChangeRef.current?.(state),
|
|
1434
1437
|
onKeyDown: (view, event) => onKeyDownRef.current?.(view, event) ?? false,
|
|
1435
1438
|
onCopy: () => onCopyRef.current?.(),
|
|
@@ -3235,7 +3238,7 @@ function buildFootnoteRenderItems(pageFootnoteMap, footnoteContentMap, doc) {
|
|
|
3235
3238
|
* PagedEditor - Main paginated editing component.
|
|
3236
3239
|
*/
|
|
3237
3240
|
const PagedEditor = forwardRef(function PagedEditor(props, ref) {
|
|
3238
|
-
const { document, documentIO, documentIdentity, experimentalSession, fonts: hostFonts, styles, theme: _theme, sectionProperties, headerContent, footerContent, firstPageHeaderContent, firstPageFooterContent, headerContentRId, footerContentRId, firstPageHeaderContentRId, firstPageFooterContentRId, readOnly = false, pageGap = 24, zoom = 1, pageRenderer, markupView, showCommentHighlights = true, showMarginGuides = false, marginGuideColor, onDocumentChange, onReadOnlyEditAttempt, onCopy, onCut, onPaste, onSelectionChange, onSelectionTextChange, onEditorViewReady, externalPlugins = EMPTY_PLUGINS, showTemplateDirectives = true, collaboration, extensionManager, suggestionModeActive = false, suggestionAuthor, onActiveNoteStoryChange, onHeaderFooterDoubleClick, hfEditMode, activeHeaderFooterRId, onBodyClick, className, style, pageEndGutter = 0, sidebarOverlay, scrollContainerRef: scrollContainerRefProp, onHyperlinkClick, onContextMenu, onAnchorPositionsChange, onTotalPagesChange, onError, anchorPositionMode = "comments-and-revisions", onAnonymizationTermClick, selectedAnonymizationCanonical = null, anonymizationSelectionSeq } = props;
|
|
3241
|
+
const { accessibleName, document, documentIO, documentIdentity, experimentalSession, fonts: hostFonts, styles, theme: _theme, sectionProperties, headerContent, footerContent, firstPageHeaderContent, firstPageFooterContent, headerContentRId, footerContentRId, firstPageHeaderContentRId, firstPageFooterContentRId, readOnly = false, pageGap = 24, zoom = 1, pageRenderer, markupView, showCommentHighlights = true, altChunkMarkerText, showMarginGuides = false, marginGuideColor, onDocumentChange, onReadOnlyEditAttempt, onCopy, onCut, onPaste, onSelectionChange, onSelectionTextChange, onEditorViewReady, externalPlugins = EMPTY_PLUGINS, showTemplateDirectives = true, collaboration, extensionManager, suggestionModeActive = false, suggestionAuthor, onActiveNoteStoryChange, onHeaderFooterDoubleClick, hfEditMode, activeHeaderFooterRId, onBodyClick, className, style, pageEndGutter = 0, sidebarOverlay, scrollContainerRef: scrollContainerRefProp, onHyperlinkClick, onContextMenu, onAnchorPositionsChange, onTotalPagesChange, onError, anchorPositionMode = "comments-and-revisions", onAnonymizationTermClick, selectedAnonymizationCanonical = null, anonymizationSelectionSeq } = props;
|
|
3239
3242
|
const getScrollContainer = useCallback(() => {
|
|
3240
3243
|
if (scrollContainerRefProp && typeof scrollContainerRefProp === "object") return getEditorScrollRoot(scrollContainerRefProp.current);
|
|
3241
3244
|
return getEditorScrollRoot(containerRef.current);
|
|
@@ -3514,6 +3517,7 @@ const PagedEditor = forwardRef(function PagedEditor(props, ref) {
|
|
|
3514
3517
|
columns,
|
|
3515
3518
|
markupView,
|
|
3516
3519
|
showCommentHighlights,
|
|
3520
|
+
altChunkMarkerText,
|
|
3517
3521
|
contentWidth,
|
|
3518
3522
|
defaultTabStop,
|
|
3519
3523
|
mirrorMargins,
|
|
@@ -3536,6 +3540,7 @@ const PagedEditor = forwardRef(function PagedEditor(props, ref) {
|
|
|
3536
3540
|
columns,
|
|
3537
3541
|
markupView,
|
|
3538
3542
|
showCommentHighlights,
|
|
3543
|
+
altChunkMarkerText,
|
|
3539
3544
|
contentWidth,
|
|
3540
3545
|
defaultTabStop,
|
|
3541
3546
|
mirrorMargins,
|
|
@@ -3617,7 +3622,8 @@ const PagedEditor = forwardRef(function PagedEditor(props, ref) {
|
|
|
3617
3622
|
emptyTemplatePreviewHidden: EMPTY_TEMPLATE_PREVIEW_HIDDEN,
|
|
3618
3623
|
hyphenationReadiness,
|
|
3619
3624
|
markupView,
|
|
3620
|
-
showCommentHighlights
|
|
3625
|
+
showCommentHighlights,
|
|
3626
|
+
...altChunkMarkerText === void 0 ? {} : { altChunkMarkerText }
|
|
3621
3627
|
}, state, options);
|
|
3622
3628
|
if (outcome.blocks) setBlocks(outcome.blocks);
|
|
3623
3629
|
if (outcome.measures !== void 0) setMeasures(outcome.measures);
|
|
@@ -3655,6 +3661,7 @@ const PagedEditor = forwardRef(function PagedEditor(props, ref) {
|
|
|
3655
3661
|
styles,
|
|
3656
3662
|
markupView,
|
|
3657
3663
|
showCommentHighlights,
|
|
3664
|
+
altChunkMarkerText,
|
|
3658
3665
|
layoutInputSignature,
|
|
3659
3666
|
hyphenationReadiness
|
|
3660
3667
|
]);
|
|
@@ -6102,8 +6109,9 @@ const PagedEditor = forwardRef(function PagedEditor(props, ref) {
|
|
|
6102
6109
|
...style
|
|
6103
6110
|
},
|
|
6104
6111
|
tabIndex: 0,
|
|
6105
|
-
role: "textbox",
|
|
6106
|
-
"aria-
|
|
6112
|
+
role: readOnly ? "document" : "textbox",
|
|
6113
|
+
"aria-label": accessibleName,
|
|
6114
|
+
"aria-multiline": readOnly ? void 0 : true,
|
|
6107
6115
|
onFocus: handleContainedFocus,
|
|
6108
6116
|
onBlur: handleContainerBlur,
|
|
6109
6117
|
onKeyDown: handleKeyDown,
|
|
@@ -6147,6 +6155,7 @@ const PagedEditor = forwardRef(function PagedEditor(props, ref) {
|
|
|
6147
6155
|
precomputedInitialState: validPrecomputedInitialState,
|
|
6148
6156
|
readOnly,
|
|
6149
6157
|
onTransaction: handleTransaction,
|
|
6158
|
+
onCanonicalCompositionEnd: scheduleLayout,
|
|
6150
6159
|
onSelectionChange: handleSelectionChange,
|
|
6151
6160
|
onRemoteSelectionsChange: setRemoteSelections,
|
|
6152
6161
|
onEditorViewReady: handleEditorViewReady,
|
|
@@ -7369,14 +7378,14 @@ function _temp$11(heading) {
|
|
|
7369
7378
|
return item;
|
|
7370
7379
|
}
|
|
7371
7380
|
// src/components/DocxEditorDialogs.tsx
|
|
7372
|
-
const FindReplaceDialog = lazy(() => import("./FindReplaceDialog-
|
|
7373
|
-
const TablePropertiesDialog = lazy(() => import("./TablePropertiesDialog-
|
|
7374
|
-
const ImagePositionDialog = lazy(() => import("./ImagePositionDialog-
|
|
7375
|
-
const ImagePropertiesDialog = lazy(() => import("./ImagePropertiesDialog-
|
|
7376
|
-
const FootnotePropertiesDialog = lazy(() => import("./FootnotePropertiesDialog-
|
|
7377
|
-
const PageSetupDialog = lazy(() => import("./PageSetupDialog-
|
|
7378
|
-
const SetNumberingValueDialog = lazy(() => import("./SetNumberingValueDialog-
|
|
7379
|
-
const InsertSymbolDialog = lazy(() => import("./InsertSymbolDialog-
|
|
7381
|
+
const FindReplaceDialog = lazy(() => import("./FindReplaceDialog-DbbzquBV.js").then((n) => n.n).then((m) => ({ default: m.FindReplaceDialog })));
|
|
7382
|
+
const TablePropertiesDialog = lazy(() => import("./TablePropertiesDialog-fDJc5_NR.js").then((n) => n.n).then((m) => ({ default: m.TablePropertiesDialog })));
|
|
7383
|
+
const ImagePositionDialog = lazy(() => import("./ImagePositionDialog-CznMopDr.js").then((n) => n.n).then((m) => ({ default: m.ImagePositionDialog })));
|
|
7384
|
+
const ImagePropertiesDialog = lazy(() => import("./ImagePropertiesDialog-TAm7NKLM.js").then((n) => n.n).then((m) => ({ default: m.ImagePropertiesDialog })));
|
|
7385
|
+
const FootnotePropertiesDialog = lazy(() => import("./FootnotePropertiesDialog-BBq9iBzN.js").then((n) => n.n).then((m) => ({ default: m.FootnotePropertiesDialog })));
|
|
7386
|
+
const PageSetupDialog = lazy(() => import("./PageSetupDialog-DpTPXo9U.js").then((n) => n.n).then((m) => ({ default: m.PageSetupDialog })));
|
|
7387
|
+
const SetNumberingValueDialog = lazy(() => import("./SetNumberingValueDialog-BzUWmoaZ.js").then((m) => ({ default: m.SetNumberingValueDialog })));
|
|
7388
|
+
const InsertSymbolDialog = lazy(() => import("./InsertSymbolDialog-CrHgjUTz.js").then((n) => n.n).then((m) => ({ default: m.InsertSymbolDialog })));
|
|
7380
7389
|
function DocxEditorDialogs(t0) {
|
|
7381
7390
|
const $ = c(55);
|
|
7382
7391
|
const { findReplace, tableProperties, imagePosition, imageProperties, pageSetup, footnoteProperties, insertSymbol, setNumberingValue } = t0;
|
|
@@ -8090,13 +8099,15 @@ function getTooltipLabel(content) {
|
|
|
8090
8099
|
* Individual toolbar button with shadcn styling.
|
|
8091
8100
|
* Compact editor chrome button.
|
|
8092
8101
|
*/
|
|
8093
|
-
function ToolbarButton({ active = false, disabled = false, title, onClick, onDoubleClick, children, className, ariaLabel, testId }) {
|
|
8102
|
+
function ToolbarButton({ active = false, disabled = false, title, onClick, onDoubleClick, children, className, ariaLabel, testId, onMouseDown, ...passThrough }) {
|
|
8094
8103
|
const derivedTestId = toToolbarTestId(ariaLabel) || toToolbarTestId(title, { stripParentheses: true });
|
|
8095
8104
|
const resolvedTestId = testId ?? (derivedTestId ? `toolbar-${derivedTestId}` : void 0);
|
|
8096
8105
|
const handleMouseDown = (e) => {
|
|
8097
8106
|
e.preventDefault();
|
|
8107
|
+
onMouseDown?.(e);
|
|
8098
8108
|
};
|
|
8099
8109
|
const button = /* @__PURE__ */ jsx("button", {
|
|
8110
|
+
...passThrough,
|
|
8100
8111
|
type: "button",
|
|
8101
8112
|
className: cn("flex h-8 w-8 shrink-0 items-center justify-center rounded-md", "transition-colors duration-100", "antialiased", "text-[var(--doc-text-muted)] hover:bg-[var(--doc-primary-light)] hover:text-[var(--doc-text)]", active && "bg-[var(--doc-primary-light)] text-[var(--doc-text)] hover:bg-[var(--doc-primary-light)]", disabled && "cursor-not-allowed text-[var(--doc-text-subtle)] opacity-[0.16] disabled:hover:bg-transparent disabled:hover:text-[var(--doc-text-subtle)]", className),
|
|
8102
8113
|
onMouseDown: handleMouseDown,
|
|
@@ -9204,6 +9215,28 @@ function FormattingBar(props) {
|
|
|
9204
9215
|
const handleBarMouseUp = useCallback(() => {
|
|
9205
9216
|
requestAnimationFrame(() => onRefocusEditor?.());
|
|
9206
9217
|
}, [onRefocusEditor]);
|
|
9218
|
+
const fontColorLabel = t("fontColor");
|
|
9219
|
+
const fontColorSwatch = (() => {
|
|
9220
|
+
if (!currentFormatting.color) return "#000000";
|
|
9221
|
+
if (currentFormatting.color.startsWith("#")) return currentFormatting.color;
|
|
9222
|
+
return `#${currentFormatting.color}`;
|
|
9223
|
+
})();
|
|
9224
|
+
const fontColorTrigger = useMemo(() => /* @__PURE__ */ jsxs(ToolbarButton, {
|
|
9225
|
+
disabled,
|
|
9226
|
+
title: fontColorLabel,
|
|
9227
|
+
ariaLabel: fontColorLabel,
|
|
9228
|
+
children: [/* @__PURE__ */ jsxs("div", {
|
|
9229
|
+
className: "flex flex-col items-center gap-0",
|
|
9230
|
+
children: [/* @__PURE__ */ jsx(BaselineIcon, { size: ICON_SIZE }), /* @__PURE__ */ jsx("span", {
|
|
9231
|
+
className: "mt-[-2px] h-1 w-4 rounded-sm",
|
|
9232
|
+
style: { backgroundColor: fontColorSwatch }
|
|
9233
|
+
})]
|
|
9234
|
+
}), /* @__PURE__ */ jsx(ChevronDownIcon, { size: 10 })]
|
|
9235
|
+
}), [
|
|
9236
|
+
disabled,
|
|
9237
|
+
fontColorLabel,
|
|
9238
|
+
fontColorSwatch
|
|
9239
|
+
]);
|
|
9207
9240
|
const moreFormattingLabel = t("moreFormatting");
|
|
9208
9241
|
const overflowTrigger = useMemo(() => /* @__PURE__ */ jsx("button", {
|
|
9209
9242
|
type: "button",
|
|
@@ -9235,24 +9268,7 @@ function FormattingBar(props) {
|
|
|
9235
9268
|
value: currentFormatting.color?.replace(/^#/u, "").toUpperCase(),
|
|
9236
9269
|
onSelect: handleTextColorSelect,
|
|
9237
9270
|
onClear: handleTextColorClear,
|
|
9238
|
-
|
|
9239
|
-
disabled,
|
|
9240
|
-
title: t("fontColor"),
|
|
9241
|
-
ariaLabel: t("fontColor"),
|
|
9242
|
-
children: [/* @__PURE__ */ jsxs("div", {
|
|
9243
|
-
className: "flex flex-col items-center gap-0",
|
|
9244
|
-
children: [/* @__PURE__ */ jsx(BaselineIcon, { size: ICON_SIZE }), /* @__PURE__ */ jsx("span", {
|
|
9245
|
-
className: "mt-[-2px] h-1 w-4 rounded-sm",
|
|
9246
|
-
style: { backgroundColor: (() => {
|
|
9247
|
-
if (currentFormatting.color) return (() => {
|
|
9248
|
-
if (currentFormatting.color.startsWith("#")) return currentFormatting.color;
|
|
9249
|
-
return `#${currentFormatting.color}`;
|
|
9250
|
-
})();
|
|
9251
|
-
return "#000000";
|
|
9252
|
-
})() }
|
|
9253
|
-
})]
|
|
9254
|
-
}), /* @__PURE__ */ jsx(ChevronDownIcon, { size: 10 })]
|
|
9255
|
-
})
|
|
9271
|
+
trigger: fontColorTrigger
|
|
9256
9272
|
})
|
|
9257
9273
|
]
|
|
9258
9274
|
}),
|
|
@@ -14032,7 +14048,7 @@ function _temp(id_4) {
|
|
|
14032
14048
|
// src/components/DocxEditor.tsx
|
|
14033
14049
|
/** No headings to track while the outline is not shown. */
|
|
14034
14050
|
const NO_HEADINGS = [];
|
|
14035
|
-
const CommentsSidebar = lazy(() => import("./CommentsSidebar-
|
|
14051
|
+
const CommentsSidebar = lazy(() => import("./CommentsSidebar-CUCUQpXb.js").then((m) => ({ default: m.CommentsSidebar })));
|
|
14036
14052
|
const TextContextMenu = lazy(() => import("./TextContextMenu-BxnNvhJg.js").then((m) => ({ default: m.TextContextMenu })));
|
|
14037
14053
|
const loadAttemptSelectiveSave = async () => {
|
|
14038
14054
|
const { attemptSelectiveSave } = await import("@stll/folio-core/docx/selectiveSave");
|
|
@@ -14134,7 +14150,7 @@ const createPagedEditorBinding = () => {
|
|
|
14134
14150
|
/**
|
|
14135
14151
|
* DocxEditor - Complete DOCX editor component
|
|
14136
14152
|
*/
|
|
14137
|
-
const DocxEditor = forwardRef(function DocxEditor({ documentBuffer, password, document: initialDocument, onSave, author = "User", onChange, onFindResultChange, onSelectionChange, onSelectionTextChange, onError, onFontsLoaded: onFontsLoadedCallback, fontFamilies, fonts, theme, showToolbar = true, showZoomControl = true, showReviewControls = true, showHeaderFooterEditing = true, pageRenderer, showMarginGuides = false, marginGuideColor, showRuler: showRulerProp = false, rulerUnit = "inch", initialZoom = 1, enableWheelZoom = true, keyboardShortcuts = DEFAULT_KEYBOARD_SHORTCUT_SCOPE, hostShortcuts: hostShortcutsProp, readOnly: readOnlyProp = false, reviewDisplayMode, showCommentHighlights = true, autoOpenReviewSidebar = true, components, toolbarExtra, className = "", style, placeholder, loadingIndicator, preserveDocumentWhileLoading = false, initialScrollTop, onScrollTopChange, showOutline: showOutlineProp = true, outlineDepth: outlineDepthProp, onOutlineDepthChange, onPrint, onInsertImage, onInsertTable, showTableInsert = true, onInsertPageBreak, onInsertTOC, onCopy, onCut, onPaste, mode: modeProp, onModeChange, onReadonlyEditAttempt, onCompatibilityChange, onEditorViewReady, onAnonymizationMatchesChange, onAnonymizationTermClick, selectedAnonymizationCanonical = null, anonymizationSelectionSeq, showTemplateDirectives = false, onSlashMenuChange, onSlashMenuKeyAction, customContextMenuItems, onCustomContextAction, comments: commentsProp, onCommentsChange, collaboration, plugins, featureFlags, experimentalSession, onSelectiveSaveTripwire }, ref) {
|
|
14153
|
+
const DocxEditor = forwardRef(function DocxEditor({ accessibleName, documentBuffer, password, document: initialDocument, onSave, author = "User", onChange, onFindResultChange, onSelectionChange, onSelectionTextChange, onError, onFontsLoaded: onFontsLoadedCallback, fontFamilies, fonts, theme, showToolbar = true, showZoomControl = true, showReviewControls = true, showHeaderFooterEditing = true, pageRenderer, showMarginGuides = false, marginGuideColor, showRuler: showRulerProp = false, rulerUnit = "inch", initialZoom = 1, enableWheelZoom = true, keyboardShortcuts = DEFAULT_KEYBOARD_SHORTCUT_SCOPE, hostShortcuts: hostShortcutsProp, readOnly: readOnlyProp = false, reviewDisplayMode, showCommentHighlights = true, autoOpenReviewSidebar = true, components, toolbarExtra, className = "", style, placeholder, loadingIndicator, preserveDocumentWhileLoading = false, initialScrollTop, onScrollTopChange, showOutline: showOutlineProp = true, outlineDepth: outlineDepthProp, onOutlineDepthChange, onPrint, onInsertImage, onInsertTable, showTableInsert = true, onInsertPageBreak, onInsertTOC, onCopy, onCut, onPaste, mode: modeProp, onModeChange, onReadonlyEditAttempt, onCompatibilityChange, onEditorViewReady, onAnonymizationMatchesChange, onAnonymizationTermClick, selectedAnonymizationCanonical = null, anonymizationSelectionSeq, showTemplateDirectives = false, onSlashMenuChange, onSlashMenuKeyAction, customContextMenuItems, onCustomContextAction, comments: commentsProp, onCommentsChange, collaboration, plugins, featureFlags, experimentalSession, onSelectiveSaveTripwire }, ref) {
|
|
14138
14154
|
const pagedEditorRef = useRef(null);
|
|
14139
14155
|
const [pagedEditorBinding] = useState(createPagedEditorBinding);
|
|
14140
14156
|
const scrollContainerRef = useRef(null);
|
|
@@ -14751,11 +14767,12 @@ const DocxEditor = forwardRef(function DocxEditor({ documentBuffer, password, do
|
|
|
14751
14767
|
experimentalSession
|
|
14752
14768
|
]);
|
|
14753
14769
|
const buildCurrentDocument = useCallback(() => {
|
|
14754
|
-
|
|
14770
|
+
const committed = historyStateRef.current;
|
|
14771
|
+
if (!committed) return null;
|
|
14755
14772
|
const canonical_0 = pagedEditorRef.current?.getEditor().getCanonicalDocument();
|
|
14756
14773
|
if (canonical_0) return canonical_0;
|
|
14757
14774
|
if (usesCanonicalSession(experimentalSession, CANONICAL_GAP.authorityRouting)) return null;
|
|
14758
|
-
let doc_0 = cloneDocumentWithParagraphPropertySources(
|
|
14775
|
+
let doc_0 = cloneDocumentWithParagraphPropertySources(committed);
|
|
14759
14776
|
const pmDoc = pagedEditorRef.current?.getDocument();
|
|
14760
14777
|
if (pmDoc) {
|
|
14761
14778
|
doc_0.package.document.content = pmDoc.package.document.content;
|
|
@@ -14779,11 +14796,7 @@ const DocxEditor = forwardRef(function DocxEditor({ documentBuffer, password, do
|
|
|
14779
14796
|
const referencedCommentIds = collectCommentIdsFromSources(doc_0.package.document.content, doc_0.package.headers, doc_0.package.footers, doc_0.package.footnotes, doc_0.package.endnotes);
|
|
14780
14797
|
setDocumentBodyComments(doc_0.package.document, pruneOrphanedComments(commentsRef.current, referencedCommentIds));
|
|
14781
14798
|
return doc_0;
|
|
14782
|
-
}, [
|
|
14783
|
-
history.state,
|
|
14784
|
-
commentsRef,
|
|
14785
|
-
experimentalSession
|
|
14786
|
-
]);
|
|
14799
|
+
}, [commentsRef, experimentalSession]);
|
|
14787
14800
|
const applyCanonicalComment = useCallback((request) => {
|
|
14788
14801
|
return getCanonicalApi()?.applyCanonicalComment(request) ?? null;
|
|
14789
14802
|
}, [getCanonicalApi]);
|
|
@@ -15747,8 +15760,7 @@ const DocxEditor = forwardRef(function DocxEditor({ documentBuffer, password, do
|
|
|
15747
15760
|
try {
|
|
15748
15761
|
const text = await navigator.clipboard.readText();
|
|
15749
15762
|
if (text && !view_12.isDestroyed) {
|
|
15750
|
-
|
|
15751
|
-
view_12.dispatch(view_12.state.tr.replaceSelection(slice).scrollIntoView());
|
|
15763
|
+
pastePlainTextSlice(view_12, buildPlainTextSlice(text, view_12.state.schema));
|
|
15752
15764
|
onPaste?.();
|
|
15753
15765
|
}
|
|
15754
15766
|
} catch {
|
|
@@ -17512,12 +17524,14 @@ const DocxEditor = forwardRef(function DocxEditor({ documentBuffer, password, do
|
|
|
17512
17524
|
})
|
|
17513
17525
|
}),
|
|
17514
17526
|
/* @__PURE__ */ jsx(PagedEditor, {
|
|
17527
|
+
accessibleName,
|
|
17515
17528
|
ref: attachPagedEditor,
|
|
17516
17529
|
document: history.state,
|
|
17517
17530
|
documentIO,
|
|
17518
17531
|
documentIdentity: loadedDocumentIdentity,
|
|
17519
17532
|
markupView: displayMode,
|
|
17520
17533
|
showCommentHighlights,
|
|
17534
|
+
altChunkMarkerText: t("contentNotDisplayed"),
|
|
17521
17535
|
...fonts !== void 0 ? { fonts } : {},
|
|
17522
17536
|
theme: history.state.package.theme || theme || null,
|
|
17523
17537
|
sectionProperties: effectiveSectionProperties ?? null,
|
|
@@ -17795,6 +17809,7 @@ function CommentAuthorVisibilityItem(t0) {
|
|
|
17795
17809
|
* import "@stll/folio-react/standalone.css";
|
|
17796
17810
|
*
|
|
17797
17811
|
* const editor = await renderAsync(buffer, document.getElementById("host")!, {
|
|
17812
|
+
* accessibleName: "Document editor",
|
|
17798
17813
|
* readOnly: false,
|
|
17799
17814
|
* showToolbar: true,
|
|
17800
17815
|
* });
|
|
@@ -17809,7 +17824,7 @@ function CommentAuthorVisibilityItem(t0) {
|
|
|
17809
17824
|
* Resolves once the document has parsed and the first `onChange` fires.
|
|
17810
17825
|
* Rejects if `onError` runs before that milestone.
|
|
17811
17826
|
*/
|
|
17812
|
-
const renderAsync = (input, container, options
|
|
17827
|
+
const renderAsync = (input, container, options) => {
|
|
17813
17828
|
const { locale = "en", ...editorOptions } = options;
|
|
17814
17829
|
return new Promise((resolve, reject) => {
|
|
17815
17830
|
const ref = React.createRef();
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React$1, { CSSProperties, ComponentProps, ComponentType, ForwardRefExoticComponent, JSX, ReactNode, RefAttributes, RefObject } from "react";
|
|
1
|
+
import React$1, { CSSProperties, ComponentProps, ComponentType, ForwardRefExoticComponent, JSX, ReactElement, ReactNode, RefAttributes, RefObject } from "react";
|
|
2
2
|
import { EditorState, Plugin, Transaction } from "prosemirror-state";
|
|
3
3
|
import { EditorView } from "prosemirror-view";
|
|
4
4
|
import { XmlFragment } from "yjs";
|
|
@@ -310,8 +310,8 @@ type ColorPreset = {
|
|
|
310
310
|
color?: string;
|
|
311
311
|
};
|
|
312
312
|
/**
|
|
313
|
-
* The ColorPicker prop subset folio's chrome relies on. The picker
|
|
314
|
-
*
|
|
313
|
+
* The ColorPicker prop subset folio's chrome relies on. The picker opens a
|
|
314
|
+
* popover from `trigger`, exposing the `presets` plus a custom-color
|
|
315
315
|
* input; `onSelect` fires with a preset value or a 6-char hex (no `#`), and
|
|
316
316
|
* `onClear` clears the color. The design-system ColorPicker accepts a superset
|
|
317
317
|
* (placement, expansion, className) so it stays assignable as an override.
|
|
@@ -322,7 +322,12 @@ type FolioColorPickerProps = {
|
|
|
322
322
|
onClear?: () => void;
|
|
323
323
|
presets?: ColorPreset[];
|
|
324
324
|
columns?: number;
|
|
325
|
-
|
|
325
|
+
/**
|
|
326
|
+
* One native `<button>` element that becomes the popover trigger itself. It
|
|
327
|
+
* must accept and forward props and a ref, so the picker never wraps it in a
|
|
328
|
+
* second, unnamed button.
|
|
329
|
+
*/
|
|
330
|
+
trigger: ReactElement;
|
|
326
331
|
};
|
|
327
332
|
/**
|
|
328
333
|
* The DatePickerPopover prop subset folio's chrome relies on. `value` accepts
|
|
@@ -596,6 +601,8 @@ type ToolbarProps = {
|
|
|
596
601
|
onTableAction?: ((action: TableAction) => void) | undefined;
|
|
597
602
|
};
|
|
598
603
|
type DocxEditorProps = {
|
|
604
|
+
/** Accessible name announced for the editor or read-only document. */
|
|
605
|
+
accessibleName: string;
|
|
599
606
|
/** Active document search result, including the zero-based current match index. */
|
|
600
607
|
onFindResultChange?: (result: FindResult | null) => void;
|
|
601
608
|
/** Document data — ArrayBuffer, Uint8Array, Blob, or File */
|
|
@@ -1245,5 +1252,5 @@ type RenderAsyncOptions = Omit<DocxEditorProps, "documentBuffer" | "document"> &
|
|
|
1245
1252
|
* Resolves once the document has parsed and the first `onChange` fires.
|
|
1246
1253
|
* Rejects if `onError` runs before that milestone.
|
|
1247
1254
|
*/
|
|
1248
|
-
declare const renderAsync: (input: DocxInput, container: HTMLElement, options
|
|
1255
|
+
declare const renderAsync: (input: DocxInput, container: HTMLElement, options: RenderAsyncOptions) => Promise<DocxEditorHandle>;
|
|
1249
1256
|
export { FolioUIProvider as _, DocxEditorApplyDocumentOperationsOptions as a, DocxEditorRef as c, ToolbarProps as d, FontOption as f, FolioUIComponents as g, FolioButtonProps as h, renderAsync as i, HighlightPassageOptions as l, ColorPreset as m, EditorHandle as n, DocxEditorCollaboration as o, EditorMode as p, RenderAsyncOptions as r, DocxEditorProps as s, DocxEditorHandle as t, HighlightPassageResult as u, OutlineItem as v, FontDefinition as y };
|