fix: not allowed input should hide action

pull/146/head
moonrailgun 2 years ago
parent 747a6d3afe
commit 464fd7c9f8

@ -6,7 +6,7 @@ import { isEnterHotkey } from '@/utils/hot-key';
import React, { useRef, useState } from 'react';
import { ChatInputAddon } from './Addon';
import { ClipboardHelper } from './clipboard-helper';
import { ChatInputActionContext } from './context';
import { ChatInputActionContext, useChatInputMentionsContext } from './context';
import { uploadMessageImage } from './utils';
import { ChatInputBoxInput } from './input';
import {
@ -31,6 +31,7 @@ export const ChatInputBox: React.FC<ChatInputBoxProps> = React.memo((props) => {
const inputRef = useRef<HTMLInputElement>(null);
const [message, setMessage] = useState('');
const [mentions, setMentions] = useState<string[]>([]);
const { disabled } = useChatInputMentionsContext();
const handleSendMsg = useEvent(async () => {
await props.onSendMsg(message, {
mentions: _uniq(mentions), // 发送前去重
@ -110,6 +111,8 @@ export const ChatInputBox: React.FC<ChatInputBoxProps> = React.memo((props) => {
/>
</div>
{!disabled && (
<>
<div className="px-2 flex space-x-1">
{pluginChatInputButtons.map((item, i) =>
React.cloneElement(item.render(), {
@ -131,6 +134,8 @@ export const ChatInputBox: React.FC<ChatInputBoxProps> = React.memo((props) => {
</div>
<ChatDropArea />
</>
)}
</div>
</div>
</ChatInputActionContext.Provider>

Loading…
Cancel
Save