mirror of
				https://github.com/zadam/trilium.git
				synced 2025-11-04 05:28:59 +01:00 
			
		
		
		
	converted jump to note to module
This commit is contained in:
		
							parent
							
								
									394fd6f527
								
							
						
					
					
						commit
						1d0e96a314
					
				@ -1,28 +1,38 @@
 | 
			
		||||
function showJumpToNote() {
 | 
			
		||||
    $("#jump-to-note-autocomplete").val('');
 | 
			
		||||
const jumpToNote = (function() {
 | 
			
		||||
    const dialogEl = $("#jump-to-note-dialog");
 | 
			
		||||
    const autoCompleteEl = $("#jump-to-note-autocomplete");
 | 
			
		||||
    const formEl = $("#jump-to-note-form");
 | 
			
		||||
 | 
			
		||||
    $("#jump-to-note-dialog").dialog({
 | 
			
		||||
    function showDialog() {
 | 
			
		||||
        autoCompleteEl.val('');
 | 
			
		||||
 | 
			
		||||
        dialogEl.dialog({
 | 
			
		||||
            modal: true,
 | 
			
		||||
            width: 800
 | 
			
		||||
        });
 | 
			
		||||
 | 
			
		||||
    $("#jump-to-note-autocomplete").autocomplete({
 | 
			
		||||
        autoCompleteEl.autocomplete({
 | 
			
		||||
            source: getAutocompleteItems(glob.allNoteIds),
 | 
			
		||||
            minLength: 0
 | 
			
		||||
        });
 | 
			
		||||
}
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
$(document).bind('keydown', 'alt+j', showJumpToNote);
 | 
			
		||||
    $(document).bind('keydown', 'alt+j', showDialog);
 | 
			
		||||
 | 
			
		||||
$("#jump-to-note-form").submit(() => {
 | 
			
		||||
    const val = $("#jump-to-note-autocomplete").val();
 | 
			
		||||
    formEl.submit(() => {
 | 
			
		||||
        const val = autoCompleteEl.val();
 | 
			
		||||
        const noteId = getNodeIdFromLabel(val);
 | 
			
		||||
 | 
			
		||||
        if (noteId) {
 | 
			
		||||
            getNodeByKey(noteId).setActive();
 | 
			
		||||
 | 
			
		||||
        $("#jump-to-note-dialog").dialog('close');
 | 
			
		||||
            dialogEl.dialog('close');
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        return false;
 | 
			
		||||
});
 | 
			
		||||
    });
 | 
			
		||||
 | 
			
		||||
    return {
 | 
			
		||||
        showDialog
 | 
			
		||||
    };
 | 
			
		||||
})();
 | 
			
		||||
@ -14,7 +14,7 @@
 | 
			
		||||
        <div style="flex-grow: 100;">
 | 
			
		||||
          <button class="btn btn-xs" onclick="recentChanges.showDialog();">Recent changes</button>
 | 
			
		||||
          <button class="btn btn-xs" onclick="recentNotes.showDialog();">Recent notes</button>
 | 
			
		||||
          <button class="btn btn-xs" onclick="showJumpToNote();">Jump to note</button>
 | 
			
		||||
          <button class="btn btn-xs" onclick="jumpToNote.showDialog();">Jump to note</button>
 | 
			
		||||
          <button class="btn btn-xs" onclick="showEventLog();">Event log</button>
 | 
			
		||||
        </div>
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user