v0.11.21 bug fixes
This commit is contained in:
@@ -14,7 +14,7 @@ function nameToColor(name) {
|
||||
return AVATAR_COLORS[(name || '').charCodeAt(0) % AVATAR_COLORS.length];
|
||||
}
|
||||
|
||||
export default function ChatWindow({ group, onBack, onGroupUpdated, onDirectMessage, onMessageDeleted, onlineUserIds = new Set() }) {
|
||||
export default function ChatWindow({ group, onBack, onGroupUpdated, onDirectMessage, onMessageDeleted, onHasTextChange, onlineUserIds = new Set() }) {
|
||||
const { user: currentUser } = useAuth();
|
||||
const { socket } = useSocket();
|
||||
const { toast } = useToast();
|
||||
@@ -330,7 +330,7 @@ export default function ChatWindow({ group, onBack, onGroupUpdated, onDirectMess
|
||||
This channel is read-only
|
||||
</div>
|
||||
) : (
|
||||
<MessageInput group={group} currentUser={currentUser} onSend={handleSend} socket={socket} replyTo={replyTo} onCancelReply={() => setReplyTo(null)} onTyping={() => {}} />
|
||||
<MessageInput group={group} currentUser={currentUser} onSend={handleSend} socket={socket} replyTo={replyTo} onCancelReply={() => setReplyTo(null)} onTyping={() => {}} onTextChange={val => onHasTextChange?.(!!val.trim())} />
|
||||
)}
|
||||
</div>
|
||||
{showInfo && (
|
||||
|
||||
@@ -12,7 +12,7 @@ function isEmojiOnly(str) {
|
||||
return emojiRegex.test(str.trim());
|
||||
}
|
||||
|
||||
export default function MessageInput({ group, replyTo, onCancelReply, onSend, onTyping, onlineUserIds = new Set() }) {
|
||||
export default function MessageInput({ group, replyTo, onCancelReply, onSend, onTyping, onTextChange, onlineUserIds = new Set() }) {
|
||||
const [text, setText] = useState('');
|
||||
const [imageFile, setImageFile] = useState(null);
|
||||
const [imagePreview, setImagePreview] = useState(null);
|
||||
@@ -89,6 +89,7 @@ export default function MessageInput({ group, replyTo, onCancelReply, onSend, on
|
||||
const val = e.target.value;
|
||||
setText(val);
|
||||
handleTypingChange(val);
|
||||
onTextChange?.(val);
|
||||
|
||||
const el = e.target;
|
||||
el.style.height = 'auto';
|
||||
@@ -157,6 +158,7 @@ export default function MessageInput({ group, replyTo, onCancelReply, onSend, on
|
||||
setImagePreview(null);
|
||||
wasTyping.current = false;
|
||||
onTyping(false);
|
||||
onTextChange?.('');
|
||||
if (inputRef.current) {
|
||||
inputRef.current.style.height = 'auto';
|
||||
inputRef.current.style.overflowY = 'hidden';
|
||||
|
||||
Reference in New Issue
Block a user