From 2b5bbdcd56edb639442b25074d96936e1a4fe42e Mon Sep 17 00:00:00 2001 From: Raphael Forment Date: Sun, 27 Aug 2023 17:49:45 +0200 Subject: [PATCH 1/2] fix bug with universe switch --- src/main.ts | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/main.ts b/src/main.ts index ed099e4..47845db 100644 --- a/src/main.ts +++ b/src/main.ts @@ -1,6 +1,5 @@ import { uniqueNamesGenerator, - adjectives, colors, animals, } from "unique-names-generator"; @@ -629,7 +628,8 @@ export class Editor { if (universeParam !== null) { new_universe = JSON.parse(atob(universeParam)); const randomName: string = uniqueNamesGenerator({ - dictionaries: [adjectives, colors, animals], + length: 2, separator: '', + dictionaries: [colors, animals], }); this.loadUniverse(randomName, new_universe["universe"]); this.emptyUrl(); @@ -940,7 +940,6 @@ export class Editor { // @ts-ignore document.getElementById("buffer-search")!.value = ""; document.getElementById("editor")!.classList.remove("invisible"); - document.getElementById("modal")!.classList.add("invisible"); document.getElementById("modal-buffers")!.classList.add("invisible"); } From 3cd115c488183ca5780c869b3e4c17f71ab24bb4 Mon Sep 17 00:00:00 2001 From: Raphael Forment Date: Sun, 27 Aug 2023 17:53:11 +0200 Subject: [PATCH 2/2] fix broken universe switching logic --- src/API.ts | 4 ++++ src/universes/tutorial.ts | 14 +------------- 2 files changed, 5 insertions(+), 13 deletions(-) diff --git a/src/API.ts b/src/API.ts index b41d29e..40222bf 100644 --- a/src/API.ts +++ b/src/API.ts @@ -62,6 +62,10 @@ export class UserAPI { _deleteUniverseFromInterface = (universe: string) => { delete this.app.universes[universe]; + this.app.settings.saveApplicationToLocalStorage( + this.app.universes, + this.app.settings + ); this.app.openBuffersModal(); } diff --git a/src/universes/tutorial.ts b/src/universes/tutorial.ts index e2a1c94..6fe423c 100644 --- a/src/universes/tutorial.ts +++ b/src/universes/tutorial.ts @@ -1,22 +1,10 @@ const global_text =` -// Global buffer: a central buffer to command them all. -// ==================================================== -// The global buffer is a special buffer used to control -// the general behavior of your universe. It is meant to -// be used as a "control room" for your universe. You can -// make use of several commands to control the execution -// flow of all the files: -// - script(universe/universes: number): run script(s) ` const local_buffer =` -// Local buffer: nine buffers to write your algorithms. ` const init_buffer=` -// Init buffer: a buffer to initialize the universe. -// This universe is runned once when the universe is -// loaded! ` const note_buffer='// Notes buffer: a buffer to write your notes.' @@ -36,4 +24,4 @@ export const tutorial_universe = { }, init: { candidate: init_buffer, committed: init_buffer, evaluations: 0 }, notes: { candidate: note_buffer }, -} \ No newline at end of file +}