@@ -479,77 +479,25 @@ function initNoteAutocomplete($el: JQuery<HTMLElement>, options?: Options) {
479479 break ;
480480 }
481481
482- // --- CREATE NOTE INTO INBOX ---
483- case SuggestionAction . CreateNoteIntoInbox : {
484- const { note } = await noteCreateService . createNote (
485- {
486- target : "inbox" ,
487- title : suggestion . noteTitle ,
488- activate : true ,
489- promptForType : true ,
490- } as CreateNoteIntoInboxOpts
491- ) ;
492-
493- if ( ! note ) return ;
494-
495- const hoistedNoteId = appContext . tabManager . getActiveContext ( ) ?. hoistedNoteId ;
496- suggestion . notePath = note ?. getBestNotePathString ( hoistedNoteId ) ;
497-
498- $el . trigger ( "autocomplete:noteselected" , [ suggestion ] ) ;
499- $el . autocomplete ( "close" ) ;
500- break ;
501- }
502-
503- case SuggestionAction . CreateAndLinkNoteIntoInbox : {
504- const { note } = await noteCreateService . createNote (
505- {
506- target : "inbox" ,
507- title : suggestion . noteTitle ,
508- activate : false ,
509- promptForType : true ,
510- } as CreateNoteIntoInboxOpts ,
511- ) ;
512-
513- if ( ! note ) return ;
514-
515- const hoistedNoteId = appContext . tabManager . getActiveContext ( ) ?. hoistedNoteId ;
516- suggestion . notePath = note ?. getBestNotePathString ( hoistedNoteId ) ;
517-
518- $el . trigger ( "autocomplete:noteselected" , [ suggestion ] ) ;
519- $el . autocomplete ( "close" ) ;
520- break ;
521- }
482+ case SuggestionAction . CreateNoteIntoInbox :
483+ case SuggestionAction . CreateAndLinkNoteIntoInbox :
484+ case SuggestionAction . CreateNoteIntoPath :
485+ case SuggestionAction . CreateAndLinkNoteIntoPath : {
486+ let target = "inbox" ;
487+ if (
488+ suggestion . action === SuggestionAction . CreateNoteIntoPath ||
489+ suggestion . action === SuggestionAction . CreateAndLinkNoteIntoPath
490+ ) {
491+ target = "path" ;
492+ }
522493
523- case SuggestionAction . CreateNoteIntoPath : {
524494 const { note } = await noteCreateService . createNote (
525495 {
526- target : "into" ,
527- parentNoteUrl : suggestion . parentNoteId ,
496+ target : target ,
528497 title : suggestion . noteTitle ,
529498 activate : true ,
530499 promptForType : true ,
531- } as CreateNoteWithUrlOpts ,
532- ) ;
533-
534- if ( ! note ) return ;
535-
536- const hoistedNoteId = appContext . tabManager . getActiveContext ( ) ?. hoistedNoteId ;
537- suggestion . notePath = note ?. getBestNotePathString ( hoistedNoteId ) ;
538-
539- $el . trigger ( "autocomplete:noteselected" , [ suggestion ] ) ;
540- $el . autocomplete ( "close" ) ;
541- break ;
542- }
543-
544- case SuggestionAction . CreateAndLinkNoteIntoPath : {
545- const { note } = await noteCreateService . createNote (
546- {
547- target : "into" ,
548- parentNoteUrl : suggestion . parentNoteId ,
549- title : suggestion . noteTitle ,
550- activate : false ,
551- promptForType : true ,
552- } as CreateNoteWithUrlOpts
500+ } as CreateNoteIntoInboxOpts
553501 ) ;
554502
555503 if ( ! note ) return ;
0 commit comments