prosemirror-resizable-view
Advanced tools
Comparing version 0.0.0-pr2166.1 to 0.0.0-pr2166.2
@@ -0,1 +1,89 @@ | ||
import { EditorView } from 'prosemirror-view'; | ||
import { Node as Node_2 } from 'prosemirror-model'; | ||
import { NodeView } from 'prosemirror-view'; | ||
export declare const leftCornerHandle: string; | ||
declare interface OptionShape { | ||
[key: string]: any; | ||
} | ||
export declare class ResizableHandle { | ||
#private; | ||
dom: HTMLDivElement; | ||
type: ResizableHandleType; | ||
constructor(type: ResizableHandleType); | ||
createHandle(type: ResizableHandleType): void; | ||
setHandleVisibility(visible: boolean): void; | ||
dataSetDragging(isDraging: boolean): void; | ||
} | ||
export declare enum ResizableHandleType { | ||
Right = 0, | ||
Left = 1, | ||
Bottom = 2, | ||
BottomRight = 3, | ||
BottomLeft = 4 | ||
} | ||
/** | ||
* 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. | ||
*/ | ||
declare abstract class ResizableNodeView implements NodeView { | ||
#private; | ||
dom: HTMLElement; | ||
readonly aspectRatio: ResizableRatioType; | ||
constructor({ node, view, getPos, aspectRatio, options, initialSize, }: { | ||
node: Node_2; | ||
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: Node_2; | ||
view: EditorView; | ||
getPos: () => number; | ||
options?: OptionShape; | ||
}): HTMLElement; | ||
createWrapper(node: Node_2, 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: Node_2): boolean; | ||
destroy(): void; | ||
} | ||
export { ResizableNodeView } | ||
export { ResizableNodeView as ResizableNodeView_alias_1 } | ||
declare enum ResizableRatioType { | ||
Fixed = 0, | ||
Flexible = 1 | ||
} | ||
export { ResizableRatioType } | ||
export { ResizableRatioType as ResizableRatioType_alias_1 } | ||
export declare const rightCornerHandle: string; | ||
export { } |
@@ -1,1 +0,6 @@ | ||
export {}; | ||
export { leftCornerHandle } from './_tsup-dts-rollup'; | ||
export { rightCornerHandle } from './_tsup-dts-rollup'; | ||
export { ResizableRatioType } from './_tsup-dts-rollup'; | ||
export { ResizableNodeView } from './_tsup-dts-rollup'; | ||
export { ResizableHandleType } from './_tsup-dts-rollup'; | ||
export { ResizableHandle } from './_tsup-dts-rollup'; |
@@ -1,9 +0,9 @@ | ||
// packages/prosemirror-resizable-view/src/prosemirror-resizable-view.ts | ||
// src/prosemirror-resizable-view.ts | ||
import { throttle } from "@remirror/core-helpers"; | ||
import { setStyle as setStyle2 } from "@remirror/core-utils"; | ||
// packages/prosemirror-resizable-view/src/resizable-view-handle.ts | ||
// src/resizable-view-handle.ts | ||
import { setStyle } from "@remirror/core-utils"; | ||
// packages/prosemirror-resizable-view/src/corner-handle.ts | ||
// src/corner-handle.ts | ||
var leftCorner = `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 18 18" width="22" height="22" fill="rgba(0, 0, 0, 0.65)" stroke="rgba(255, 255, 255, 0.5)" transform="rotate(90)" xmlns:v="https://vecta.io/nano"><path fill-rule="evenodd" d="M14 0a2 2 0 0 0-2 2v10H2a2 2 0 1 0 0 4h12a2 2 0 0 0 2-2V2a2 2 0 0 0-2-2z"/></svg>`; | ||
@@ -14,3 +14,3 @@ var rightCorner = `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 18 18" width="22" height="22" fill="rgba(0, 0, 0, 0.65)" stroke="rgba(255, 255, 255, 0.5)" transform="matrix(0 1 1 0 0 0)" xmlns:v="https://vecta.io/nano"><path fill-rule="evenodd" d="M14 0a2 2 0 0 0-2 2v10H2a2 2 0 1 0 0 4h12a2 2 0 0 0 2-2V2a2 2 0 0 0-2-2z"/></svg>`; | ||
// packages/prosemirror-resizable-view/src/resizable-view-handle.ts | ||
// src/resizable-view-handle.ts | ||
var ResizableHandle = class { | ||
@@ -140,3 +140,3 @@ dom; | ||
// packages/prosemirror-resizable-view/src/prosemirror-resizable-view.ts | ||
// src/prosemirror-resizable-view.ts | ||
var MIN_WIDTH = 50; | ||
@@ -143,0 +143,0 @@ var ResizableRatioType = /* @__PURE__ */(ResizableRatioType2 => { |
{ | ||
"name": "prosemirror-resizable-view", | ||
"version": "0.0.0-pr2166.1", | ||
"version": "0.0.0-pr2166.2", | ||
"private": false, | ||
@@ -39,7 +39,10 @@ "description": "A ProseMirror node view that make your node resizable", | ||
"@babel/runtime": "^7.22.3", | ||
"@remirror/core-helpers": "0.0.0-pr2166.1", | ||
"@remirror/core-utils": "0.0.0-pr2166.1", | ||
"@remirror/core-helpers": "0.0.0-pr2166.2", | ||
"@remirror/core-utils": "0.0.0-pr2166.2", | ||
"prosemirror-model": "^1.19.2", | ||
"prosemirror-view": "^1.31.3" | ||
}, | ||
"devDependencies": { | ||
"@remirror/cli": "0.0.0-pr2166.2" | ||
}, | ||
"publishConfig": { | ||
@@ -50,3 +53,6 @@ "access": "public" | ||
"sizeLimit": "5 KB" | ||
}, | ||
"scripts": { | ||
"build": "remirror-cli build" | ||
} | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
94965
1349
1
+ Added@remirror/core-constants@0.0.0-pr2166.2(transitive)
+ Added@remirror/core-helpers@0.0.0-pr2166.2(transitive)
+ Added@remirror/core-types@0.0.0-pr2166.2(transitive)
+ Added@remirror/core-utils@0.0.0-pr2166.2(transitive)
+ Added@remirror/messages@0.0.0-pr2166.2(transitive)
+ Added@remirror/pm@0.0.0-pr2166.2(transitive)
+ Added@remirror/types@0.0.0-pr2166.2(transitive)
+ Addedprosemirror-paste-rules@0.0.0-pr2166.2(transitive)
+ Addedprosemirror-suggest@0.0.0-pr2166.2(transitive)
+ Addedprosemirror-trailing-node@0.0.0-pr2166.2(transitive)
- Removed@remirror/core-constants@0.0.0-pr2166.1(transitive)
- Removed@remirror/core-helpers@0.0.0-pr2166.1(transitive)
- Removed@remirror/core-types@0.0.0-pr2166.1(transitive)
- Removed@remirror/core-utils@0.0.0-pr2166.1(transitive)
- Removed@remirror/messages@0.0.0-pr2166.1(transitive)
- Removed@remirror/pm@0.0.0-pr2166.1(transitive)
- Removed@remirror/types@0.0.0-pr2166.1(transitive)
- Removedprosemirror-paste-rules@0.0.0-pr2166.1(transitive)
- Removedprosemirror-suggest@0.0.0-pr2166.1(transitive)
- Removedprosemirror-trailing-node@0.0.0-pr2166.1(transitive)