mirror of
https://github.com/TriliumNext/Notes.git
synced 2025-08-18 00:02:28 +08:00
Remove delays to close the right-click menu
This commit is contained in:
parent
647a5c948c
commit
4f42be3647
@ -183,8 +183,6 @@ class ContextMenu {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.hide();
|
|
||||||
|
|
||||||
if ("handler" in item && item.handler) {
|
if ("handler" in item && item.handler) {
|
||||||
item.handler(item, e);
|
item.handler(item, e);
|
||||||
}
|
}
|
||||||
@ -218,9 +216,6 @@ class ContextMenu {
|
|||||||
|
|
||||||
async hide() {
|
async hide() {
|
||||||
this.options?.onHide?.();
|
this.options?.onHide?.();
|
||||||
// seems like if we hide the menu immediately, some clicks can get propagated to the underlying component
|
|
||||||
// see https://github.com/zadam/trilium/pull/3805 for details
|
|
||||||
await timeout(100);
|
|
||||||
this.$widget.removeClass("show");
|
this.$widget.removeClass("show");
|
||||||
this.$cover.removeClass("show");
|
this.$cover.removeClass("show");
|
||||||
$("body").removeClass("context-menu-shown");
|
$("body").removeClass("context-menu-shown");
|
||||||
@ -228,12 +223,6 @@ class ContextMenu {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function timeout(ms: number) {
|
|
||||||
return new Promise((accept, reject) => {
|
|
||||||
setTimeout(accept, ms);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
const contextMenu = new ContextMenu();
|
const contextMenu = new ContextMenu();
|
||||||
|
|
||||||
export default contextMenu;
|
export default contextMenu;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user