diff --git a/src/app/features/project-editor/facade/project-editor.facade.ts b/src/app/features/project-editor/facade/project-editor.facade.ts index 72d27dc..0e975d7 100644 --- a/src/app/features/project-editor/facade/project-editor.facade.ts +++ b/src/app/features/project-editor/facade/project-editor.facade.ts @@ -292,10 +292,18 @@ export class ProjectEditorFacade { return current ? this.ioService.exportBootstrap(current) : ''; } + /** + * Replaces the whole draft with an imported bootstrap. Routed through + * updateBootstrap() (not a direct state.update) so an import gets the same + * undo-history entry and draftStorage persistence as any other edit - + * otherwise the import "worked" on screen but silently wasn't saved to the + * localStorage draft, and Undo couldn't step back through it. + */ importBootstrap(raw: string): void { try { const imported = this.normalize(this.ioService.importBootstrap(raw)); - this.state.update(current => ({ ...current, bootstrap: imported, importError: null })); + this.state.update(current => ({ ...current, importError: null })); + this.updateBootstrap(() => imported); } catch { this.state.update(current => ({ ...current, importError: 'builder.importError' })); }