From 71303d4804b623b5c57d4feeffb9b808fc05aaa6 Mon Sep 17 00:00:00 2001 From: Cheng Zhao Date: Wed, 16 Dec 2015 22:57:03 +0800 Subject: [PATCH] Fix context menu not working in devtools --- atom/renderer/lib/inspector.coffee | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/atom/renderer/lib/inspector.coffee b/atom/renderer/lib/inspector.coffee index d5ddfd72e486..364ccc39d42a 100644 --- a/atom/renderer/lib/inspector.coffee +++ b/atom/renderer/lib/inspector.coffee @@ -27,7 +27,9 @@ convertToMenuTemplate = (items) -> label: item.label enabled: item.enabled if item.id? - transformed.click = -> DevToolsAPI.contextMenuItemSelected item.id + transformed.click = -> + DevToolsAPI.contextMenuItemSelected item.id + DevToolsAPI.contextMenuCleared() template.push transformed template @@ -37,9 +39,7 @@ createMenu = (x, y, items, document) -> menu = Menu.buildFromTemplate convertToMenuTemplate(items) # The menu is expected to show asynchronously. - setImmediate -> - menu.popup remote.getCurrentWindow() - DevToolsAPI.contextMenuCleared() + setTimeout -> menu.popup remote.getCurrentWindow() showFileChooserDialog = (callback) -> {remote} = require 'electron'