Skip to content
Discussion options

You must be logged in to vote

A little tricky bug if you don't know how to open console...
I open the console tool first time.

this is the code which is work.

const path = dv.page("FakeTemplater").file.path;
const file = this.app.vault.getAbstractFileByPath(path);
const templater = this.app.plugins.plugins["templater-obsidian"].templater;
const buttonMaker = () => {
    const btn = this.container.createEl('button', {"text": "Test"});

    btn.addEventListener('click', async (evt) => {
        evt.preventDefault();
        await templater.create_new_note_from_template(file,null,"A",true);
    });
    return btn;
}

buttonMaker();

//FakeTem.md
dv.el("b",path)
//<t>
dv.el("b",file)

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by Another5405
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant