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