File tree Expand file tree Collapse file tree 3 files changed +15
-7
lines changed
main-layout/src/browser/drop-area Expand file tree Collapse file tree 3 files changed +15
-7
lines changed Original file line number Diff line number Diff line change @@ -1326,6 +1326,7 @@ export const localizationBundle = {
1326
1326
'main-layout.bottom-panel.toggle' : 'Toggle Bottom Side Bar' ,
1327
1327
'main-layout.bottom-panel.show' : 'Show Bottom Side Bar' ,
1328
1328
'main-layout.bottom-panel.hide' : 'Hide Bottom Side Bar' ,
1329
+ 'main-layout.drop-area.tip' : 'drop here' ,
1329
1330
1330
1331
'refactor-preview.title' : 'REFACTOR PREVIEW' ,
1331
1332
'refactor-preview.title.clear' : 'Discard Refactoring' ,
Original file line number Diff line number Diff line change @@ -924,6 +924,7 @@ export const localizationBundle = {
924
924
'main-layout.bottom-panel.toggle' : '切换底部面板' ,
925
925
'main-layout.bottom-panel.show' : '显示底部面板' ,
926
926
'main-layout.bottom-panel.hide' : '隐藏底部面板' ,
927
+ 'main-layout.drop-area.tip' : '放置此处' ,
927
928
928
929
'refactor-preview.title' : '重构预览' ,
929
930
'refactor-preview.title.clear' : '放弃重构' ,
Original file line number Diff line number Diff line change 1
1
import React from 'react' ;
2
2
3
- import { useInjectable } from '@opensumi/ide-core-browser' ;
4
- import { IMainLayoutService } from '@opensumi/ide-main-layout' ;
3
+ import { localize , useInjectable } from '@opensumi/ide-core-browser' ;
4
+
5
+ import { IMainLayoutService } from '../../common' ;
5
6
6
7
import styles from './styles.module.less' ;
7
8
@@ -13,18 +14,23 @@ const DropArea: React.FC<IDropAreaProps> = (props) => {
13
14
const { location } = props ;
14
15
const layoutService = useInjectable < IMainLayoutService > ( IMainLayoutService ) ;
15
16
17
+ const handleDrop = React . useCallback (
18
+ ( e : React . DragEvent ) => {
19
+ const containerId = e . dataTransfer ?. getData ( 'containerId' ) ;
20
+ layoutService . moveContainerTo ( containerId , location ) ;
21
+ } ,
22
+ [ layoutService , location ] ,
23
+ ) ;
24
+
16
25
return (
17
26
< div
18
27
className = { styles . drop_area }
19
- onDrop = { ( e ) => {
20
- const containerId = e . dataTransfer ?. getData ( 'containerId' ) ;
21
- layoutService . moveContainerTo ( containerId , location ) ;
22
- } }
28
+ onDrop = { handleDrop }
23
29
onDragOver = { ( e ) => {
24
30
e . preventDefault ( ) ;
25
31
} }
26
32
>
27
- drop here
33
+ { localize ( 'main-layout. drop-area.tip' ) }
28
34
</ div >
29
35
) ;
30
36
} ;
You can’t perform that action at this time.
0 commit comments