diff options
| author | Stephen Blott | 2015-02-16 11:57:29 +0000 | 
|---|---|---|
| committer | Stephen Blott | 2015-02-16 11:57:35 +0000 | 
| commit | 7cedc5d2481f61f4b0d1cbf99fbd203bb5c68b54 (patch) | |
| tree | 598510660164a875e95226fb445d44ad05ba5884 /content_scripts/mode.coffee | |
| parent | 20c952fe6c4ede0fe7c3e90dbb5c88d3f4a7380c (diff) | |
| download | vimium-7cedc5d2481f61f4b0d1cbf99fbd203bb5c68b54.tar.bz2 | |
Deactivate global insert mode on focus.
Rationale.  There are really two insert modes: the one we activate with
"i" and the one that's activated when a focusable element receives the
focus.  This makes that distinction clearer.  And, in particular, it
means that, when the latter type of insert mode is active, we *know*
that gloabl insert mode is *not* active.
Diffstat (limited to 'content_scripts/mode.coffee')
| -rw-r--r-- | content_scripts/mode.coffee | 7 | 
1 files changed, 7 insertions, 0 deletions
| diff --git a/content_scripts/mode.coffee b/content_scripts/mode.coffee index 7877d97c..fa583a1c 100644 --- a/content_scripts/mode.coffee +++ b/content_scripts/mode.coffee @@ -86,6 +86,13 @@ class Mode          _name: "mode-#{@id}/exitOnClick"          "click": (event) => @alwaysContinueBubbling => @exit event +    #If @options.exitOnFocus is truthy, then the mode will exit whenever a focusable element is activated. +    if @options.exitOnFocus +      @push +        _name: "mode-#{@id}/exitOnFocus" +        "focus": (event) => @alwaysContinueBubbling => +          @exit event if DomUtils.isFocusable event.target +      # Some modes are singletons: there may be at most one instance active at any time.  A mode is a singleton      # if @options.singleton is truthy.  The value of @options.singleton should be the key which is intended to      # be unique.  New instances deactivate existing instances with the same key. | 
