select template when creating note, closes #2813

This commit is contained in:
zadam
2022-06-02 14:16:49 +02:00
parent b204014a11
commit 93f0596b16
12 changed files with 214 additions and 47 deletions

View File

@@ -75,6 +75,20 @@ async function createNote(parentNotePath, options = {}) {
};
}
async function createNoteWithTypePrompt(parentNotePath, options = {}) {
const noteTypeChooserDialog = await import('../dialogs/note_type_chooser.js');
const {success, noteType, templateNoteId} = await noteTypeChooserDialog.chooseNoteType();
if (!success) {
return;
}
options.type = noteType;
options.templateNoteId = templateNoteId;
return await createNote(parentNotePath, options);
}
/* If first element is heading, parse it out and use it as a new heading. */
function parseSelectedHtml(selectedHtml) {
const dom = $.parseHTML(selectedHtml);
@@ -106,5 +120,6 @@ async function duplicateSubtree(noteId, parentNotePath) {
export default {
createNote,
createNoteWithTypePrompt,
duplicateSubtree
};