@stll/folio-react 0.22.1 → 0.23.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/{CommentsSidebar-D68oqCy8.js → CommentsSidebar-CGs9K70B.js} +1 -1
- package/dist/compat/eigenpal.d.ts +1 -1
- package/dist/compat/eigenpal.js +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/{renderAsync-Dxi_koXh.js → renderAsync-CTnJ1YYt.js} +16 -9
- package/dist/{renderAsync-DuY_uo1B.d.ts → renderAsync-D5OOIQRt.d.ts} +9 -1
- package/package.json +2 -2
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { d as containedHandler } from "./renderAsync-
|
|
1
|
+
import { d as containedHandler } from "./renderAsync-CTnJ1YYt.js";
|
|
2
2
|
import { useCallback, useEffect, useLayoutEffect, useMemo, useRef, useState } from "react";
|
|
3
3
|
import { CheckIcon, MoreVerticalIcon } from "lucide-react";
|
|
4
4
|
import { useLocale, useTranslations } from "use-intl";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { c as DocxEditorRef, i as renderAsync, n as EditorHandle, r as RenderAsyncOptions, s as DocxEditorProps, t as DocxEditorHandle } from "../renderAsync-
|
|
1
|
+
import { c as DocxEditorRef, i as renderAsync, n as EditorHandle, r as RenderAsyncOptions, s as DocxEditorProps, t as DocxEditorHandle } from "../renderAsync-D5OOIQRt.js";
|
|
2
2
|
import { ReactNode } from "react";
|
|
3
3
|
import { CreateEmptyDocumentOptions, createDocumentWithText, createEmptyDocument } from "@stll/folio-core/utils/createDocument";
|
|
4
4
|
//#region src/compat/eigenpal.d.ts
|
package/dist/compat/eigenpal.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { n as DocxEditor$1, t as renderAsync } from "../renderAsync-
|
|
1
|
+
import { n as DocxEditor$1, t as renderAsync } from "../renderAsync-CTnJ1YYt.js";
|
|
2
2
|
import { t as messages_exports } from "../messages.js";
|
|
3
3
|
import { c } from "react-compiler-runtime";
|
|
4
4
|
import { forwardRef } from "react";
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { _ as FolioUIProvider, a as DocxEditorApplyDocumentOperationsOptions, c as DocxEditorRef, d as ToolbarProps, f as EditorMode, g as FolioUIComponents, h as FolioButtonProps, i as renderAsync, l as HighlightPassageOptions, m as ColorPreset, n as EditorHandle, o as DocxEditorCollaboration, p as FontOption, r as RenderAsyncOptions, s as DocxEditorProps, t as DocxEditorHandle, u as HighlightPassageResult, v as OutlineItem, y as FontDefinition } from "./renderAsync-
|
|
1
|
+
import { _ as FolioUIProvider, a as DocxEditorApplyDocumentOperationsOptions, c as DocxEditorRef, d as ToolbarProps, f as EditorMode, g as FolioUIComponents, h as FolioButtonProps, i as renderAsync, l as HighlightPassageOptions, m as ColorPreset, n as EditorHandle, o as DocxEditorCollaboration, p as FontOption, r as RenderAsyncOptions, s as DocxEditorProps, t as DocxEditorHandle, u as HighlightPassageResult, v as OutlineItem, y as FontDefinition } from "./renderAsync-D5OOIQRt.js";
|
|
2
2
|
import { A as HyperlinkDialog, C as ImagePropertiesData, D as ImagePositionDialog, E as ImagePositionData, F as FindReplaceDialog, I as FindReplaceDialogProps, M as HyperlinkDialogProps, N as FootnotePropertiesDialog, O as ImagePositionDialogProps, P as FootnotePropertiesDialogProps, S as InsertImageDialogProps, T as ImagePropertiesDialogProps, _ as InsertTableStyleOption, a as TablePropertiesDialogProps, b as InsertImageDialog, c as SplitCellDialogProps, d as PasteSpecialMode, f as PageSetupDialog, g as InsertTableDialogProps, h as InsertTableDialogData, i as TablePropertiesDialog, j as HyperlinkDialogData, k as HyperlinkBookmarkOption, l as PasteSpecialDialog, m as InsertTableDialog, n as WatermarkDialogProps, o as SplitCellDialog, p as PageSetupDialogProps, r as TableProperties, s as SplitCellDialogData, t as WatermarkDialog, u as PasteSpecialDialogProps, v as InsertSymbolDialog, w as ImagePropertiesDialog, x as InsertImageDialogData, y as InsertSymbolDialogProps } from "./dialogs-DZz6gVev.js";
|
|
3
3
|
import React, { CSSProperties, ReactNode, RefObject } from "react";
|
|
4
4
|
import { CreateEmptyDocumentOptions, createEmptyDocument } from "@stll/folio-core/utils/createDocument";
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as formatZoom, c as FormattingBar, i as clampZoom, l as ZoomControl, n as DocxEditor, o as parseZoom, r as ZOOM_PRESETS, s as useWheelZoom, t as renderAsync, u as AutocompleteCaretOverlay } from "./renderAsync-
|
|
1
|
+
import { a as formatZoom, c as FormattingBar, i as clampZoom, l as ZoomControl, n as DocxEditor, o as parseZoom, r as ZOOM_PRESETS, s as useWheelZoom, t as renderAsync, u as AutocompleteCaretOverlay } from "./renderAsync-CTnJ1YYt.js";
|
|
2
2
|
import { n as FolioUIProvider } from "./folio-ui-BgDDRsUX.js";
|
|
3
3
|
import { t as FindReplaceDialog } from "./FindReplaceDialog-CqKK82nE.js";
|
|
4
4
|
import { t as FootnotePropertiesDialog } from "./FootnotePropertiesDialog-CixRdIiT.js";
|
|
@@ -12,6 +12,7 @@ import { FOLIO_DOCX_SERIALIZATION_MODE, createFolioEditor } from "@stll/folio-co
|
|
|
12
12
|
import { cloneDocumentWithParagraphPropertySources } from "@stll/folio-core/docx/document-clone";
|
|
13
13
|
import { normalizeBaseDirection } from "@stll/folio-core/docx/normalizeBaseDirection";
|
|
14
14
|
import { getCachedNumberingMap } from "@stll/folio-core/docx/numberingParser";
|
|
15
|
+
import { classifyEditorKeydown, deleteSelectedTable, historyShortcutOwner, isFocusInInputLike, isKeydownInShortcutScope, isMacPlatform } from "@stll/folio-core/managers/editorShortcuts";
|
|
15
16
|
import { computeScrollPageInfo, updateScrollPageTotal } from "@stll/folio-core/paged-layout/scrollPageInfo";
|
|
16
17
|
import { NO_LIST_STATE, TextSelection, addColumnLeft, addColumnRight, addRowAbove, addRowBelow, applyFormatMarks, applyStyle, applyTableStyle, autoFitContents, captureFormatMarks, clearFormatting, clearTextColor, createStyleResolver, decreaseIndent, decreaseListLevel, deleteColumn, deleteRow, deleteTable, distributeColumns, extractSelectionState, getDocumentBuiltInStyles, getSelectedText, getTableContext, increaseIndent, increaseListLevel, listStateLevel, mergeCells, removeTabStop, removeTableBorders, sameListState, schema, selectColumn, selectRow, selectTable, setAlignment, setAllTableBorders, setCellBorder, setCellFillColor, setCellMargins, setCellTextDirection, setCellVerticalAlign, setFontFamily, setFontSize, setHighlight, setIndentFirstLine, setIndentLeft, setIndentRight, setInsideTableBorders, setLineSpacing, setLtr, setOutsideTableBorders, setRowHeight, setRtl, setTableBorderColor, setTableBorderPreset, setTableBorderWidth, setTableProperties, setTextColor, splitCell, toggleBidi, toggleBold, toggleBulletList, toggleHeaderRow, toggleItalic, toggleNoWrap, toggleNumberedList, toggleStrike, toggleSubscript, toggleSuperscript, toggleUnderline } from "@stll/folio-core/prosemirror";
|
|
17
18
|
import { acceptAIEditRevision, acceptChange, acceptSuggestion, findAIEditRevisionRange, findChangeAtPosition, findNextChange, findParagraphBoundaryChangeAtPosition, findPreviousChange, findSuggestionRange, getSuggestions, rejectAIEditRevision, rejectChange, rejectSuggestion } from "@stll/folio-core/prosemirror/commands/comments";
|
|
@@ -106,7 +107,6 @@ import { createEmptyHeaderFooter, pickActiveHeaderFooterRId, removeHeaderFooter,
|
|
|
106
107
|
import { editHyperlinkAtCursor, removeHyperlinkAtCursor } from "@stll/folio-core/prosemirror/commands/hyperlink";
|
|
107
108
|
import { anchorTargetAttrs, sanitizeExternalUrl, windowFeaturesFor } from "@stll/folio-core/utils/urlSecurity";
|
|
108
109
|
import { applyImagePosition, applyImageProperties, applyImageTransform, applyImageWrapType, insertImageFromFile } from "@stll/folio-core/prosemirror/commands/image";
|
|
109
|
-
import { classifyEditorKeydown, deleteSelectedTable, isFocusInInputLike, isKeydownInShortcutScope, isMacPlatform } from "@stll/folio-core/managers/editorShortcuts";
|
|
110
110
|
import { getScrollTopForZoomAnchor, getViewportCenterZoomAnchorForZoomChange } from "@stll/folio-core/paged-layout/zoomScrollAnchor";
|
|
111
111
|
import { ZOOM_MAX, ZOOM_MIN, ZOOM_STEP } from "@stll/folio-core/utils/zoom";
|
|
112
112
|
import { COMMENT_ANCHOR_SELECTOR, commentAnchorIds } from "@stll/folio-core/render-dom/commentAnchorAttributes";
|
|
@@ -10488,7 +10488,8 @@ function _temp$2() {}
|
|
|
10488
10488
|
* Page-level keyboard shortcuts:
|
|
10489
10489
|
* - Cmd/Ctrl+F → open find dialog with selected text
|
|
10490
10490
|
* - Cmd/Ctrl+H → open replace dialog
|
|
10491
|
-
* - Cmd/Ctrl+P → trigger the custom print path (intercepts the OS dialog)
|
|
10491
|
+
* - Cmd/Ctrl+P → trigger the custom print path (intercepts the OS dialog),
|
|
10492
|
+
* unless `hostShortcuts` gives print to the host
|
|
10492
10493
|
* - Delete/Backspace → delete the currently selected table when nothing else
|
|
10493
10494
|
* is selected (works with both ProseMirror `CellSelection` whole-table
|
|
10494
10495
|
* selections and the layout-overlay table selection). Suppressed when
|
|
@@ -10503,17 +10504,19 @@ function _temp$2() {}
|
|
|
10503
10504
|
* whole-table deletion check live in `@stll/folio-core`; this hook owns only
|
|
10504
10505
|
* the listener lifecycle, ref freshness, and the host-callback dispatch.
|
|
10505
10506
|
*/
|
|
10506
|
-
function useKeyboardShortcuts({ pagedEditorRef, findReplace, tableSelection, onDirectPrint, scope, roots }) {
|
|
10507
|
+
function useKeyboardShortcuts({ pagedEditorRef, findReplace, tableSelection, onDirectPrint, scope, hostShortcuts, roots }) {
|
|
10507
10508
|
const callbacksRef = useRef({
|
|
10508
10509
|
findReplace,
|
|
10509
10510
|
tableSelection,
|
|
10510
10511
|
onDirectPrint,
|
|
10512
|
+
hostShortcuts,
|
|
10511
10513
|
roots
|
|
10512
10514
|
});
|
|
10513
10515
|
callbacksRef.current = {
|
|
10514
10516
|
findReplace,
|
|
10515
10517
|
tableSelection,
|
|
10516
10518
|
onDirectPrint,
|
|
10519
|
+
hostShortcuts,
|
|
10517
10520
|
roots
|
|
10518
10521
|
};
|
|
10519
10522
|
useEffect(() => {
|
|
@@ -10537,7 +10540,8 @@ function useKeyboardShortcuts({ pagedEditorRef, findReplace, tableSelection, onD
|
|
|
10537
10540
|
const editorDom = pagedEditorRef.current?.getView()?.dom;
|
|
10538
10541
|
switch (classifyEditorKeydown(e_0, {
|
|
10539
10542
|
isMac: isMacPlatform(),
|
|
10540
|
-
isInputLike: isFocusInInputLike(e_0.target, editorDom)
|
|
10543
|
+
isInputLike: isFocusInInputLike(e_0.target, editorDom),
|
|
10544
|
+
hostShortcuts: callbacksRef.current.hostShortcuts
|
|
10541
10545
|
}).type) {
|
|
10542
10546
|
case "deleteSelectedTable":
|
|
10543
10547
|
handleDeleteSelectedTable(e_0);
|
|
@@ -12275,7 +12279,7 @@ function useFolioComments({ doc, autoOpenReviewSidebar, anchorPositions, editorC
|
|
|
12275
12279
|
* - Error boundary
|
|
12276
12280
|
* - Loading states
|
|
12277
12281
|
*/
|
|
12278
|
-
const CommentsSidebar = lazy(() => import("./CommentsSidebar-
|
|
12282
|
+
const CommentsSidebar = lazy(() => import("./CommentsSidebar-CGs9K70B.js").then((m) => ({ default: m.CommentsSidebar })));
|
|
12279
12283
|
const TextContextMenu = lazy(() => import("./TextContextMenu-Ci7-M4oU.js").then((m) => ({ default: m.TextContextMenu })));
|
|
12280
12284
|
const loadAttemptSelectiveSave = async () => {
|
|
12281
12285
|
const { attemptSelectiveSave } = await import("@stll/folio-core/docx/selectiveSave");
|
|
@@ -12337,7 +12341,7 @@ function areActiveTrackedChangesEqual(a, b) {
|
|
|
12337
12341
|
/**
|
|
12338
12342
|
* DocxEditor - Complete DOCX editor component
|
|
12339
12343
|
*/
|
|
12340
|
-
const DocxEditor = forwardRef(function DocxEditor({ documentBuffer, password, document: initialDocument, onSave, author = "User", onChange, 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 = "document", readOnly: readOnlyProp = false, autoOpenReviewSidebar = true, components, toolbarExtra, className = "", style, placeholder, loadingIndicator, preserveDocumentWhileLoading = false, initialScrollTop, onScrollTopChange, showOutline: showOutlineProp = true, 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, onSelectiveSaveTripwire }, ref) {
|
|
12344
|
+
const DocxEditor = forwardRef(function DocxEditor({ documentBuffer, password, document: initialDocument, onSave, author = "User", onChange, 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 = "document", hostShortcuts: hostShortcutsProp, readOnly: readOnlyProp = false, autoOpenReviewSidebar = true, components, toolbarExtra, className = "", style, placeholder, loadingIndicator, preserveDocumentWhileLoading = false, initialScrollTop, onScrollTopChange, showOutline: showOutlineProp = true, 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, onSelectiveSaveTripwire }, ref) {
|
|
12341
12345
|
const t = useTranslations("folio");
|
|
12342
12346
|
useEffect(() => {
|
|
12343
12347
|
const onClipboardReadError = () => {
|
|
@@ -12423,17 +12427,19 @@ const DocxEditor = forwardRef(function DocxEditor({ documentBuffer, password, do
|
|
|
12423
12427
|
useEffect(() => {
|
|
12424
12428
|
setShowOutline(showOutlineProp);
|
|
12425
12429
|
}, [showOutlineProp]);
|
|
12430
|
+
const [hostShortcuts] = useState(() => hostShortcutsProp ?? []);
|
|
12431
|
+
const historyShortcuts = historyShortcutOwner(hostShortcuts);
|
|
12426
12432
|
const history = useDocumentHistory(initialDocument || null, {
|
|
12427
12433
|
maxEntries: 100,
|
|
12428
12434
|
groupingInterval: 500,
|
|
12429
|
-
enableKeyboardShortcuts:
|
|
12435
|
+
enableKeyboardShortcuts: historyShortcuts === "editor"
|
|
12430
12436
|
});
|
|
12431
12437
|
const extensionManager = useMemo(() => {
|
|
12432
|
-
const mgr = new ExtensionManager(createStarterKit());
|
|
12438
|
+
const mgr = new ExtensionManager(createStarterKit({ historyShortcuts }));
|
|
12433
12439
|
mgr.buildSchema();
|
|
12434
12440
|
mgr.initializeRuntime();
|
|
12435
12441
|
return mgr;
|
|
12436
|
-
}, []);
|
|
12442
|
+
}, [historyShortcuts]);
|
|
12437
12443
|
const [initialSuggestionMode] = useState(() => ({
|
|
12438
12444
|
active: editingMode === "suggesting",
|
|
12439
12445
|
author
|
|
@@ -13099,6 +13105,7 @@ const DocxEditor = forwardRef(function DocxEditor({ documentBuffer, password, do
|
|
|
13099
13105
|
tableSelection,
|
|
13100
13106
|
onDirectPrint: handleDirectPrint,
|
|
13101
13107
|
scope: keyboardShortcuts,
|
|
13108
|
+
hostShortcuts,
|
|
13102
13109
|
roots: shortcutRoots
|
|
13103
13110
|
});
|
|
13104
13111
|
const handleApplyFootnoteProperties = useCallback((footnotePr, endnotePr) => {
|
|
@@ -6,7 +6,7 @@ import { FolioAIEditApplyMode, FolioAIEditApplyResult, FolioAIEditOperation, Fol
|
|
|
6
6
|
import { FolioDocumentOperationBatch, FolioDocumentOperationResult, FolioDocumentOperationUndoHandle, FolioDocumentOperationUndoResult } from "@stll/folio-core/server";
|
|
7
7
|
import { ContentControlFilter, SetContentControlContentInput, SetContentControlValueInput } from "@stll/folio-core/content-controls";
|
|
8
8
|
import { PageRendererName } from "@stll/folio-core/display-list/editor/pageRenderer";
|
|
9
|
-
import { KeyboardShortcutScope } from "@stll/folio-core/managers/editorShortcuts";
|
|
9
|
+
import { HostShortcut, KeyboardShortcutScope } from "@stll/folio-core/managers/editorShortcuts";
|
|
10
10
|
import { FolioEditor } from "@stll/folio-core/controller/folioEditor";
|
|
11
11
|
import { DocxCompatibility } from "@stll/folio-core/docx/compatibility";
|
|
12
12
|
import { FolioSelectiveSaveFlags } from "@stll/folio-core/docx/selectiveSaveFlags";
|
|
@@ -721,6 +721,14 @@ type DocxEditorProps = {
|
|
|
721
721
|
* and opens the dialog through `DocxEditorRef.openFind` / `openReplace`.
|
|
722
722
|
*/
|
|
723
723
|
keyboardShortcuts?: KeyboardShortcutScope;
|
|
724
|
+
/**
|
|
725
|
+
* Shortcuts the host binds itself; the editor leaves their keys alone
|
|
726
|
+
* (default: none). `"history"` unbinds undo and redo (Mod-z, Mod-y,
|
|
727
|
+
* Mod-Shift-z) so a host with its own undo stack calls
|
|
728
|
+
* `DocxEditorRef.undo` / `redo` instead; `"print"` leaves Cmd/Ctrl+P to the
|
|
729
|
+
* host. Read when the editor mounts; remount to change it.
|
|
730
|
+
*/
|
|
731
|
+
hostShortcuts?: readonly HostShortcut[];
|
|
724
732
|
/** Whether the editor is read-only. When true, hides toolbar and rulers */
|
|
725
733
|
readOnly?: boolean;
|
|
726
734
|
/** Whether comments/tracked changes should auto-open the review sidebar (default: true) */
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stll/folio-react",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.23.0",
|
|
4
4
|
"description": "React editor for folio: a Word-document (.docx) editor for the browser, built on @stll/folio-core and ProseMirror.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"document-editor",
|
|
@@ -75,7 +75,7 @@
|
|
|
75
75
|
"@fontsource/noto-sans-arabic": "^5.2.7",
|
|
76
76
|
"@fontsource/source-sans-3": "^5.2.9",
|
|
77
77
|
"@fontsource/tinos": "^5.2.7",
|
|
78
|
-
"@stll/folio-core": "^0.
|
|
78
|
+
"@stll/folio-core": "^0.51.0",
|
|
79
79
|
"better-result": "3.0.1",
|
|
80
80
|
"lucide-react": "1.24.0",
|
|
81
81
|
"prosemirror-history": "^1.5.0",
|