File tree Expand file tree Collapse file tree 1 file changed +13
-2
lines changed Expand file tree Collapse file tree 1 file changed +13
-2
lines changed Original file line number Diff line number Diff line change 1
1
import { Drawer , DrawerSize } from '@blueprintjs/core'
2
2
3
+ import { SyntheticEvent } from 'react'
3
4
import { useSearchParams } from 'react-router-dom'
4
5
5
6
import { OperationSetViewer } from 'components/viewer/OperationSetViewer'
@@ -10,14 +11,24 @@ export function OperationDrawer() {
10
11
const operationId = + ( searchParams . get ( 'op' ) || NaN ) || undefined
11
12
const operationSetId = + ( searchParams . get ( 'opset' ) || NaN ) || undefined
12
13
13
- const closeOperation = ( ) => {
14
+ const closeOperation = ( e ?: SyntheticEvent ) => {
15
+ // 如果是通过鼠标点击外面来触发的关闭,那么只在左键点击时关闭,避免用后退键点击时关闭后又立即打开的问题
16
+ // (原因是后退键会先触发关闭,然后触发浏览器的后退操作,使页面回到上一个 URL,导致又触发打开)
17
+ if ( e ?. nativeEvent instanceof MouseEvent && e . nativeEvent . button !== 0 ) {
18
+ return
19
+ }
20
+
14
21
setSearchParams ( ( params ) => {
15
22
params . delete ( 'op' )
16
23
return params
17
24
} )
18
25
}
19
26
20
- const closeOperationSet = ( ) => {
27
+ const closeOperationSet = ( e ?: SyntheticEvent ) => {
28
+ if ( e ?. nativeEvent instanceof MouseEvent && e . nativeEvent . button !== 0 ) {
29
+ return
30
+ }
31
+
21
32
setSearchParams ( ( params ) => {
22
33
params . delete ( 'opset' )
23
34
return params
You can’t perform that action at this time.
0 commit comments