UNPKG

@churchapps/apphelper-markdown

Version:

ChurchApps markdown/lexical editor components

58 lines (57 loc) 2.2 kB
import { LexicalNode, LexicalCommand, NodeKey } from "lexical"; import { LinkNode } from "@lexical/link"; export interface LinkCustomizationAttributes { url: string; target?: string; classNames?: Array<string>; } export declare class CustomLinkNode extends LinkNode { __url: string; __target: string; __classNames: Array<string>; constructor(url: string, target: string, classNames: Array<string>, key?: NodeKey); static importJSON(serializedNode: any): CustomLinkNode; exportJSON(): { type: string; url: string; target: string; classNames: string[]; version: number; title?: null | string; $?: Record<string, unknown>; children: import("lexical").SerializedLexicalNode[]; direction: "ltr" | "rtl" | null; format: import("lexical").ElementFormatType; indent: number; textFormat?: number; textStyle?: string; rel?: null | string; } | { type: string; url: string; target: string; classNames: string[]; version: number; title?: null | string; $?: Record<string, unknown>; children: import("lexical").SerializedLexicalNode[]; direction: "ltr" | "rtl" | null; format: import("lexical").ElementFormatType; indent: number; textFormat?: number; textStyle?: string; rel?: null | string; isUnlinked: boolean; }; static getType(): string; static clone(node: CustomLinkNode): CustomLinkNode; createDOM(): HTMLAnchorElement; updateDOM(): boolean; setClassNames(classNames: Array<string>): void; } export declare const TOGGLE_CUSTOM_LINK_NODE_COMMAND: LexicalCommand<LinkCustomizationAttributes>; export declare function $createCustomLinkNode(url: string, target: string, classNames: Array<string>): CustomLinkNode; export declare function $isCustomLinkNode(node: LexicalNode | null | undefined | any): node is CustomLinkNode; export declare const toggleCustomLinkNode: ({ url, target, classNames, getNodeByKey }: LinkCustomizationAttributes & { getNodeByKey: (key: NodeKey) => HTMLElement | null; }) => void;