diff options
| author | Stephen Blott | 2014-11-23 16:55:10 +0000 |
|---|---|---|
| committer | Stephen Blott | 2014-11-23 16:55:10 +0000 |
| commit | 5c5fb4c3a9c365e3b2de02d1a2a55d056abb320b (patch) | |
| tree | 9eedd5814331e79d6b84b4e46557bb6b0227440f /content_scripts | |
| parent | 4de8e668be6ff09637fbaa5e2eff2825e13f1fd6 (diff) | |
| parent | fe55f0688664e38b0e299c371a90dfe80ef8d3f7 (diff) | |
| download | vimium-5c5fb4c3a9c365e3b2de02d1a2a55d056abb320b.tar.bz2 | |
Merge branch 'contentEditable-fix' of github.com:smblott-github/vimium
Diffstat (limited to 'content_scripts')
| -rw-r--r-- | content_scripts/vimium_frontend.coffee | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/content_scripts/vimium_frontend.coffee b/content_scripts/vimium_frontend.coffee index 0c88be84..d5586bd8 100644 --- a/content_scripts/vimium_frontend.coffee +++ b/content_scripts/vimium_frontend.coffee @@ -534,6 +534,7 @@ isEmbed = (element) -> ["embed", "object"].indexOf(element.nodeName.toLowerCase( # any element which makes it a rich text editor, like the notes on jjot.com. # isEditable = (target) -> + # Note: document.activeElement.isContentEditable is also rechecked in isInsertMode() dynamically. return true if target.isContentEditable nodeName = target.nodeName.toLowerCase() # use a blacklist instead of a whitelist because new form controls are still being implemented for html5 @@ -557,6 +558,7 @@ window.enterInsertMode = (target) -> # when the last editable element that came into focus -- which insertModeLock points to -- has been blurred. # If insert mode is entered manually (via pressing 'i'), then we set insertModeLock to 'undefined', and only # leave insert mode when the user presses <ESC>. +# Note. This returns the truthiness of target, which is required by isInsertMode. # enterInsertModeWithoutShowingIndicator = (target) -> insertModeLock = target @@ -565,7 +567,13 @@ exitInsertMode = (target) -> insertModeLock = null HUD.hide() -isInsertMode = -> insertModeLock != null +isInsertMode = -> + return true if insertModeLock != null + # Some sites (e.g. inbox.google.com) change the contentEditable attribute on the fly (see #1245); and + # unfortunately, isEditable() is called *before* the change is made. Therefore, we need to re-check whether + # the active element is contentEditable. + document.activeElement and document.activeElement.isContentEditable and + enterInsertModeWithoutShowingIndicator document.activeElement # should be called whenever rawQuery is modified. updateFindModeQuery = -> |
