mirror of
https://github.com/zadam/trilium.git
synced 2025-11-08 06:15:48 +01:00
all access to notes and branches is now async so we can lazy load it in the future
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import treeService from '../services/tree.js';
|
||||
import server from '../services/server.js';
|
||||
|
||||
const $dialog = $("#edit-tree-prefix-dialog");
|
||||
const $form = $("#edit-tree-prefix-form");
|
||||
@@ -18,9 +19,9 @@ async function showDialog() {
|
||||
const currentNode = treeService.getCurrentNode();
|
||||
|
||||
branchId = currentNode.data.branchId;
|
||||
const nt = treeService.getBranch(branchId);
|
||||
const branch = await treeService.getBranch(branchId);
|
||||
|
||||
$treePrefixInput.val(nt.prefix).focus();
|
||||
$treePrefixInput.val(branch.prefix).focus();
|
||||
|
||||
const noteTitle = treeService.getNoteTitle(currentNode.data.noteId);
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import linkService from '../services/link.js';
|
||||
import utils from '../services/utils.js';
|
||||
import server from '../services/server.js';
|
||||
|
||||
const $dialog = $("#event-log-dialog");
|
||||
const $list = $("#event-log-list");
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import noteDetailService from '../services/note_detail.js';
|
||||
import utils from '../services/utils.js';
|
||||
import server from '../services/server.js';
|
||||
|
||||
const $showDialogButton = $(".show-labels-button");
|
||||
const $dialog = $("#labels-dialog");
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import noteDetailService from '../services/note_detail.js';
|
||||
import utils from '../services/utils.js';
|
||||
import server from '../services/server.js';
|
||||
|
||||
const $showDialogButton = $("#show-history-button");
|
||||
const $dialog = $("#note-history-dialog");
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import linkService from '../services/link.js';
|
||||
import utils from '../services/utils.js';
|
||||
import server from '../services/server.js';
|
||||
|
||||
const $showDialogButton = $("#recent-changes-button");
|
||||
const $dialog = $("#recent-changes-dialog");
|
||||
|
||||
@@ -26,7 +26,7 @@ function addRecentNote(branchId, notePath) {
|
||||
}, 1500);
|
||||
}
|
||||
|
||||
function showDialog() {
|
||||
async function showDialog() {
|
||||
glob.activeDialog = $dialog;
|
||||
|
||||
$dialog.dialog({
|
||||
@@ -40,25 +40,28 @@ function showDialog() {
|
||||
|
||||
// remove the current note
|
||||
const recNotes = list.filter(note => note !== treeService.getCurrentNotePath());
|
||||
const items = [];
|
||||
|
||||
for (const notePath of recNotes) {
|
||||
let noteTitle;
|
||||
|
||||
try {
|
||||
noteTitle = await treeService.getNotePathTitle(notePath);
|
||||
}
|
||||
catch (e) {
|
||||
noteTitle = "[error - can't find note title]";
|
||||
|
||||
messagingService.logError("Could not find title for notePath=" + notePath + ", stack=" + e.stack);
|
||||
}
|
||||
|
||||
items.push({
|
||||
label: noteTitle,
|
||||
value: notePath
|
||||
});
|
||||
}
|
||||
|
||||
$searchInput.autocomplete({
|
||||
source: recNotes.map(notePath => {
|
||||
let noteTitle;
|
||||
|
||||
try {
|
||||
noteTitle = treeService.getNotePathTitle(notePath);
|
||||
}
|
||||
catch (e) {
|
||||
noteTitle = "[error - can't find note title]";
|
||||
|
||||
messagingService.logError("Could not find title for notePath=" + notePath + ", stack=" + e.stack);
|
||||
}
|
||||
|
||||
return {
|
||||
label: noteTitle,
|
||||
value: notePath
|
||||
}
|
||||
}),
|
||||
source: items,
|
||||
minLength: 0,
|
||||
autoFocus: true,
|
||||
select: function (event, ui) {
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import utils from '../services/utils.js';
|
||||
import server from '../services/server.js';
|
||||
|
||||
const $dialog = $("#sql-console-dialog");
|
||||
const $query = $('#sql-console-query');
|
||||
|
||||
Reference in New Issue
Block a user