2017-10-09 18:53:11 -04:00
|
|
|
$(document).bind('keydown', 'alt+j', () => {
|
2017-10-10 20:19:16 -04:00
|
|
|
$("#jump-to-note-autocomplete").val('');
|
2017-09-09 12:06:15 -04:00
|
|
|
|
2017-10-10 20:19:16 -04:00
|
|
|
$("#jump-to-note-dialog").dialog({
|
2017-09-09 12:06:15 -04:00
|
|
|
modal: true,
|
|
|
|
width: 500
|
|
|
|
});
|
|
|
|
|
2017-10-10 20:19:16 -04:00
|
|
|
$("#jump-to-note-autocomplete").autocomplete({
|
2017-09-09 12:06:15 -04:00
|
|
|
source: getAutocompleteItems(globalAllNoteIds),
|
|
|
|
minLength: 0
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
2017-10-10 20:19:16 -04:00
|
|
|
$("#jump-to-note-form").submit(() => {
|
|
|
|
const val = $("#jump-to-note-autocomplete").val();
|
2017-09-09 12:06:15 -04:00
|
|
|
const noteId = getNodeIdFromLabel(val);
|
|
|
|
|
|
|
|
if (noteId) {
|
|
|
|
getNodeByKey(noteId).setActive();
|
|
|
|
|
2017-10-10 20:19:16 -04:00
|
|
|
$("#jump-to-note-dialog").dialog('close');
|
2017-09-09 12:06:15 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
return false;
|
|
|
|
});
|