Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(711)

Unified Diff: third_party/WebKit/Source/devtools/front_end/sources/SourcesView.js

Issue 2716683006: DevTools: add entry points for command menu (Closed)
Patch Set: Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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 8f39d886e0eac9dcde3761cf3a684657bf9c0547..72e031fbda79974c6f0b4a0d65c19c6354448a87 100644
--- a/third_party/WebKit/Source/devtools/front_end/sources/SourcesView.js
+++ b/third_party/WebKit/Source/devtools/front_end/sources/SourcesView.js
@@ -26,10 +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');
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);
@@ -92,6 +90,35 @@ Sources.SourcesView = class extends UI.VBox {
this.element.addEventListener('keydown', this._handleKeyDown.bind(this), false);
}
+ placeholderElement() {
+ 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);
+ }
+
+ return placeholderElement;
+ }
+
/**
* @param {function(!Array.<!UI.KeyboardShortcut.Descriptor>, function(!Event=):boolean)} registerShortcutDelegate
*/

Powered by Google App Engine
This is Rietveld 408576698