diff options
| -rw-r--r-- | background_scripts/commands.coffee | 2 | ||||
| -rw-r--r-- | content_scripts/vimium_frontend.coffee | 20 | ||||
| -rw-r--r-- | content_scripts/vomnibar.coffee | 2 | ||||
| -rw-r--r-- | pages/help_dialog.coffee | 8 | ||||
| -rw-r--r-- | pages/options.coffee | 3 | 
5 files changed, 18 insertions, 17 deletions
| diff --git a/background_scripts/commands.coffee b/background_scripts/commands.coffee index 30ea6c39..2999ebfc 100644 --- a/background_scripts/commands.coffee +++ b/background_scripts/commands.coffee @@ -295,7 +295,7 @@ defaultKeyMappings =  # If the noRepeat and repeatLimit options are both specified, then noRepeat takes precedence.  commandDescriptions =    # Navigating the current page -  showHelp: ["Show help", { noRepeat: true }] +  showHelp: ["Show help", { topFrame: true, noRepeat: true }]    scrollDown: ["Scroll down"]    scrollUp: ["Scroll up"]    scrollLeft: ["Scroll left"] diff --git a/content_scripts/vimium_frontend.coffee b/content_scripts/vimium_frontend.coffee index 9f7d9d52..f20bba7e 100644 --- a/content_scripts/vimium_frontend.coffee +++ b/content_scripts/vimium_frontend.coffee @@ -121,9 +121,8 @@ class NormalMode extends KeyHandlerMode          Are you sure you want to continue?"""      if registryEntry.topFrame -      # The Vomnibar (a top-frame command) cannot coexist with the help dialog (it causes focus issues). +      # We never return to a UI-component frame (e.g. the help dialog), it might have lost the focus.        sourceFrameId = if window.isVimiumUIComponent then 0 else frameId -      HelpDialog.toggle() if HelpDialog.isShowing()        chrome.runtime.sendMessage          handler: "sendMessageToFrames", message: {name: "runInTopFrame", sourceFrameId, registryEntry}      else if registryEntry.background @@ -625,22 +624,25 @@ enterFindMode = ->    Marks.setPreviousPosition()    new FindMode() -window.showHelp = -> -  chrome.runtime.sendMessage handler: "getHelpDialogHtml", HelpDialog.toggle.bind HelpDialog +window.showHelp = (sourceFrameId) -> +  chrome.runtime.sendMessage handler: "getHelpDialogHtml", (response) -> +    HelpDialog.toggle {sourceFrameId, html: response} -# If we are in the help dialog iframe, HelpDialog is already defined with the necessary functions. +# If we are in the help dialog iframe, then HelpDialog is already defined with the necessary functions.  window.HelpDialog ?=    helpUI: null    isShowing: -> @helpUI?.showing +  abort: -> @helpUI.hide false if @isShowing() -  toggle: (html) -> +  toggle: (request) ->      @helpUI ?= new UIComponent "pages/help_dialog.html", "vimiumHelpDialogFrame", ->      if @isShowing()        @helpUI.hide()      else -      # On the options page, we allow the help dialog to lose the focus, elsewhere we do not.  This allows -      # users to view the help dialog while typing in the key-mappings input. -      @helpUI.activate {name: "activate", html, focus: true, allowBlur: window.isVimiumOptionsPage ? false} +      # On the options page, we allow the help dialog to blur, elsewhere we do not.  This allows users to view +      # the help dialog while typing in the key-mappings input. +      @helpUI.activate extend request, +        name: "activate", focus: true, allowBlur: window.isVimiumOptionsPage ? false  initializePreDomReady()  DomUtils.documentReady initializeOnDomReady diff --git a/content_scripts/vomnibar.coffee b/content_scripts/vomnibar.coffee index 02ce97c5..66494fc2 100644 --- a/content_scripts/vomnibar.coffee +++ b/content_scripts/vomnibar.coffee @@ -59,6 +59,8 @@ Vomnibar =    open: (sourceFrameId, options) ->      @init()      if @vomnibarUI?.uiComponentIsReady +      # The Vomnibar cannot coexist with the help dialog (it causes focus issues). +      HelpDialog.abort()        @vomnibarUI.activate extend options, { name: "activate", sourceFrameId, focus: true }  root = exports ? window diff --git a/pages/help_dialog.coffee b/pages/help_dialog.coffee index 990fa063..b2d33f95 100644 --- a/pages/help_dialog.coffee +++ b/pages/help_dialog.coffee @@ -1,9 +1,5 @@ -# This overrides the HelpDialog implementation in vimium_frontend.coffee, which prevents us from being able -# to spawn a help dialog within the help dialog UIComponent. As such, we need to provide all the properties -# that we expect on the normal HelpDialog implementation. -# -# NOTE(mrmr1993): In the future, we can move to a single help dialog UIComponent per tab (ie. in the -#   top-level frame), and then we don't need to be concerned about nested help dialog frames. +# This overrides the HelpDialog implementation in vimium_frontend.coffee.  We provide aliases for the two +# HelpDialog methods required by normalMode (isShowing() and toggle()).  HelpDialog =    dialogElement: null    isShowing: -> true diff --git a/pages/options.coffee b/pages/options.coffee index 3487c52f..883405e6 100644 --- a/pages/options.coffee +++ b/pages/options.coffee @@ -235,7 +235,8 @@ initOptionsPage = ->    activateHelpDialog = ->      request = showUnboundCommands: true, showCommandNames: true, customTitle: "Command Listing" -    chrome.runtime.sendMessage extend(request, handler: "getHelpDialogHtml"), HelpDialog.toggle.bind HelpDialog +    chrome.runtime.sendMessage extend(request, handler: "getHelpDialogHtml"), (response) -> +      HelpDialog.toggle {html: response}    saveOptions = ->      Option.saveOptions() | 
