refactor: improve portal provider logic

This commit is contained in:
thecodrr
2022-06-22 13:50:08 +05:00
parent 89f5ed0464
commit 0c669a5aea
27 changed files with 128 additions and 245 deletions

View File

@@ -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();
};
}