mirror of
https://github.com/streetwriters/notesnook.git
synced 2025-12-20 21:49:32 +01:00
refactor: improve portal provider logic
This commit is contained in:
@@ -57,11 +57,9 @@ export class SelectionBasedNodeView<
|
||||
node: PMNode,
|
||||
editor: Editor,
|
||||
getPos: GetPosNode,
|
||||
portalProviderAPI: PortalProviderAPI,
|
||||
eventDispatcher: EventDispatcher,
|
||||
options: ReactNodeViewOptions<P>
|
||||
) {
|
||||
super(node, editor, getPos, portalProviderAPI, eventDispatcher, options);
|
||||
super(node, editor, getPos, options);
|
||||
|
||||
this.updatePos();
|
||||
|
||||
@@ -251,16 +249,9 @@ export function createSelectionBasedNodeView<
|
||||
) {
|
||||
return ({ node, getPos, editor }: NodeViewRendererProps) => {
|
||||
const _getPos = () => (typeof getPos === "boolean" ? -1 : getPos());
|
||||
return new SelectionBasedNodeView(
|
||||
node,
|
||||
editor,
|
||||
_getPos,
|
||||
editor.storage.portalProviderAPI,
|
||||
editor.storage.eventDispatcher,
|
||||
{
|
||||
...options,
|
||||
component,
|
||||
}
|
||||
).init();
|
||||
return new SelectionBasedNodeView(node, editor, _getPos, {
|
||||
...options,
|
||||
component,
|
||||
}).init();
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user