@stll/folio-react 0.14.0 → 0.15.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.
@@ -1,4 +1,4 @@
1
- import { d as containedHandler } from "./renderAsync-jai-gbWC.js";
1
+ import { d as containedHandler } from "./renderAsync-nQ5eeFE1.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-ssuGUIDc.js";
1
+ import { c as DocxEditorRef, i as renderAsync, n as EditorHandle, r as RenderAsyncOptions, s as DocxEditorProps, t as DocxEditorHandle } from "../renderAsync-DD_yAlp1.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-jai-gbWC.js";
1
+ import { n as DocxEditor$1, t as renderAsync } from "../renderAsync-nQ5eeFE1.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-ssuGUIDc.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-DD_yAlp1.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-jai-gbWC.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-nQ5eeFE1.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";
@@ -611,15 +611,6 @@ type DocxEditorProps = {
611
611
  password?: string | undefined;
612
612
  /** Pre-parsed document (alternative to documentBuffer) */
613
613
  document?: Document | null;
614
- /**
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.
621
- */
622
- documentKey?: string;
623
614
  /** Callback when document is saved */
624
615
  onSave?: (buffer: ArrayBuffer) => void;
625
616
  /** Author name used for comments and track changes */
@@ -1192,14 +1192,14 @@ const HIDDEN_HOST_STYLES = {
1192
1192
  * HiddenProseMirror - Off-screen ProseMirror editor for keyboard input
1193
1193
  */
1194
1194
  const HiddenProseMirror = forwardRef((props, ref) => {
1195
- const { document, documentKey, styles, theme: _theme, widthPx = 612, readOnly = false, onTransaction, onSelectionChange, externalPlugins = EMPTY_EXTERNAL_PLUGINS, collaboration, extensionManager, onEditorViewReady, onEditorViewDestroy, onKeyDown, onCopy, onCut, onPaste, onReadOnlyEditAttempt, onRemoteSelectionsChange, precomputedInitialState } = props;
1195
+ const { document, documentIdentity, styles, theme: _theme, widthPx = 612, readOnly = false, onTransaction, onSelectionChange, externalPlugins = EMPTY_EXTERNAL_PLUGINS, collaboration, extensionManager, onEditorViewReady, onEditorViewDestroy, onKeyDown, onCopy, onCut, onPaste, onReadOnlyEditAttempt, onRemoteSelectionsChange, precomputedInitialState } = props;
1196
1196
  const [collaborationModules, setCollaborationModules] = useState(null);
1197
1197
  const [collaborationModulesError, setCollaborationModulesError] = useState(null);
1198
1198
  const hasCollaboration = collaboration !== void 0;
1199
1199
  const hostRef = useRef(null);
1200
1200
  const readOnlyRef = useRef(readOnly);
1201
1201
  const documentRef = useRef(document);
1202
- const documentKeyRef = useRef(documentKey);
1202
+ const documentIdentityRef = useRef(documentIdentity);
1203
1203
  const stylesRef = useRef(styles);
1204
1204
  const extensionManagerRef = useRef(extensionManager);
1205
1205
  const externalPluginsRef = useRef(externalPlugins);
@@ -1234,7 +1234,7 @@ const HiddenProseMirror = forwardRef((props, ref) => {
1234
1234
  collaborationRef.current = collaboration;
1235
1235
  collaborationModulesRef.current = collaborationModules;
1236
1236
  documentRef.current = document;
1237
- documentKeyRef.current = documentKey;
1237
+ documentIdentityRef.current = documentIdentity;
1238
1238
  const managerRef = useRef(null);
1239
1239
  if (managerRef.current === null) managerRef.current = createHiddenEditorManager({
1240
1240
  getHost: () => hostRef.current,
@@ -1246,7 +1246,7 @@ const HiddenProseMirror = forwardRef((props, ref) => {
1246
1246
  getCollaborationModules: () => collaborationModulesRef.current,
1247
1247
  getPrecomputedInitialState: () => precomputedInitialStateRef.current,
1248
1248
  getReadOnly: () => readOnlyRef.current,
1249
- getDocumentKey: () => documentKeyRef.current,
1249
+ getDocumentIdentity: () => documentIdentityRef.current,
1250
1250
  getDocumentContext: () => documentRef.current,
1251
1251
  onTransaction: (transaction, newState) => onTransactionRef.current?.(transaction, newState),
1252
1252
  onSelectionChange: (state) => onSelectionChangeRef.current?.(state),
@@ -1311,7 +1311,7 @@ const HiddenProseMirror = forwardRef((props, ref) => {
1311
1311
  managerRef.current?.syncExternalDocument();
1312
1312
  }, [
1313
1313
  document,
1314
- documentKey,
1314
+ documentIdentity,
1315
1315
  styles,
1316
1316
  extensionManager,
1317
1317
  externalPlugins,
@@ -3113,7 +3113,7 @@ function buildFootnoteRenderItems(pageFootnoteMap, footnoteContentMap, doc) {
3113
3113
  * PagedEditor - Main paginated editing component.
3114
3114
  */
3115
3115
  const PagedEditor = forwardRef(function PagedEditor(props, ref) {
3116
- const { document, documentKey, 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;
3116
+ const { document, 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;
3117
3117
  const getScrollContainer = useCallback(() => {
3118
3118
  if (scrollContainerRefProp && typeof scrollContainerRefProp === "object") return scrollContainerRefProp.current;
3119
3119
  return containerRef.current;
@@ -6012,7 +6012,7 @@ const PagedEditor = forwardRef(function PagedEditor(props, ref) {
6012
6012
  /* @__PURE__ */ jsx(HiddenProseMirror, {
6013
6013
  ref: hiddenPMRef,
6014
6014
  document,
6015
- ...documentKey !== void 0 ? { documentKey } : {},
6015
+ documentIdentity,
6016
6016
  widthPx: contentWidth,
6017
6017
  precomputedInitialState: validPrecomputedInitialState,
6018
6018
  readOnly,
@@ -10149,7 +10149,7 @@ const useDocumentLoader = (t0) => {
10149
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
+ const [loadedDocumentIdentity, setLoadedDocumentIdentity] = useState("0");
10153
10153
  let t1;
10154
10154
  if ($[0] !== history || $[1] !== onCompatibilityChange || $[2] !== onError || $[3] !== onReset || $[4] !== setDocumentLoadState) {
10155
10155
  t1 = () => {
@@ -12598,7 +12598,7 @@ function useFolioComments({ doc, autoOpenReviewSidebar, anchorPositions, editorC
12598
12598
  * - Error boundary
12599
12599
  * - Loading states
12600
12600
  */
12601
- const CommentsSidebar = lazy(() => import("./CommentsSidebar-tKYg7bKy.js").then((m) => ({ default: m.CommentsSidebar })));
12601
+ const CommentsSidebar = lazy(() => import("./CommentsSidebar-DhAbtuuQ.js").then((m) => ({ default: m.CommentsSidebar })));
12602
12602
  const TextContextMenu = lazy(() => import("./TextContextMenu-Ci7-M4oU.js").then((m) => ({ default: m.TextContextMenu })));
12603
12603
  const loadAttemptSelectiveSave = async () => {
12604
12604
  const { attemptSelectiveSave } = await import("@stll/folio-core/docx/selectiveSave");
@@ -15272,7 +15272,7 @@ const DocxEditor = forwardRef(function DocxEditor({ documentBuffer, password, do
15272
15272
  /* @__PURE__ */ jsx(PagedEditor, {
15273
15273
  ref: pagedEditorRef,
15274
15274
  document: history.state,
15275
- ...loadedDocumentIdentity !== void 0 ? { documentKey: loadedDocumentIdentity } : {},
15275
+ documentIdentity: loadedDocumentIdentity,
15276
15276
  ...fonts !== void 0 ? { fonts } : {},
15277
15277
  theme: history.state.package.theme || theme || null,
15278
15278
  sectionProperties: effectiveSectionProperties ?? null,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stll/folio-react",
3
- "version": "0.14.0",
3
+ "version": "0.15.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.19.0",
71
+ "@stll/folio-core": "^0.21.0",
72
72
  "better-result": "2.10.0",
73
73
  "lucide-react": "1.24.0",
74
74
  "prosemirror-history": "^1.5.0",