@@ -497,48 +497,45 @@ export default class EditableTextTypeWidget extends AbstractTextTypeWidget {
497497 parentNotePath : string | undefined ,
498498 action : CreateNoteAction
499499 ) : Promise < string > {
500- try {
501- switch ( action ) {
502- // --- Create & link note INTO inbox ---
503- case CreateNoteAction . CreateAndLinkNote : {
504- const { note } = await noteCreateService . createNote (
505- {
506- target : "inbox" ,
507- title,
508- activate : false ,
509- promptForType : true ,
510- }
511- ) ;
512-
513- return note ?. getBestNotePathString ( ) ?? "" ;
514- }
515-
516- // --- Create & link note INTO current path ---
517- case CreateNoteAction . CreateAndLinkChildNote : {
518- if ( ! parentNotePath ) {
519- console . error ( "Cannot create note: parentNotePath is undefined." ) ;
520- return "" ;
500+ switch ( action ) {
501+ case CreateNoteAction . CreateAndLinkNote : {
502+ const { note } = await noteCreateService . createNote (
503+ {
504+ target : "inbox" ,
505+ title,
506+ activate : false ,
507+ promptForType : true ,
521508 }
522- const { note } = await noteCreateService . createNote (
523- {
524- target : "into" ,
525- parentNoteUrl : parentNotePath ,
526- title,
527- activate : false ,
528- promptForType : true ,
529- }
530- ) ;
509+ ) ;
531510
532- return note ?. getBestNotePathString ( ) ?? "" ;
533- }
511+ return note ?. getBestNotePathString ( ) ?? "" ;
512+ }
534513
535- default :
536- console . warn ( "impossible CreateNoteAction state:" , action ) ;
514+ case CreateNoteAction . CreateAndLinkChildNote : {
515+ if ( ! parentNotePath ) {
516+ console . error ( "Cannot create note: parentNotePath is undefined." ) ;
537517 return "" ;
518+ }
519+ const { note } = await noteCreateService . createNote (
520+ {
521+ target : "into" ,
522+ parentNoteUrl : parentNotePath ,
523+ title,
524+ activate : false ,
525+ promptForType : true ,
526+ }
527+ ) ;
528+
529+ return note ?. getBestNotePathString ( ) ?? "" ;
538530 }
539- } catch ( err ) {
540- console . error ( "Error while creating note from CKEditor:" , err ) ;
541- return "" ;
531+
532+ // We always create and Link notes in the CkEditor. Never just
533+ // create.
534+ case CreateNoteAction . CreateNote :
535+ case CreateNoteAction . CreateChildNote :
536+ default :
537+ console . warn ( "impossible CreateNoteAction state:" , action ) ;
538+ return "" ;
542539 }
543540 }
544541
0 commit comments