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

Side by Side Diff: third_party/WebKit/Source/devtools/front_end/console/ConsolePrompt.js

Issue 2565113002: DevTools: update console viewport scroll when prompt is resized (Closed)
Patch Set: SourcesTE listen to same event Created 3 years, 9 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 unified diff | Download patch
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 Console.ConsolePrompt = class extends UI.Widget { 7 Console.ConsolePrompt = class extends UI.Widget {
8 constructor() { 8 constructor() {
9 super(); 9 super();
10 this._addCompletionsFromHistory = true; 10 this._addCompletionsFromHistory = true;
(...skipping 14 matching lines...) Expand all
25 this._editor = 25 this._editor =
26 factory.createEditor({lineNumbers: false, lineWrapping: true, mimeType : 'javascript', autoHeight: true}); 26 factory.createEditor({lineNumbers: false, lineWrapping: true, mimeType : 'javascript', autoHeight: true});
27 27
28 this._editor.configureAutocomplete({ 28 this._editor.configureAutocomplete({
29 substituteRangeCallback: this._substituteRange.bind(this), 29 substituteRangeCallback: this._substituteRange.bind(this),
30 suggestionsCallback: this._wordsWithQuery.bind(this), 30 suggestionsCallback: this._wordsWithQuery.bind(this),
31 captureEnter: true 31 captureEnter: true
32 }); 32 });
33 this._editor.widget().element.addEventListener('keydown', this._editorKeyD own.bind(this), true); 33 this._editor.widget().element.addEventListener('keydown', this._editorKeyD own.bind(this), true);
34 this._editor.widget().show(this.element); 34 this._editor.widget().show(this.element);
35 this._editor.widget().on(UI.TextEditor.ContentChangedEvent, this._onConten tChanged, this);
35 36
36 this.setText(this._initialText); 37 this.setText(this._initialText);
37 delete this._initialText; 38 delete this._initialText;
38 if (this.hasFocus()) 39 if (this.hasFocus())
39 this.focus(); 40 this.focus();
40 this.element.tabIndex = -1; 41 this.element.tabIndex = -1;
41 42
42 this._editorSetForTest(); 43 this._editorSetForTest();
43 } 44 }
44 } 45 }
45 46
47 _onContentChanged() {
48 this.emit(new Console.ConsolePrompt.ContentChangedEvent());
49 }
50
46 /** 51 /**
47 * @return {!Console.ConsoleHistoryManager} 52 * @return {!Console.ConsoleHistoryManager}
48 */ 53 */
49 history() { 54 history() {
50 return this._history; 55 return this._history;
51 } 56 }
52 57
53 clearAutocomplete() { 58 clearAutocomplete() {
54 if (this._editor) 59 if (this._editor)
55 this._editor.clearAutocomplete(); 60 this._editor.clearAutocomplete();
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
130 135
131 if (newText === undefined) 136 if (newText === undefined)
132 return; 137 return;
133 keyboardEvent.consume(true); 138 keyboardEvent.consume(true);
134 this.setText(newText); 139 this.setText(newText);
135 140
136 if (isPrevious) 141 if (isPrevious)
137 this._editor.setSelection(Common.TextRange.createFromLocation(0, Infinity) ); 142 this._editor.setSelection(Common.TextRange.createFromLocation(0, Infinity) );
138 else 143 else
139 this.moveCaretToEndOfPrompt(); 144 this.moveCaretToEndOfPrompt();
140 this.setMinimumSize(0, this._editor.widget().element.offsetHeight);
141 } 145 }
142 146
143 /** 147 /**
144 * @param {!KeyboardEvent} event 148 * @param {!KeyboardEvent} event
145 */ 149 */
146 _enterKeyPressed(event) { 150 _enterKeyPressed(event) {
147 if (event.altKey || event.ctrlKey || event.shiftKey) 151 if (event.altKey || event.ctrlKey || event.shiftKey)
148 return; 152 return;
149 153
150 event.consume(true); 154 event.consume(true);
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after
361 return this._currentHistoryItem(); 365 return this._currentHistoryItem();
362 } 366 }
363 367
364 /** 368 /**
365 * @return {string|undefined} 369 * @return {string|undefined}
366 */ 370 */
367 _currentHistoryItem() { 371 _currentHistoryItem() {
368 return this._data[this._data.length - this._historyOffset]; 372 return this._data[this._data.length - this._historyOffset];
369 } 373 }
370 }; 374 };
375
376 /** @implements {Common.Emittable} */
377 Console.ConsolePrompt.ContentChangedEvent = class {};
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698