fix: read preferences value from state
This commit is contained in:
@@ -951,7 +951,7 @@ class EditorViewCtrl extends PureViewCtrl implements EditorViewScope {
|
|||||||
this.application.getPrefsService().syncUserPreferences();
|
this.application.getPrefsService().syncUserPreferences();
|
||||||
}
|
}
|
||||||
|
|
||||||
reloadPreferences() {
|
async reloadPreferences() {
|
||||||
const monospaceEnabled = this.application.getPrefsService().getValue(
|
const monospaceEnabled = this.application.getPrefsService().getValue(
|
||||||
WebPrefKey.EditorMonospaceEnabled,
|
WebPrefKey.EditorMonospaceEnabled,
|
||||||
true
|
true
|
||||||
@@ -964,7 +964,7 @@ class EditorViewCtrl extends PureViewCtrl implements EditorViewScope {
|
|||||||
WebPrefKey.EditorResizersEnabled,
|
WebPrefKey.EditorResizersEnabled,
|
||||||
true
|
true
|
||||||
);
|
);
|
||||||
this.setEditorState({
|
await this.setEditorState({
|
||||||
monospaceEnabled,
|
monospaceEnabled,
|
||||||
spellcheck,
|
spellcheck,
|
||||||
marginResizersEnabled
|
marginResizersEnabled
|
||||||
@@ -1020,12 +1020,15 @@ class EditorViewCtrl extends PureViewCtrl implements EditorViewScope {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async toggleWebPrefKey(key: WebPrefKey) {
|
async toggleWebPrefKey(key: WebPrefKey) {
|
||||||
(this as any)[key] = !(this as any)[key];
|
const currentValue = this.state[key];
|
||||||
this.application.getPrefsService().setUserPrefValue(
|
await this.application.getPrefsService().setUserPrefValue(
|
||||||
key,
|
key,
|
||||||
(this as any)[key],
|
!currentValue,
|
||||||
true
|
true
|
||||||
);
|
);
|
||||||
|
await this.setEditorState({
|
||||||
|
[key]: !currentValue
|
||||||
|
})
|
||||||
this.reloadFont();
|
this.reloadFont();
|
||||||
|
|
||||||
if (key === WebPrefKey.EditorSpellcheck) {
|
if (key === WebPrefKey.EditorSpellcheck) {
|
||||||
@@ -1033,7 +1036,7 @@ class EditorViewCtrl extends PureViewCtrl implements EditorViewScope {
|
|||||||
await this.setEditorState({ textareaUnloading: false });
|
await this.setEditorState({ textareaUnloading: false });
|
||||||
this.setEditorState({ textareaUnloading: true });
|
this.setEditorState({ textareaUnloading: true });
|
||||||
this.reloadFont();
|
this.reloadFont();
|
||||||
} else if (key === WebPrefKey.EditorResizersEnabled && (this as any)[key] === true) {
|
} else if (key === WebPrefKey.EditorResizersEnabled && this.state[key] === true) {
|
||||||
this.$timeout(() => {
|
this.$timeout(() => {
|
||||||
this.leftPanelPuppet!.flash!();
|
this.leftPanelPuppet!.flash!();
|
||||||
this.rightPanelPuppet!.flash!();
|
this.rightPanelPuppet!.flash!();
|
||||||
|
|||||||
Reference in New Issue
Block a user