From 7a843f47f6d0cc8472c7e6df6790bdf1d6565b01 Mon Sep 17 00:00:00 2001 From: Voiture Date: Fri, 15 Nov 2024 10:18:38 -0500 Subject: [PATCH] Added methods on ChatWindow to interface with scroll plugin --- assets/chat/js/chat.js | 4 ++-- assets/chat/js/window.js | 8 ++++++++ 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/assets/chat/js/chat.js b/assets/chat/js/chat.js index 40eb855a..fd1408ff 100644 --- a/assets/chat/js/chat.js +++ b/assets/chat/js/chat.js @@ -437,11 +437,11 @@ class Chat { // ESC document.addEventListener('keydown', (e) => { if (isKeyCode(e, KEYCODES.ESC)) { - const activeView = this.getActiveWindow().scrollplugin; + const activeWindow = this.getActiveWindow(); // If any menus are open, close them first if (this.getActiveMenu()) ChatMenu.closeMenus(this); // If the active window is scrolled up (not pinned), scroll to bottom - else if (!activeView.pinned) activeView.scrollBottom(); + else if (!activeWindow.isScrollPinned()) activeWindow.scrollBottom(); } }); diff --git a/assets/chat/js/window.js b/assets/chat/js/window.js index 9c57a436..30703321 100644 --- a/assets/chat/js/window.js +++ b/assets/chat/js/window.js @@ -117,6 +117,14 @@ class ChatWindow extends EventEmitter { } } + isScrollPinned() { + return this.scrollplugin.pinned; + } + + scrollBottom() { + this.scrollplugin.scrollBottom(); + } + /** * Use chat state (settings and authentication data) to update the messages in * this window.