prosemirror-resizable-view
package prosemirror-resizable-view
class ResizableNodeView
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.
Signature:
export declare abstract class ResizableNodeView implements NodeView
Implements: NodeView
ResizableNodeView.(constructor)
Constructs a new instance of the ResizableNodeView
class
Signature:
constructor({ node, view, getPos, aspectRatio, options, initialSize, }: {
node: ProsemirrorNode;
view: EditorView;
getPos: () => number;
aspectRatio?: ResizableRatioType;
options?: OptionShape;
initialSize?: {
width: number;
height: number;
};
});
Parameters:
Parameter | Type | Description |
---|---|---|
{ node, view, getPos, aspectRatio, options, initialSize, } | { node: ProsemirrorNode; view: EditorView; getPos: () => number; aspectRatio?: ResizableRatioType; options?: OptionShape; initialSize?: { width: number; height: number; }; } |
property aspectRatio
Signature:
readonly aspectRatio: ResizableRatioType;
property dom
Signature:
dom: HTMLElement;
method createElement
createElement
- a method to produce the element DOM element for this prosemirror node. The subclasses have to implement this abstract method.
Signature:
abstract createElement(props: {
node: ProsemirrorNode;
view: EditorView;
getPos: () => number;
options?: OptionShape;
}): HTMLElement;
Parameters:
Parameter | Type | Description |
---|---|---|
props | { node: ProsemirrorNode; view: EditorView; getPos: () => number; options?: OptionShape; } |
Returns:
HTMLElement
method createWrapper
Signature:
createWrapper(node: ProsemirrorNode, initialSize?: {
width: number;
height: number;
}): HTMLElement;
Parameters:
Parameter | Type | Description |
---|---|---|
node | ProsemirrorNode | |
initialSize | { width: number; height: number; } | (Optional) |
Returns:
HTMLElement
method destroy
Signature:
destroy(): void;
Returns:
void
method startResizing
Signature:
startResizing(e: MouseEvent, view: EditorView, getPos: () => number, handle: ResizableHandle): void;
Parameters:
Parameter | Type | Description |
---|---|---|
e | MouseEvent | |
view | EditorView | |
getPos | () => number | |
handle | ResizableHandle |
Returns:
void
method update
update
will be called by Prosemirror, when the view is updating itself.
Signature:
update(node: ProsemirrorNode): boolean;
Parameters:
Parameter | Type | Description |
---|---|---|
node | ProsemirrorNode |
Returns:
boolean
enum ResizableRatioType
Signature:
export declare enum ResizableRatioType
Enumeration Members:
Member | Value | Description |
---|---|---|
Fixed | 0 | |
Flexible | 1 |