Chromium Code Reviews| Index: third_party/WebKit/Source/devtools/front_end/sources/SourcesView.js |
| diff --git a/third_party/WebKit/Source/devtools/front_end/sources/SourcesView.js b/third_party/WebKit/Source/devtools/front_end/sources/SourcesView.js |
| index 11a957142e8fe786b95e7387db11cb61b4e32a77..9080cc4a2ea6d5f736c1be1d84ad8068a4b45403 100644 |
| --- a/third_party/WebKit/Source/devtools/front_end/sources/SourcesView.js |
| +++ b/third_party/WebKit/Source/devtools/front_end/sources/SourcesView.js |
| @@ -26,12 +26,8 @@ Sources.SourcesView = class extends UI.VBox { |
| /** @type {!Map.<!Workspace.UISourceCode, !UI.Widget>} */ |
| this._sourceViewByUISourceCode = new Map(); |
| - var tabbedEditorPlaceholderText = |
| - Host.isMac() ? Common.UIString('Hit \u2318+P to open a file') : Common.UIString('Hit Ctrl+P to open a file'); |
| - if (Runtime.experiments.isEnabled('persistence2')) |
| - tabbedEditorPlaceholderText += '\n\n' + Common.UIString('Drop in a folder to add to workspace'); |
| this._editorContainer = new Sources.TabbedEditorContainer( |
| - this, Common.settings.createLocalSetting('previouslyViewedFiles', []), tabbedEditorPlaceholderText); |
| + this, Common.settings.createLocalSetting('previouslyViewedFiles', []), this.placeholderElement()); |
| this._editorContainer.show(this._searchableView.element); |
| this._editorContainer.addEventListener( |
| Sources.TabbedEditorContainer.Events.EditorSelected, this._editorSelected, this); |
| @@ -94,6 +90,40 @@ Sources.SourcesView = class extends UI.VBox { |
| this.element.addEventListener('keydown', this._handleKeyDown.bind(this), false); |
| } |
| + placeholderElement() { |
|
pfeldman
2017/03/28 00:59:34
It should be annotated and private.
luoe
2017/04/22 00:07:03
Done.
|
| + var shortcuts = [ |
| + { |
| + defaultShortcut: Common.UIString('Ctrl+P'), |
| + macShortcut: Common.UIString('\u2318+P'), |
| + description: Common.UIString('Open a file') |
| + }, |
| + { |
| + defaultShortcut: Common.UIString('Ctrl+Shift+P'), |
| + macShortcut: Common.UIString('\u2318+Shift+P'), |
| + description: Common.UIString('Run command') |
| + }, |
| + { |
| + defaultShortcut: Common.UIString('Esc'), |
| + macShortcut: Common.UIString('Esc'), |
| + description: Common.UIString('Toggle console drawer') |
| + }, |
| + ]; |
| + |
| + var placeholderElement = createElementWithClass('span', 'sources-placeholder'); |
| + for (var shortcut of shortcuts) { |
| + var row = placeholderElement.createChild('div', 'sources-placeholder-row'); |
| + row.createChild('div', 'sources-placeholder-key') |
| + .createTextChild(Host.isMac() ? shortcut.macShortcut : shortcut.defaultShortcut); |
| + row.createChild('div', 'sources-placeholder-value').createTextChild(shortcut.description); |
| + } |
| + if (Runtime.experiments.isEnabled('persistence2')) { |
| + placeholderElement.createChild('div', 'sources-placeholder-message').textContent = |
| + Common.UIString('Drop in a folder to add to workspace'); |
| + } |
| + |
| + return placeholderElement; |
| + } |
| + |
| /** |
| * @param {function(!Array.<!UI.KeyboardShortcut.Descriptor>, function(!Event=):boolean)} registerShortcutDelegate |
| */ |