mirror of
https://github.com/owncast/owncast.git
synced 2024-11-28 11:09:01 +03:00
add emoji to the caret position (#1253)
This commit is contained in:
parent
93f682d526
commit
7526b5305c
1 changed files with 6 additions and 2 deletions
|
@ -123,10 +123,14 @@ export default class ChatInput extends Component {
|
|||
content = emoji.emoji;
|
||||
}
|
||||
|
||||
const newHTML = inputHTML + content;
|
||||
const position = getCaretPosition(this.formMessageInput.current);
|
||||
const newHTML = inputHTML.substring(0, position) +
|
||||
content +
|
||||
inputHTML.substring(position);
|
||||
|
||||
const charsLeft = this.calculateCurrentBytesLeft(newHTML);
|
||||
this.setState({
|
||||
inputHTML: inputHTML + content,
|
||||
inputHTML: newHTML,
|
||||
inputCharsLeft: charsLeft,
|
||||
});
|
||||
// a hacky way add focus back into input field
|
||||
|
|
Loading…
Reference in a new issue