Skip to content

Build your personal knowledge base with Trilium Notes

frontend API additions

zadama27525af9e34
diff --git a/src/public/javascripts/services/frontend_script_api.js b/src/public/javascripts/services/frontend_script_api.js
index 0fa7d98fbc..349a90f2a6 100644
--- a/src/public/javascripts/services/frontend_script_api.js
+++ b/src/public/javascripts/services/frontend_script_api.js
@@ -131,6 +131,14 @@ function FrontendScriptApi(startNote, currentNote, originEntity = null) {
}
};
+ /**
+ * Returns note by given noteId. If note is missing from cache, it's loaded.
+ **
+ * @param {string} noteId
+ * @return {Promise<NoteShort>}
+ */
+ this.getNote = async noteId => await treeCache.getNote(noteId);
+
/**
* Returns list of notes. If note is missing from cache, it's loaded.
*
@@ -210,6 +218,12 @@ function FrontendScriptApi(startNote, currentNote, originEntity = null) {
*/
this.getActiveNote = noteDetailService.getActiveNote;
+ /**
+ * @method
+ * @returns {string} returns note path of active note
+ */
+ this.getActiveNotePath = treeService.getActiveNotePath;
+
/**
* This method checks whether user navigated away from the note from which the scripts has been started.
* This is necessary because script execution is async and by the time it is finished, the user might have