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() {
 | 
					const jumpToNote = (function() {
 | 
				
			||||||
    $("#jump-to-note-autocomplete").val('');
 | 
					    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() {
 | 
				
			||||||
        modal: true,
 | 
					        autoCompleteEl.val('');
 | 
				
			||||||
        width: 800
 | 
					 | 
				
			||||||
    });
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
    $("#jump-to-note-autocomplete").autocomplete({
 | 
					        dialogEl.dialog({
 | 
				
			||||||
        source: getAutocompleteItems(glob.allNoteIds),
 | 
					            modal: true,
 | 
				
			||||||
        minLength: 0
 | 
					            width: 800
 | 
				
			||||||
    });
 | 
					        });
 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
$(document).bind('keydown', 'alt+j', showJumpToNote);
 | 
					        autoCompleteEl.autocomplete({
 | 
				
			||||||
 | 
					            source: getAutocompleteItems(glob.allNoteIds),
 | 
				
			||||||
$("#jump-to-note-form").submit(() => {
 | 
					            minLength: 0
 | 
				
			||||||
    const val = $("#jump-to-note-autocomplete").val();
 | 
					        });
 | 
				
			||||||
    const noteId = getNodeIdFromLabel(val);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    if (noteId) {
 | 
					 | 
				
			||||||
        getNodeByKey(noteId).setActive();
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        $("#jump-to-note-dialog").dialog('close');
 | 
					 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    return false;
 | 
					    $(document).bind('keydown', 'alt+j', showDialog);
 | 
				
			||||||
});
 | 
					
 | 
				
			||||||
 | 
					    formEl.submit(() => {
 | 
				
			||||||
 | 
					        const val = autoCompleteEl.val();
 | 
				
			||||||
 | 
					        const noteId = getNodeIdFromLabel(val);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        if (noteId) {
 | 
				
			||||||
 | 
					            getNodeByKey(noteId).setActive();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            dialogEl.dialog('close');
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        return false;
 | 
				
			||||||
 | 
					    });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    return {
 | 
				
			||||||
 | 
					        showDialog
 | 
				
			||||||
 | 
					    };
 | 
				
			||||||
 | 
					})();
 | 
				
			||||||
@ -14,7 +14,7 @@
 | 
				
			|||||||
        <div style="flex-grow: 100;">
 | 
					        <div style="flex-grow: 100;">
 | 
				
			||||||
          <button class="btn btn-xs" onclick="recentChanges.showDialog();">Recent changes</button>
 | 
					          <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="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>
 | 
					          <button class="btn btn-xs" onclick="showEventLog();">Event log</button>
 | 
				
			||||||
        </div>
 | 
					        </div>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user