Flush DOM before displaying context menu

Released under CC0
This commit is contained in:
Christopher Chedeau 2016-11-18 09:56:02 -08:00
parent f8b079551b
commit cd781b9f9d
2 changed files with 8 additions and 4 deletions

View File

@ -4,6 +4,7 @@ fs = require 'fs-plus'
{calculateSpecificity, validateSelector} = require 'clear-cut' {calculateSpecificity, validateSelector} = require 'clear-cut'
{Disposable} = require 'event-kit' {Disposable} = require 'event-kit'
{remote} = require 'electron' {remote} = require 'electron'
ipcHelpers = require './ipc-helpers'
MenuHelpers = require './menu-helpers' MenuHelpers = require './menu-helpers'
platformContextMenu = require('../package.json')?._atomMenu?['context-menu'] platformContextMenu = require('../package.json')?._atomMenu?['context-menu']
@ -200,7 +201,8 @@ class ContextMenuManager
menuTemplate = @templateForEvent(event) menuTemplate = @templateForEvent(event)
return unless menuTemplate?.length > 0 return unless menuTemplate?.length > 0
remote.getCurrentWindow().emit('context-menu', menuTemplate)
ipcHelpers.call('window-method', 'openContextMenu', menuTemplate)
return return
clear: -> clear: ->

View File

@ -101,10 +101,12 @@ class AtomWindow
hasProjectPath: -> @getLoadSettings().initialPaths?.length > 0 hasProjectPath: -> @getLoadSettings().initialPaths?.length > 0
setupContextMenu: -> setupContextMenu: ->
ContextMenu = require './context-menu'
@browserWindow.on 'context-menu', (menuTemplate) => @browserWindow.on 'context-menu', (menuTemplate) =>
new ContextMenu(menuTemplate, this) @openContextMenu(menuTemplate)
openContextMenu: (menuTemplate) ->
ContextMenu = require './context-menu'
new ContextMenu(menuTemplate, this)
containsPaths: (paths) -> containsPaths: (paths) ->
for pathToCheck in paths for pathToCheck in paths