diff --git a/client/web/src/components/ChatBox/ChatInputBox/index.tsx b/client/web/src/components/ChatBox/ChatInputBox/index.tsx index 00cae6d2..8e8d35e8 100644 --- a/client/web/src/components/ChatBox/ChatInputBox/index.tsx +++ b/client/web/src/components/ChatBox/ChatInputBox/index.tsx @@ -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 = React.memo((props) => { const inputRef = useRef(null); const [message, setMessage] = useState(''); const [mentions, setMentions] = useState([]); + const { disabled } = useChatInputMentionsContext(); const handleSendMsg = useEvent(async () => { await props.onSendMsg(message, { mentions: _uniq(mentions), // 发送前去重 @@ -110,27 +111,31 @@ export const ChatInputBox: React.FC = React.memo((props) => { /> -
- {pluginChatInputButtons.map((item, i) => - React.cloneElement(item.render(), { - key: `plugin-chatinput-btn#${i}`, - }) - )} + {!disabled && ( + <> +
+ {pluginChatInputButtons.map((item, i) => + React.cloneElement(item.render(), { + key: `plugin-chatinput-btn#${i}`, + }) + )} - + - {message ? ( - handleSendMsg()} - /> - ) : ( - - )} -
+ {message ? ( + handleSendMsg()} + /> + ) : ( + + )} +
- + + + )}