Skip to content
This repository has been archived by the owner on Mar 3, 2023. It is now read-only.

Commit

Permalink
Merge pull request #13397 from atom/revert-13266-fb-vjeux-flush-conte…
Browse files Browse the repository at this point in the history
…xt-menu

Revert "Flush DOM before displaying context menu"
  • Loading branch information
Antonio Scandurra committed Dec 6, 2016
2 parents 847ca8f + 8e6cef4 commit 600d917
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
4 changes: 1 addition & 3 deletions src/context-menu-manager.coffee
Expand Up @@ -4,7 +4,6 @@ fs = require 'fs-plus'
{calculateSpecificity, validateSelector} = require 'clear-cut'
{Disposable} = require 'event-kit'
{remote} = require 'electron'
ipcHelpers = require './ipc-helpers'
MenuHelpers = require './menu-helpers'

platformContextMenu = require('../package.json')?._atomMenu?['context-menu']
Expand Down Expand Up @@ -201,8 +200,7 @@ class ContextMenuManager
menuTemplate = @templateForEvent(event)

return unless menuTemplate?.length > 0

ipcHelpers.call('window-method', 'openContextMenu', menuTemplate)
remote.getCurrentWindow().emit('context-menu', menuTemplate)
return

clear: ->
Expand Down
10 changes: 7 additions & 3 deletions src/main-process/atom-window.coffee
Expand Up @@ -3,7 +3,6 @@ path = require 'path'
fs = require 'fs'
url = require 'url'
{EventEmitter} = require 'events'
ContextMenu = require './context-menu'

module.exports =
class AtomWindow
Expand Down Expand Up @@ -101,8 +100,11 @@ class AtomWindow

hasProjectPath: -> @getLoadSettings().initialPaths?.length > 0

openContextMenu: (menuTemplate) ->
new ContextMenu(menuTemplate, this)
setupContextMenu: ->
ContextMenu = require './context-menu'

@browserWindow.on 'context-menu', (menuTemplate) =>
new ContextMenu(menuTemplate, this)

containsPaths: (paths) ->
for pathToCheck in paths
Expand Down Expand Up @@ -164,6 +166,8 @@ class AtomWindow
unless url is @browserWindow.webContents.getURL()
event.preventDefault()

@setupContextMenu()

if @isSpec
# Spec window's web view should always have focus
@browserWindow.on 'blur', =>
Expand Down

0 comments on commit 600d917

Please sign in to comment.