@stll/folio-react 0.16.7 → 0.17.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-DsY20BSs.js → CommentsSidebar-DtoKrEhl.js} +1 -1
- package/dist/compat/eigenpal.d.ts +1 -1
- package/dist/compat/eigenpal.js +40 -29
- package/dist/index.d.ts +12 -4
- package/dist/index.js +1 -1
- package/dist/{renderAsync-D5MafItf.js → renderAsync-BTVnhZop.js} +66 -27
- package/dist/{renderAsync-Dhu0sHJ4.d.ts → renderAsync-CqIfcY3H.d.ts} +33 -0
- package/package.json +2 -2
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { d as containedHandler } from "./renderAsync-
|
|
1
|
+
import { d as containedHandler } from "./renderAsync-BTVnhZop.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-CqIfcY3H.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-BTVnhZop.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";
|
|
@@ -75,47 +75,58 @@ const useTranslation = () => {
|
|
|
75
75
|
return t1;
|
|
76
76
|
};
|
|
77
77
|
const DocxEditor = forwardRef((t0, ref) => {
|
|
78
|
-
const $ = c(
|
|
78
|
+
const $ = c(14);
|
|
79
|
+
let disableFindReplaceShortcuts;
|
|
79
80
|
let i18n;
|
|
81
|
+
let keyboardShortcuts;
|
|
80
82
|
let locale;
|
|
81
83
|
let props;
|
|
82
84
|
if ($[0] !== t0) {
|
|
83
|
-
const { agentPanel: _agentPanel, colorMode: _colorMode, commentsSidebarOpen: _commentsSidebarOpen, disableFindReplaceShortcuts:
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
85
|
+
const { agentPanel: _agentPanel, colorMode: _colorMode, commentsSidebarOpen: _commentsSidebarOpen, disableFindReplaceShortcuts: t1, documentName: _documentName, documentNameEditable: _documentNameEditable, externalContent: _externalContent, externalPlugins: _externalPlugins, i18n: t2, locale: t3, onCommentAdd: _onCommentAdd, onCommentDelete: _onCommentDelete, onCommentReply: _onCommentReply, onCommentResolve: _onCommentResolve, onCommentsSidebarOpenChange: _onCommentsSidebarOpenChange, onDocumentNameChange: _onDocumentNameChange, onOpen: _onOpen, onRenderedDomContextReady: _onRenderedDomContextReady, pluginOverlays: _pluginOverlays, pluginRenderedDomContext: _pluginRenderedDomContext, pluginSidebarItems: _pluginSidebarItems, printOptions: _printOptions, renderLogo: _renderLogo, renderTitleBarRight: _renderTitleBarRight, showFileOpen: _showFileOpen, showHelpMenu: _showHelpMenu, showOutlineButton: _showOutlineButton, watermarkPresets: _watermarkPresets, keyboardShortcuts: t4, ...t5 } = t0;
|
|
86
|
+
disableFindReplaceShortcuts = t1;
|
|
87
|
+
i18n = t2;
|
|
88
|
+
locale = t3;
|
|
89
|
+
keyboardShortcuts = t4;
|
|
90
|
+
props = t5;
|
|
87
91
|
$[0] = t0;
|
|
88
|
-
$[1] =
|
|
89
|
-
$[2] =
|
|
90
|
-
$[3] =
|
|
92
|
+
$[1] = disableFindReplaceShortcuts;
|
|
93
|
+
$[2] = i18n;
|
|
94
|
+
$[3] = keyboardShortcuts;
|
|
95
|
+
$[4] = locale;
|
|
96
|
+
$[5] = props;
|
|
91
97
|
} else {
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
98
|
+
disableFindReplaceShortcuts = $[1];
|
|
99
|
+
i18n = $[2];
|
|
100
|
+
keyboardShortcuts = $[3];
|
|
101
|
+
locale = $[4];
|
|
102
|
+
props = $[5];
|
|
95
103
|
}
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
104
|
+
const t1 = keyboardShortcuts ?? (disableFindReplaceShortcuts === true ? "none" : "document");
|
|
105
|
+
let t2;
|
|
106
|
+
if ($[6] !== props || $[7] !== ref || $[8] !== t1) {
|
|
107
|
+
t2 = /* @__PURE__ */ jsx(DocxEditor$1, {
|
|
99
108
|
...props,
|
|
109
|
+
keyboardShortcuts: t1,
|
|
100
110
|
ref
|
|
101
111
|
});
|
|
102
|
-
$[
|
|
103
|
-
$[
|
|
104
|
-
$[
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
112
|
+
$[6] = props;
|
|
113
|
+
$[7] = ref;
|
|
114
|
+
$[8] = t1;
|
|
115
|
+
$[9] = t2;
|
|
116
|
+
} else t2 = $[9];
|
|
117
|
+
let t3;
|
|
118
|
+
if ($[10] !== i18n || $[11] !== locale || $[12] !== t2) {
|
|
119
|
+
t3 = /* @__PURE__ */ jsx(LocaleProvider, {
|
|
109
120
|
i18n,
|
|
110
121
|
locale,
|
|
111
|
-
children:
|
|
122
|
+
children: t2
|
|
112
123
|
});
|
|
113
|
-
$[
|
|
114
|
-
$[
|
|
115
|
-
$[
|
|
116
|
-
$[
|
|
117
|
-
} else
|
|
118
|
-
return
|
|
124
|
+
$[10] = i18n;
|
|
125
|
+
$[11] = locale;
|
|
126
|
+
$[12] = t2;
|
|
127
|
+
$[13] = t3;
|
|
128
|
+
} else t3 = $[13];
|
|
129
|
+
return t3;
|
|
119
130
|
});
|
|
120
131
|
DocxEditor.displayName = "EigenpalCompatDocxEditor";
|
|
121
132
|
const resolveLocale = (locale, i18n) => locale ?? i18n?._lang ?? "en";
|
package/dist/index.d.ts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
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-CqIfcY3H.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";
|
|
5
5
|
import { FolioAIBlock, FolioAIBlockAnchor, FolioAIBlockKind, FolioAIBlockPreviewRun, FolioAIComment, FolioAIEditAppliedOperation, FolioAIEditApplyMode, FolioAIEditApplyResult, FolioAIEditOperation, FolioAIEditReviewMeta, FolioAIEditSeverity, FolioAIEditSkipReason, FolioAIEditSkippedOperation, FolioAIEditSnapshot, FolioAISignatureParty, WordDiffSegment, applyFolioAIEditOperations, createFolioAIEditSnapshot, diffWordSegments, hashFolioAIBlockText, normalizeFolioAIBlockText } from "@stll/folio-core/ai-edits";
|
|
6
|
+
import { KeyboardShortcutScope, KeyboardShortcutScope as KeyboardShortcutScope$1 } from "@stll/folio-core/managers/editorShortcuts";
|
|
6
7
|
import { DocxCompatibility } from "@stll/folio-core/docx/compatibility";
|
|
7
8
|
import { insertImageFromFile, insertPageBreakInView, insertTableInView, insertTableOfContentsInView } from "@stll/folio-core/prosemirror";
|
|
8
9
|
import { FolioSuggestion, SuggestionAppliedAs, SuggestionKind } from "@stll/folio-core/prosemirror/commands/comments";
|
|
@@ -104,8 +105,15 @@ type UseWheelZoomOptions = {
|
|
|
104
105
|
getCurrentZoom?: () => number;
|
|
105
106
|
/** Callback when zoom changes */
|
|
106
107
|
onZoomChange?: (zoom: number) => void;
|
|
107
|
-
/**
|
|
108
|
-
|
|
108
|
+
/**
|
|
109
|
+
* Which presses the zoom shortcuts (Cmd/Ctrl+0, Cmd/Ctrl++, Cmd/Ctrl+-)
|
|
110
|
+
* answer (default: `"document"`). `"editor"` answers only a press inside
|
|
111
|
+
* `shortcutRoots`, so a host that docks the editor beside other panes keeps
|
|
112
|
+
* its own bindings elsewhere; `"none"` binds no keyboard listener.
|
|
113
|
+
*/
|
|
114
|
+
keyboardShortcuts?: KeyboardShortcutScope$1;
|
|
115
|
+
/** Elements a press must land inside under the `"editor"` scope. */
|
|
116
|
+
shortcutRoots?: readonly RefObject<HTMLElement | null>[];
|
|
109
117
|
/** Whether to prevent default browser zoom behavior */
|
|
110
118
|
preventDefault?: boolean;
|
|
111
119
|
};
|
|
@@ -190,4 +198,4 @@ type AutocompleteCaretOverlayProps = {
|
|
|
190
198
|
};
|
|
191
199
|
declare const AutocompleteCaretOverlay: ({ caret, text, isStreaming }: AutocompleteCaretOverlayProps) => React.JSX.Element | null;
|
|
192
200
|
//#endregion
|
|
193
|
-
export { type AIBarStatus, type AIChatMode, type AICitation, type AICitationRange, type AICitationSource, type AIGenerateInput, type AISuggestion, type AISuggestionApplyMode, type AISuggestionPreset, type AISuggestionSeverity, type AISuggestionStatus, type AcceptAutocompleteResult, type AnonymizationMatch, type AnonymizationTerm, type ApplyResult, AutocompleteCaretOverlay, type AutocompleteCaretOverlayProps, type AutocompleteCaretRect, type AutocompleteSuggestionPluginOptions, type AutocompleteSuggestionState, type AutocompleteSuggestionStatus, type AutocompleteTriggerCheck, type AutocompleteTriggerOptions, type AutocompleteTriggerSkipReason, type BlockRect, type ColorPreset, type CreateEmptyDocumentOptions, DEFAULT_AI_SUGGESTION_PRESETS, DEFAULT_AUTOCOMPLETE_DEAD_ZONE_NODES, DOCUMENT_PRESET_VERSION, DOCUMENT_STYLE_SET_VERSION, type DeriveBlockIdInput, type DirectiveKind, type DirectiveRange, type Document, type DocumentPreset, type DocumentStyleCatalog, type DocumentStyleCatalogEntry, type DocumentStyleSet, type DocxCompatibility, DocxEditor, type DocxEditorApplyDocumentOperationsOptions, type DocxEditorCollaboration, type DocxEditorHandle, type DocxEditorProps, type DocxEditorRef, type EditorHandle, type EditorMode, type ExtractDocumentStyleSetOptions, FindReplaceDialog, type FindReplaceDialogProps, type FolioAIBlock, type FolioAIBlockAnchor, type FolioAIBlockKind, type FolioAIBlockPreviewRun, type FolioAIComment, type FolioAIEditAppliedOperation, type FolioAIEditApplyMode, type FolioAIEditApplyResult, type FolioAIEditOperation, type FolioAIEditReviewMeta, type FolioAIEditSeverity, type FolioAIEditSkipReason, type FolioAIEditSkippedOperation, type FolioAIEditSnapshot, type FolioAISignatureParty, type FolioBlockId, type FolioButtonProps, type FolioSuggestion, type FolioUIComponents, FolioUIProvider, type FontDefinition, type FontOption, FootnotePropertiesDialog, type FootnotePropertiesDialogProps, FormattingBar, type FormattingBarProps, type HighlightPassageOptions, type HighlightPassageResult, type HyperlinkBookmarkOption, HyperlinkDialog, type HyperlinkDialogData, type HyperlinkDialogProps, type ImageMeta, type ImagePositionData, ImagePositionDialog, type ImagePositionDialogProps, type ImagePropertiesData, ImagePropertiesDialog, type ImagePropertiesDialogProps, type ImageRef, InsertImageDialog, type InsertImageDialogData, type InsertImageDialogProps, InsertSymbolDialog, type InsertSymbolDialogProps, InsertTableDialog, type InsertTableDialogData, type InsertTableDialogProps, type InsertTableStyleOption, type MarkdownOptions, type MarkdownResult, type OutlineItem, PageSetupDialog, type PageSetupDialogProps, PasteSpecialDialog, type PasteSpecialDialogProps, type PasteSpecialMode, type PictureWatermark, type PositionalText, type RenderAsyncOptions, type ResolvedAnchor, STELLA_STYLE_SET_NAME, type ScrollToParaIdOptions, SplitCellDialog, type SplitCellDialogData, type SplitCellDialogProps, type SuggestionAppliedAs, type SuggestionKind, type TableProperties, TablePropertiesDialog, type TablePropertiesDialogProps, type TemplatePreviewSpan, type TemplatePreviewValue, type TemplatePreviewValues, type TemplateSlashMenuKeyAction, type TemplateSlashMenuState, type TextWatermark, type UseWheelZoomOptions, type UseWheelZoomReturn, type Watermark, WatermarkDialog, type WatermarkDialogProps, type WordDiffSegment, ZOOM_PRESETS, ZoomControl, type ZoomControlProps, type ZoomLevel, acceptAutocompleteSuggestion, acceptAutocompleteWord, anonymizationDecorationsKey, appendAutocompleteToken, applyFolioAIEditOperations, applySuggestions, autocompleteSuggestionKey, autocompleteSuggestionPlugin, buildPositionalText, clampZoom, clearAutocompleteSuggestion, clearTemplateSlashMenu, consumeTemplateSlashQuery, createAICitationDecorationsPlugin, createDocx, createEmptyDocument, createFolioAIEditSnapshot, createStellaStyleDocumentPreset, createStellaStyleSet, deriveBlockId, diffWordSegments, extractDocumentStyleSet, extractDocumentStyleSetFromDocx, finishAutocompleteSuggestion, formatZoom, fromMarkdown, getAnonymizationMatches, getAutocompleteSuggestion, getDocumentWatermark, getFolioCaretViewportRect, getFolioParaIdFromBlockId, getFolioSelectionViewportRect, getTemplateDirectives, getTemplateSlashMenu, hashFolioAIBlockText, insertImageFromFile, insertPageBreakInView, insertTableInView, insertTableOfContentsInView, inspectDocumentStyles, inspectDocumentStylesFromDocx, isFolioBlockId, isSequentialFolioBlockId, isSuggestionStale, normalizeFolioAIBlockText, parseZoom, renderAsync, resetTemplateSlashQuery, resolveSuggestionAnchor, scanDirectives, scrollFolioPositionIntoView, setAICitationsMeta, setAISuggestionsMeta, setActiveCitationMeta, setAnonymizationTermsMeta, setDocumentWatermark, setFocusedSuggestionMeta, setTemplatePreviewValues, shouldTriggerAutocomplete, startAutocompleteSuggestion, templateSlashMenuKey, toMarkdown, toMarkdownResult, useWheelZoom };
|
|
201
|
+
export { type AIBarStatus, type AIChatMode, type AICitation, type AICitationRange, type AICitationSource, type AIGenerateInput, type AISuggestion, type AISuggestionApplyMode, type AISuggestionPreset, type AISuggestionSeverity, type AISuggestionStatus, type AcceptAutocompleteResult, type AnonymizationMatch, type AnonymizationTerm, type ApplyResult, AutocompleteCaretOverlay, type AutocompleteCaretOverlayProps, type AutocompleteCaretRect, type AutocompleteSuggestionPluginOptions, type AutocompleteSuggestionState, type AutocompleteSuggestionStatus, type AutocompleteTriggerCheck, type AutocompleteTriggerOptions, type AutocompleteTriggerSkipReason, type BlockRect, type ColorPreset, type CreateEmptyDocumentOptions, DEFAULT_AI_SUGGESTION_PRESETS, DEFAULT_AUTOCOMPLETE_DEAD_ZONE_NODES, DOCUMENT_PRESET_VERSION, DOCUMENT_STYLE_SET_VERSION, type DeriveBlockIdInput, type DirectiveKind, type DirectiveRange, type Document, type DocumentPreset, type DocumentStyleCatalog, type DocumentStyleCatalogEntry, type DocumentStyleSet, type DocxCompatibility, DocxEditor, type DocxEditorApplyDocumentOperationsOptions, type DocxEditorCollaboration, type DocxEditorHandle, type DocxEditorProps, type DocxEditorRef, type EditorHandle, type EditorMode, type ExtractDocumentStyleSetOptions, FindReplaceDialog, type FindReplaceDialogProps, type FolioAIBlock, type FolioAIBlockAnchor, type FolioAIBlockKind, type FolioAIBlockPreviewRun, type FolioAIComment, type FolioAIEditAppliedOperation, type FolioAIEditApplyMode, type FolioAIEditApplyResult, type FolioAIEditOperation, type FolioAIEditReviewMeta, type FolioAIEditSeverity, type FolioAIEditSkipReason, type FolioAIEditSkippedOperation, type FolioAIEditSnapshot, type FolioAISignatureParty, type FolioBlockId, type FolioButtonProps, type FolioSuggestion, type FolioUIComponents, FolioUIProvider, type FontDefinition, type FontOption, FootnotePropertiesDialog, type FootnotePropertiesDialogProps, FormattingBar, type FormattingBarProps, type HighlightPassageOptions, type HighlightPassageResult, type HyperlinkBookmarkOption, HyperlinkDialog, type HyperlinkDialogData, type HyperlinkDialogProps, type ImageMeta, type ImagePositionData, ImagePositionDialog, type ImagePositionDialogProps, type ImagePropertiesData, ImagePropertiesDialog, type ImagePropertiesDialogProps, type ImageRef, InsertImageDialog, type InsertImageDialogData, type InsertImageDialogProps, InsertSymbolDialog, type InsertSymbolDialogProps, InsertTableDialog, type InsertTableDialogData, type InsertTableDialogProps, type InsertTableStyleOption, type KeyboardShortcutScope, type MarkdownOptions, type MarkdownResult, type OutlineItem, PageSetupDialog, type PageSetupDialogProps, PasteSpecialDialog, type PasteSpecialDialogProps, type PasteSpecialMode, type PictureWatermark, type PositionalText, type RenderAsyncOptions, type ResolvedAnchor, STELLA_STYLE_SET_NAME, type ScrollToParaIdOptions, SplitCellDialog, type SplitCellDialogData, type SplitCellDialogProps, type SuggestionAppliedAs, type SuggestionKind, type TableProperties, TablePropertiesDialog, type TablePropertiesDialogProps, type TemplatePreviewSpan, type TemplatePreviewValue, type TemplatePreviewValues, type TemplateSlashMenuKeyAction, type TemplateSlashMenuState, type TextWatermark, type UseWheelZoomOptions, type UseWheelZoomReturn, type Watermark, WatermarkDialog, type WatermarkDialogProps, type WordDiffSegment, ZOOM_PRESETS, ZoomControl, type ZoomControlProps, type ZoomLevel, acceptAutocompleteSuggestion, acceptAutocompleteWord, anonymizationDecorationsKey, appendAutocompleteToken, applyFolioAIEditOperations, applySuggestions, autocompleteSuggestionKey, autocompleteSuggestionPlugin, buildPositionalText, clampZoom, clearAutocompleteSuggestion, clearTemplateSlashMenu, consumeTemplateSlashQuery, createAICitationDecorationsPlugin, createDocx, createEmptyDocument, createFolioAIEditSnapshot, createStellaStyleDocumentPreset, createStellaStyleSet, deriveBlockId, diffWordSegments, extractDocumentStyleSet, extractDocumentStyleSetFromDocx, finishAutocompleteSuggestion, formatZoom, fromMarkdown, getAnonymizationMatches, getAutocompleteSuggestion, getDocumentWatermark, getFolioCaretViewportRect, getFolioParaIdFromBlockId, getFolioSelectionViewportRect, getTemplateDirectives, getTemplateSlashMenu, hashFolioAIBlockText, insertImageFromFile, insertPageBreakInView, insertTableInView, insertTableOfContentsInView, inspectDocumentStyles, inspectDocumentStylesFromDocx, isFolioBlockId, isSequentialFolioBlockId, isSuggestionStale, normalizeFolioAIBlockText, parseZoom, renderAsync, resetTemplateSlashQuery, resolveSuggestionAnchor, scanDirectives, scrollFolioPositionIntoView, setAICitationsMeta, setAISuggestionsMeta, setActiveCitationMeta, setAnonymizationTermsMeta, setDocumentWatermark, setFocusedSuggestionMeta, setTemplatePreviewValues, shouldTriggerAutocomplete, startAutocompleteSuggestion, templateSlashMenuKey, toMarkdown, toMarkdownResult, useWheelZoom };
|
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-BTVnhZop.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";
|
|
@@ -98,7 +98,7 @@ import { createEmptyHeaderFooter, pickActiveHeaderFooterRId, removeHeaderFooter,
|
|
|
98
98
|
import { editHyperlinkAtCursor, removeHyperlinkAtCursor } from "@stll/folio-core/prosemirror/commands/hyperlink";
|
|
99
99
|
import { sanitizeExternalUrl } from "@stll/folio-core/utils/urlSecurity";
|
|
100
100
|
import { applyImagePosition, applyImageProperties, applyImageTransform, applyImageWrapType, insertImageFromFile } from "@stll/folio-core/prosemirror/commands/image";
|
|
101
|
-
import { classifyEditorKeydown, deleteSelectedTable, isFocusInInputLike, isMacPlatform } from "@stll/folio-core/managers/editorShortcuts";
|
|
101
|
+
import { classifyEditorKeydown, deleteSelectedTable, isFocusInInputLike, isKeydownInShortcutScope, isMacPlatform } from "@stll/folio-core/managers/editorShortcuts";
|
|
102
102
|
import { getScrollTopForZoomAnchor, getViewportCenterZoomAnchorForZoomChange } from "@stll/folio-core/paged-layout/zoomScrollAnchor";
|
|
103
103
|
import { ZOOM_MAX, ZOOM_MIN, ZOOM_STEP } from "@stll/folio-core/utils/zoom";
|
|
104
104
|
import { isValidHexId } from "@stll/folio-core/utils/hexId";
|
|
@@ -3129,7 +3129,7 @@ function buildFootnoteRenderItems(pageFootnoteMap, footnoteContentMap, doc) {
|
|
|
3129
3129
|
* PagedEditor - Main paginated editing component.
|
|
3130
3130
|
*/
|
|
3131
3131
|
const PagedEditor = forwardRef(function PagedEditor(props, ref) {
|
|
3132
|
-
const { document, documentIO, documentIdentity, fonts: hostFonts, styles, theme: _theme, sectionProperties, headerContent, footerContent, firstPageHeaderContent, firstPageFooterContent, headerContentRId, footerContentRId, firstPageHeaderContentRId, firstPageFooterContentRId, readOnly = false, pageGap = 24, zoom = 1, 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, commentsSidebarOpen = false, sidebarOverlay, scrollContainerRef: scrollContainerRefProp, onHyperlinkClick, onContextMenu, onAnchorPositionsChange, onTotalPagesChange, anchorPositionMode = "comments-and-revisions", onAnonymizationTermClick, selectedAnonymizationCanonical = null, anonymizationSelectionSeq } = props;
|
|
3132
|
+
const { document, documentIO, documentIdentity, fonts: hostFonts, styles, theme: _theme, sectionProperties, headerContent, footerContent, firstPageHeaderContent, firstPageFooterContent, headerContentRId, footerContentRId, firstPageHeaderContentRId, firstPageFooterContentRId, readOnly = false, pageGap = 24, zoom = 1, pageRenderer, 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, commentsSidebarOpen = false, sidebarOverlay, scrollContainerRef: scrollContainerRefProp, onHyperlinkClick, onContextMenu, onAnchorPositionsChange, onTotalPagesChange, anchorPositionMode = "comments-and-revisions", onAnonymizationTermClick, selectedAnonymizationCanonical = null, anonymizationSelectionSeq } = props;
|
|
3133
3133
|
const getScrollContainer = useCallback(() => {
|
|
3134
3134
|
if (scrollContainerRefProp && typeof scrollContainerRefProp === "object") return scrollContainerRefProp.current;
|
|
3135
3135
|
return containerRef.current;
|
|
@@ -3405,6 +3405,7 @@ const PagedEditor = forwardRef(function PagedEditor(props, ref) {
|
|
|
3405
3405
|
pageGap,
|
|
3406
3406
|
showMarginGuides,
|
|
3407
3407
|
marginGuideColor,
|
|
3408
|
+
...pageRenderer === void 0 ? {} : { pageRenderer },
|
|
3408
3409
|
syncCoordinator,
|
|
3409
3410
|
headerContent,
|
|
3410
3411
|
footerContent,
|
|
@@ -3450,6 +3451,7 @@ const PagedEditor = forwardRef(function PagedEditor(props, ref) {
|
|
|
3450
3451
|
zoom,
|
|
3451
3452
|
showMarginGuides,
|
|
3452
3453
|
marginGuideColor,
|
|
3454
|
+
pageRenderer,
|
|
3453
3455
|
syncCoordinator,
|
|
3454
3456
|
headerContent,
|
|
3455
3457
|
footerContent,
|
|
@@ -3489,17 +3491,18 @@ const PagedEditor = forwardRef(function PagedEditor(props, ref) {
|
|
|
3489
3491
|
folioEditor,
|
|
3490
3492
|
hfEditMode
|
|
3491
3493
|
]);
|
|
3492
|
-
const
|
|
3494
|
+
const paintSettingsInitializedRef = useRef(false);
|
|
3493
3495
|
useEffect(() => {
|
|
3494
|
-
if (!
|
|
3495
|
-
|
|
3496
|
+
if (!paintSettingsInitializedRef.current) {
|
|
3497
|
+
paintSettingsInitializedRef.current = true;
|
|
3496
3498
|
return;
|
|
3497
3499
|
}
|
|
3498
3500
|
folioEditor.relayout();
|
|
3499
3501
|
}, [
|
|
3500
3502
|
folioEditor,
|
|
3501
3503
|
marginGuideColor,
|
|
3502
|
-
showMarginGuides
|
|
3504
|
+
showMarginGuides,
|
|
3505
|
+
pageRenderer
|
|
3503
3506
|
]);
|
|
3504
3507
|
const layoutSchedulerRef = useRef(null);
|
|
3505
3508
|
if (layoutSchedulerRef.current === null) layoutSchedulerRef.current = createLayoutScheduler({
|
|
@@ -7568,6 +7571,17 @@ function ContentControlDropdownItem(t0) {
|
|
|
7568
7571
|
return t2;
|
|
7569
7572
|
}
|
|
7570
7573
|
//#endregion
|
|
7574
|
+
//#region src/components/dialogs/findReplaceSelectionSeed.ts
|
|
7575
|
+
/**
|
|
7576
|
+
* The search text a find/replace dialog opens with: the current DOM selection,
|
|
7577
|
+
* or `""` when it is collapsed or absent. One helper so the keyboard shortcut
|
|
7578
|
+
* and `DocxEditorRef.openFind` / `openReplace` cannot seed differently.
|
|
7579
|
+
*/
|
|
7580
|
+
const readFindSelectionSeed = () => {
|
|
7581
|
+
const selection = window.getSelection();
|
|
7582
|
+
return selection && !selection.isCollapsed ? selection.toString() : "";
|
|
7583
|
+
};
|
|
7584
|
+
//#endregion
|
|
7571
7585
|
//#region src/components/dialogs/findReplaceUtils.ts
|
|
7572
7586
|
const scrollToMatch = (containerElement, match) => {
|
|
7573
7587
|
if (!containerElement) return;
|
|
@@ -10861,7 +10875,7 @@ function _temp$2() {}
|
|
|
10861
10875
|
//#endregion
|
|
10862
10876
|
//#region src/components/hooks/useKeyboardShortcuts.ts
|
|
10863
10877
|
/**
|
|
10864
|
-
*
|
|
10878
|
+
* Page-level keyboard shortcuts:
|
|
10865
10879
|
* - Cmd/Ctrl+F → open find dialog with selected text
|
|
10866
10880
|
* - Cmd/Ctrl+H → open replace dialog
|
|
10867
10881
|
* - Cmd/Ctrl+P → trigger the custom print path (intercepts the OS dialog)
|
|
@@ -10871,27 +10885,29 @@ function _temp$2() {}
|
|
|
10871
10885
|
* focus is in a non-editor input/textarea/contenteditable to avoid
|
|
10872
10886
|
* deleting tables while the user is typing in a sidebar or dialog.
|
|
10873
10887
|
*
|
|
10874
|
-
*
|
|
10888
|
+
* `scope` decides which presses reach that dispatch: `"document"` every press
|
|
10889
|
+
* on the page, `"editor"` only presses inside `roots`, `"none"` no listener at
|
|
10890
|
+
* all, leaving the shortcuts to the host.
|
|
10891
|
+
*
|
|
10892
|
+
* Thin React binding: the classification, scope, platform/input predicates, and
|
|
10875
10893
|
* whole-table deletion check live in `@stll/folio-core`; this hook owns only
|
|
10876
10894
|
* the listener lifecycle, ref freshness, and the host-callback dispatch.
|
|
10877
10895
|
*/
|
|
10878
|
-
function useKeyboardShortcuts({ pagedEditorRef, findReplace, tableSelection, onDirectPrint }) {
|
|
10896
|
+
function useKeyboardShortcuts({ pagedEditorRef, findReplace, tableSelection, onDirectPrint, scope, roots }) {
|
|
10879
10897
|
const callbacksRef = useRef({
|
|
10880
10898
|
findReplace,
|
|
10881
10899
|
tableSelection,
|
|
10882
|
-
onDirectPrint
|
|
10900
|
+
onDirectPrint,
|
|
10901
|
+
roots
|
|
10883
10902
|
});
|
|
10884
10903
|
callbacksRef.current = {
|
|
10885
10904
|
findReplace,
|
|
10886
10905
|
tableSelection,
|
|
10887
|
-
onDirectPrint
|
|
10906
|
+
onDirectPrint,
|
|
10907
|
+
roots
|
|
10888
10908
|
};
|
|
10889
10909
|
useEffect(() => {
|
|
10890
|
-
|
|
10891
|
-
const selection = window.getSelection();
|
|
10892
|
-
const selectedText = selection && !selection.isCollapsed ? selection.toString() : "";
|
|
10893
|
-
callbacksRef.current.findReplace.openFind(selectedText);
|
|
10894
|
-
};
|
|
10910
|
+
if (scope === "none") return;
|
|
10895
10911
|
const handleDeleteSelectedTable = (e) => {
|
|
10896
10912
|
const view = pagedEditorRef.current?.getView();
|
|
10897
10913
|
if (view && deleteSelectedTable(view.state, view.dispatch)) {
|
|
@@ -10904,6 +10920,10 @@ function useKeyboardShortcuts({ pagedEditorRef, findReplace, tableSelection, onD
|
|
|
10904
10920
|
}
|
|
10905
10921
|
};
|
|
10906
10922
|
const handleKeyDown = (e_0) => {
|
|
10923
|
+
if (!isKeydownInShortcutScope(e_0, {
|
|
10924
|
+
scope,
|
|
10925
|
+
roots: callbacksRef.current.roots.map((root) => root.current)
|
|
10926
|
+
})) return;
|
|
10907
10927
|
const editorDom = pagedEditorRef.current?.getView()?.dom;
|
|
10908
10928
|
switch (classifyEditorKeydown(e_0, {
|
|
10909
10929
|
isMac: isMacPlatform(),
|
|
@@ -10914,7 +10934,7 @@ function useKeyboardShortcuts({ pagedEditorRef, findReplace, tableSelection, onD
|
|
|
10914
10934
|
return;
|
|
10915
10935
|
case "openFind":
|
|
10916
10936
|
e_0.preventDefault();
|
|
10917
|
-
|
|
10937
|
+
callbacksRef.current.findReplace.openFind(readFindSelectionSeed());
|
|
10918
10938
|
return;
|
|
10919
10939
|
case "print":
|
|
10920
10940
|
e_0.preventDefault();
|
|
@@ -10927,7 +10947,7 @@ function useKeyboardShortcuts({ pagedEditorRef, findReplace, tableSelection, onD
|
|
|
10927
10947
|
return () => {
|
|
10928
10948
|
document.removeEventListener("keydown", handleKeyDown);
|
|
10929
10949
|
};
|
|
10930
|
-
}, [pagedEditorRef]);
|
|
10950
|
+
}, [pagedEditorRef, scope]);
|
|
10931
10951
|
}
|
|
10932
10952
|
//#endregion
|
|
10933
10953
|
//#region src/components/hooks/useZoomAndPageInfo.ts
|
|
@@ -11082,6 +11102,8 @@ function useZoomAndPageInfo({ scrollContainerRef, pagedEditorRef, initialZoom })
|
|
|
11082
11102
|
* zoom owner (e.g. DocxEditor's viewport-anchored zoom) and the hook only emits
|
|
11083
11103
|
* through `onZoomChange`, so the two never diverge.
|
|
11084
11104
|
*/
|
|
11105
|
+
/** Stable empty default so an omitted `shortcutRoots` never re-runs the effect. */
|
|
11106
|
+
const NO_SHORTCUT_ROOTS = [];
|
|
11085
11107
|
const DEFAULT_INITIAL_ZOOM = 1;
|
|
11086
11108
|
const DEFAULT_MIN_ZOOM = ZOOM_MIN;
|
|
11087
11109
|
const DEFAULT_MAX_ZOOM = ZOOM_MAX;
|
|
@@ -11123,7 +11145,7 @@ function roundZoom(zoom) {
|
|
|
11123
11145
|
* React hook for Ctrl+scroll zoom functionality
|
|
11124
11146
|
*/
|
|
11125
11147
|
function useWheelZoom(options = {}) {
|
|
11126
|
-
const { initialZoom = DEFAULT_INITIAL_ZOOM, minZoom = DEFAULT_MIN_ZOOM, maxZoom = DEFAULT_MAX_ZOOM, zoomStep = DEFAULT_ZOOM_STEP, enabled = true, containerRef, getCurrentZoom, onZoomChange,
|
|
11148
|
+
const { initialZoom = DEFAULT_INITIAL_ZOOM, minZoom = DEFAULT_MIN_ZOOM, maxZoom = DEFAULT_MAX_ZOOM, zoomStep = DEFAULT_ZOOM_STEP, enabled = true, containerRef, getCurrentZoom, onZoomChange, keyboardShortcuts = "document", shortcutRoots = NO_SHORTCUT_ROOTS, preventDefault = true } = options;
|
|
11127
11149
|
const [zoom, setZoomState] = useState(initialZoom);
|
|
11128
11150
|
const zoomRef = useRef(zoom);
|
|
11129
11151
|
useEffect(() => {
|
|
@@ -11212,7 +11234,11 @@ function useWheelZoom(options = {}) {
|
|
|
11212
11234
|
* Handle keyboard shortcuts
|
|
11213
11235
|
*/
|
|
11214
11236
|
const handleKeyDown = useCallback((event_0) => {
|
|
11215
|
-
|
|
11237
|
+
const inScope = isKeydownInShortcutScope(event_0, {
|
|
11238
|
+
scope: keyboardShortcuts,
|
|
11239
|
+
roots: shortcutRoots.map((root) => root.current)
|
|
11240
|
+
});
|
|
11241
|
+
if (!enabled || !inScope) return;
|
|
11216
11242
|
if (!(event_0.ctrlKey || event_0.metaKey)) return;
|
|
11217
11243
|
if (event_0.key === "0") {
|
|
11218
11244
|
event_0.preventDefault();
|
|
@@ -11231,7 +11257,8 @@ function useWheelZoom(options = {}) {
|
|
|
11231
11257
|
}
|
|
11232
11258
|
}, [
|
|
11233
11259
|
enabled,
|
|
11234
|
-
|
|
11260
|
+
keyboardShortcuts,
|
|
11261
|
+
shortcutRoots,
|
|
11235
11262
|
zoomIn,
|
|
11236
11263
|
zoomOut,
|
|
11237
11264
|
zoomTo100
|
|
@@ -11249,14 +11276,14 @@ function useWheelZoom(options = {}) {
|
|
|
11249
11276
|
handleWheel
|
|
11250
11277
|
]);
|
|
11251
11278
|
useEffect(() => {
|
|
11252
|
-
if (!enabled ||
|
|
11279
|
+
if (!enabled || keyboardShortcuts === "none") return;
|
|
11253
11280
|
document.addEventListener("keydown", handleKeyDown);
|
|
11254
11281
|
return () => {
|
|
11255
11282
|
document.removeEventListener("keydown", handleKeyDown);
|
|
11256
11283
|
};
|
|
11257
11284
|
}, [
|
|
11258
11285
|
enabled,
|
|
11259
|
-
|
|
11286
|
+
keyboardShortcuts,
|
|
11260
11287
|
handleKeyDown
|
|
11261
11288
|
]);
|
|
11262
11289
|
const currentZoom = getCurrentZoom ? getCurrentZoom() : zoom;
|
|
@@ -12652,7 +12679,7 @@ function useFolioComments({ doc, autoOpenReviewSidebar, anchorPositions, editorC
|
|
|
12652
12679
|
* - Error boundary
|
|
12653
12680
|
* - Loading states
|
|
12654
12681
|
*/
|
|
12655
|
-
const CommentsSidebar = lazy(() => import("./CommentsSidebar-
|
|
12682
|
+
const CommentsSidebar = lazy(() => import("./CommentsSidebar-DtoKrEhl.js").then((m) => ({ default: m.CommentsSidebar })));
|
|
12656
12683
|
const TextContextMenu = lazy(() => import("./TextContextMenu-Ci7-M4oU.js").then((m) => ({ default: m.TextContextMenu })));
|
|
12657
12684
|
const loadAttemptSelectiveSave = async () => {
|
|
12658
12685
|
const { attemptSelectiveSave } = await import("@stll/folio-core/docx/selectiveSave");
|
|
@@ -12714,7 +12741,7 @@ function areActiveTrackedChangesEqual(a, b) {
|
|
|
12714
12741
|
/**
|
|
12715
12742
|
* DocxEditor - Complete DOCX editor component
|
|
12716
12743
|
*/
|
|
12717
|
-
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, showMarginGuides = false, marginGuideColor, showRuler: showRulerProp = false, rulerUnit = "inch", initialZoom = 1, enableWheelZoom = true, 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, featureFlags, onSelectiveSaveTripwire }, ref) {
|
|
12744
|
+
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, featureFlags, onSelectiveSaveTripwire }, ref) {
|
|
12718
12745
|
const t = useTranslations("folio");
|
|
12719
12746
|
useEffect(() => {
|
|
12720
12747
|
const onClipboardReadError = () => {
|
|
@@ -12906,6 +12933,7 @@ const DocxEditor = forwardRef(function DocxEditor({ documentBuffer, password, do
|
|
|
12906
12933
|
const pagedEditorRef = useRef(null);
|
|
12907
12934
|
const hfEditorRef = useRef(null);
|
|
12908
12935
|
const containerRef = useRef(null);
|
|
12936
|
+
const shortcutRoots = useMemo(() => [containerRef], []);
|
|
12909
12937
|
const lastSelectionRef = useRef(null);
|
|
12910
12938
|
const imageInputRef = useRef(null);
|
|
12911
12939
|
const editorContentRef = useRef(null);
|
|
@@ -12958,7 +12986,7 @@ const DocxEditor = forwardRef(function DocxEditor({ documentBuffer, password, do
|
|
|
12958
12986
|
enabled: enableWheelZoom,
|
|
12959
12987
|
getCurrentZoom: () => zoomRef.current,
|
|
12960
12988
|
onZoomChange: setZoomWithViewportAnchor,
|
|
12961
|
-
|
|
12989
|
+
keyboardShortcuts: "none"
|
|
12962
12990
|
});
|
|
12963
12991
|
const [bodyHistoryAvailability, setBodyHistoryAvailability] = useState({
|
|
12964
12992
|
canRedo: false,
|
|
@@ -13464,7 +13492,9 @@ const DocxEditor = forwardRef(function DocxEditor({ documentBuffer, password, do
|
|
|
13464
13492
|
pagedEditorRef,
|
|
13465
13493
|
findReplace,
|
|
13466
13494
|
tableSelection,
|
|
13467
|
-
onDirectPrint: handleDirectPrint
|
|
13495
|
+
onDirectPrint: handleDirectPrint,
|
|
13496
|
+
scope: keyboardShortcuts,
|
|
13497
|
+
roots: shortcutRoots
|
|
13468
13498
|
});
|
|
13469
13499
|
const handleApplyFootnoteProperties = useCallback((footnotePr, endnotePr) => {
|
|
13470
13500
|
if (!history.state?.package) return;
|
|
@@ -14249,6 +14279,12 @@ const DocxEditor = forwardRef(function DocxEditor({ documentBuffer, password, do
|
|
|
14249
14279
|
scrollToParaId: (paraId, options_1) => pagedEditorRef.current?.scrollToParaId(paraId, options_1) ?? false,
|
|
14250
14280
|
openPrintPreview: handleDirectPrint,
|
|
14251
14281
|
print: handleDirectPrint,
|
|
14282
|
+
openFind: () => {
|
|
14283
|
+
findReplace.openFind(readFindSelectionSeed());
|
|
14284
|
+
},
|
|
14285
|
+
openReplace: () => {
|
|
14286
|
+
findReplace.openReplace(readFindSelectionSeed());
|
|
14287
|
+
},
|
|
14252
14288
|
loadDocument: (document_0) => {
|
|
14253
14289
|
const editor_2 = pagedEditorRef.current?.getEditor();
|
|
14254
14290
|
if (editor_2) {
|
|
@@ -14629,6 +14665,8 @@ const DocxEditor = forwardRef(function DocxEditor({ documentBuffer, password, do
|
|
|
14629
14665
|
setZoomWithViewportAnchor,
|
|
14630
14666
|
zoomRef,
|
|
14631
14667
|
handleDirectPrint,
|
|
14668
|
+
findReplace.openFind,
|
|
14669
|
+
findReplace.openReplace,
|
|
14632
14670
|
loadParsedDocument,
|
|
14633
14671
|
loadBuffer,
|
|
14634
14672
|
updateComments,
|
|
@@ -15380,6 +15418,7 @@ const DocxEditor = forwardRef(function DocxEditor({ documentBuffer, password, do
|
|
|
15380
15418
|
onBodyClick: handleBodyClick,
|
|
15381
15419
|
onActiveNoteStoryChange: handleActiveNoteStoryChange,
|
|
15382
15420
|
zoom,
|
|
15421
|
+
...pageRenderer === void 0 ? {} : { pageRenderer },
|
|
15383
15422
|
showMarginGuides,
|
|
15384
15423
|
...marginGuideColor !== void 0 ? { marginGuideColor } : {},
|
|
15385
15424
|
readOnly,
|
|
@@ -5,6 +5,8 @@ import { XmlFragment } from "yjs";
|
|
|
5
5
|
import { FolioAIEditApplyMode, FolioAIEditApplyResult, FolioAIEditOperation, FolioAIEditSnapshot, FolioCommentAnchor, FolioDocumentNavigationTarget, FolioReviewChange } from "@stll/folio-core/ai-edits";
|
|
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
|
+
import { PageRendererName } from "@stll/folio-core/display-list/editor/pageRenderer";
|
|
9
|
+
import { KeyboardShortcutScope } from "@stll/folio-core/managers/editorShortcuts";
|
|
8
10
|
import { FolioEditor } from "@stll/folio-core/controller/folioEditor";
|
|
9
11
|
import { DocxCompatibility } from "@stll/folio-core/docx/compatibility";
|
|
10
12
|
import { FolioSelectiveSaveFlags } from "@stll/folio-core/docx/selectiveSaveFlags";
|
|
@@ -684,6 +686,17 @@ type DocxEditorProps = {
|
|
|
684
686
|
* header/footer.
|
|
685
687
|
*/
|
|
686
688
|
showHeaderFooterEditing?: boolean;
|
|
689
|
+
/**
|
|
690
|
+
* Which renderer paints the pages (default: `"legacy"`).
|
|
691
|
+
*
|
|
692
|
+
* `"display-list"` builds folio's painter-neutral paint IR from the layout
|
|
693
|
+
* and paints the pages from it, so the editor and a document export draw
|
|
694
|
+
* from one structure rather than from two painters that have to agree. It
|
|
695
|
+
* places every code point at the advance the layout engine measured, which
|
|
696
|
+
* costs substantially more DOM per page; measure before turning it on for a
|
|
697
|
+
* long document.
|
|
698
|
+
*/
|
|
699
|
+
pageRenderer?: PageRendererName;
|
|
687
700
|
/** Whether to show page margin guides/boundaries (default: false) */
|
|
688
701
|
showMarginGuides?: boolean;
|
|
689
702
|
/** Color for margin guides (default: '#c0c0c0') */
|
|
@@ -704,6 +717,22 @@ type DocxEditorProps = {
|
|
|
704
717
|
initialZoom?: number | "fit-width";
|
|
705
718
|
/** Whether Ctrl/Cmd+wheel and trackpad-pinch zoom are enabled (default: true) */
|
|
706
719
|
enableWheelZoom?: boolean;
|
|
720
|
+
/**
|
|
721
|
+
* Which key presses the editor's page-level shortcuts answer: find and
|
|
722
|
+
* replace (Cmd/Ctrl+F, Cmd/Ctrl+H), print (Cmd/Ctrl+P) and deleting the
|
|
723
|
+
* selected table (Delete/Backspace). Editing keymaps inside the document
|
|
724
|
+
* body are unaffected, and so are the zoom keys, which the editor leaves to
|
|
725
|
+
* the browser (`useWheelZoom` takes the same scope for a host that binds
|
|
726
|
+
* them itself).
|
|
727
|
+
* - `"document"`: every press on the page. Default; for a page whose only
|
|
728
|
+
* surface is the editor.
|
|
729
|
+
* - `"editor"`: only a press whose target is inside this editor (its root
|
|
730
|
+
* element, which contains the find/replace dialog), so a host that docks
|
|
731
|
+
* the editor beside other panes keeps its own bindings elsewhere.
|
|
732
|
+
* - `"none"`: no page-level listener. The host dispatches shortcuts itself
|
|
733
|
+
* and opens the dialog through `DocxEditorRef.openFind` / `openReplace`.
|
|
734
|
+
*/
|
|
735
|
+
keyboardShortcuts?: KeyboardShortcutScope;
|
|
707
736
|
/** Whether the editor is read-only. When true, hides toolbar and rulers */
|
|
708
737
|
readOnly?: boolean;
|
|
709
738
|
/** Whether comments/tracked changes should auto-open the review sidebar (default: true) */
|
|
@@ -925,6 +954,10 @@ type DocxEditorRef = {
|
|
|
925
954
|
openPrintPreview: () => void;
|
|
926
955
|
/** Print the document directly */
|
|
927
956
|
print: () => void;
|
|
957
|
+
/** Open the find dialog, seeded with the current text selection when there is one. */
|
|
958
|
+
openFind: () => void;
|
|
959
|
+
/** Open the replace dialog, seeded with the current text selection when there is one. */
|
|
960
|
+
openReplace: () => void;
|
|
928
961
|
/** Load a pre-parsed document programmatically */
|
|
929
962
|
loadDocument: (doc: Document) => void;
|
|
930
963
|
/** Load a DOCX buffer programmatically (ArrayBuffer, Uint8Array, Blob, or File) */
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stll/folio-react",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.17.1",
|
|
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",
|
|
@@ -68,7 +68,7 @@
|
|
|
68
68
|
"@fontsource/noto-sans-arabic": "^5.2.7",
|
|
69
69
|
"@fontsource/source-sans-3": "^5.2.9",
|
|
70
70
|
"@fontsource/tinos": "^5.2.7",
|
|
71
|
-
"@stll/folio-core": "^0.
|
|
71
|
+
"@stll/folio-core": "^0.34.0",
|
|
72
72
|
"better-result": "3.0.1",
|
|
73
73
|
"lucide-react": "1.24.0",
|
|
74
74
|
"prosemirror-history": "^1.5.0",
|