зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1569187 - Move blur event listeners outside of JSTerm. r=jdescottes.
Differential Revision: https://phabricator.services.mozilla.com/D39510 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
74b0e7a43e
Коммит
52a8f8e0e7
|
@ -101,6 +101,15 @@ class App extends Component {
|
|||
this.onClick = this.onClick.bind(this);
|
||||
this.onPaste = this.onPaste.bind(this);
|
||||
this.onKeyDown = this.onKeyDown.bind(this);
|
||||
this.onBlur = this.onBlur.bind(this);
|
||||
}
|
||||
|
||||
componentDidMount() {
|
||||
window.addEventListener("blur", this.onBlur);
|
||||
}
|
||||
|
||||
onBlur() {
|
||||
this.props.dispatch(actions.autocompleteClear());
|
||||
}
|
||||
|
||||
onKeyDown(event) {
|
||||
|
|
|
@ -124,7 +124,6 @@ class JSTerm extends Component {
|
|||
|
||||
this._keyPress = this._keyPress.bind(this);
|
||||
this._inputEventHandler = this._inputEventHandler.bind(this);
|
||||
this._blurEventHandler = this._blurEventHandler.bind(this);
|
||||
this.onContextMenu = this.onContextMenu.bind(this);
|
||||
this.imperativeUpdate = this.imperativeUpdate.bind(this);
|
||||
|
||||
|
@ -507,7 +506,6 @@ class JSTerm extends Component {
|
|||
? null
|
||||
: this._getInputPaddingInlineStart();
|
||||
|
||||
this.webConsoleUI.window.addEventListener("blur", this._blurEventHandler);
|
||||
this.lastInputValue && this._setValue(this.lastInputValue);
|
||||
}
|
||||
|
||||
|
@ -951,16 +949,6 @@ class JSTerm extends Component {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* The window "blur" event handler.
|
||||
* @private
|
||||
*/
|
||||
_blurEventHandler() {
|
||||
if (this.autocompletePopup) {
|
||||
this.clearCompletion();
|
||||
}
|
||||
}
|
||||
|
||||
/* eslint-disable complexity */
|
||||
/**
|
||||
* The inputNode "keypress" event handler.
|
||||
|
@ -1739,10 +1727,6 @@ class JSTerm extends Component {
|
|||
this.inputNode.removeEventListener("keypress", this._keyPress);
|
||||
this.inputNode.removeEventListener("input", this._inputEventHandler);
|
||||
this.inputNode.removeEventListener("keyup", this._inputEventHandler);
|
||||
this.webConsoleUI.window.removeEventListener(
|
||||
"blur",
|
||||
this._blurEventHandler
|
||||
);
|
||||
}
|
||||
|
||||
if (this.editor) {
|
||||
|
|
Загрузка…
Ссылка в новой задаче