File tree Expand file tree Collapse file tree 2 files changed +12
-17
lines changed
app/src/app/pages/Sandbox/Editor/Content/Tabs Expand file tree Collapse file tree 2 files changed +12
-17
lines changed Original file line number Diff line number Diff line change @@ -15,13 +15,6 @@ import {
1515} from './elements' ;
1616
1717class EditorTabs extends React . Component {
18- componentWillMount ( ) {
19- window . addEventListener ( 'keydown' , this . closeListener ) ;
20- }
21- componentWillUnmount ( ) {
22- window . removeEventListener ( 'keydown' , this . closeListener ) ;
23- }
24-
2518 componentDidUpdate ( prevProps ) {
2619 if ( this . props . currentModuleId !== prevProps . currentModuleId ) {
2720 // We need to scroll to the tab
@@ -42,16 +35,6 @@ class EditorTabs extends React.Component {
4235 }
4336 }
4437
45- closeListener = e => {
46- if ( ( e . ctrlKey || e . metaKey ) && e . keyCode === 87 ) {
47- e . preventDefault ( ) ;
48- const currentPos = this . props . tabs
49- . filter ( x => x )
50- . findIndex ( t => t . moduleId === this . props . currentModuleId ) ;
51- this . closeTab ( currentPos ) ;
52- }
53- } ;
54-
5538 closeTab = tabIndex => {
5639 this . props . signals . editor . tabClosed ( { tabIndex } ) ;
5740 } ;
Original file line number Diff line number Diff line change @@ -53,6 +53,18 @@ export const KEYBINDINGS = {
5353 signal : 'workspace.toggleCurrentWorkspaceItem' ,
5454 } ,
5555
56+ 'editor.close-tab' : {
57+ title : 'Close Current Tab' ,
58+ type : 'View' ,
59+ bindings : [ [ 'Control' , 'W' ] ] ,
60+ signal : 'editor.tabClosed' ,
61+ payload : state => ( {
62+ tabIndex : state . editor . tabs
63+ . filter ( x => x )
64+ . findIndex ( t => t . moduleId === state . currentModuleId ) ,
65+ } ) ,
66+ } ,
67+
5668 'editor.zen-mode' : {
5769 title : 'Toggle Zen Mode' ,
5870 type : 'View' ,
You can’t perform that action at this time.
0 commit comments