mirror of
https://github.com/ragestudio/comty.git
synced 2025-06-10 02:54:15 +00:00
avoid to input whitespace or spaces on first input
This commit is contained in:
parent
f3239a6629
commit
c42607eee6
@ -33,6 +33,11 @@ export default (props) => {
|
|||||||
return setValue(null)
|
return setValue(null)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// if post only have whitespaces, dont allow to submit
|
||||||
|
if (e.target.value.trim() === "") {
|
||||||
|
return setValue("")
|
||||||
|
}
|
||||||
|
|
||||||
return setValue(String(e.target.value))
|
return setValue(String(e.target.value))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -144,6 +144,11 @@ export default (props) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const onChangeMessageInput = (event) => {
|
const onChangeMessageInput = (event) => {
|
||||||
|
// if the fist character is a space or a whitespace remove it
|
||||||
|
if (event.target.value[0] === " " || event.target.value[0] === "\n") {
|
||||||
|
event.target.value = event.target.value.slice(1)
|
||||||
|
}
|
||||||
|
|
||||||
updatePostData({
|
updatePostData({
|
||||||
message: event.target.value
|
message: event.target.value
|
||||||
})
|
})
|
||||||
|
Loading…
x
Reference in New Issue
Block a user