mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-14 05:45:37 +00:00
Bug 1478410 - Fix split console close in codeMirror jsterm; r=bgrins.
This patch removes the <kbd>Esc</kbd> handler from codeMirror to put it on the jsterm-container. This prevent the interference from codeMirror when we don't need to handle the event (i.e. it should bubbles up to the toolbox where the split console state is managed). The webconsole_split test is run with both old and new jsterm. MozReview-Commit-ID: BaLyj4wSdmv --HG-- extra : rebase_source : 6b549379839dc824a38ee49ffd859092cfbecb13 extra : source : de58a50eb0165665644b07fffd228e5478861e2e
This commit is contained in:
parent
e37cf0384a
commit
a7990cf932
@ -309,15 +309,6 @@ class JSTerm extends Component {
|
||||
return "CodeMirror.Pass";
|
||||
},
|
||||
|
||||
"Esc": () => {
|
||||
if (this.autocompletePopup.isOpen) {
|
||||
this.clearCompletion();
|
||||
return null;
|
||||
}
|
||||
|
||||
return "CodeMirror.Pass";
|
||||
},
|
||||
|
||||
"PageUp": () => {
|
||||
if (this.autocompletePopup.isOpen) {
|
||||
this.complete(this.COMPLETE_PAGEUP);
|
||||
@ -353,7 +344,9 @@ class JSTerm extends Component {
|
||||
}
|
||||
|
||||
return "CodeMirror.Pass";
|
||||
}
|
||||
},
|
||||
|
||||
"Esc": false,
|
||||
}
|
||||
});
|
||||
|
||||
@ -362,6 +355,14 @@ class JSTerm extends Component {
|
||||
const cm = this.editor.codeMirror;
|
||||
cm.on("paste", (_, event) => this.props.onPaste(event));
|
||||
cm.on("drop", (_, event) => this.props.onPaste(event));
|
||||
|
||||
this.node.addEventListener("keydown", event => {
|
||||
if (event.keyCode === KeyCodes.DOM_VK_ESCAPE && this.autocompletePopup.isOpen) {
|
||||
this.clearCompletion();
|
||||
event.preventDefault();
|
||||
event.stopPropagation();
|
||||
}
|
||||
});
|
||||
}
|
||||
} else if (this.inputNode) {
|
||||
this.inputNode.addEventListener("keypress", this._keyPress);
|
||||
|
@ -12,11 +12,20 @@ const L10N =
|
||||
new LocalizationHelper("devtools/client/locales/toolbox.properties");
|
||||
|
||||
// Test is slow on Linux EC2 instances - Bug 962931
|
||||
requestLongerTimeout(2);
|
||||
requestLongerTimeout(4);
|
||||
|
||||
add_task(async function() {
|
||||
let toolbox;
|
||||
// Run test with legacy JsTerm
|
||||
await pushPref("devtools.webconsole.jsterm.codeMirror", false);
|
||||
await performTests();
|
||||
// And then run it with the CodeMirror-powered one.
|
||||
await pushPref("devtools.webconsole.jsterm.codeMirror", true);
|
||||
await performTests();
|
||||
});
|
||||
|
||||
async function performTests() {
|
||||
let toolbox;
|
||||
await pushPref("devtools.webconsole.jsterm.codeMirror", true);
|
||||
await addTab(TEST_URI);
|
||||
await testConsoleLoadOnDifferentPanel();
|
||||
await testKeyboardShortcuts();
|
||||
@ -249,4 +258,4 @@ add_task(async function() {
|
||||
const pref = Services.prefs.getCharPref("devtools.toolbox.host");
|
||||
is(pref, hostType, "host pref is " + hostType);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user