fix: reserve Untitled Project name; rename project will trigger save immidiatly.

This commit is contained in:
Xiaohan-Tian
2026-04-16 20:24:43 -07:00
parent 3010cf4e2d
commit 24ffaa76f6
5 changed files with 79 additions and 11 deletions
+2 -2
View File
@@ -351,11 +351,11 @@ export class KGProjectStorage {
* Used when the user renames the project and saves. Handles the case where the
* old folder doesn't exist yet (new project never saved).
*/
public async saveWithRename(oldName: string, newName: string, data: KGProject): Promise<void> {
public async saveWithRename(oldName: string, newName: string, data: KGProject, overwrite: boolean = false): Promise<void> {
this.ensureInitialized();
// Save project JSON to the new folder
await this.save(newName, data, false);
await this.save(newName, data, overwrite);
// Migrate media files only if the old folder exists
if (await this.exists(oldName)) {