From 17ac7cf8ff995fb4024ffabd3028c87f57ad9aba Mon Sep 17 00:00:00 2001 From: SamTV12345 <40429738+samtv12345@users.noreply.github.com> Date: Tue, 8 Aug 2023 18:08:58 +0200 Subject: [PATCH] Revert change to focus on padeditor.ace --- src/static/js/chat.js | 2 +- src/static/js/pad.js | 7 ++++--- src/static/js/pad_editbar.js | 4 ++-- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/src/static/js/chat.js b/src/static/js/chat.js index b1c21fa54..9dee3be4f 100755 --- a/src/static/js/chat.js +++ b/src/static/js/chat.js @@ -227,7 +227,7 @@ exports.chat = (() => { if ((evt.altKey === true && evt.which === 67) || evt.which === 27) { // If we're in chat already.. $(':focus').trigger('blur'); // required to do not try to remove! - padeditor.ace.trigger('focus'); // Sends focus back to pad + padeditor.ace.focus(); // Sends focus back to pad evt.preventDefault(); return false; } diff --git a/src/static/js/pad.js b/src/static/js/pad.js index b4105be6b..802f1d476 100644 --- a/src/static/js/pad.js +++ b/src/static/js/pad.js @@ -410,13 +410,14 @@ const pad = { const postAceInit = () => { padeditbar.init(); setTimeout(() => { - padeditor.ace.trigger('focus'); + padeditor.ace.focus(); }, 0); - $('#options-stickychat').on('click', () => { chat.stickToScreen(); }); + const optionsStickyChat = $('#options-stickychat'); + optionsStickyChat.on('click', () => { chat.stickToScreen(); }); // if we have a cookie for always showing chat then show it if (padcookie.getPref('chatAlwaysVisible')) { chat.stickToScreen(true); // stick it to the screen - $('#options-stickychat').prop('checked', true); // set the checkbox to on + optionsStickyChat.prop('checked', true); // set the checkbox to on } // if we have a cookie for always showing chat then show it if (padcookie.getPref('chatAndUsers')) { diff --git a/src/static/js/pad_editbar.js b/src/static/js/pad_editbar.js index ff7da72cf..d7f12465d 100644 --- a/src/static/js/pad_editbar.js +++ b/src/static/js/pad_editbar.js @@ -201,7 +201,7 @@ exports.padeditbar = new class { if (this.isEnabled() && this.commands[cmd]) { this.commands[cmd](cmd, padeditor.ace, item); } - if (padeditor.ace) padeditor.ace.trigger('focus'); + if (padeditor.ace) padeditor.ace.focus(); } // cb is deprecated (this function is synchronous so a callback is unnecessary). @@ -312,7 +312,7 @@ exports.padeditbar = new class { // Timeslider probably.. $('#editorcontainerbox').trigger('focus'); // Focus back onto the pad } else { - padeditor.ace.trigger('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 evt.preventDefault(); }