feat(node-toolbar): add node-toolbar component

This commit is contained in:
Christopher Möller
2022-11-15 21:48:08 +01:00
parent fd00b18ebe
commit beba0a32de
17 changed files with 386 additions and 50 deletions
@@ -0,0 +1,15 @@
import { ReactNode } from 'react';
import { createPortal } from 'react-dom';
import { ReactFlowState, useStore } from '@reactflow/core';
function NodeToolbarPortal({ children }: { children: ReactNode }) {
const wrapperRef = useStore((state: ReactFlowState) => state.domNode?.querySelector('.react-flow__pane'));
if (!wrapperRef) {
return null;
}
return createPortal(children, wrapperRef);
}
export default NodeToolbarPortal;