mirror of
https://github.com/zadam/trilium.git
synced 2025-10-28 18:18:55 +01:00
fix: add left-click check for tree button handlers
This commit is contained in:
parent
df1b87e3ac
commit
7f3c34178b
@ -219,21 +219,22 @@ export default class NoteTreeWidget extends NoteContextAwareWidget {
|
|||||||
this.$tree = this.$widget.find(".tree");
|
this.$tree = this.$widget.find(".tree");
|
||||||
this.$treeActions = this.$widget.find(".tree-actions");
|
this.$treeActions = this.$widget.find(".tree-actions");
|
||||||
|
|
||||||
this.$tree.on("mousedown", ".unhoist-button", () => hoistedNoteService.unhoist());
|
this.$tree.on("mousedown", (e: JQuery.MouseDownEvent) => {
|
||||||
this.$tree.on("mousedown", ".refresh-search-button", (e) => this.refreshSearch(e));
|
const target = e.target as HTMLElement;
|
||||||
this.$tree.on("mousedown", ".add-note-button", (e) => {
|
if (e.button !== 0) return;
|
||||||
const node = $.ui.fancytree.getNode(e as unknown as Event);
|
|
||||||
const parentNotePath = treeService.getNotePath(node);
|
|
||||||
|
|
||||||
noteCreateService.createNote(parentNotePath, {
|
if (target.classList.contains("unhoist-button")) {
|
||||||
isProtected: node.data.isProtected
|
hoistedNoteService.unhoist();
|
||||||
});
|
} else if (target.classList.contains("refresh-search-button")) {
|
||||||
});
|
this.refreshSearch(e);
|
||||||
|
} else if (target.classList.contains("add-note-button")) {
|
||||||
this.$tree.on("mousedown", ".enter-workspace-button", (e) => {
|
const node = $.ui.fancytree.getNode(e as unknown as Event);
|
||||||
const node = $.ui.fancytree.getNode(e as unknown as Event);
|
const parentNotePath = treeService.getNotePath(node);
|
||||||
|
noteCreateService.createNote(parentNotePath, { isProtected: node.data.isProtected });
|
||||||
this.triggerCommand("hoistNote", { noteId: node.data.noteId });
|
} else if (target.classList.contains("enter-workspace-button")) {
|
||||||
|
const node = $.ui.fancytree.getNode(e as unknown as Event);
|
||||||
|
this.triggerCommand("hoistNote", { noteId: node.data.noteId });
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// fancytree doesn't support middle click, so this is a way to support it
|
// fancytree doesn't support middle click, so this is a way to support it
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user