feat: simplify chord guide feature; updated help doc; added hotkeys doc
This commit is contained in:
@@ -65,6 +65,7 @@ interface AppConfig {
|
||||
};
|
||||
piano_roll: {
|
||||
switch: string;
|
||||
switch_voicing: string;
|
||||
select: string;
|
||||
pencil: string;
|
||||
hold_to_create_note: string;
|
||||
@@ -106,6 +107,13 @@ interface AppConfig {
|
||||
[key: string]: unknown;
|
||||
}
|
||||
|
||||
export function enforceDefaultHotkeysForAppConfig(config: AppConfig, defaultConfig: AppConfig): AppConfig {
|
||||
return {
|
||||
...config,
|
||||
hotkeys: defaultConfig.hotkeys,
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* ConfigManager - Manages application configuration with IndexedDB persistence
|
||||
* Implements the singleton pattern for global access
|
||||
@@ -162,6 +170,7 @@ export class ConfigManager {
|
||||
|
||||
// Merge with default config (saved config overrides defaults)
|
||||
this.config = this.mergeConfigs(this.defaultConfig!, savedConfig);
|
||||
this.config = enforceDefaultHotkeysForAppConfig(this.config, this.defaultConfig!);
|
||||
|
||||
this.isInitialized = true;
|
||||
console.log('ConfigManager initialized successfully with config:', this.config);
|
||||
@@ -253,7 +262,8 @@ export class ConfigManager {
|
||||
merge_regions: 'ctrl+j'
|
||||
},
|
||||
piano_roll: {
|
||||
switch: 'tab',
|
||||
switch: 'g',
|
||||
switch_voicing: 'shift+tab',
|
||||
select: 'q',
|
||||
pencil: 'w',
|
||||
hold_to_create_note: 'ctrl',
|
||||
@@ -329,9 +339,10 @@ export class ConfigManager {
|
||||
try {
|
||||
const shouldSanitize = !this.isRunningOnLocalhost() &&
|
||||
!this.config.general.persist_api_keys_non_localhost;
|
||||
const configToPersist = shouldSanitize
|
||||
const baseConfigToPersist = shouldSanitize
|
||||
? this.getSanitizedConfigForStorage()
|
||||
: this.config;
|
||||
const configToPersist = this.removeHotkeysFromConfigForStorage(baseConfigToPersist);
|
||||
|
||||
await this.storage.save(
|
||||
ConfigManager.CONFIG_KEY,
|
||||
@@ -475,6 +486,11 @@ export class ConfigManager {
|
||||
return { ...this.config };
|
||||
}
|
||||
|
||||
private removeHotkeysFromConfigForStorage(config: AppConfig): AppConfig {
|
||||
const { hotkeys: _hotkeys, ...configWithoutHotkeys } = config;
|
||||
return configWithoutHotkeys as AppConfig;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a value from an object using dot notation
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user