|
|
|
@ -17,6 +17,8 @@ import { getApplicationSettingById } from "../profile/application_settings";
|
|
|
|
|
import { FormElementInput } from "../core/modal_dialog_forms";
|
|
|
|
|
import { DialogWithForm } from "../core/modal_dialog_elements";
|
|
|
|
|
|
|
|
|
|
const trim = require("trim");
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @typedef {import("../savegame/savegame_typedefs").SavegameMetadata} SavegameMetadata
|
|
|
|
|
* @typedef {import("../profile/setting_types").EnumSetting} EnumSetting
|
|
|
|
@ -436,7 +438,7 @@ export class MainMenuState extends GameState {
|
|
|
|
|
label: null,
|
|
|
|
|
placeholder: "",
|
|
|
|
|
defaultValue: game.name || "",
|
|
|
|
|
validator: val => val.match(regex),
|
|
|
|
|
validator: val => val.match(regex) && trim(val).length > 0,
|
|
|
|
|
});
|
|
|
|
|
const dialog = new DialogWithForm({
|
|
|
|
|
app: this.app,
|
|
|
|
@ -449,7 +451,7 @@ export class MainMenuState extends GameState {
|
|
|
|
|
|
|
|
|
|
// When confirmed, save the name
|
|
|
|
|
dialog.buttonSignals.ok.add(() => {
|
|
|
|
|
game.name = nameInput.getValue();
|
|
|
|
|
game.name = trim(nameInput.getValue());
|
|
|
|
|
this.app.savegameMgr.writeAsync();
|
|
|
|
|
this.renderSavegames();
|
|
|
|
|
});
|
|
|
|
|