mirror of
				https://github.com/zadam/trilium.git
				synced 2025-11-03 20:06:08 +01:00 
			
		
		
		
	
		
			
				
	
	
		
			36 lines
		
	
	
		
			1.0 KiB
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
			
		
		
	
	
			36 lines
		
	
	
		
			1.0 KiB
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
import noteDetailService from "./note_detail.js";
 | 
						|
import treeUtils from "./tree_utils.js";
 | 
						|
import linkService from "./link.js";
 | 
						|
 | 
						|
function setupTooltip() {
 | 
						|
    $(document).tooltip({
 | 
						|
        items: "#note-detail-wrapper a",
 | 
						|
        content: function (callback) {
 | 
						|
            let notePath = linkService.getNotePathFromLink($(this).attr("href"));
 | 
						|
 | 
						|
            if (!notePath) {
 | 
						|
                notePath = $(this).attr("note-path");
 | 
						|
            }
 | 
						|
 | 
						|
            if (notePath) {
 | 
						|
                const noteId = treeUtils.getNoteIdFromNotePath(notePath);
 | 
						|
 | 
						|
                noteDetailService.loadNote(noteId).then(note => callback(note.content));
 | 
						|
            }
 | 
						|
        },
 | 
						|
        close: function (event, ui) {
 | 
						|
            ui.tooltip.hover(function () {
 | 
						|
                    $(this).stop(true).fadeTo(400, 1);
 | 
						|
                },
 | 
						|
                function () {
 | 
						|
                    $(this).fadeOut('400', function () {
 | 
						|
                        $(this).remove();
 | 
						|
                    });
 | 
						|
                });
 | 
						|
        }
 | 
						|
    });
 | 
						|
}
 | 
						|
 | 
						|
export default {
 | 
						|
    setupTooltip
 | 
						|
} |