@springbrand/message-panel 0.1.3-alpha.7 → 0.1.3-alpha.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -26,6 +26,7 @@ import {
|
|
|
26
26
|
useRef,
|
|
27
27
|
useState,
|
|
28
28
|
type DragEvent as ReactDragEvent,
|
|
29
|
+
type Ref,
|
|
29
30
|
type ReactNode,
|
|
30
31
|
} from "react";
|
|
31
32
|
import { DropdownMenu } from "../primitives/dropdown-menu";
|
|
@@ -126,6 +127,8 @@ export interface CloudOsChatInputProps {
|
|
|
126
127
|
minRows?: number;
|
|
127
128
|
maxRows?: number;
|
|
128
129
|
autoFocus?: boolean;
|
|
130
|
+
/** Gives the host direct access to the chat textarea. */
|
|
131
|
+
textareaRef?: Ref<HTMLTextAreaElement>;
|
|
129
132
|
/** 输入框下方一行(原文件放 token / cost)。 */
|
|
130
133
|
footnote?: ReactNode;
|
|
131
134
|
}
|
|
@@ -185,6 +188,7 @@ function CloudOsChatInputContent({
|
|
|
185
188
|
minRows = 1,
|
|
186
189
|
maxRows = 6,
|
|
187
190
|
autoFocus = false,
|
|
191
|
+
textareaRef: forwardedTextareaRef,
|
|
188
192
|
footnote,
|
|
189
193
|
runtime,
|
|
190
194
|
}: CloudOsChatInputProps & { runtime: AssistantRuntime }) {
|
|
@@ -411,6 +415,11 @@ function CloudOsChatInputContent({
|
|
|
411
415
|
<textarea
|
|
412
416
|
ref={(element) => {
|
|
413
417
|
textareaRef.current = element;
|
|
418
|
+
if (typeof forwardedTextareaRef === "function") {
|
|
419
|
+
forwardedTextareaRef(element);
|
|
420
|
+
} else if (forwardedTextareaRef) {
|
|
421
|
+
forwardedTextareaRef.current = element;
|
|
422
|
+
}
|
|
414
423
|
if (element) autoResizeTextarea(element, minRows, maxRows);
|
|
415
424
|
}}
|
|
416
425
|
value={value}
|