Skip to content
Discussion options

You must be logged in to vote

Hello!

Basically your problem is that adding a template to a note means adding a relation, linking your new note to another existing note with a relation attribute. For that, you need .setRelation with the template's noteId.
Right now in your example, you're creating an attribute of type 'relation' to nothing, because 'template' is just a meaningless string, it's not what a relation attribute requires.

I've done something similar in my Hexmap widget and here's how, modifying your example:

api.addButtonToToolbar({
    title: 'log interaction',
    icon: 'user',
    shortcut: 'alt+i',
    action: async () => {

        const newNote = await api.runOnServer(() => {
            const todayNot…

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@glen-w
Comment options

@MorganeLeCaignec
Comment options

Answer selected by glen-w
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants