File tree Expand file tree Collapse file tree 3 files changed +3
-16
lines changed
src/browser/extension/background Expand file tree Collapse file tree 3 files changed +3
-16
lines changed Original file line number Diff line number Diff line change @@ -7,8 +7,6 @@ const menus = [
77 { id : 'devtools-panel' , title : 'Open in a chrome panel (enable in Chrome settings)' } ,
88 { id : 'devtools-remote' , title : 'Open Remote DevTools' }
99] ;
10- let pageUrl ;
11- let pageTab ;
1210
1311let shortcuts = { } ;
1412chrome . commands . getAll ( commands => {
@@ -17,24 +15,12 @@ chrome.commands.getAll(commands => {
1715 } ) ;
1816} ) ;
1917
20- export default function createMenu ( forUrl , tabId ) {
21- if ( typeof tabId !== 'number' ) return ; // It is an extension's background page
22- chrome . pageAction . show ( tabId ) ;
23- if ( tabId === pageTab ) return ;
24-
25- let url = forUrl ;
26- let hash = forUrl . indexOf ( '#' ) ;
27- if ( hash !== - 1 ) url = forUrl . substr ( 0 , hash ) ;
28- if ( pageUrl === url ) return ;
29- pageUrl = url ; pageTab = tabId ;
30- chrome . contextMenus . removeAll ( ) ;
31-
18+ export default function createMenu ( ) {
3219 menus . forEach ( ( { id, title } ) => {
3320 chrome . contextMenus . create ( {
3421 id : id ,
3522 title : title + ( shortcuts [ id ] ? ' (' + shortcuts [ id ] + ')' : '' ) ,
3623 contexts : [ 'all' ] ,
37- documentUrlPatterns : [ url ] ,
3824 onclick : ( ) => { openDevToolsWindow ( id ) ; }
3925 } ) ;
4026 } ) ;
Original file line number Diff line number Diff line change 11import createDevStore from 'remotedev-app/lib/store/createDevStore' ;
22import openDevToolsWindow from './openWindow' ;
33import { toContentScript } from './messaging' ;
4+ import createMenu from './contextMenus' ;
45
56const store = createDevStore ( ( action ) => {
67 toContentScript ( action ) ;
@@ -12,3 +13,4 @@ window.store.liftedStore.instances = {};
1213chrome . commands . onCommand . addListener ( shortcut => {
1314 openDevToolsWindow ( shortcut ) ;
1415} ) ;
16+ setTimeout ( createMenu , 0 ) ;
Original file line number Diff line number Diff line change 11import { onConnect , onMessage , sendToTab } from 'crossmessaging' ;
22import updateState from 'remotedev-app/lib/store/updateState' ;
33import syncOptions from '../options/syncOptions' ;
4- import createMenu from './contextMenus' ;
54import openDevToolsWindow from './openWindow' ;
65let panelConnections = { } ;
76let tabConnections = { } ;
You can’t perform that action at this time.
0 commit comments