Skip to content

Commit

Permalink
Merge branch 'develop' into feat/reaction-feature
Browse files Browse the repository at this point in the history
  • Loading branch information
abirc8010 authored Jan 11, 2025
2 parents 06e7439 + 8f3bb40 commit 489f540
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions packages/react/src/views/ChatInput/ChatInput.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ import useShowCommands from '../../hooks/useShowCommands';
import useSearchMentionUser from '../../hooks/useSearchMentionUser';
import formatSelection from '../../lib/formatSelection';
import { parseEmoji } from '../../lib/emoji';
import { Markdown } from '../Markdown';

const ChatInput = ({ scrollToBottom }) => {
const { styleOverrides, classNames } = useComponentOverrides('ChatInput');
Expand Down Expand Up @@ -172,7 +171,15 @@ const ChatInput = ({ scrollToBottom }) => {
};

const handleNewLine = (e, addLine = true) => {
if (addLine) messageRef.current.value += '\n';
if (addLine) {
const { selectionStart, selectionEnd, value } = messageRef.current;
messageRef.current.value = `${value.substring(
0,
selectionStart
)}\n${value.substring(selectionEnd)}`;
messageRef.current.selectionStart = messageRef.current.selectionEnd;
messageRef.current.selectionEnd = selectionStart + 1;
}

e.target.style.height = 'auto';
if (e.target.scrollHeight <= 150) {
Expand Down

0 comments on commit 489f540

Please sign in to comment.