1
0
mirror of https://github.com/tooot-app/app synced 2025-06-05 22:19:13 +02:00

Fix details

This commit is contained in:
Zhiyuan Zheng
2021-05-11 21:38:48 +02:00
parent 7ffc0c7dc6
commit bfa821a36d
13 changed files with 234 additions and 186 deletions

View File

@ -86,6 +86,7 @@ export interface Props {
start: number
end: number
}>
maxLength?: number
}
const ComponentEmojis: React.FC<Props> = ({
@ -93,6 +94,7 @@ const ComponentEmojis: React.FC<Props> = ({
value,
setValue,
selectionRange,
maxLength,
children
}) => {
const { reduceMotionEnabled } = useAccessibility()
@ -125,9 +127,13 @@ const ComponentEmojis: React.FC<Props> = ({
const newTextWithSpace = ` ${emojiShortcode}${
whiteSpaceRear ? '' : ' '
}`
setValue([contentFront, newTextWithSpace, contentRear].join(''))
setValue(
[contentFront, newTextWithSpace, contentRear]
.join('')
.slice(0, maxLength)
)
} else {
setValue(`${emojiShortcode} `)
setValue(`${emojiShortcode} `.slice(0, maxLength))
}
},
[value, selectionRange.current?.start, selectionRange.current?.end]