mirror of
https://github.com/zadam/trilium.git
synced 2025-11-15 09:45:52 +01:00
fix branch prefix dialog
This commit is contained in:
@@ -11,11 +11,17 @@ const $noteTitle = $('#branch-prefix-note-title');
|
||||
|
||||
let branchId;
|
||||
|
||||
export async function showDialog(node) {
|
||||
branchId = node.data.branchId;
|
||||
export async function showDialog(notePath) {
|
||||
const {noteId, parentNoteId} = treeService.getNoteIdAndParentIdFromNotePath(notePath);
|
||||
|
||||
if (!noteId || !parentNoteId) {
|
||||
return;
|
||||
}
|
||||
|
||||
branchId = await treeCache.getBranchId(parentNoteId, noteId);
|
||||
const branch = treeCache.getBranch(branchId);
|
||||
|
||||
if (branch.noteId === 'root') {
|
||||
if (!branch || branch.noteId === 'root') {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -29,7 +35,7 @@ export async function showDialog(node) {
|
||||
|
||||
$treePrefixInput.val(branch.prefix);
|
||||
|
||||
const noteTitle = await treeService.getNoteTitle(node.data.noteId);
|
||||
const noteTitle = await treeService.getNoteTitle(noteId);
|
||||
|
||||
$noteTitle.text(" - " + noteTitle);
|
||||
}
|
||||
@@ -39,8 +45,6 @@ async function savePrefix() {
|
||||
|
||||
await server.put('branches/' + branchId + '/set-prefix', { prefix: prefix });
|
||||
|
||||
await treeService.setPrefix(branchId, prefix);
|
||||
|
||||
$dialog.modal('hide');
|
||||
|
||||
toastService.showMessage("Branch prefix has been saved.");
|
||||
|
||||
Reference in New Issue
Block a user