Merge pull request #3205 from FreeCodeCamp/feature/ctrl-enter-submit
add ctrl enter press to submit on modal
This commit is contained in:
@@ -418,6 +418,13 @@ var testSuccess = function() {
|
||||
}
|
||||
};
|
||||
|
||||
function ctrlEnterClickHandler(e) {
|
||||
// ctrl + enter
|
||||
if (e.ctrlKey && e.keyCode === 13) {
|
||||
$('#submit-challenge').click();
|
||||
}
|
||||
}
|
||||
|
||||
function showCompletion() {
|
||||
if (isInitRun) {
|
||||
isInitRun = false;
|
||||
@@ -433,8 +440,11 @@ function showCompletion() {
|
||||
);
|
||||
var bonfireSolution = myCodeMirror.getValue();
|
||||
var didCompleteWith = $('#completed-with').val() || null;
|
||||
|
||||
|
||||
$('#complete-courseware-dialog').modal('show');
|
||||
$('#complete-courseware-dialog .modal-header').click();
|
||||
|
||||
$('#submit-challenge').click(function(e) {
|
||||
e.preventDefault();
|
||||
|
||||
@@ -765,6 +775,17 @@ $('#submitButton').on('click', function() {
|
||||
});
|
||||
|
||||
$(document).ready(function() {
|
||||
|
||||
// init modal keybindings on open
|
||||
$('#complete-courseware-dialog').on('shown.bs.modal', function() {
|
||||
$('#complete-courseware-dialog').keyup(ctrlEnterClickHandler);
|
||||
});
|
||||
|
||||
// remove modal keybinds on close
|
||||
$('#complete-courseware-dialog').on('hidden.bs.modal', function() {
|
||||
$('#complete-courseware-dialog').unbind('keyup', ctrlEnterClickHandler);
|
||||
});
|
||||
|
||||
var $preview = $('#preview');
|
||||
isInitRun = true;
|
||||
|
||||
|
Reference in New Issue
Block a user