From 97ccf9e0826138406494bb455f1463a31860c64c Mon Sep 17 00:00:00 2001 From: Richard Hansen Date: Sat, 14 Aug 2021 07:04:26 -0400 Subject: [PATCH] pad_editbar: Factor out duplicate code --- src/static/js/pad_editbar.js | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/static/js/pad_editbar.js b/src/static/js/pad_editbar.js index dd352fef9..695b6c1c2 100644 --- a/src/static/js/pad_editbar.js +++ b/src/static/js/pad_editbar.js @@ -301,16 +301,14 @@ exports.padeditbar = { // If we're in the editbar already.. // Close any dropdowns we have open.. 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 // Or some other window I haven't thought about! if (typeof pad === 'undefined') { // 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 } 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 // The above focus doesn't always work in FF, you have to hit enter afterwards evt.preventDefault();