fix group context menu

This commit is contained in:
MathMan05
2026-07-05 15:41:43 -05:00
parent 8930830582
commit a795bd6374
2 changed files with 14 additions and 3 deletions
+2 -1
View File
@@ -393,6 +393,7 @@ class Contextmenu<x, y> {
touchEnd: (x: number, y: number) => unknown = () => {},
click: "right" | "left" = "right",
side: "top" | "bottom" = "top",
dontlayer = false,
) {
const func = (event: MouseEvent) => {
const selectedText = window.getSelection();
@@ -417,7 +418,7 @@ class Contextmenu<x, y> {
obj.dispatchEvent(layered);
};
obj.addEventListener("layered", (layered) => {
if (this.layered) {
if (this.layered && !dontlayer) {
layered.menus.push([this as Contextmenu<unknown, unknown>, addinfo, other]);
} else if (!layered.primary) {
layered.primary = [this as Contextmenu<unknown, unknown>, addinfo, other];
+12 -2
View File
@@ -590,8 +590,18 @@ class Group extends Channel {
}
createguildHTML() {
const div = document.createElement("div");
Group.groupcontextmenu.bindContextmenu(div, this, undefined);
if (this.type === 1 && this.users[0]) {
const isSingle = this.type === 1 && this.users[0];
Group.groupcontextmenu.bindContextmenu(
div,
this,
undefined,
undefined,
undefined,
undefined,
undefined,
!isSingle,
);
if (isSingle) {
User.contextmenu.bindContextmenu(div, this.users[0], undefined);
}
this.html = new WeakRef(div);