Skip to content

Commit 67d8a22

Browse files
committed
Add an option to blur flash embeds as part of exiting insert mode.
Disabled by default.
1 parent 61bf492 commit 67d8a22

File tree

4 files changed

+19
-1
lines changed

4 files changed

+19
-1
lines changed

background_scripts/settings.coffee

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ root.Settings = Settings =
6666
linkHintNumbers: "0123456789"
6767
filterLinkHints: false
6868
hideHud: false
69+
enableBlurEmbeds: false
6970
userDefinedLinkHintCss:
7071
"""
7172
div > .vimiumHintMarker {

content_scripts/vimium_frontend.coffee

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ settings =
4949
loadedValues: 0
5050
valuesToLoad: ["scrollStepSize", "linkHintCharacters", "linkHintNumbers", "filterLinkHints", "hideHud",
5151
"previousPatterns", "nextPatterns", "findModeRawQuery", "regexFindMode", "userDefinedLinkHintCss",
52-
"helpDialog_showAdvancedCommands"]
52+
"helpDialog_showAdvancedCommands", "enableBlurEmbeds"]
5353
isLoaded: false
5454
eventListeners: {}
5555

@@ -398,6 +398,8 @@ onKeydown = (event) ->
398398
keyChar = "<" + keyChar + ">"
399399

400400
if (isInsertMode() && KeyboardUtils.isEscape(event))
401+
# Blurring out of embeds could be dangerous, do nothing unless the user explicitly enables it.
402+
return if isEmbed(event.srcElement) and not settings.get "enableBlurEmbeds"
401403
if isEditable(event.srcElement) or isEmbed(event.srcElement)
402404
# Remove focus so the user can't just get himself back into insert mode by typing in the same input
403405
# box.

pages/options.coffee

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,7 @@ document.addEventListener "DOMContentLoaded", ->
181181
linkHintNumbers: NonEmptyTextOption
182182
nextPatterns: NonEmptyTextOption
183183
previousPatterns: NonEmptyTextOption
184+
enableBlurEmbeds: CheckBoxOption
184185
regexFindMode: CheckBoxOption
185186
scrollStepSize: NumberOption
186187
searchEngines: TextOption

pages/options.html

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -327,6 +327,20 @@
327327
</label>
328328
</td>
329329
</tr>
330+
<tr>
331+
<td class="caption"></td>
332+
<td verticalAlign="top" class="booleanOption">
333+
<div class="help">
334+
<div class="example">
335+
This is an experimental option, and could break embeds (eg. some flash games) that expect to handle the escape key.
336+
</div>
337+
</div>
338+
<label>
339+
<input id="enableBlurEmbeds" type="checkbox"/>
340+
Enable blurring embed elements to exit insert mode.
341+
</label>
342+
</td>
343+
</tr>
330344
<tr>
331345
<td class="caption"></td>
332346
<td verticalAlign="top" class="booleanOption">

0 commit comments

Comments
 (0)