mirror of
https://github.com/pulsar-edit/pulsar.git
synced 2024-09-21 16:08:24 +03:00
Merge pull request #1141 from atom/bo-jquery-extensions
Add setTooltip jquery function
This commit is contained in:
commit
fe035d4d7c
@ -15,4 +15,27 @@ jQuery.cleanData = (elements) ->
|
||||
view.unsubscribe()
|
||||
originalCleanData(elements)
|
||||
|
||||
tooltipDefaults =
|
||||
delay:
|
||||
show: 500
|
||||
hide: 100
|
||||
container: 'body'
|
||||
html: true
|
||||
|
||||
getKeystroke = (bindings) ->
|
||||
if bindings?.length
|
||||
"<span class=\"keystroke\">#{bindings[0].keystroke}</span>"
|
||||
else
|
||||
''
|
||||
|
||||
jQuery.fn.setTooltip = (title, {command, commandElement}={}) ->
|
||||
atom.requireWithGlobals('bootstrap/js/tooltip', {jQuery})
|
||||
|
||||
bindings = if commandElement
|
||||
atom.keymap.keyBindingsForCommandMatchingElement(command, commandElement)
|
||||
else
|
||||
atom.keymap.keyBindingsForCommand(command)
|
||||
|
||||
this.tooltip(jQuery.extend(tooltipDefaults, {title: "#{title} #{getKeystroke(bindings)}"}))
|
||||
|
||||
module.exports = spacePen
|
||||
|
Loading…
Reference in New Issue
Block a user