Fixes #359
This commit is contained in:
parent
ece92ccf08
commit
df38a43a1e
@ -50,6 +50,22 @@ export async function instantiateTemplateCommand() {
|
|||||||
if (!pageName) {
|
if (!pageName) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
// Fails if doesn't exist
|
||||||
|
space.getPageMeta(pageName);
|
||||||
|
// So, page exists, let's warn
|
||||||
|
if (
|
||||||
|
!await editor.confirm(
|
||||||
|
`Page ${pageName} already exists, are you sure you want to override it?`,
|
||||||
|
)
|
||||||
|
) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
} catch {
|
||||||
|
// The preferred scenario, let's keep going
|
||||||
|
}
|
||||||
|
|
||||||
const pageText = replaceTemplateVars(renderToText(parseTree), pageName);
|
const pageText = replaceTemplateVars(renderToText(parseTree), pageName);
|
||||||
await space.writePage(pageName, pageText);
|
await space.writePage(pageName, pageText);
|
||||||
await editor.navigate(pageName);
|
await editor.navigate(pageName);
|
||||||
|
Loading…
Reference in New Issue
Block a user