@churchapps/apphelper-markdown
Version:
ChurchApps markdown/lexical editor components
69 lines (68 loc) • 2.48 kB
TypeScript
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 getType(): string;
static clone(node: CustomLinkNode): CustomLinkNode;
static importJSON(serializedNode: any): CustomLinkNode;
static importDOM(): {
a: (node: Node) => {
conversion: (domNode: HTMLElement) => {
node: CustomLinkNode;
};
priority: 0 | 1 | 2 | 3 | 4;
};
};
createDOM(): HTMLAnchorElement;
updateDOM(): boolean;
exportDOM(): {
element: HTMLAnchorElement;
};
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;
};
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;