mirror of
https://github.com/pulsar-edit/pulsar.git
synced 2024-11-10 10:17:11 +03:00
Merge pull request #7770 from atom/ns-only-forward-menu-action-on-osx
Handle native chromium undo, redo, cut, copy, paste, selectAll on all platforms
This commit is contained in:
commit
4091fa9e78
@ -114,23 +114,23 @@ class WindowEventHandler
|
||||
|
||||
@handleNativeKeybindings()
|
||||
|
||||
# Wire commands that should be handled by the native menu
|
||||
# for elements with the `.native-key-bindings` class.
|
||||
# Wire commands that should be handled by Chromium for elements with the
|
||||
# `.native-key-bindings` class.
|
||||
handleNativeKeybindings: ->
|
||||
menu = null
|
||||
bindCommandToAction = (command, action) =>
|
||||
@subscribe $(document), command, (event) ->
|
||||
if event.target.webkitMatchesSelector('.native-key-bindings')
|
||||
menu ?= require('remote').require('menu')
|
||||
menu.sendActionToFirstResponder(action)
|
||||
webContents = require('remote').getCurrentWindow().webContents
|
||||
webContents[action]()
|
||||
true
|
||||
|
||||
bindCommandToAction('core:copy', 'copy:')
|
||||
bindCommandToAction('core:paste', 'paste:')
|
||||
bindCommandToAction('core:undo', 'undo:')
|
||||
bindCommandToAction('core:redo', 'redo:')
|
||||
bindCommandToAction('core:select-all', 'selectAll:')
|
||||
bindCommandToAction('core:cut', 'cut:')
|
||||
bindCommandToAction('core:copy', 'copy')
|
||||
bindCommandToAction('core:paste', 'paste')
|
||||
bindCommandToAction('core:undo', 'undo')
|
||||
bindCommandToAction('core:redo', 'redo')
|
||||
bindCommandToAction('core:select-all', 'selectAll')
|
||||
bindCommandToAction('core:cut', 'cut')
|
||||
|
||||
onKeydown: (event) ->
|
||||
atom.keymaps.handleKeyboardEvent(event)
|
||||
|
Loading…
Reference in New Issue
Block a user