import { Editor } from '@tiptap/react'; import { IpfsImageUploadResponse } from '../types'; interface UseMarkdownSyncArgs { editor: Editor | null; /** Whether Split View is currently active. */ isSplitView: boolean; /** Editability to restore when leaving Split View (preview docs stay read-only). */ isPreviewMode?: boolean; /** Active tab id — re-seeds the markdown when the user switches tabs. */ activeTabId?: string; ipfsImageUploadFn?: (file: File) => Promise; /** Debounce (ms) before reparsing markdown into the doc. */ debounceMs?: number; /** * Called when the doc→markdown seed fails on entry. Without a usable seed, * any edit would replace the doc with a near-empty parse, so the caller * should surface the error and exit Split View. */ onSeedError?: () => void; } /** * Split View markdown sync — MVP (one-way: markdown → doc). * * On entering Split View we make the editor read-only and seed the markdown * text from the current doc. On every (debounced) markdown edit we reparse the * ENTIRE markdown and replace the ENTIRE doc — formatting loss is accepted. * The right-pane scroll position is saved/restored around the rebuild so the * preview doesn't jump. * * Safety rails: * - Edits are ignored until the seed has resolved (a failed/slow seed must * never let a keystroke full-replace the doc with an empty parse). * - A pending debounced edit is FLUSHED, not dropped, when the session ends * (exit / tab switch / unmount) — otherwise the last keystrokes before a * quick exit would be silently lost. */ export declare const useMarkdownSync: ({ editor, isSplitView, isPreviewMode, activeTabId, ipfsImageUploadFn, debounceMs, onSeedError, }: UseMarkdownSyncArgs) => { markdown: string; onMarkdownChange: (value: string) => void; rightScrollRef: import('react').MutableRefObject; }; export {};