Adds error handling for font settings initialization
Implements error handling for font settings creation to ensure fallback to default fonts if loading fails. Reorders font size settings setup to follow font dropdowns for logical flow. Enhances robustness and improves user settings experience.
This commit is contained in:
1 file changed
+9
-3
@@ -17,9 +17,12 @@ export class TypographySection implements ModalSection {
|
|||||||
.setName('Typography')
|
.setName('Typography')
|
||||||
.setHeading();
|
.setHeading();
|
||||||
|
|
||||||
// Create font settings asynchronously
|
// Create font settings asynchronously with explicit error handling
|
||||||
void this.createFontSettings(state);
|
// Font size settings are created after font dropdowns to preserve logical ordering
|
||||||
this.createFontSizeSettings(state);
|
this.createFontSettings(state).catch(error => {
|
||||||
|
console.error('Failed to create font settings:', error);
|
||||||
|
// Font settings will fall back to default fonts if this fails
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private async createFontSettings(state: ModalState): Promise<void> {
|
private async createFontSettings(state: ModalState): Promise<void> {
|
||||||
@@ -102,6 +105,9 @@ export class TypographySection implements ModalSection {
|
|||||||
state.updateTemplateVariables({ monospaceFont: value });
|
state.updateTemplateVariables({ monospaceFont: value });
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// Create font size settings after font dropdowns for logical ordering
|
||||||
|
this.createFontSizeSettings(state);
|
||||||
}
|
}
|
||||||
|
|
||||||
private createFontSizeSettings(state: ModalState): void {
|
private createFontSizeSettings(state: ModalState): void {
|
||||||
|
|||||||
Reference in new issue
Block a user