mirror of
https://github.com/atom/atom.git
synced 2026-02-16 09:35:54 -05:00
Hide click-triggered tooltips when clicking anywhere outside of tooltip
Signed-off-by: Antonio Scandurra <as-cii@github.com>
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user