@@ -39,35 +39,6 @@ interface DuplicateResponse {
3939 note : FNote ;
4040}
4141
42- /**
43- * Creates a new note inside the user's Inbox.
44- *
45- * @param {CreateNoteOpts } [options] - Optional settings such as title, type, template, or content.
46- * @returns {Promise<{ note: FNote | null; branch: FBranch | undefined }> }
47- * Resolves with the created note and its branch, or `{ note: null, branch: undefined }` if the inbox is missing.
48- */
49- async function createNoteIntoInbox (
50- options : CreateNoteOpts = { }
51- ) : Promise < { note : FNote | null ; branch : FBranch | undefined } > {
52- const inboxNote = await dateNoteService . getInboxNote ( ) ;
53- if ( ! inboxNote ) {
54- console . warn ( "Missing inbox note." ) ;
55- // always return a defined object
56- return { note : null , branch : undefined } ;
57- }
58-
59- if ( options . isProtected === undefined ) {
60- options . isProtected =
61- inboxNote . isProtected && protectedSessionHolder . isProtectedSessionAvailable ( ) ;
62- }
63-
64- const result = await createNoteIntoPath ( inboxNote . noteId , {
65- ...options ,
66- target : "into" ,
67- } ) ;
68-
69- return result ;
70- }
7142/**
7243 * Core function that creates a new note under the specified parent note path.
7344 *
@@ -149,6 +120,36 @@ async function createNoteIntoPath(
149120 } ;
150121}
151122
123+ /**
124+ * Creates a new note inside the user's Inbox.
125+ *
126+ * @param {CreateNoteOpts } [options] - Optional settings such as title, type, template, or content.
127+ * @returns {Promise<{ note: FNote | null; branch: FBranch | undefined }> }
128+ * Resolves with the created note and its branch, or `{ note: null, branch: undefined }` if the inbox is missing.
129+ */
130+ async function createNoteIntoInbox (
131+ options : CreateNoteOpts = { }
132+ ) : Promise < { note : FNote | null ; branch : FBranch | undefined } > {
133+ const inboxNote = await dateNoteService . getInboxNote ( ) ;
134+ if ( ! inboxNote ) {
135+ console . warn ( "Missing inbox note." ) ;
136+ // always return a defined object
137+ return { note : null , branch : undefined } ;
138+ }
139+
140+ if ( options . isProtected === undefined ) {
141+ options . isProtected =
142+ inboxNote . isProtected && protectedSessionHolder . isProtectedSessionAvailable ( ) ;
143+ }
144+
145+ const result = await createNoteIntoPath ( inboxNote . noteId , {
146+ ...options ,
147+ target : "into" ,
148+ } ) ;
149+
150+ return result ;
151+ }
152+
152153async function chooseNoteType ( ) {
153154 return new Promise < ChooseNoteTypeResponse > ( ( res ) => {
154155 appContext . triggerCommand ( "chooseNoteType" , { callback : res } ) ;
0 commit comments