Skip to content

Commit

Permalink
release(setting): v1.0.1
Browse files Browse the repository at this point in the history
  • Loading branch information
surunzi committed Apr 20, 2024
1 parent fe1b310 commit f7e9fde
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 2 deletions.
2 changes: 1 addition & 1 deletion index.json
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,7 @@
"setting": {
"install": true,
"react": true,
"version": "1.0.0",
"version": "1.0.1",
"style": true,
"icon": false,
"test": true,
Expand Down
4 changes: 4 additions & 0 deletions src/setting/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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
4 changes: 4 additions & 0 deletions src/setting/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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', '')
Expand Down
2 changes: 1 addition & 1 deletion src/setting/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "setting",
"version": "1.0.0",
"version": "1.0.1",
"description": "Settings panel",
"dependencies": {
"micromark": "^3.1.0"
Expand Down
6 changes: 6 additions & 0 deletions src/setting/react.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -298,6 +298,12 @@ export const LunaSettingInput: FC<ISettingTextProps> = (props) => {
setDisabled(settingInput.current, props.disabled)
}, [props.disabled])

useEffect(() => {
if (settingInput.current) {
settingInput.current.setValue(props.value)
}
}, [props.value])

return null
}

Expand Down

0 comments on commit f7e9fde

Please sign in to comment.