mirror of
https://github.com/alexmickelson/canvasManagement.git
synced 2026-03-26 07:38:33 -06:00
renaming pages also a thing
This commit is contained in:
@@ -65,7 +65,7 @@ const getItem = async <T extends CourseItemType>(
|
||||
) as CourseItemReturnType<T>;
|
||||
} else if (type === "Page") {
|
||||
return localPageMarkdownUtils.parseMarkdown(
|
||||
rawFile
|
||||
rawFile, name
|
||||
) as CourseItemReturnType<T>;
|
||||
}
|
||||
|
||||
|
||||
@@ -37,25 +37,12 @@ export const pageFileStorageService = {
|
||||
courseName,
|
||||
moduleName,
|
||||
"pages",
|
||||
page.name + ".md"
|
||||
pageName + ".md"
|
||||
);
|
||||
|
||||
const pageMarkdown = localPageMarkdownUtils.toMarkdown(page);
|
||||
console.log(`Saving page ${filePath}`);
|
||||
await fs.writeFile(filePath, pageMarkdown);
|
||||
|
||||
const pageNameIsChanged = pageName !== page.name;
|
||||
if (pageNameIsChanged) {
|
||||
console.log("removing old page after name change " + pageName);
|
||||
const oldFilePath = path.join(
|
||||
basePath,
|
||||
courseName,
|
||||
moduleName,
|
||||
"pages",
|
||||
pageName + ".md"
|
||||
);
|
||||
await fs.unlink(oldFilePath);
|
||||
}
|
||||
},
|
||||
async delete({
|
||||
courseName,
|
||||
|
||||
Reference in New Issue
Block a user