feat: paste multiple lines in parameters input

This commit is contained in:
jialin
2026-03-17 16:35:55 +08:00
committed by jialin
parent 556c4a434d
commit 4f02bcd40c
11 changed files with 76 additions and 58 deletions
+11 -1
View File
@@ -7,6 +7,7 @@ interface HintInputProps {
label?: string;
onChange: (value: string) => void;
onBlur?: (e: any) => void;
onPaste?: (e: any) => void;
placeholder?: string;
trim?: boolean;
sourceOptions?: Global.HintOptions[];
@@ -15,7 +16,15 @@ interface HintInputProps {
const matchReg = /[^=]+=[^=]*$/;
const HintInput: React.FC<HintInputProps> = (props) => {
const { value, label, onChange, onBlur, sourceOptions, trim = true } = props;
const {
value,
label,
onChange,
onBlur,
onPaste,
sourceOptions,
trim = true
} = props;
const cursorPosRef = React.useRef(0);
const contextBeforeCursorRef = React.useRef('');
const [options, setOptions] = React.useState<
@@ -92,6 +101,7 @@ const HintInput: React.FC<HintInputProps> = (props) => {
options={options}
trim={trim}
style={{ flex: 1 }}
onPaste={onPaste}
/>
);
};