) => {
+ const items = e.clipboardData?.items;
+ if (!items) return;
+ for (let i = 0; i < items.length; i += 1) {
+ const item = items[i];
+ if (item.kind === 'file' && item.type.startsWith('image/')) {
+ const file = item.getAsFile();
+ if (!file) continue;
+ e.preventDefault();
+ const reply = consumePendingReply();
+ sendImage(topic, file, reply).catch((err) => showError(err, '图片发送失败'));
+ return;
+ }
+ }
+ };
+
return (
@@ -1214,6 +1237,7 @@ export function ConversationView() {
value={draft}
onChange={handleDraftChange}
onKeyDown={handleKeyDown}
+ onPaste={handleComposerPaste}
placeholder="输入消息,Enter 发送,Shift+Enter 换行"
className="min-h-[72px] flex-1 resize-none bg-transparent text-[15px] leading-normal outline-none placeholder:text-text-placeholder-1"
/>