Action to dictate text to the same draft

Something along these lines should do it. This will prompt for dictation, and then append to the end of the current draft with a timestamp and the dictated text. It utilized template tags. The template variable can be edited to change the format of the appended element.

// define a template
let template = `
# [[time]]
[[dictated-text]]
`;

// dictate
var s = editor.dictate();
if (s.length > 0) {
    draft.setTemplateTag("dictated-text", s);
    draft.content = draft.content + draft.processTemplate(template);
    draft.update();
}
1 Like