import { Editor, Location, MaximizeMode, Node, NodeEntry, NodeMatch, Path, Point, Range } from 'slate-vue3/core'; import { CustomElement, HeadingElement } from './types'; export declare function isParagraph(n: unknown): n is CustomElement; export declare function isNormalBlock(n: unknown): boolean; export declare function isHeading(n: unknown): n is HeadingElement; export declare function isBlockElement(editor: Editor, n: unknown): n is CustomElement; export declare function getPointingOptions(editor: Editor, type: CustomElement['type']): { at?: Location; match?: NodeMatch; mode?: MaximizeMode; }; export declare function isPointingAt(editor: Editor, type: CustomElement['type']): boolean; export declare function toggleBlockAttr(editor: Editor, key: string, value: string): void; /** * 判断光标是否指向某个块元素的最后 * @param editor 编辑器实例对象 * @param type 元素类型 * @param callback 可选的回调,在满足条件时调用,并接收此元素和其路径 * @returns */ export declare function isPointAtEndOfElement(editor: Editor, type: CustomElement['type'], callback?: (match: NodeEntry) => void): boolean; /** * 判断两范围是否相等 * * 不像 Range.equals 需要anchor和focus的位置相同;此函数在anchor和focus相反时也能返回真。 * * */ export declare function isRangeEqual(r1: Range, r2: Range): boolean; /** * 判断某个 point 是否在指定块元素的首行 */ export declare function isPointAtFirstLine(editor: Editor, elementPath: Path, point: Point): boolean; /** * 判断某个 point 是否在指定块元素的尾行 */ export declare function isPointAtLastLine(editor: Editor, elementPath: Path, point: Point): boolean; /** * 接收 range,返回排序后的 range */ export declare function getSortedRange(range: Range): Range; export declare enum RangePosition { BEFORE = 2340, BEFORE_BEGIN = 2324, INTERSECT_BEGIN = 2316, AFTER_BEGIN = 1292, CONTAIN = 780, BEFORE_END = 778, INTERSECT_END = 777, AFTER_END = 649, AFTER = 585, COVER = 1290, COVER_BEGIN = 2314, COVER_END = 1289, COVER_BOTH = 2313, BEGIN = 1300, END = 650 } /** * 获取目标相较于当前范围的位置 */ export declare function getRangePosition(range: Range, target: Range): RangePosition; /** * 获取上一个同级节点,找不到则返回 undefined */ export declare function getPreviousSibling(editor: Editor, path: Path, options?: { quit?: (node: Node, path: Path) => boolean; match?: NodeMatch; }): NodeEntry | undefined; /** * 获取下一个同级节点,找不到则返回 undefined */ export declare function getNextSibling(editor: Editor, path: Path, options?: { quit?: (node: Node, path: Path) => boolean; match?: (node: Node, path: Path) => boolean; }): NodeEntry | undefined; export declare function isEdgesEqual(edges: [Point, Point], another: [Point, Point]): boolean;