mirror of
https://github.com/zadam/trilium.git
synced 2025-11-28 19:44:24 +01:00
fix(context_menu): toggling submenu hides the menu most of the time
This commit is contained in:
parent
706da768e2
commit
d2d7fd7c4c
@ -298,8 +298,6 @@ class ContextMenu {
|
||||
// important to use mousedown instead of click since the former does not change focus
|
||||
// (especially important for focused text for spell check)
|
||||
.on("mousedown", (e) => {
|
||||
e.stopPropagation();
|
||||
|
||||
if (e.which !== 1) {
|
||||
// only left click triggers menu items
|
||||
return false;
|
||||
@ -313,6 +311,11 @@ class ContextMenu {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Prevent submenu from failing to expand on mobile
|
||||
if (!("items" in item && item.items)) {
|
||||
this.hide();
|
||||
}
|
||||
|
||||
if ("handler" in item && item.handler) {
|
||||
item.handler(item, e);
|
||||
}
|
||||
@ -324,16 +327,6 @@ class ContextMenu {
|
||||
return false;
|
||||
});
|
||||
|
||||
$item.on("mouseup", (e) => {
|
||||
// Prevent submenu from failing to expand on mobile
|
||||
if (!this.isMobile || !("items" in item && item.items)) {
|
||||
e.stopPropagation();
|
||||
// Hide the content menu on mouse up to prevent the mouse event from propagating to the elements below.
|
||||
this.hide();
|
||||
return false;
|
||||
}
|
||||
});
|
||||
|
||||
if ("enabled" in item && item.enabled !== undefined && !item.enabled) {
|
||||
$item.addClass("disabled");
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user