Allow universe renaming
This commit is contained in:
@ -263,7 +263,7 @@ export const initializeSelectedUniverse = (app: Editor): void => {
|
||||
app.universes[app.selected_universe] = structuredClone(template_universe);
|
||||
}
|
||||
}
|
||||
app.interface.universe_viewer.innerHTML = `Topos: ${app.selected_universe}`;
|
||||
app.interface.universe_viewer.placeholder! = `${app.selected_universe}`;
|
||||
};
|
||||
|
||||
export const emptyUrl = () => {
|
||||
@ -334,7 +334,7 @@ export const loadUniverse = (
|
||||
// Updating references to the currently selected universe
|
||||
app.settings.selected_universe = selectedUniverse;
|
||||
app.selected_universe = selectedUniverse;
|
||||
app.interface.universe_viewer.innerHTML = `Topos: ${selectedUniverse}`;
|
||||
app.interface.universe_viewer.placeholder! = `${selectedUniverse}`;
|
||||
// Updating the editor View to reflect the selected universe
|
||||
app.updateEditorView();
|
||||
// Evaluating the initialisation script for the selected universe
|
||||
|
||||
@ -116,6 +116,20 @@ export const installInterfaceLogic = (app: Editor) => {
|
||||
}
|
||||
});
|
||||
|
||||
app.interface.universe_viewer.addEventListener("input", () => {
|
||||
let content = app.interface.universe_viewer.value as string;
|
||||
content = content.trim();
|
||||
if (content.length > 2 && content.length < 40) {
|
||||
if (content !== app.selected_universe) {
|
||||
Object.defineProperty(app.universes, content,
|
||||
Object.getOwnPropertyDescriptor(app.universes, app.selected_universe));
|
||||
delete app.universes[app.selected_universe];
|
||||
}
|
||||
app.selected_universe = content.trim();
|
||||
loadUniverse(app, app.selected_universe)
|
||||
}
|
||||
})
|
||||
|
||||
app.interface.audio_nudge_range.addEventListener("input", () => {
|
||||
app.clock.nudge = parseInt(
|
||||
(app.interface.audio_nudge_range as HTMLInputElement).value
|
||||
|
||||
Reference in New Issue
Block a user