Skip to content

Take control over your live stream video by running it yourself. Streaming + chat out of the box.

add emoji to the caret position (#1253)

Meisame4fd2397328d
diff --git a/webroot/js/components/chat/chat-input.js b/webroot/js/components/chat/chat-input.js
index 89952333b6..2587085620 100644
--- a/webroot/js/components/chat/chat-input.js
+++ b/webroot/js/components/chat/chat-input.js
@@ -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