feat: added save as option when renaming the project

This commit is contained in:
Xiaohan-Tian
2026-05-10 13:25:12 -07:00
parent 578be7b726
commit 8fa2c16395
5 changed files with 115 additions and 23 deletions
+14
View File
@@ -371,6 +371,20 @@ export class KGProjectStorage {
}
}
/**
* Save the current in-memory project under a new name without removing the source folder.
* Used for "Save as Copy": the original project remains intact in OPFS.
*/
public async saveAs(sourceName: string, targetName: string, data: KGProject): Promise<void> {
this.ensureInitialized();
await this.save(targetName, data, false);
if (await this.exists(sourceName)) {
await this.copyMediaFiles(sourceName, targetName);
}
}
/**
* Export a project folder as a zip Blob (.kgstudio bundle).
* Includes project.json, meta.json, and all files in media/.