feat: persist line wrap setting (#3647)
Co-authored-by: jamesgeorge007 <jamesgeorge998001@gmail.com>
This commit is contained in:
@@ -13,7 +13,36 @@ export function useSetting<K extends keyof SettingsDef>(
|
||||
settingsStore.dispatch({
|
||||
dispatcher: "applySetting",
|
||||
payload: {
|
||||
// @ts-expect-error TS is not able to understand the type semantics here
|
||||
settingKey,
|
||||
// @ts-expect-error TS is not able to understand the type semantics here
|
||||
value,
|
||||
},
|
||||
})
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
export function useNestedSetting<
|
||||
K extends keyof SettingsDef,
|
||||
P extends keyof SettingsDef[K],
|
||||
>(settingKey: K, property: P): Ref<SettingsDef[K][P]> {
|
||||
return useStream(
|
||||
settingsStore.subject$.pipe(
|
||||
pluck(settingKey),
|
||||
pluck(property),
|
||||
distinctUntilChanged()
|
||||
),
|
||||
settingsStore.value[settingKey][property],
|
||||
(value: SettingsDef[K][P]) => {
|
||||
settingsStore.dispatch({
|
||||
dispatcher: "applyNestedSetting",
|
||||
payload: {
|
||||
// @ts-expect-error TS is not able to understand the type semantics here
|
||||
settingKey,
|
||||
// @ts-expect-error TS is not able to understand the type semantics here
|
||||
property,
|
||||
// @ts-expect-error TS is not able to understand the type semantics here
|
||||
value,
|
||||
},
|
||||
})
|
||||
@@ -35,7 +64,9 @@ export function useSettingStatic<K extends keyof SettingsDef>(
|
||||
settingsStore.dispatch({
|
||||
dispatcher: "applySetting",
|
||||
payload: {
|
||||
// @ts-expect-error TS is not able to understand the type semantics here
|
||||
settingKey,
|
||||
// @ts-expect-error TS is not able to understand the type semantics here
|
||||
value,
|
||||
},
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user