Skip to content

Commit

Permalink
feat(react): support useNodeIdProps
Browse files Browse the repository at this point in the history
  • Loading branch information
janryWang committed Jun 12, 2021
1 parent 407f91e commit 3a11f73
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 1 deletion.
2 changes: 1 addition & 1 deletion packages/core/src/effects/useDragDropEffect.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import {
DragStopEvent,
ViewportScrollEvent,
} from '../events'
import { Point, requestIdle } from '@designable/shared'
import { Point } from '@designable/shared'

export const useDragDropEffect = (engine: Engine) => {
engine.subscribeTo(DragStartEvent, (event) => {
Expand Down
1 change: 1 addition & 0 deletions packages/react/src/hooks/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,4 @@ export * from './useRegistry'
export * from './useValidNodeOffsetRect'
export * from './useViewportDragon'
export * from './useOutlineDragon'
export * from './useNodeIdProps'
10 changes: 10 additions & 0 deletions packages/react/src/hooks/useNodeIdProps.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import { useDesigner } from './useDesigner'
import { useTreeNode } from './useTreeNode'

export const useNodeIdProps = () => {
const node = useTreeNode()
const designer = useDesigner()
return {
[designer.props.nodeIdAttrName]: node.id,
}
}

0 comments on commit 3a11f73

Please sign in to comment.