import { Node as ProsemirrorNode } from 'prosemirror-model'; import { EditorView, NodeView } from 'prosemirror-view'; import { ResizableHandle } from './resizable-view-handle'; export declare enum ResizableRatioType { Fixed = 0, Flexible = 1 } interface OptionShape { [key: string]: any; } /** * ResizableNodeView serves as a base NodeView for resizable element, * and cannot be directly instantiated. * With this base NodeView, you can resize the DOM element by dragging the handle over the image. * * @param node - the node which uses this nodeView. Must have `width` and `height` in the attrs. * @param view - the editor view used by this nodeView. * @param getPos - a utility method to get the absolute cursor position of the node. * @param aspectRatio? - to determine which type of aspect ratio should be used. * @param options? - extra options to pass to `createElement` method. * @param initialSize? - initial view size. */ export declare abstract class ResizableNodeView implements NodeView { #private; dom: HTMLElement; readonly aspectRatio: ResizableRatioType; constructor({ node, view, getPos, aspectRatio, options, initialSize, }: { node: ProsemirrorNode; view: EditorView; getPos: () => number; aspectRatio?: ResizableRatioType; options?: OptionShape; initialSize?: { width: number; height: number; }; }); /** * `createElement` - a method to produce the element DOM element for this prosemirror node. * The subclasses have to implement this abstract method. */ abstract createElement(props: { node: ProsemirrorNode; view: EditorView; getPos: () => number; options?: OptionShape; }): HTMLElement; createWrapper(node: ProsemirrorNode, initialSize?: { width: number; height: number; }): HTMLElement; startResizing(e: MouseEvent, view: EditorView, getPos: () => number, handle: ResizableHandle): void; /** * `update` will be called by Prosemirror, when the view is updating itself. */ update(node: ProsemirrorNode): boolean; destroy(): void; } export {};