diff options
| author | Stephen Blott | 2015-01-22 16:50:58 +0000 |
|---|---|---|
| committer | Stephen Blott | 2015-01-23 09:53:49 +0000 |
| commit | 256beee031efef70f4ee750044d9e697d66868bd (patch) | |
| tree | 851b8aa8abdb3b5875d5caa52166d83f13ca89b8 /content_scripts/mode_insert.coffee | |
| parent | eefe8c29b2410119412984301eba8c66dffda059 (diff) | |
| download | vimium-256beee031efef70f4ee750044d9e697d66868bd.tar.bz2 | |
Visual/edit modes: develop edit mode.
- implement "i", "a".
- fix "w" for edit mode.
- try out "e" for enter edit mode.
- initial implementation "o", "O"
- Suppress backspace and delete.
- Scroll in text areas.
Diffstat (limited to 'content_scripts/mode_insert.coffee')
| -rw-r--r-- | content_scripts/mode_insert.coffee | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/content_scripts/mode_insert.coffee b/content_scripts/mode_insert.coffee index eac4a3d0..818c8408 100644 --- a/content_scripts/mode_insert.coffee +++ b/content_scripts/mode_insert.coffee @@ -10,10 +10,11 @@ class InsertMode extends Mode handleKeyEvent = (event) => return @continueBubbling unless @isActive event + console.log "key", String.fromCharCode(event.charCode) if event.type == 'keypress' return @stopBubblingAndTrue unless event.type == 'keydown' and KeyboardUtils.isEscape event DomUtils.suppressKeyupAfterEscape handlerStack target = event.srcElement - if target and DomUtils.isFocusable target + if target and DomUtils.isFocusable(target) and @options.blurOnEscape # 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,6 +28,7 @@ class InsertMode extends Mode keypress: handleKeyEvent keyup: handleKeyEvent keydown: handleKeyEvent + blurOnEscape: true super extend defaults, options @@ -38,6 +40,7 @@ class InsertMode extends Mode 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 @@ -74,6 +77,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. |
