pad_editbar: Factor out duplicate code

pull/5152/head
Richard Hansen 2021-08-14 07:04:26 -04:00
parent ee41de4809
commit 97ccf9e082
1 changed files with 2 additions and 4 deletions

View File

@ -301,16 +301,14 @@ exports.padeditbar = {
// If we're in the editbar already.. // If we're in the editbar already..
// Close any dropdowns we have open.. // Close any dropdowns we have open..
this.toggleDropDown('none'); this.toggleDropDown('none');
// Shift focus away from any drop downs
$(':focus').blur(); // required to do not try to remove!
// Check we're on a pad and not on the timeslider // Check we're on a pad and not on the timeslider
// Or some other window I haven't thought about! // Or some other window I haven't thought about!
if (typeof pad === 'undefined') { if (typeof pad === 'undefined') {
// Timeslider probably.. // Timeslider probably..
// Shift focus away from any drop downs
$(':focus').blur(); // required to do not try to remove!
$('#editorcontainerbox').focus(); // Focus back onto the pad $('#editorcontainerbox').focus(); // Focus back onto the pad
} else { } else {
// Shift focus away from any drop downs
$(':focus').blur(); // required to do not try to remove!
padeditor.ace.focus(); // Sends focus back to pad padeditor.ace.focus(); // Sends focus back to pad
// The above focus doesn't always work in FF, you have to hit enter afterwards // The above focus doesn't always work in FF, you have to hit enter afterwards
evt.preventDefault(); evt.preventDefault();