Skip to content

Build your personal knowledge base with Trilium Notes

BackendAPI: Return Note created within createNoteAndRefresh (#647)

Arne5063cfb979ca
diff --git a/src/services/backend_script_api.js b/src/services/backend_script_api.js
index 377b58d4da..514f70416a 100644
--- a/src/services/backend_script_api.js
+++ b/src/services/backend_script_api.js
@@ -209,9 +209,11 @@ function BackendScriptApi(currentNote, apiParams) {
* @returns {Promise<{note: Note, branch: Branch}>} object contains newly created entities note and branch
*/
this.createNoteAndRefresh = async function(parentNoteId, title, content, extraOptions) {
- await noteService.createNote(parentNoteId, title, content, extraOptions);
+ const note = await noteService.createNote(parentNoteId, title, content, extraOptions);
ws.refreshTree();
+
+ return note;
};
/**
@@ -315,4 +317,4 @@ function BackendScriptApi(currentNote, apiParams) {
this.getAppInfo = () => appInfo
}
-module.exports = BackendScriptApi;
\ No newline at end of file
+module.exports = BackendScriptApi;