Hide click-triggered tooltips when clicking anywhere outside of tooltip

Signed-off-by: Antonio Scandurra <as-cii@github.com>
This commit is contained in:
Nathan Sobo
2016-10-10 10:52:42 -06:00
parent 253917f007
commit 718cc017e6
4 changed files with 67 additions and 18 deletions

View File

@@ -46,14 +46,15 @@ Tooltip = null
module.exports =
class TooltipManager
defaults:
delay:
show: 1000
hide: 100
trigger: 'hover'
container: 'body'
html: true
placement: 'auto top'
viewportPadding: 2
hoverDefaults:
{delay: {show: 1000, hide: 100}}
constructor: ({@keymapManager, @viewRegistry}) ->
# Essential: Add a tooltip to the given element.
@@ -92,7 +93,11 @@ class TooltipManager
else if keystroke?
options.title = getKeystroke(bindings)
tooltip = new Tooltip(target, _.defaults(options, @defaults), @viewRegistry)
options = _.defaults(options, @defaults)
if options.trigger is 'hover'
options = _.defaults(options, @hoverDefaults)
tooltip = new Tooltip(target, options, @viewRegistry)
hideTooltip = ->
tooltip.leave(currentTarget: target)