diff --git a/index.json b/index.json index 4541dca..ed92ac5 100644 --- a/index.json +++ b/index.json @@ -299,7 +299,7 @@ "setting": { "install": true, "react": true, - "version": "1.0.0", + "version": "1.0.1", "style": true, "icon": false, "test": true, diff --git a/src/setting/CHANGELOG.md b/src/setting/CHANGELOG.md index 872ffde..c3b420a 100644 --- a/src/setting/CHANGELOG.md +++ b/src/setting/CHANGELOG.md @@ -1,3 +1,7 @@ +## 1.0.1 (20 Apr 2024) + +* fix: react input value + ## 1.0.0 (18 Dec 2023) * chore: rename setting text to input \ No newline at end of file diff --git a/src/setting/index.ts b/src/setting/index.ts index 014d52d..a971336 100644 --- a/src/setting/index.ts +++ b/src/setting/index.ts @@ -391,6 +391,10 @@ export class LunaSettingInput extends LunaSettingItem { $input.on('change', () => this.onChange($input.val())) this.$input = $input } + setValue(value: string) { + this.$input.val(value) + this.value = value + } disable() { super.disable() this.$input.attr('disabled', '') diff --git a/src/setting/package.json b/src/setting/package.json index 87b9020..1686030 100644 --- a/src/setting/package.json +++ b/src/setting/package.json @@ -1,6 +1,6 @@ { "name": "setting", - "version": "1.0.0", + "version": "1.0.1", "description": "Settings panel", "dependencies": { "micromark": "^3.1.0" diff --git a/src/setting/react.tsx b/src/setting/react.tsx index 7d828bc..2d83c59 100644 --- a/src/setting/react.tsx +++ b/src/setting/react.tsx @@ -298,6 +298,12 @@ export const LunaSettingInput: FC = (props) => { setDisabled(settingInput.current, props.disabled) }, [props.disabled]) + useEffect(() => { + if (settingInput.current) { + settingInput.current.setValue(props.value) + } + }, [props.value]) + return null }