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

Side by Side Diff: third_party/WebKit/Source/devtools/front_end/elements/ClassesPaneWidget.js

Issue 2568013003: DevTools: Fix 'Add new class' placeholder text (Closed)
Patch Set: switch to setPlaceholder Created 4 years 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 unified diff | Download patch
« no previous file with comments | « no previous file | third_party/WebKit/Source/devtools/front_end/elements/elementsPanel.css » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2015 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 /** 4 /**
5 * @unrestricted 5 * @unrestricted
6 */ 6 */
7 Elements.ClassesPaneWidget = class extends UI.Widget { 7 Elements.ClassesPaneWidget = class extends UI.Widget {
8 constructor() { 8 constructor() {
9 super(); 9 super();
10 this.element.className = 'styles-element-classes-pane'; 10 this.element.className = 'styles-element-classes-pane';
11 var container = this.element.createChild('div', 'title-container'); 11 var container = this.element.createChild('div', 'title-container');
12 this._input = container.createChild('div', 'new-class-input monospace'); 12 this._input = container.createChild('div', 'new-class-input monospace');
13 this._input.setAttribute('placeholder', Common.UIString('Add new class'));
14 this.setDefaultFocusedElement(this._input); 13 this.setDefaultFocusedElement(this._input);
15 this._classesContainer = this.element.createChild('div', 'source-code'); 14 this._classesContainer = this.element.createChild('div', 'source-code');
16 this._classesContainer.classList.add('styles-element-classes-container'); 15 this._classesContainer.classList.add('styles-element-classes-container');
17 this._prompt = new Elements.ClassesPaneWidget.ClassNamePrompt(); 16 this._prompt = new Elements.ClassesPaneWidget.ClassNamePrompt();
18 this._prompt.setAutocompletionTimeout(0); 17 this._prompt.setAutocompletionTimeout(0);
19 this._prompt.renderAsBlock(); 18 this._prompt.renderAsBlock();
20 19
21 var proxyElement = this._prompt.attach(this._input); 20 var proxyElement = this._prompt.attach(this._input);
21 this._prompt.setPlaceholder(Common.UIString('Add new class'));
22 proxyElement.addEventListener('keydown', this._onKeyDown.bind(this), false); 22 proxyElement.addEventListener('keydown', this._onKeyDown.bind(this), false);
23 23
24 SDK.targetManager.addModelListener(SDK.DOMModel, SDK.DOMModel.Events.DOMMuta ted, this._onDOMMutated, this); 24 SDK.targetManager.addModelListener(SDK.DOMModel, SDK.DOMModel.Events.DOMMuta ted, this._onDOMMutated, this);
25 /** @type {!Set<!SDK.DOMNode>} */ 25 /** @type {!Set<!SDK.DOMNode>} */
26 this._mutatingNodes = new Set(); 26 this._mutatingNodes = new Set();
27 UI.context.addFlavorChangeListener(SDK.DOMNode, this._update, this); 27 UI.context.addFlavorChangeListener(SDK.DOMNode, this._update, this);
28 } 28 }
29 29
30 /** 30 /**
31 * @param {!Event} event 31 * @param {!Event} event
(...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after
255 if (!this._classNamesPromise || this._selectedFrameId !== selectedNode.frame Id()) 255 if (!this._classNamesPromise || this._selectedFrameId !== selectedNode.frame Id())
256 this._classNamesPromise = this._getClassNames(selectedNode); 256 this._classNamesPromise = this._getClassNames(selectedNode);
257 257
258 return this._classNamesPromise.then(completions => { 258 return this._classNamesPromise.then(completions => {
259 if (prefix[0] === '.') 259 if (prefix[0] === '.')
260 completions = completions.map(value => '.' + value); 260 completions = completions.map(value => '.' + value);
261 return completions.filter(value => value.startsWith(prefix)).map(completio n => ({title: completion})); 261 return completions.filter(value => value.startsWith(prefix)).map(completio n => ({title: completion}));
262 }); 262 });
263 } 263 }
264 }; 264 };
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Source/devtools/front_end/elements/elementsPanel.css » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698