@stll/folio-react 0.13.4 → 0.14.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.
@@ -1,4 +1,4 @@
1
- import { d as containedHandler } from "./renderAsync-DWI5zwPp.js";
1
+ import { d as containedHandler } from "./renderAsync-jai-gbWC.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-B_Bi9oSr.js";
1
+ import { c as DocxEditorRef, i as renderAsync, n as EditorHandle, r as RenderAsyncOptions, s as DocxEditorProps, t as DocxEditorHandle } from "../renderAsync-ssuGUIDc.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
@@ -1,4 +1,4 @@
1
- import { n as DocxEditor$1, t as renderAsync } from "../renderAsync-DWI5zwPp.js";
1
+ import { n as DocxEditor$1, t as renderAsync } from "../renderAsync-jai-gbWC.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-B_Bi9oSr.js";
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-ssuGUIDc.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-DWI5zwPp.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-jai-gbWC.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";
@@ -10146,9 +10146,10 @@ function useContextMenu(t0) {
10146
10146
  * callbacks each render.
10147
10147
  */
10148
10148
  const useDocumentLoader = (t0) => {
10149
- const $ = c(20);
10149
+ const $ = c(21);
10150
10150
  const { documentBuffer, initialDocument, password, history, onError, onCompatibilityChange, onReset, setDocumentLoadState } = t0;
10151
10151
  const originalBufferRef = useRef(null);
10152
+ const [loadedDocumentIdentity, setLoadedDocumentIdentity] = useState(void 0);
10152
10153
  let t1;
10153
10154
  if ($[0] !== history || $[1] !== onCompatibilityChange || $[2] !== onError || $[3] !== onReset || $[4] !== setDocumentLoadState) {
10154
10155
  t1 = () => {
@@ -10157,7 +10158,8 @@ const useDocumentLoader = (t0) => {
10157
10158
  onError,
10158
10159
  onCompatibilityChange,
10159
10160
  onReset,
10160
- setDocumentLoadState
10161
+ setDocumentLoadState,
10162
+ setLoadedDocumentIdentity
10161
10163
  });
10162
10164
  return {
10163
10165
  manager: instance,
@@ -10182,7 +10184,8 @@ const useDocumentLoader = (t0) => {
10182
10184
  onError,
10183
10185
  onCompatibilityChange,
10184
10186
  onReset,
10185
- setDocumentLoadState
10187
+ setDocumentLoadState,
10188
+ setLoadedDocumentIdentity
10186
10189
  });
10187
10190
  let t3;
10188
10191
  let t4;
@@ -10237,18 +10240,20 @@ const useDocumentLoader = (t0) => {
10237
10240
  }
10238
10241
  useEffect(t5, t6);
10239
10242
  let t7;
10240
- if ($[16] !== api.loadBuffer || $[17] !== api.loadParsedDocument || $[18] !== api.resetForNewDocument) {
10243
+ if ($[16] !== api.loadBuffer || $[17] !== api.loadParsedDocument || $[18] !== api.resetForNewDocument || $[19] !== loadedDocumentIdentity) {
10241
10244
  t7 = {
10242
10245
  loadBuffer: api.loadBuffer,
10243
10246
  loadParsedDocument: api.loadParsedDocument,
10244
10247
  resetForNewDocument: api.resetForNewDocument,
10245
- originalBufferRef
10248
+ originalBufferRef,
10249
+ loadedDocumentIdentity
10246
10250
  };
10247
10251
  $[16] = api.loadBuffer;
10248
10252
  $[17] = api.loadParsedDocument;
10249
10253
  $[18] = api.resetForNewDocument;
10250
- $[19] = t7;
10251
- } else t7 = $[19];
10254
+ $[19] = loadedDocumentIdentity;
10255
+ $[20] = t7;
10256
+ } else t7 = $[20];
10252
10257
  return t7;
10253
10258
  };
10254
10259
  //#endregion
@@ -12593,7 +12598,7 @@ function useFolioComments({ doc, autoOpenReviewSidebar, anchorPositions, editorC
12593
12598
  * - Error boundary
12594
12599
  * - Loading states
12595
12600
  */
12596
- const CommentsSidebar = lazy(() => import("./CommentsSidebar-Dlm746vL.js").then((m) => ({ default: m.CommentsSidebar })));
12601
+ const CommentsSidebar = lazy(() => import("./CommentsSidebar-tKYg7bKy.js").then((m) => ({ default: m.CommentsSidebar })));
12597
12602
  const TextContextMenu = lazy(() => import("./TextContextMenu-Ci7-M4oU.js").then((m) => ({ default: m.TextContextMenu })));
12598
12603
  const loadAttemptSelectiveSave = async () => {
12599
12604
  const { attemptSelectiveSave } = await import("@stll/folio-core/docx/selectiveSave");
@@ -12655,7 +12660,7 @@ function areActiveTrackedChangesEqual(a, b) {
12655
12660
  /**
12656
12661
  * DocxEditor - Complete DOCX editor component
12657
12662
  */
12658
- const DocxEditor = forwardRef(function DocxEditor({ documentBuffer, password, document: initialDocument, documentKey, 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) {
12663
+ 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) {
12659
12664
  const t = useTranslations("folio");
12660
12665
  useEffect(() => {
12661
12666
  const onClipboardReadError = () => {
@@ -12990,7 +12995,7 @@ const DocxEditor = forwardRef(function DocxEditor({ documentBuffer, password, do
12990
12995
  focusActiveEditor,
12991
12996
  pmImageContext: state.pmImageContext
12992
12997
  });
12993
- const { loadBuffer, loadParsedDocument, originalBufferRef } = useDocumentLoader({
12998
+ const { loadBuffer, loadParsedDocument, originalBufferRef, loadedDocumentIdentity } = useDocumentLoader({
12994
12999
  documentBuffer: documentBuffer ?? null,
12995
13000
  initialDocument: initialDocument ?? null,
12996
13001
  password,
@@ -15267,7 +15272,7 @@ const DocxEditor = forwardRef(function DocxEditor({ documentBuffer, password, do
15267
15272
  /* @__PURE__ */ jsx(PagedEditor, {
15268
15273
  ref: pagedEditorRef,
15269
15274
  document: history.state,
15270
- ...documentKey !== void 0 ? { documentKey } : {},
15275
+ ...loadedDocumentIdentity !== void 0 ? { documentKey: loadedDocumentIdentity } : {},
15271
15276
  ...fonts !== void 0 ? { fonts } : {},
15272
15277
  theme: history.state.package.theme || theme || null,
15273
15278
  sectionProperties: effectiveSectionProperties ?? null,
@@ -612,10 +612,12 @@ type DocxEditorProps = {
612
612
  /** Pre-parsed document (alternative to documentBuffer) */
613
613
  document?: Document | null;
614
614
  /**
615
- * Stable identity of the loaded document (same across internal edits, distinct
616
- * per loaded file, e.g. a file/document id). Used to distinguish a genuine
617
- * external load from an edited document round-tripped back through state.
618
- * Falls back to a document-metadata signature when omitted.
615
+ * @deprecated Ignored. The editor tracks its own load sequence, so every
616
+ * `document` / `documentBuffer` load resets the hidden editor and a document
617
+ * round-tripped back through state after an internal edit never does; a
618
+ * host-supplied key cannot express that boundary (an unchanged key across a
619
+ * reload left the hidden editor on the previous document). Kept until the
620
+ * next breaking release for host and adapter-parity compatibility.
619
621
  */
620
622
  documentKey?: string;
621
623
  /** Callback when document is saved */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stll/folio-react",
3
- "version": "0.13.4",
3
+ "version": "0.14.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",
@@ -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.17.0",
71
+ "@stll/folio-core": "^0.19.0",
72
72
  "better-result": "2.10.0",
73
73
  "lucide-react": "1.24.0",
74
74
  "prosemirror-history": "^1.5.0",