import { Editor, Node, Path } from 'slate'; import type { CodeNode } from '../../el'; export declare const isCodeBlockElement: (node: Node | null | undefined) => node is CodeNode; /** * 块级 code 唯一正文来源为 `value`;`children` 仅保留 void 占位。 * Slate `setNodes` 不能设置 `children`,更新 value 时单独重置占位 text leaf。 */ export declare const setCodeBlockNodes: (editor: Editor, path: Path, data: Partial) => void; export declare const removeEmptyCodeBlock: (editor: Editor, path: Path) => void; export declare const insertParagraphAfterCodeBlock: (editor: Editor, path: Path) => void; export type CodeBlockAceKeyDownResult = 'handled' | 'ignored'; /** * Ace 内键盘:空块 Backspace、Mod+Enter 跳出代码块;其余键由 Ace 处理。 */ export declare const handleCodeBlockAceKeyDown: (editor: Editor, path: Path, event: KeyboardEvent, codeText: string) => CodeBlockAceKeyDownResult; /** 代码块 textarea 内 Mod+A 全选正文 */ export declare const selectAllInCodeBlockTextarea: (textarea: HTMLTextAreaElement) => void; /** * SimpleCodeBlockEditor / Ace 共用:优先处理块内快捷键,避免外层 Slate 抢走 Mod+A 等。 */ export declare const handleCodeBlockTextInputKeyDown: (editor: Editor, path: Path, event: KeyboardEvent, textarea: HTMLTextAreaElement) => CodeBlockAceKeyDownResult; /** 焦点在 Ace 输入区时,外层 Slate onKeyDown 应让路。 */ export declare const isCodeBlockAceInputTarget: (target: EventTarget | null) => boolean;