diff options
| author | Stephen Blott | 2015-01-26 11:30:21 +0000 |
|---|---|---|
| committer | Stephen Blott | 2015-01-26 11:32:18 +0000 |
| commit | d57b08232513b285360b220dbb4de91bc6b61765 (patch) | |
| tree | 7cd5ee0f8dd50de6811fa7321b573ab6dc0327c7 /content_scripts/mode_insert.coffee | |
| parent | f644d622ffd7b8ce332d4c2470cd52772abadb2a (diff) | |
| download | vimium-d57b08232513b285360b220dbb4de91bc6b61765.tar.bz2 | |
Visual/edit modes: fix problem resuming insert mode.
Diffstat (limited to 'content_scripts/mode_insert.coffee')
| -rw-r--r-- | content_scripts/mode_insert.coffee | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/content_scripts/mode_insert.coffee b/content_scripts/mode_insert.coffee index bee2ce58..79043be9 100644 --- a/content_scripts/mode_insert.coffee +++ b/content_scripts/mode_insert.coffee @@ -13,7 +13,7 @@ class InsertMode extends Mode return @stopBubblingAndTrue unless event.type == 'keydown' and KeyboardUtils.isEscape event DomUtils.suppressKeyupAfterEscape handlerStack target = event.srcElement - if target and DomUtils.isFocusable(target) and @options.blurOnEscape + if target and DomUtils.isFocusable target # Remove the focus, so the user can't just get back into insert mode by typing in the same input box. # NOTE(smblott, 2014/12/22) Including embeds for .blur() etc. here is experimental. It appears to be # the right thing to do for most common use cases. However, it could also cripple flash-based sites and @@ -27,12 +27,14 @@ class InsertMode extends Mode keypress: handleKeyEvent keyup: handleKeyEvent keydown: handleKeyEvent - blurOnEscape: true super extend defaults, options @insertModeLock = - if document.activeElement and DomUtils.isEditable document.activeElement + if options.targetElement and DomUtils.isEditable options.targetElement + # The caller has told us which element to activate on. + options.targetElement + else if document.activeElement and DomUtils.isEditable document.activeElement # An input element is already active, so use it. document.activeElement else @@ -69,7 +71,6 @@ class InsertMode extends Mode Mode.updateBadge() exit: (_, target) -> - # Note: target == undefined, here, is required only for tests. if (target and target == @insertModeLock) or @global or target == undefined @log "#{@id}: deactivating (permanent)" if @debug and @permanent and @insertModeLock @insertModeLock = null |
