): CardNode | {
text: string;
};
/**
* 标准化URL,添加协议前缀
*/
private static normalizeUrl;
/**
* 解析URL参数
*/
private static parseUrlParams;
/**
* 检查是否为图片类型
*/
private static isImageType;
/**
* 创建图片节点
*/
private static createImageNode;
/**
* 创建通用媒体节点
*/
private static createGenericMediaNode;
/**
* 用卡片节点包装内容节点
*
* @param node - 单个节点或节点数组(数组场景用于反序列化 `` 块)
* @param props - 额外属性
* @returns 包装后的卡片节点
*/
static wrapperCardNode(node: any | any[], props?: Record): CardNode;
}
export declare const getDefaultView: (value: any) => Window | null;
export declare const isDOMNode: (value: any) => value is DOMNode;
export declare const isEventHandled: >(event: EventType, handler?: ((event: EventType) => void) | undefined) => boolean;
export declare const hasTarget: (editor: ReactEditor, target: EventTarget | null) => target is DOMNode;
export declare const isTargetInsideVoid: (editor: ReactEditor, target: EventTarget | null) => boolean;
/**
* 基于 anchorNode 和 focusNode 创建新的 DOM Selection 对象
*
* @param anchorNode - 选区起始节点
* @param anchorOffset - 起始节点中的偏移量
* @param focusNode - 选区结束节点
* @param focusOffset - 结束节点中的偏移量
* @returns 新创建的 Selection 对象,如果创建失败则返回 null
*/
export declare function createSelectionFromNodes(anchorNode: Node | null, anchorOffset: number, focusNode: Node | null, focusOffset: number): Selection | null;
/**
* 基于 anchorNode 和 focusNode 创建 DOM Range 对象
*
* @param anchorNode - 选区起始节点
* @param anchorOffset - 起始节点中的偏移量
* @param focusNode - 选区结束节点
* @param focusOffset - 结束节点中的偏移量
* @returns 新创建的 DOM Range 对象,如果创建失败则返回 null
*/
export declare function createDomRangeFromNodes(anchorNode: Node | null, anchorOffset: number, focusNode: Node | null, focusOffset: number): globalThis.Range | null;
/**
* 从 DOM Selection 对象中提取并转换为 Slate Range
*
* @param editor - React 编辑器实例
* @param domSelection - DOM Selection 对象
* @returns 转换后的 Slate Range 对象,如果转换失败则返回 null
*/
export declare function getSelectionFromDomSelection(editor: ReactEditor, domSelection: Selection): Range | null;
/**
* 检查目标是否为可编辑的 DOM 节点。
*
* @param editor - React 编辑器实例。
* @param target - 事件目标,可能为 null。
* @returns 如果目标是可编辑的 DOM 节点,则返回 true。
*/
export declare const hasEditableTarget: (editor: ReactEditor, target: EventTarget | null) => target is DOMNode;
export declare function getPointStrOffset(editor: Editor, point: Point): number;
export declare function getRelativePath(path: string | any[], anther: string | any[]): any[];
export declare function calcPath(path: string | any[], anther: string | any[]): any[];
export declare function isPath(path: string | any[]): boolean;
export declare function findLeafPath(editor: Editor, path: Path): Path;
/**
* 转义正则表达式特殊字符
*
* @param string - 需要转义的字符串
* @returns 转义后的字符串
* @private
*/
export { escapeRegExp, normalizeMarkdownSearchText, } from './markdownSearchText';
/**
* 在编辑器中按路径和文本搜索内容,支持 Markdown 文本的智能处理
*
* @param editor - 编辑器实例
* @param pathDescription - 搜索范围的路径描述
* @param searchText - 搜索文本,支持 Markdown 语法
* @param options - 搜索选项
* @param options.caseSensitive - 是否区分大小写,默认 false
* @param options.wholeWord - 是否全词匹配,默认 false
* @param options.maxResults - 最大结果数量,默认 2
* @param options.includeMarkdownVariants - 是否包含 Markdown 语法的清理变体,默认 true
* @returns 搜索结果数组,包含路径、范围、节点、链接信息等
*
* @description
* 该函数支持以下功能:
* - 自动清理 Markdown 语法(链接、粗体、斜体、代码等)
* - 生成多个搜索变体以提高匹配率
* - 避免重复匹配同一位置的文本
* - 记录匹配的搜索变体信息
* - 支持识别链接(a 标签):返回结果包含 isLink 和 linkUrl 字段
*
* @example
* // 搜索包含 Markdown 语法的文本
* const results = findByPathAndText(editor, [0], "**粗体文本**");
* // 将同时匹配 "**粗体文本**" 和 "粗体文本"
*
* @example
* // 搜索链接文本
* const results = findByPathAndText(editor, [0], "点击这里");
* // 如果匹配到的是链接,results[0].isLink === true 且 results[0].linkUrl 包含 URL
*/
export declare function findByPathAndText(editor: Editor, pathDescription: Path, searchText: string, options?: {
caseSensitive?: boolean;
wholeWord?: boolean;
maxResults?: number;
includeMarkdownVariants?: boolean;
}): {
path: Path;
range: {
anchor: {
path: Path;
offset: number;
};
focus: {
path: Path;
offset: number;
};
};
node: any;
matchedText: string;
offset: {
start: number;
end: number;
};
lineContent: string;
nodeType: string | undefined;
searchVariant: string | undefined;
isLink: boolean | undefined;
linkUrl: string | undefined;
}[] | {
path: Path;
range: Range;
node: Node;
matchedText: string;
offset: {
start: number;
end: number;
};
lineContent: string;
nodeType?: string | undefined;
searchVariant?: string | undefined;
isLink?: boolean | undefined;
linkUrl?: string | undefined;
}[];