Fix bad ctrl enter logic
This commit is contained in:
@ -9,8 +9,7 @@ window.common = (function(global) {
|
||||
// ctrl + enter or cmd + enter
|
||||
if (
|
||||
e.keyCode === 13 &&
|
||||
e.metaKey ||
|
||||
e.ctrlKey
|
||||
(e.metaKey || e.ctrlKey)
|
||||
) {
|
||||
$('#complete-courseware-dialog').off('keydown', ctrlEnterClickHandler);
|
||||
if ($('#submit-challenge').length > 0) {
|
||||
|
@ -57,6 +57,11 @@ $(document).ready(function() {
|
||||
({ err, solved, output, tests }) => {
|
||||
if (err) {
|
||||
console.error(err);
|
||||
if (common.challengeType === common.challengeTypes.HTML) {
|
||||
return common.updatePreview$(`
|
||||
<h1>${err}</h1>
|
||||
`).subscribe(() => {});
|
||||
}
|
||||
return common.updateOutputDisplay('' + err);
|
||||
}
|
||||
common.updateOutputDisplay(output);
|
||||
@ -65,7 +70,7 @@ $(document).ready(function() {
|
||||
common.showCompletion();
|
||||
}
|
||||
},
|
||||
(err) => {
|
||||
({ err }) => {
|
||||
console.error(err);
|
||||
common.updateOutputDisplay('' + err);
|
||||
}
|
||||
@ -76,8 +81,18 @@ $(document).ready(function() {
|
||||
return Observable.fromCallback($preview.ready, $preview)()
|
||||
.delay(500)
|
||||
.flatMap(() => common.executeChallenge$())
|
||||
.catch(err => Observable.just(err))
|
||||
.subscribe(
|
||||
({ tests }) => {
|
||||
({ err, tests }) => {
|
||||
if (err) {
|
||||
console.error(err);
|
||||
if (common.challengeType === common.challengeTypes.HTML) {
|
||||
return common.updatePreview$(`
|
||||
<h1>${err}</h1>
|
||||
`).subscribe(() => {});
|
||||
}
|
||||
return common.updateOutputDisplay('' + err);
|
||||
}
|
||||
common.displayTestResults(tests);
|
||||
},
|
||||
({ err }) => {
|
||||
|
@ -65,8 +65,7 @@ block content
|
||||
function controlEnterHandler(e) {
|
||||
if (
|
||||
e.keyCode === 13 &&
|
||||
e.ctrlKey ||
|
||||
e.metaKey
|
||||
(e.ctrlKey || e.metaKey)
|
||||
) {
|
||||
$('body').unbind('keydown');
|
||||
$('#complete-courseware-editorless-dialog').modal('show');
|
||||
@ -76,8 +75,7 @@ block content
|
||||
function modalControlEnterHandler(e) {
|
||||
if (
|
||||
e.keyCode === 13 &&
|
||||
e.ctrlKey ||
|
||||
e.metaKey
|
||||
(e.ctrlKey || e.metaKey)
|
||||
) {
|
||||
$('#complete-courseware-editorless-dialog').unbind('keydown');
|
||||
$('#next-courseware-button').click();
|
||||
|
@ -81,8 +81,10 @@ block content
|
||||
|
||||
common.controlEnterHandler = function (e) {
|
||||
$('body').unbind('keydown');
|
||||
if (e.metaKey && e.keyCode === 13 ||
|
||||
e.ctrlKey && e.keyCode === 13) {
|
||||
if (
|
||||
e.keyCode === 13 &&
|
||||
(e.metaKey || e.ctrlKey)
|
||||
) {
|
||||
$('#complete-zipline-or-basejump-dialog').modal('show');
|
||||
} else {
|
||||
$('body').bind('keydown', common.controlEnterHandler);
|
||||
@ -91,8 +93,10 @@ block content
|
||||
|
||||
common.modalControlEnterHandler = function (e) {
|
||||
$('#complete-zipline-or-basejump-dialog').unbind('keydown');
|
||||
if (e.metaKey && e.keyCode === 13 ||
|
||||
e.ctrlKey && e.keyCode === 13) {
|
||||
if (
|
||||
e.keyCode === 13 &&
|
||||
(e.metaKey || e.ctrlKey)
|
||||
) {
|
||||
$('#next-courseware-button').click();
|
||||
} else {
|
||||
$('#complete-zipline-or-basejump-dialog').on('keydown', common.modalControlEnterHandler);
|
||||
|
Reference in New Issue
Block a user