minor type update and bug fix
This commit is contained in:
parent
74203afb39
commit
b72d7673f4
3 changed files with 14 additions and 6 deletions
|
@ -148,7 +148,9 @@ class Emoji {
|
|||
body.append(emojiElem);
|
||||
emojiElem.addEventListener("click", () => {
|
||||
res(emojiClass);
|
||||
Contextmenu.currentmenu.remove();
|
||||
if (Contextmenu.currentmenu !== "") {
|
||||
Contextmenu.currentmenu.remove();
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
|
@ -182,7 +184,9 @@ class Emoji {
|
|||
body.append(emoji);
|
||||
emoji.onclick = _ => {
|
||||
res(emojit.emoji);
|
||||
Contextmenu.currentmenu.remove();
|
||||
if (Contextmenu.currentmenu !== "") {
|
||||
Contextmenu.currentmenu.remove();
|
||||
}
|
||||
};
|
||||
}
|
||||
};
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
class Contextmenu<x,y>{
|
||||
static currentmenu;
|
||||
static currentmenu:HTMLElement|"";
|
||||
name:string;
|
||||
buttons:[string,(this:x,arg:y,e:MouseEvent)=>void,string|null,(this:x,arg:y)=>boolean,(this:x,arg:y)=>boolean,string][];
|
||||
div:HTMLDivElement;
|
||||
|
@ -9,7 +9,7 @@ class Contextmenu<x,y>{
|
|||
if(Contextmenu.currentmenu===""){
|
||||
return;
|
||||
}
|
||||
if(!Contextmenu.currentmenu.contains(event.target)){
|
||||
if(!Contextmenu.currentmenu.contains(event.target as Node)){
|
||||
Contextmenu.currentmenu.remove();
|
||||
Contextmenu.currentmenu="";
|
||||
}
|
||||
|
|
|
@ -169,7 +169,9 @@ class Emoji{
|
|||
|
||||
emojiElem.addEventListener("click", ()=>{
|
||||
res(emojiClass);
|
||||
Contextmenu.currentmenu.remove();
|
||||
if(Contextmenu.currentmenu!==""){
|
||||
Contextmenu.currentmenu.remove();
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
|
@ -207,7 +209,9 @@ class Emoji{
|
|||
body.append(emoji);
|
||||
emoji.onclick=_=>{
|
||||
res(emojit.emoji);
|
||||
Contextmenu.currentmenu.remove();
|
||||
if(Contextmenu.currentmenu!==""){
|
||||
Contextmenu.currentmenu.remove();
|
||||
}
|
||||
};
|
||||
}
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue