mirror of
https://github.com/zadam/trilium.git
synced 2025-03-01 09:36:31 +08:00
converted jump to note to module
This commit is contained in:
parent
394fd6f527
commit
1d0e96a314
2 changed files with 34 additions and 24 deletions
|
@ -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() {
|
||||||
|
autoCompleteEl.val('');
|
||||||
|
|
||||||
|
dialogEl.dialog({
|
||||||
modal: true,
|
modal: true,
|
||||||
width: 800
|
width: 800
|
||||||
});
|
});
|
||||||
|
|
||||||
$("#jump-to-note-autocomplete").autocomplete({
|
autoCompleteEl.autocomplete({
|
||||||
source: getAutocompleteItems(glob.allNoteIds),
|
source: getAutocompleteItems(glob.allNoteIds),
|
||||||
minLength: 0
|
minLength: 0
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
$(document).bind('keydown', 'alt+j', showJumpToNote);
|
$(document).bind('keydown', 'alt+j', showDialog);
|
||||||
|
|
||||||
$("#jump-to-note-form").submit(() => {
|
formEl.submit(() => {
|
||||||
const val = $("#jump-to-note-autocomplete").val();
|
const val = autoCompleteEl.val();
|
||||||
const noteId = getNodeIdFromLabel(val);
|
const noteId = getNodeIdFromLabel(val);
|
||||||
|
|
||||||
if (noteId) {
|
if (noteId) {
|
||||||
getNodeByKey(noteId).setActive();
|
getNodeByKey(noteId).setActive();
|
||||||
|
|
||||||
$("#jump-to-note-dialog").dialog('close');
|
dialogEl.dialog('close');
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
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…
Reference in a new issue