@stll/folio-react 0.16.2 → 0.16.3

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.
@@ -1,4 +1,4 @@
1
- import { d as containedHandler } from "./renderAsync-DxN5E41W.js";
1
+ import { d as containedHandler } from "./renderAsync--zG_WoQH.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 { n as DocxEditor$1, t as renderAsync } from "../renderAsync-DxN5E41W.js";
1
+ import { n as DocxEditor$1, t as renderAsync } from "../renderAsync--zG_WoQH.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.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-DxN5E41W.js";
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--zG_WoQH.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";
@@ -658,6 +658,20 @@ const NoteStoryEditor = forwardRef(function NoteStoryEditor(t0, ref) {
658
658
  });
659
659
  NoteStoryEditor.displayName = "NoteStoryEditor";
660
660
  //#endregion
661
+ //#region src/paged-editor/remoteSelectionGeometry.ts
662
+ const hasSameCaretPosition = (previous, next) => {
663
+ if (previous === null || next === null) return previous === next;
664
+ return previous.height === next.height && previous.pageIndex === next.pageIndex && previous.x === next.x && previous.y === next.y;
665
+ };
666
+ const hasSameSelectionRect = (previous, next) => previous.height === next.height && previous.pageIndex === next.pageIndex && previous.width === next.width && previous.x === next.x && previous.y === next.y;
667
+ const retainRemoteSelectionGeometry = (previous, next) => {
668
+ if (previous === null || !hasSameCaretPosition(previous.caretPosition, next.caretPosition) || previous.selectionRects.length !== next.selectionRects.length) return next;
669
+ return previous.selectionRects.every((rect, index) => {
670
+ const nextRect = next.selectionRects.at(index);
671
+ return nextRect !== void 0 && hasSameSelectionRect(rect, nextRect);
672
+ }) ? previous : next;
673
+ };
674
+ //#endregion
661
675
  //#region src/utils/contained-handler.ts
662
676
  /**
663
677
  * Wrap a React event handler so it only fires when the event target
@@ -2906,10 +2920,10 @@ const RemoteSelectionOverlay = (t0) => {
2906
2920
  x: caretBase.x + offset.x,
2907
2921
  y: caretBase.y + offset.y
2908
2922
  } : null;
2909
- setGeometry({
2923
+ setGeometry((previous) => retainRemoteSelectionGeometry(previous, {
2910
2924
  caretPosition,
2911
2925
  selectionRects: nextSelectionRects
2912
- });
2926
+ }));
2913
2927
  }, () => {
2914
2928
  if (!cancelled) setGeometry(null);
2915
2929
  });
@@ -12635,7 +12649,7 @@ function useFolioComments({ doc, autoOpenReviewSidebar, anchorPositions, editorC
12635
12649
  * - Error boundary
12636
12650
  * - Loading states
12637
12651
  */
12638
- const CommentsSidebar = lazy(() => import("./CommentsSidebar-C4avAlpl.js").then((m) => ({ default: m.CommentsSidebar })));
12652
+ const CommentsSidebar = lazy(() => import("./CommentsSidebar-BcM4a3qD.js").then((m) => ({ default: m.CommentsSidebar })));
12639
12653
  const TextContextMenu = lazy(() => import("./TextContextMenu-Ci7-M4oU.js").then((m) => ({ default: m.TextContextMenu })));
12640
12654
  const loadAttemptSelectiveSave = async () => {
12641
12655
  const { attemptSelectiveSave } = await import("@stll/folio-core/docx/selectiveSave");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stll/folio-react",
3
- "version": "0.16.2",
3
+ "version": "0.16.3",
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",