mirror of
https://github.com/atom/atom.git
synced 2026-01-23 05:48:10 -05:00
Assign tooltips in Atom environment constructor
This commit is contained in:
@@ -171,6 +171,8 @@ class Atom extends Model
|
||||
KeymapManager = require './keymap-extensions'
|
||||
@keymaps = new KeymapManager({configDirPath, resourcePath, notificationManager: @notifications})
|
||||
|
||||
TooltipManager = require './tooltip-manager'
|
||||
@tooltips = new TooltipManager(keymapManager: @keymaps)
|
||||
|
||||
reset: ->
|
||||
@config.reset()
|
||||
@@ -210,7 +212,6 @@ class Atom extends Model
|
||||
|
||||
ViewRegistry = require './view-registry'
|
||||
CommandRegistry = require './command-registry'
|
||||
TooltipManager = require './tooltip-manager'
|
||||
PackageManager = require './package-manager'
|
||||
Clipboard = require './clipboard'
|
||||
GrammarRegistry = require './grammar-registry'
|
||||
@@ -231,7 +232,6 @@ class Atom extends Model
|
||||
process.env.NODE_ENV ?= 'production' unless devMode
|
||||
|
||||
@keymaps.subscribeToFileReadFailure()
|
||||
@tooltips = new TooltipManager
|
||||
@commands = new CommandRegistry
|
||||
@views = new ViewRegistry
|
||||
@registerViewProviders()
|
||||
|
||||
@@ -54,6 +54,8 @@ class TooltipManager
|
||||
placement: 'auto top'
|
||||
viewportPadding: 2
|
||||
|
||||
constructor: ({@keymapManager}) ->
|
||||
|
||||
# Essential: Add a tooltip to the given element.
|
||||
#
|
||||
# * `target` An `HTMLElement`
|
||||
@@ -81,7 +83,7 @@ class TooltipManager
|
||||
{keyBindingCommand, keyBindingTarget} = options
|
||||
|
||||
if keyBindingCommand?
|
||||
bindings = atom.keymaps.findKeyBindings(command: keyBindingCommand, target: keyBindingTarget)
|
||||
bindings = @keymapManager.findKeyBindings(command: keyBindingCommand, target: keyBindingTarget)
|
||||
keystroke = getKeystroke(bindings)
|
||||
if options.title? and keystroke?
|
||||
options.title += " " + getKeystroke(bindings)
|
||||
|
||||
Reference in New Issue
Block a user