Start fixing MDI

This commit is contained in:
2025-04-22 13:54:57 +02:00
parent 792272a478
commit f3b508c9f7
8 changed files with 461 additions and 228 deletions
+41 -10
View File
@@ -8,17 +8,48 @@
export let profile: MudProfile;
export let isNewProfile = false;
// Local state
let localProfile = { ...profile };
let autoLogin = { ...localProfile.autoLogin || { enabled: false, username: '', password: '', commands: [] } };
// Initialize with defaults first, then merge with provided profile
let defaultProfile = {
id: isNewProfile ? `profile-${Date.now()}-${Math.random().toString(36).substring(2, 9)}` : (profile?.id || ''),
name: 'New Profile',
host: 'mud.example.com',
port: 23,
useSSL: false,
ansiColor: true,
autoLogin: {
enabled: false,
username: '',
password: '',
commands: []
},
accessibilityOptions: {
textToSpeech: false,
highContrast: false,
speechRate: 1,
speechPitch: 1,
speechVolume: 1
},
font: 'monospace',
fontSize: 14,
theme: 'dark'
};
// Local state - merge default with provided profile
let localProfile = { ...defaultProfile, ...profile };
console.log('Initialized profile editor with:', localProfile);
// Extract nested objects for easier binding
let autoLogin = {
...defaultProfile.autoLogin,
...(localProfile.autoLogin || {})
};
let newCommand = '';
let accessibilityOptions = { ...localProfile.accessibilityOptions || {
textToSpeech: false,
highContrast: false,
speechRate: 1,
speechPitch: 1,
speechVolume: 1
}};
let accessibilityOptions = {
...defaultProfile.accessibilityOptions,
...(localProfile.accessibilityOptions || {})
};
// Handle form submission
function handleSubmit() {