Skip to content

Build your personal knowledge base with Trilium Notes

fix(tree): middle click triggering paste

Elian Doranbce2094fb2f3
diff --git a/apps/client/src/widgets/note_tree.ts b/apps/client/src/widgets/note_tree.ts
index 12647e2077..fbd788ad7f 100644
--- a/apps/client/src/widgets/note_tree.ts
+++ b/apps/client/src/widgets/note_tree.ts
@@ -244,6 +244,9 @@ export default class NoteTreeWidget extends NoteContextAwareWidget {
const notePath = treeService.getNotePath(node);
if (notePath) {
+ e.stopPropagation();
+ e.preventDefault();
+
if (e.ctrlKey) {
appContext.triggerCommand("openInPopup", { noteIdOrPath: notePath });
} else {
@@ -252,7 +255,11 @@ export default class NoteTreeWidget extends NoteContextAwareWidget {
});
}
}
-
+ }
+ });
+ this.$tree.on("mouseup", ".fancytree-title", (e) => {
+ // Prevent middle click from pasting in the editor.
+ if (e.which === 2) {
e.stopPropagation();
e.preventDefault();
}