trilium/public/javascripts/jump_to_note.js

28 lines
635 B
JavaScript
Raw Normal View History

2017-10-11 08:37:45 +08:00
function showJumpToNote() {
$("#jump-to-note-autocomplete").val('');
$("#jump-to-note-dialog").dialog({
modal: true,
width: 800
});
$("#jump-to-note-autocomplete").autocomplete({
source: getAutocompleteItems(globalAllNoteIds),
minLength: 0
});
2017-10-11 08:37:45 +08:00
}
$(document).bind('keydown', 'alt+j', showJumpToNote);
$("#jump-to-note-form").submit(() => {
const val = $("#jump-to-note-autocomplete").val();
const noteId = getNodeIdFromLabel(val);
if (noteId) {
getNodeByKey(noteId).setActive();
$("#jump-to-note-dialog").dialog('close');
}
return false;
});