@stll/folio-react 0.12.3 → 0.13.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-mwa9JsIj.js → CommentsSidebar-ZHaLP2Kq.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-CH8S7yqU.d.ts → renderAsync-B_Bi9oSr.d.ts} +6 -2
- package/dist/{renderAsync-DFwDFNB9.js → renderAsync-DLhuA3FM.js} +36 -2
- package/package.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { d as containedHandler } from "./renderAsync-
|
|
1
|
+
import { d as containedHandler } from "./renderAsync-DLhuA3FM.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-B_Bi9oSr.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-DLhuA3FM.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-B_Bi9oSr.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-lCOx21mG.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-DLhuA3FM.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";
|
|
@@ -694,8 +694,12 @@ type DocxEditorProps = {
|
|
|
694
694
|
showRuler?: boolean;
|
|
695
695
|
/** Measurement unit shown on the rulers (default: 'inch'). */
|
|
696
696
|
rulerUnit?: "inch" | "cm";
|
|
697
|
-
/**
|
|
698
|
-
|
|
697
|
+
/**
|
|
698
|
+
* Initial zoom level as a number (default: 1.0 = 100%), or `"fit-width"` to
|
|
699
|
+
* size the page to the editor's width and keep it fit as the editor resizes.
|
|
700
|
+
* A manual zoom (toolbar or `ref.setZoom`) afterwards overrides the fit.
|
|
701
|
+
*/
|
|
702
|
+
initialZoom?: number | "fit-width";
|
|
699
703
|
/** Whether Ctrl/Cmd+wheel and trackpad-pinch zoom are enabled (default: true) */
|
|
700
704
|
enableWheelZoom?: boolean;
|
|
701
705
|
/** Whether the editor is read-only. When true, hides toolbar and rulers */
|
|
@@ -10714,8 +10714,12 @@ function useKeyboardShortcuts({ pagedEditorRef, findReplace, tableSelection, onD
|
|
|
10714
10714
|
//#endregion
|
|
10715
10715
|
//#region src/components/hooks/useZoomAndPageInfo.ts
|
|
10716
10716
|
const PAGE_INFO_FADE_MS = 600;
|
|
10717
|
+
const FIT_TO_WIDTH_PADDING_PX = 16;
|
|
10718
|
+
const FIT_TO_WIDTH_MIN_ZOOM = .1;
|
|
10719
|
+
const FIT_TO_WIDTH_MAX_ZOOM = 1;
|
|
10717
10720
|
function useZoomAndPageInfo({ scrollContainerRef, pagedEditorRef, initialZoom }) {
|
|
10718
|
-
const
|
|
10721
|
+
const fitToWidth = initialZoom === "fit-width";
|
|
10722
|
+
const [zoom, setZoom] = useState(typeof initialZoom === "number" ? initialZoom : 1);
|
|
10719
10723
|
const zoomRef = useRef(zoom);
|
|
10720
10724
|
const pendingZoomAnchorRef = useRef(null);
|
|
10721
10725
|
const [scrollPageInfo, setScrollPageInfo] = useState({
|
|
@@ -10801,6 +10805,36 @@ function useZoomAndPageInfo({ scrollContainerRef, pagedEditorRef, initialZoom })
|
|
|
10801
10805
|
scheduleScrollPageInfoFade,
|
|
10802
10806
|
updateScrollPageInfo
|
|
10803
10807
|
]);
|
|
10808
|
+
useEffect(() => {
|
|
10809
|
+
if (!fitToWidth || !scrollContainerEl) return;
|
|
10810
|
+
let rafId = 0;
|
|
10811
|
+
const applyFit = () => {
|
|
10812
|
+
const pageWidth = pagedEditorRef.current?.getLayout()?.pages[0]?.size.w ?? 0;
|
|
10813
|
+
if (pageWidth <= 0) {
|
|
10814
|
+
rafId = requestAnimationFrame(applyFit);
|
|
10815
|
+
return;
|
|
10816
|
+
}
|
|
10817
|
+
const available = scrollContainerEl.clientWidth - FIT_TO_WIDTH_PADDING_PX;
|
|
10818
|
+
if (available <= 0) return;
|
|
10819
|
+
const target = Math.min(FIT_TO_WIDTH_MAX_ZOOM, Math.max(FIT_TO_WIDTH_MIN_ZOOM, Math.round(available / pageWidth * 100) / 100));
|
|
10820
|
+
if (Math.abs(target - zoomRef.current) > .005) setZoomWithViewportAnchor(target);
|
|
10821
|
+
};
|
|
10822
|
+
const observer = new ResizeObserver(() => {
|
|
10823
|
+
cancelAnimationFrame(rafId);
|
|
10824
|
+
rafId = requestAnimationFrame(applyFit);
|
|
10825
|
+
});
|
|
10826
|
+
observer.observe(scrollContainerEl);
|
|
10827
|
+
applyFit();
|
|
10828
|
+
return () => {
|
|
10829
|
+
cancelAnimationFrame(rafId);
|
|
10830
|
+
observer.disconnect();
|
|
10831
|
+
};
|
|
10832
|
+
}, [
|
|
10833
|
+
fitToWidth,
|
|
10834
|
+
scrollContainerEl,
|
|
10835
|
+
pagedEditorRef,
|
|
10836
|
+
setZoomWithViewportAnchor
|
|
10837
|
+
]);
|
|
10804
10838
|
return {
|
|
10805
10839
|
zoom,
|
|
10806
10840
|
zoomRef,
|
|
@@ -12400,7 +12434,7 @@ function useFolioComments({ doc, autoOpenReviewSidebar, anchorPositions, editorC
|
|
|
12400
12434
|
* - Error boundary
|
|
12401
12435
|
* - Loading states
|
|
12402
12436
|
*/
|
|
12403
|
-
const CommentsSidebar = lazy(() => import("./CommentsSidebar-
|
|
12437
|
+
const CommentsSidebar = lazy(() => import("./CommentsSidebar-ZHaLP2Kq.js").then((m) => ({ default: m.CommentsSidebar })));
|
|
12404
12438
|
const TextContextMenu = lazy(() => import("./TextContextMenu-Ci7-M4oU.js").then((m) => ({ default: m.TextContextMenu })));
|
|
12405
12439
|
const loadAttemptSelectiveSave = async () => {
|
|
12406
12440
|
const { attemptSelectiveSave } = await import("@stll/folio-core/docx/selectiveSave");
|
package/package.json
CHANGED