mirror of
				https://github.com/zadam/trilium.git
				synced 2025-11-03 20:06:08 +01:00 
			
		
		
		
	ctrl-click opens new tab
This commit is contained in:
		@@ -50,8 +50,13 @@ function goToLink(e) {
 | 
			
		||||
    const notePath = getNotePathFromLink($link);
 | 
			
		||||
 | 
			
		||||
    if (notePath) {
 | 
			
		||||
        if (e.ctrlKey) {
 | 
			
		||||
            noteDetailService.loadNoteDetail(notePath.split("/").pop(), true);
 | 
			
		||||
        }
 | 
			
		||||
        else {
 | 
			
		||||
            treeService.activateNote(notePath);
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
    else {
 | 
			
		||||
        const address = $link.attr('href');
 | 
			
		||||
 | 
			
		||||
@@ -127,6 +132,16 @@ $(document).on('contextmenu', ".note-detail-render a", noteContextMenu);
 | 
			
		||||
$(document).on('click', "a[data-action='note']", goToLink);
 | 
			
		||||
$(document).on('click', 'div.popover-content a, div.ui-tooltip-content a', goToLink);
 | 
			
		||||
$(document).on('dblclick', '.note-detail-text a', goToLink);
 | 
			
		||||
$(document).on('click', '.note-detail-text a', function (e) {
 | 
			
		||||
    const notePath = getNotePathFromLink($(e.target));
 | 
			
		||||
    if (notePath && e.ctrlKey) {
 | 
			
		||||
        // if it's a ctrl-click, then we open on new tab, otherwise normal flow (CKEditor opens link-editing dialog)
 | 
			
		||||
        e.preventDefault();
 | 
			
		||||
 | 
			
		||||
        noteDetailService.loadNoteDetail(notePath.split("/").pop(), true);
 | 
			
		||||
    }
 | 
			
		||||
});
 | 
			
		||||
 | 
			
		||||
$(document).on('click', '.note-detail-render a', goToLink);
 | 
			
		||||
$(document).on('click', '.note-detail-text.ck-read-only a', goToLink);
 | 
			
		||||
$(document).on('click', 'span.ck-button__label', e => {
 | 
			
		||||
 
 | 
			
		||||
@@ -400,15 +400,18 @@ function initFancyTree(tree) {
 | 
			
		||||
            const node = data.node;
 | 
			
		||||
 | 
			
		||||
            if (targetType === 'title' || targetType === 'icon') {
 | 
			
		||||
                if (!event.ctrlKey) {
 | 
			
		||||
                if (event.shiftKey) {
 | 
			
		||||
                    node.setSelected(!node.isSelected());
 | 
			
		||||
                }
 | 
			
		||||
                else if (event.ctrlKey) {
 | 
			
		||||
                    noteDetailService.loadNoteDetail(node.data.noteId, true);
 | 
			
		||||
                }
 | 
			
		||||
                else {
 | 
			
		||||
                    node.setActive();
 | 
			
		||||
                    node.setSelected(true);
 | 
			
		||||
 | 
			
		||||
                    clearSelectedNodes();
 | 
			
		||||
                }
 | 
			
		||||
                else {
 | 
			
		||||
                    node.setSelected(!node.isSelected());
 | 
			
		||||
                }
 | 
			
		||||
 | 
			
		||||
                return false;
 | 
			
		||||
            }
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user