11import openDevToolsWindow from './openWindow' ;
22
33const menus = [
4- { id : 'devtools-left' , title : 'To left (Alt+Shift+Left arrow) ' } ,
5- { id : 'devtools-right' , title : 'To right (Alt+Shift+Right arrow) ' } ,
6- { id : 'devtools-bottom' , title : 'To bottom (Alt+Shift+Down arrow) ' } ,
7- { id : 'devtools-panel' , title : 'In panel (Alt+Shift+Top arrow) ' }
4+ { id : 'devtools-left' , title : 'To left' } ,
5+ { id : 'devtools-right' , title : 'To right' } ,
6+ { id : 'devtools-bottom' , title : 'To bottom' } ,
7+ { id : 'devtools-panel' , title : 'In panel' }
88] ;
9-
109let pageUrl ;
1110let pageTab ;
1211
12+ let shortcuts = { } ;
13+ chrome . commands . getAll ( commands => {
14+ commands . forEach ( ( { name, shortcut } ) => {
15+ shortcuts [ name ] = shortcut ;
16+ } ) ;
17+ } ) ;
18+
1319export default function createMenu ( forUrl , tabId ) {
1420 if ( typeof tabId !== 'number' || tabId === pageTab ) return ;
1521
@@ -23,7 +29,7 @@ export default function createMenu(forUrl, tabId) {
2329 menus . forEach ( ( { id, title } ) => {
2430 chrome . contextMenus . create ( {
2531 id : id ,
26- title : title ,
32+ title : title + ' (' + shortcuts [ id ] + ')' ,
2733 contexts : [ 'all' ] ,
2834 documentUrlPatterns : [ url ] ,
2935 onclick : ( ) => { openDevToolsWindow ( id ) ; }
0 commit comments