feat: remove context menu on global mousedown only if the context menu useState variable's show value is set to true
This commit is contained in:
parent
46a135de22
commit
e5bdf63f2a
1 changed files with 5 additions and 2 deletions
5
app.vue
5
app.vue
|
@ -23,11 +23,14 @@ onMounted(() => {
|
|||
contextMenuHandler(e);
|
||||
});
|
||||
document.addEventListener("mousedown", (e) => {
|
||||
if (e.target instanceof HTMLElement && e.target.closest("#context-menu")) return;
|
||||
if (e.target instanceof HTMLElement && e.target.classList.contains("context-menu-item")) return;
|
||||
console.log("click");
|
||||
console.log("target:", e.target);
|
||||
console.log(e.target instanceof HTMLDivElement);
|
||||
if (contextMenu.value.show) {
|
||||
console.log("context menu is shown, hiding");
|
||||
removeContextMenu(contextMenu);
|
||||
}
|
||||
if (e.target instanceof HTMLElement && e.target.classList.contains("message-text") && e.target.contentEditable) {
|
||||
e.target.contentEditable = "false";
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue