/** * useContentSync - Manages editor value state, external content syncing, * and the onChange handler with history tracking. */ import { Descendant, Editor } from 'slate'; import type { AbsRange } from './useFakeHighlight'; interface ContentSyncArgs { editor: Editor; initialValue: Descendant[]; richTextContent: string; onContentChange: (html: string, immediate?: boolean) => void; updateActiveStyles: (isContentChange?: boolean) => void; updateFakeHighlightAbs: (abs: AbsRange | null) => void; fakeHighlightAbsRef: React.MutableRefObject; hasFocusRef: React.MutableRefObject; /** Authoritative editing ref, true before DOM focus. Used (not hasFocusRef) for the * tree-reset guard so a stale prop update can't reset the tree before focus lands. */ isTextEditingRef: React.MutableRefObject; lastSelectionRef: React.MutableRefObject; /** Set by useContentSave; checked to detect round-trips and skip tree resets. */ recentSavesRef?: React.MutableRefObject>; /** When true, accept the next external content change even if the editor has focus (e.g. Cmd+Z undo). */ forceNextSyncRef?: React.MutableRefObject; /** Optional post-processing step (e.g. re-apply token marks) after a forced tree reset. */ transformTreeRef?: React.MutableRefObject<((tree: Descendant[]) => Descendant[]) | null>; /** Whether an initialValue identity change by itself should replace the editor tree. * Resolved-token mode needs this; raw token editing does not. */ syncInitialValueChanges?: boolean; /** When set, requested via queueMicrotask after each content change to auto-resolve * newly typed $token$ patterns. The request may be coalesced during a paste burst. */ autoResolveTokensRef?: React.MutableRefObject<((includeValueChanges?: boolean) => void) | null>; } interface ContentSyncResult { value: Descendant[]; handleChange: (newValue: Descendant[]) => void; lastEmittedHtmlRef: React.MutableRefObject; } export declare function useContentSync({ editor, initialValue, richTextContent, onContentChange, updateActiveStyles, updateFakeHighlightAbs, fakeHighlightAbsRef, hasFocusRef, isTextEditingRef, lastSelectionRef, recentSavesRef, forceNextSyncRef, transformTreeRef, syncInitialValueChanges, autoResolveTokensRef, }: ContentSyncArgs): ContentSyncResult; export {}; //# sourceMappingURL=useContentSync.d.ts.map