Shift+click to open a note in split view #3937
Unanswered
soulsands
asked this question in
Show and tell
Replies: 2 comments 2 replies
-
Works like a charm! I've added it to https://github.com/Nriver/awesome-trilium. |
Beta Was this translation helpful? Give feedback.
1 reply
-
As of the current version v0.62.4, the shift-click function is broken. I have fixed the issue by updating the jquery selector. window.addEventListener(
'click',
function (e) {
if (e.shiftKey) {
const targetNote = $(e.target).closest('[href]');
let notePath = targetNote.attr('href');
if (!notePath && e.ctrlKey) {
const treeEle = $(e.target).closest('.fancytree-node');
const node = $.ui.fancytree.getNode(treeEle);
notePath = node.data.noteId;
}
if (notePath) {
e.stopPropagation();
e.preventDefault();
api.openSplitWithNote(notePath, false);
}
}
},
true
);
await glob.appContext.initialized;
const appContext = glob.appContext
const mapWidget = appContext.getComponentByEl(document.querySelector('.note-map-widget'));
const mapWidgetProto = Object.getPrototypeOf(mapWidget);
const original_refreshWithNote = mapWidgetProto.refreshWithNote;
mapWidgetProto.refreshWithNote = async function () {
await original_refreshWithNote.apply(this, arguments);
if(!this.graph)return;
this.graph.onNodeClick((node,e) => {
if (e.shiftKey) {
api.openSplitWithNote(node.id);
} else {
appContext.tabManager.getActiveContext().setNote(node.id)
}
})
} |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hello.
I find that opening a note in split view is less distracting, making it more useful when I simply want to browse information. Therefore, I have created a script that offers a shortcut to open a note in split view. The script uses shift+click for normal links and ctrl+shift+click for tree nodes (as shift+click is already taken). You may find it useful if you share my perspective.
It currently works in version 0.59.4.
Follow these steps to use it.
Beta Was this translation helpful? Give feedback.
All reactions