Skip to content

Commit

Permalink
fix: 配置无效
Browse files Browse the repository at this point in the history
  • Loading branch information
maotoumao committed Nov 3, 2024
1 parent 8134643 commit 636e17f
Show file tree
Hide file tree
Showing 7 changed files with 13 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,9 @@ export default function CheckBoxSettingItem<T extends keyof IAppConfig>(
title={label}
role="button"
onClick={() => {
const event = new Event("ConfigChanged", {});
const event = new Event("ConfigChanged", {
cancelable: true
});
if (onChange) {
onChange(event, !checked);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ export default function FontPickerSettingItem<T extends keyof IAppConfig>(
onChange={(event, newValue) => {
// 字体不可序列化 不知道为啥 json.stringify是空对象
event.preventDefault();
console.log(event.defaultPrevented, "Prev");
AppConfig.setConfig({
[keyPath]: {
family: (newValue as FontData).family,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,9 @@ export default function InputSettingItem<T extends keyof IAppConfig>(
if (tmpValue === null) {
return;
}
const event = new Event("ConfigChanged");
const event = new Event("ConfigChanged", {
cancelable: true
});

if (onChange) {
onChange(event, tmpValue as any);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,9 @@ export default function ListBoxSettingItem<T extends keyof IAppConfig>(
value={value}
onChange={
(newVal) => {
const event = new Event("ConfigChanged", {});
const event = new Event("ConfigChanged", {
cancelable: true
});
if (onChange) {
onChange(event, newVal);
}
Expand Down
1 change: 1 addition & 0 deletions src/shared/app-config/default-app-config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import {defaultFont} from "@/common/constant";
import {IAppConfig} from "@/types/app-config";

const _defaultAppConfig: IAppConfig = {
"$schema-version": 1,
"playMusic.whenQualityMissing": "lower",
"playMusic.defaultQuality": "standard",
"playMusic.clickMusicList": "replace",
Expand Down
1 change: 1 addition & 0 deletions src/shared/app-config/renderer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ class AppConfig {
}

public setConfig(data: IAppConfig) {
console.log("set!", data);
mod.setConfig(data);
}

Expand Down
1 change: 1 addition & 0 deletions src/types/app-config.d.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
interface _IAppConfig {
"$schema-version": number;
"normal.closeBehavior": "exit_app" | "minimize";
"normal.maxHistoryLength": number;
"normal.checkUpdate": boolean;
Expand Down

0 comments on commit 636e17f

Please sign in to comment.