Skip to content

Commit

Permalink
term: remove redundant events of inputHelper and redundant contentEdi…
Browse files Browse the repository at this point in the history
…table

We do not need to listen for keydown and keypress for inputHelper because these events will propagate through the parent.
Listening them will be redundant and will cause some shortcut key combinations to stop working.

Since we now have a hidden `textarea`, there is no longer need to set anything to contentEditable
  • Loading branch information
PeterCxy committed Jun 3, 2018
1 parent 5b9cc25 commit 5bbe456
Show file tree
Hide file tree
Showing 6 changed files with 3 additions and 23 deletions.
6 changes: 0 additions & 6 deletions butterfly/static/ext.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion butterfly/static/ext.min.js

Large diffs are not rendered by default.

2 changes: 0 additions & 2 deletions butterfly/static/main.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions butterfly/static/main.min.js

Large diffs are not rendered by default.

8 changes: 0 additions & 8 deletions coffees/ext/popup.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -9,21 +9,13 @@ class Popup
@el.innerHTML = html
@el.classList.remove 'hidden'

# ff glorious hack
if typeof InstallTrigger isnt "undefined"
document.body.contentEditable = 'false'

addEventListener 'click', @bound_click_maybe_close
addEventListener 'keydown', @bound_key_maybe_close

close: ->
removeEventListener 'click', @bound_click_maybe_close
removeEventListener 'keydown', @bound_key_maybe_close

# ff glorious hack
if typeof InstallTrigger isnt "undefined"
document.body.contentEditable = 'true'

@el.classList.add 'hidden'
@el.innerHTML = ''

Expand Down
4 changes: 0 additions & 4 deletions coffees/term.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -119,10 +119,6 @@ class Terminal
@compositionUpdate.bind(@)
@inputHelper.addEventListener 'compositionend',
@compositionEnd.bind(@)
@inputHelper.addEventListener 'keydown',
@keyDown.bind(@)
@inputHelper.addEventListener 'keypress',
@keyPress.bind(@)
addEventListener 'keydown', @keyDown.bind(@)
addEventListener 'keypress', @keyPress.bind(@)
# Always focus on the inputHelper textarea
Expand Down

0 comments on commit 5bbe456

Please sign in to comment.