@selfcommunity/react-ui
Version:
React UI Components to integrate a Community created with SelfCommunity Platform.
46 lines (45 loc) • 1.62 kB
TypeScript
import { LegacyRef } from 'react';
import { DecoratorNode, DOMExportOutput, EditorConfig, LexicalNode, NodeKey, SerializedLexicalNode, Spread } from 'lexical';
export interface ImagePayload {
altText: string;
className?: string;
height?: 'inherit' | number;
imageRef?: LegacyRef<HTMLImageElement>;
maxWidth: number | string;
src: string;
width?: 'inherit' | number;
}
declare function convertImageElement(domNode: any): {
node: ImageNode;
};
export type SerializedImageNode = Spread<{
altText: string;
maxWidth: number | string;
src: string;
type: 'image';
version: 1;
}, SerializedLexicalNode>;
export declare class ImageNode extends DecoratorNode<JSX.Element> {
__src: string;
__altText: string;
__maxWidth: number | string;
static getType(): string;
static clone(node: ImageNode): ImageNode;
constructor(src: string, altText: string, maxWidth: number | string, key?: NodeKey);
setWidthAndHeight(width: 'inherit' | number, height: 'inherit' | number): void;
createDOM(config: EditorConfig): HTMLElement;
updateDOM(): false;
static importDOM(): {
img: (node: any) => {
conversion: typeof convertImageElement;
priority: number;
};
};
exportDOM(): DOMExportOutput;
decorate(): JSX.Element;
static importJSON(serializedNode: SerializedImageNode): ImageNode;
exportJSON(): SerializedImageNode;
}
export declare function $createImageNode({ src, altText, maxWidth }: ImagePayload): ImageNode;
export declare function $isImageNode(node?: LexicalNode): boolean;
export {};