diff options
| author | Stephen Blott | 2015-02-09 11:40:53 +0000 | 
|---|---|---|
| committer | Stephen Blott | 2015-02-09 11:40:53 +0000 | 
| commit | 0bf605a934115083e700f5de090f39841417482a (patch) | |
| tree | 408c191bd702da6847bca9943f6eba93ad28b209 /content_scripts/mode_insert.coffee | |
| parent | ac648a0e9f53c2fc359daa68309c25dd8c9db031 (diff) | |
| parent | ed306994697f6f9f5e13f9d018b5c7ffa2fff680 (diff) | |
| download | vimium-0bf605a934115083e700f5de090f39841417482a.tar.bz2 | |
Merge branch 'visual-and-edit-modes'
Conflicts:
	background_scripts/main.coffee
	content_scripts/vimium_frontend.coffee
	lib/keyboard_utils.coffee
Diffstat (limited to 'content_scripts/mode_insert.coffee')
| -rw-r--r-- | content_scripts/mode_insert.coffee | 11 | 
1 files changed, 8 insertions, 3 deletions
diff --git a/content_scripts/mode_insert.coffee b/content_scripts/mode_insert.coffee index 6932f419..90162d5a 100644 --- a/content_scripts/mode_insert.coffee +++ b/content_scripts/mode_insert.coffee @@ -31,19 +31,24 @@ class InsertMode extends Mode      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          null      @push +      _name: "mode-#{@id}-focus"        "blur": (event) => @alwaysContinueBubbling =>          target = event.target          # We can't rely on focus and blur events arriving in the expected order.  When the active element          # changes, we might get "focus" before "blur".  We track the active element in @insertModeLock, and          # exit only when that element blurs. -        @exit event, target if @insertModeLock and target == @insertModeLock +        # We don't exit if we're running under edit mode.  Edit mode itself will handles that case. +        @exit event, target if @insertModeLock and target == @insertModeLock and not @options.parentMode        "focus": (event) => @alwaysContinueBubbling =>          if @insertModeLock != event.target and DomUtils.isFocusable event.target            @activateOnElement event.target @@ -66,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 @@ -74,6 +78,7 @@ class InsertMode extends Mode        if @permanent then Mode.updateBadge() else super()    updateBadge: (badge) -> +    badge.badge ||= @badge if @badge      badge.badge ||= "I" if @isActive badge    # Static stuff. This allows PostFindMode to suppress the permanently-installed InsertMode instance.  | 
