Start fixing MDI
This commit is contained in:
@@ -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() {
|
||||
|
||||
Reference in New Issue
Block a user