diff --git a/package.json b/package.json index c339a4291..8a01220fa 100644 --- a/package.json +++ b/package.json @@ -20,13 +20,13 @@ "atomShellVersion": "0.15.1", "dependencies": { "async": "0.2.6", - "atom-keymap": "^1.0.0", + "atom-keymap": "^1.0.2", "bootstrap": "git+https://github.com/atom/bootstrap.git#6af81906189f1747fd6c93479e3d998ebe041372", "clear-cut": "0.4.0", "coffee-script": "1.7.0", "coffeestack": "0.7.0", "delegato": "^1", - "emissary": "^1.2.1", + "emissary": "^1.2.2", "first-mate": "^2.0.1", "fs-plus": "^2.2.6", "fstream": "0.1.24", @@ -89,7 +89,7 @@ "grammar-selector": "0.27.0", "image-view": "0.36.0", "incompatible-packages": "0.5.0", - "keybinding-resolver": "0.18.0", + "keybinding-resolver": "0.19.0", "link": "0.25.0", "markdown-preview": "0.95.0", "metrics": "0.33.0", diff --git a/src/editor-component.coffee b/src/editor-component.coffee index 577c9db0d..7c365af6f 100644 --- a/src/editor-component.coffee +++ b/src/editor-component.coffee @@ -524,6 +524,12 @@ EditorComponent = React.createClass @refs.input.focus() onTextInput: (event) -> + event.stopPropagation() + + # If we prevent the insertion of a space character, then the browser + # interprets the spacebar keypress as a page-down command. + event.preventDefault() unless event.data is ' ' + return unless @isInputEnabled() {editor} = @props @@ -539,9 +545,6 @@ EditorComponent = React.createClass editor.insertText(event.data) inputNode.value = event.data - # If we prevent the insertion of a space character, then the browser - # interprets the spacebar keypress as a page-down command. - event.preventDefault() unless event.data is ' ' onInputFocused: -> @setState(focused: true) diff --git a/src/window-event-handler.coffee b/src/window-event-handler.coffee index 4e29717c1..6669a185c 100644 --- a/src/window-event-handler.coffee +++ b/src/window-event-handler.coffee @@ -57,8 +57,7 @@ class WindowEventHandler @subscribeToCommand $(document), 'core:focus-previous', @focusPrevious - @subscribe $(document), 'keydown', (event) -> - atom.keymaps.handleKeyboardEvent(event.originalEvent) + document.addEventListener 'keydown', @onKeydown @subscribe $(document), 'drop', (e) -> e.preventDefault() @@ -95,6 +94,10 @@ class WindowEventHandler bindCommandToAction('core:redo', 'redo:') bindCommandToAction('core:select-all', 'selectAll:') + onKeydown: (event) -> + atom.keymaps.handleKeyboardEvent(event) + event.stopImmediatePropagation() + openLink: ({target, currentTarget}) -> location = target?.getAttribute('href') or currentTarget?.getAttribute('href') if location and location[0] isnt '#' and /^https?:\/\//.test(location)