Fixes snippets not working in unsaved page
This commit is contained in:
parent
b39ba3585a
commit
5b620b2dcc
@ -221,7 +221,17 @@ export async function weeklyNoteCommand() {
|
|||||||
export async function insertTemplateText(cmdDef: any) {
|
export async function insertTemplateText(cmdDef: any) {
|
||||||
const cursorPos = await editor.getCursor();
|
const cursorPos = await editor.getCursor();
|
||||||
const page = await editor.getCurrentPage();
|
const page = await editor.getCurrentPage();
|
||||||
const pageMeta = await space.getPageMeta(page);
|
let pageMeta: PageMeta | undefined;
|
||||||
|
try {
|
||||||
|
pageMeta = await space.getPageMeta(page);
|
||||||
|
} catch {
|
||||||
|
// Likely page not yet created
|
||||||
|
pageMeta = {
|
||||||
|
name: page,
|
||||||
|
lastModified: -1,
|
||||||
|
perm: "rw",
|
||||||
|
};
|
||||||
|
}
|
||||||
let templateText: string = cmdDef.value;
|
let templateText: string = cmdDef.value;
|
||||||
const carretPos = templateText.indexOf("|^|");
|
const carretPos = templateText.indexOf("|^|");
|
||||||
templateText = templateText.replace("|^|", "");
|
templateText = templateText.replace("|^|", "");
|
||||||
|
Loading…
Reference in New Issue
Block a user