Skip to content

Commit

Permalink
Fix user context menu bugs (#265)
Browse files Browse the repository at this point in the history
Co-authored-by: KrinklesMontgomery <darius.vallejo@gmail.com>
  • Loading branch information
slugalisk and KrinklesMontgomery authored Jul 13, 2020
1 parent 8e32df0 commit 6906bdb
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
7 changes: 6 additions & 1 deletion assets/chat/js/chat.js
Original file line number Diff line number Diff line change
Expand Up @@ -597,15 +597,20 @@ class Chat {
this.output.on("contextmenu", "a.user", e => {
if ($(e.target).parent().data("username").toLowerCase() !== this.user.username.toLowerCase()) {
e.preventDefault();
window.getSelection().removeAllRanges();
this.contextMenu = new ChatContextMenu(this, e);
this.contextMenu.show(e)
this.contextMenu.show(e);
this.mainwindow.lock();
}
})

this.ui.on("click", e => {
if (this.contextMenu) {
if (!$(e.target).is(this.contextMenu.ui)) {
this.contextMenu.hide()
if (this.mainwindow.locked()) {
this.mainwindow.unlock();
}
}
}
})
Expand Down
10 changes: 8 additions & 2 deletions assets/chat/js/scroll.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,15 @@ class ChatScrollPlugin {

const $el = $(e);
if ($el.find(".chat-scroll-notify").length > 0) {
$el.on("update", () =>
$el.on("update", () => {
if (chat.contextMenu) {
chat.contextMenu.hide();
if (chat.mainwindow.locked()) {
chat.mainwindow.unlock();
}
}
$el.toggleClass("chat-unpinned", !this.isPinned())
); //debounce
}); //debounce
$el.on("mousedown", ".chat-scroll-notify", () => false);
$el.on("mouseup", ".chat-scroll-notify", () => {
this.updateAndPin(true);
Expand Down

0 comments on commit 6906bdb

Please sign in to comment.