mirror of
https://github.com/zadam/trilium.git
synced 2025-12-06 07:24:25 +01:00
fix(note-autocomplete): logic error hidden by as typecast
This commit is contained in:
parent
470d7eee31
commit
7e4833e893
@ -480,20 +480,10 @@ function initNoteAutocomplete($el: JQuery<HTMLElement>, options?: Options) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
case SuggestionAction.CreateNoteIntoInbox:
|
case SuggestionAction.CreateNoteIntoInbox:
|
||||||
case SuggestionAction.CreateAndLinkNoteIntoInbox:
|
case SuggestionAction.CreateAndLinkNoteIntoInbox: {
|
||||||
case SuggestionAction.CreateNoteIntoPath:
|
|
||||||
case SuggestionAction.CreateAndLinkNoteIntoPath: {
|
|
||||||
let target = "inbox";
|
|
||||||
if (
|
|
||||||
suggestion.action === SuggestionAction.CreateNoteIntoPath ||
|
|
||||||
suggestion.action === SuggestionAction.CreateAndLinkNoteIntoPath
|
|
||||||
) {
|
|
||||||
target = "into";
|
|
||||||
}
|
|
||||||
|
|
||||||
const { note } = await noteCreateService.createNote(
|
const { note } = await noteCreateService.createNote(
|
||||||
{
|
{
|
||||||
target: target,
|
target: "inbox",
|
||||||
title: suggestion.noteTitle,
|
title: suggestion.noteTitle,
|
||||||
activate: true,
|
activate: true,
|
||||||
promptForType: true,
|
promptForType: true,
|
||||||
@ -510,6 +500,30 @@ function initNoteAutocomplete($el: JQuery<HTMLElement>, options?: Options) {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
case SuggestionAction.CreateNoteIntoPath:
|
||||||
|
case SuggestionAction.CreateAndLinkNoteIntoPath: {
|
||||||
|
if (!suggestion.parentNoteId) return;
|
||||||
|
|
||||||
|
const { note } = await noteCreateService.createNote(
|
||||||
|
{
|
||||||
|
parentNoteUrl: suggestion.parentNoteId,
|
||||||
|
target: "into",
|
||||||
|
title: suggestion.noteTitle,
|
||||||
|
activate: true,
|
||||||
|
promptForType: true,
|
||||||
|
},
|
||||||
|
);
|
||||||
|
|
||||||
|
if (!note) return;
|
||||||
|
|
||||||
|
const hoistedNoteId = appContext.tabManager.getActiveContext()?.hoistedNoteId;
|
||||||
|
suggestion.notePath = note?.getBestNotePathString(hoistedNoteId);
|
||||||
|
|
||||||
|
$el.trigger("autocomplete:noteselected", [suggestion]);
|
||||||
|
$el.autocomplete("close");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
case SuggestionAction.SearchNotes: {
|
case SuggestionAction.SearchNotes: {
|
||||||
const searchString = suggestion.noteTitle;
|
const searchString = suggestion.noteTitle;
|
||||||
appContext.triggerCommand("searchNotes", { searchString });
|
appContext.triggerCommand("searchNotes", { searchString });
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user