import { Editor, Node, Operation, Path } from 'slate'; import type { CardAfterNode, CardBeforeNode } from '../../el'; type CardSlotElement = CardBeforeNode | CardAfterNode; export declare const isCardSlotElement: (node: Node | null | undefined) => node is CardSlotElement; /** 删 card 后若文档为空,补一个空段落,避免后续 selection 拿到无效 path */ export declare const ensureNonEmptyEditor: (editor: Editor) => void; export declare const safeParentPath: (path: Path) => Path | null; export declare const safeGetNode: (editor: Editor, path: Path | null) => Node | null; export declare const getCardSlotParent: (editor: Editor, leafPath: Path) => { parentPath: Path; parentNode: Node; } | null; export declare const getSelectedMediaPath: (editor: Editor) => Path | null; /** Media children are Slate selection anchors, not editable caption text. */ export declare const getSelectedMediaBlockPath: (editor: Editor) => Path | null; /** Delete one media, retaining the rest of its card and a visible caret. */ export declare const deleteMediaAtPath: (editor: Editor, mediaPath: Path) => boolean; export declare const deleteSelectedMedia: (editor: Editor) => boolean; /** * 若给定 path 是 card-after 的内部 text 节点路径([card, 2, 0]), * 返回它所属的 card 的 path 与节点;否则返回 null。 */ export declare const findCardForCardAfterInner: (editor: Editor, innerPath: Path) => { cardPath: Path; cardAfterPath: Path; } | null; export declare const redirectCardAfterText: (editor: Editor, innerPath: Path, text: string) => boolean; export declare const redirectCardAfterFragment: (editor: Editor, innerPath: Path, fragment: Node[]) => boolean; export declare const redirectCardAfterNode: (editor: Editor, innerPath: Path, node: Node) => boolean; export declare const collectCardPathsForTextOperation: (editor: Editor, textPath: Path) => Path[]; export declare const pruneEmptyCardsAtPaths: (editor: Editor, cardPaths: Path[]) => void; /** * remove_node / insert_node 仍由 Operation 管线触发,保留在 apply 层。 */ export declare const handleCardRemoveNodeOperation: (editor: Editor, operation: Operation & { type: 'remove_node'; }, apply: (op: Operation) => void) => boolean; export declare const handleCardInsertNodeOperation: (editor: Editor, operation: Operation & { type: 'insert_node'; }) => boolean; export declare const tryHandleCardInsertText: (editor: Editor, text: string, insertText: (value: string) => void) => boolean; export declare const tryHandleCardInsertFragment: (editor: Editor, fragment: Node[], insertFragment: (value: Node[]) => void) => boolean; export declare const handleCardDeleteBackward: (editor: Editor, unit: Parameters[0], deleteBackward: Editor['deleteBackward']) => boolean; export {};