Skip to content

Commit 4226aa1

Browse files
committed
fix: custom padding and merge edges initial values reset
1 parent 00d134c commit 4226aa1

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/lib/components/preferences/items/ImagePadding.tsx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ const useStyles = makeStyles(({ spacing }: Theme) => ({
2727
const ImagePadding: React.FC<InputProps> = (props) => {
2828
const classes = useStyles()
2929
const values = (props.value as string).split(' ') ?? []
30+
const initialValues = React.useRef<Array<string>>(values).current
3031
const handleChange = (index: number) => (value: any = '0px') => {
3132
const newValues = [...values]
3233
newValues[index] = value
@@ -43,7 +44,11 @@ const ImagePadding: React.FC<InputProps> = (props) => {
4344
props.onChange('0px')
4445
break
4546
default:
46-
props.onChange('0px 0px 0px 0px')
47+
if (initialValues.length > 1) {
48+
props.onChange(initialValues.join(' '))
49+
} else {
50+
props.onChange('0px 0px 0px 0px')
51+
}
4752
}
4853
}
4954
return (

0 commit comments

Comments
 (0)