From 1e0aa396770b480e54243265c24fa50a00debca2 Mon Sep 17 00:00:00 2001 From: Raphael Forment Date: Sun, 27 Aug 2023 23:59:31 +0200 Subject: [PATCH] improving universe switching interface --- src/API.ts | 2 +- src/main.ts | 31 ++++++++++++++++--------------- 2 files changed, 17 insertions(+), 16 deletions(-) diff --git a/src/API.ts b/src/API.ts index dc9ca6c..504738b 100644 --- a/src/API.ts +++ b/src/API.ts @@ -66,7 +66,7 @@ export class UserAPI { this.app.universes, this.app.settings ); - this.app.openBuffersModal(); + this.app.updateKnownUniversesView(); } _playDocExample = (code?: string) => { diff --git a/src/main.ts b/src/main.ts index f39fff9..a13517c 100644 --- a/src/main.ts +++ b/src/main.ts @@ -241,9 +241,6 @@ export class Editor { // ================================================================================ // Building the documentation - // loadSamples().then(() => { - // this.docs = documentation_factory(this); - // }); let pre_loading = async () => { await loadSamples(); }; pre_loading(); this.docs = documentation_factory(this); @@ -311,18 +308,7 @@ export class Editor { // This is the modal to switch between universes if (event.ctrlKey && event.key === "b") { this.hideDocumentation(); - let existing_universes = document.getElementById("existing-universes"); - let known_universes = Object.keys(this.universes); - let final_html = ""; - existing_universes!.innerHTML = final_html; + this.updateKnownUniversesView(); this.openBuffersModal(); } @@ -668,6 +654,21 @@ export class Editor { return JSON.parse(hash); }; + updateKnownUniversesView = () => { + let existing_universes = document.getElementById("existing-universes"); + let known_universes = Object.keys(this.universes); + let final_html = ""; + existing_universes!.innerHTML = final_html; + } + share() { const hashed_table = btoa( JSON.stringify({