@@ -10,6 +10,7 @@ export const BlockPositioner = (props: {
1010 event : Event ,
1111 reason : OpenChangeReason ,
1212 ) => void ;
13+ canDismissViaOutsidePress ?: boolean ;
1314} ) => {
1415 const element = props . blockID
1516 ? document . querySelector ( `[data-id="${ props . blockID } "]` )
@@ -21,28 +22,20 @@ export const BlockPositioner = (props: {
2122 return element
2223 ? {
2324 getBoundingClientRect : ( ) => {
24- // console.log(
25- // "getBoundingClientRect",
26- // element.getBoundingClientRect()
27- // );
2825 return element . getBoundingClientRect ( ) ;
2926 } ,
3027 contextElement : element ,
3128 }
3229 : null ;
3330 } , [ element ] ) ;
3431
35- const { isMounted, ref, style, getFloatingProps } = useUIElementPositioning (
36- element ? true : false ,
37- reference ,
38- 3000 ,
39- {
32+ const { isMounted, ref, style, getFloatingProps, isPositioned } =
33+ useUIElementPositioning ( element ? true : false , reference , 3000 , {
4034 canDismiss : {
4135 enabled : true ,
4236 escapeKey : true ,
43- outsidePress : false ,
37+ outsidePress : props . canDismissViaOutsidePress ,
4438 } ,
45- // canDismiss: false,
4639 placement : "bottom" ,
4740 middleware : [
4841 offset ( 10 ) ,
@@ -62,8 +55,7 @@ export const BlockPositioner = (props: {
6255 } ) ;
6356 return cleanup ;
6457 } ,
65- } ,
66- ) ;
58+ } ) ;
6759
6860 if ( ! isMounted ) {
6961 return null ;
@@ -77,7 +69,7 @@ export const BlockPositioner = (props: {
7769 } }
7870 { ...getFloatingProps ( ) }
7971 >
80- { props . children }
72+ { isPositioned && props . children }
8173 </ div >
8274 ) ;
8375} ;
0 commit comments