-
I am tryiing to use a note's json contents as a data source and I am unable to get the return from my getNoteContents(noteID) function to be anything other than undefined. I am a long time developer, but new-ish to js. My function I am calling:
How I am calling it ( from inside a function defined as:
Always returns "undefined". I have verified and reverified that:
Thoughts? Thank you! |
Beta Was this translation helpful? Give feedback.
Replies: 5 comments 10 replies
-
You are not So to fix it replace Or if you're just after the content, no need to run it on the backend at all. const targetNote = await api.getNote('TR2pVO3d7opK');
const noteContent = await targetNote.getContent(); |
Beta Was this translation helpful? Give feedback.
-
So if I replace all my nonsensical code with this:
calling this:
The alert shows:
Back where I started :-( Thanks for your responses though, it is appreciated! |
Beta Was this translation helpful? Give feedback.
-
Are you doing anything else in your script? I tested this myself with a valid note ID and it works just fine Are you on Trilium stable or beta? |
Beta Was this translation helpful? Give feedback.
-
Ok, this is truly, really, the last post. SO, I have my primary Trilium (lots of content, 0.61.5-beta) that I call "prod". I now have another instance, which is fresh, running the stable release which I call "stable". I have a third instance which is an empty 0.61.5-beta instance that I call "beta". PROD: getContent() returns undefined I am feeling comfortable, with all this testing, that there is an issue with getContent() in the 0.61.5-beta version. Process:
Hope this all helps. Thanks, |
Beta Was this translation helpful? Give feedback.
-
Thanks again for all the help. I have moved back to the stable release for this. You are the best! |
Beta Was this translation helpful? Give feedback.
You're right this appears to be not working in the beta. @zadam is
FNote.getContent()
no longer meant to work in the beta? I'm guessing no since it's not documented in the jsdoc and ultimately replaced withgetBlob
right?For now, sottey, you can just do this:
this method should work on both stable and the beta
or if you only care about the beta you can move to
getBlob
which returns a promise that resolves to theFBlob
object that has acontent
member like this: