File tree Expand file tree Collapse file tree 2 files changed +12
-4
lines changed Expand file tree Collapse file tree 2 files changed +12
-4
lines changed Original file line number Diff line number Diff line change @@ -40,6 +40,17 @@ export const Item = ({
40
40
const [ isDragging , setIsDragging ] = React . useState ( false ) ;
41
41
const [ isDragOver , setIsDragOver ] = React . useState ( false ) ;
42
42
const [ mouseDownPos , setMouseDownPos ] = React . useState < { x : number ; y : number } | null > ( null ) ;
43
+ const itemRef = React . useRef < HTMLDivElement > ( null ) ;
44
+
45
+ // Scroll into view when selected
46
+ React . useEffect ( ( ) => {
47
+ if ( selected && itemRef . current ) {
48
+ itemRef . current . scrollIntoView ( {
49
+ behavior : 'smooth' ,
50
+ block : 'nearest' ,
51
+ } ) ;
52
+ }
53
+ } , [ selected ] ) ;
43
54
44
55
const handleCopy = React . useCallback ( ( ) => {
45
56
onCopy ( path ) ;
@@ -182,6 +193,7 @@ export const Item = ({
182
193
183
194
return (
184
195
< Card
196
+ ref = { itemRef }
185
197
className = { b ( {
186
198
selected,
187
199
dragging : isDragging ,
Original file line number Diff line number Diff line change @@ -23,7 +23,6 @@ export const useSelectedBlockBorders = (
23
23
24
24
// Update blockBorders when selectedBlock changes
25
25
React . useEffect ( ( ) => {
26
- console . log ( 321 , selectedBlock ) ;
27
26
if ( ! selectedBlock ) {
28
27
setBlockBorders ( null ) ;
29
28
} else {
@@ -47,8 +46,5 @@ export const useSelectedBlockBorders = (
47
46
}
48
47
} , [ blockBorders , canvasElement ] ) ;
49
48
50
- React . useEffect ( ( ) => {
51
- console . log ( 'blockBorders' ) ;
52
- } , [ blockBorders ] ) ;
53
49
return blockBorders ;
54
50
} ;
You can’t perform that action at this time.
0 commit comments