mirror of
https://github.com/ChatGPTNextWeb/ChatGPT-Next-Web.git
synced 2025-10-09 11:36:38 +08:00
44
This commit is contained in:
parent
546b13c10a
commit
a21ddd7aa3
@ -1,6 +1,9 @@
|
|||||||
import { useDebouncedCallback } from "use-debounce";
|
import { useDebouncedCallback } from "use-debounce";
|
||||||
import { memo, useState, useRef, useEffect, useLayoutEffect } from "react";
|
import { memo, useState, useRef, useEffect, useLayoutEffect } from "react";
|
||||||
import TextareaAutosize from "react-textarea-autosize";
|
// import TextareaAutosize from "react-textarea-autosize";
|
||||||
|
import TextareaAutosize, {
|
||||||
|
TextareaAutosizeProps,
|
||||||
|
} from "react-textarea-autosize";
|
||||||
|
|
||||||
import SendWhiteIcon from "../icons/send-white-fill.svg";
|
import SendWhiteIcon from "../icons/send-white-fill.svg";
|
||||||
import BrainIcon from "../icons/brain.svg";
|
import BrainIcon from "../icons/brain.svg";
|
||||||
@ -43,6 +46,14 @@ import chatStyle from "./chat.module.scss";
|
|||||||
import { Input, Modal, showModal, showToast } from "./ui-lib";
|
import { Input, Modal, showModal, showToast } from "./ui-lib";
|
||||||
import { text } from "stream/consumers";
|
import { text } from "stream/consumers";
|
||||||
|
|
||||||
|
interface CustomTextAreaProps extends TextareaAutosizeProps {
|
||||||
|
enterKeyHint: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
function CustomTextArea(props: CustomTextAreaProps) {
|
||||||
|
return <TextareaAutosize {...props} />;
|
||||||
|
}
|
||||||
|
|
||||||
const Markdown = dynamic(
|
const Markdown = dynamic(
|
||||||
async () => memo((await import("./markdown")).Markdown),
|
async () => memo((await import("./markdown")).Markdown),
|
||||||
{
|
{
|
||||||
@ -668,6 +679,7 @@ export function Chat(props: {
|
|||||||
<div className={styles["chat-input-panel-inner"]}>
|
<div className={styles["chat-input-panel-inner"]}>
|
||||||
<TextareaAutosize
|
<TextareaAutosize
|
||||||
enterKeyHint="send"
|
enterKeyHint="send"
|
||||||
|
autoComplete="on"
|
||||||
ref={inputRef}
|
ref={inputRef}
|
||||||
className={styles["chat-input"]}
|
className={styles["chat-input"]}
|
||||||
placeholder={Locale.Chat.Input(submitKey)}
|
placeholder={Locale.Chat.Input(submitKey)}
|
||||||
|
11
package-lock.json
generated
11
package-lock.json
generated
@ -37,6 +37,7 @@
|
|||||||
"@types/react": "^18.0.28",
|
"@types/react": "^18.0.28",
|
||||||
"@types/react-dom": "^18.0.11",
|
"@types/react-dom": "^18.0.11",
|
||||||
"@types/react-katex": "^3.0.0",
|
"@types/react-katex": "^3.0.0",
|
||||||
|
"@types/react-textarea-autosize": "^8.0.0",
|
||||||
"@types/spark-md5": "^3.0.2",
|
"@types/spark-md5": "^3.0.2",
|
||||||
"cross-env": "^7.0.3",
|
"cross-env": "^7.0.3",
|
||||||
"eslint": "^8.36.0",
|
"eslint": "^8.36.0",
|
||||||
@ -2431,6 +2432,16 @@
|
|||||||
"@types/react": "*"
|
"@types/react": "*"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/@types/react-textarea-autosize": {
|
||||||
|
"version": "8.0.0",
|
||||||
|
"resolved": "https://registry.npmmirror.com/@types/react-textarea-autosize/-/react-textarea-autosize-8.0.0.tgz",
|
||||||
|
"integrity": "sha512-KVqk+/+RMQB3ZDpk7ZTpYHauU3Ue+Y0f09POvGaEpaGb+izzbpoM47tkDGlbF37iT7JYZ8QFwLzqiOPYbQaztA==",
|
||||||
|
"deprecated": "This is a stub types definition. react-textarea-autosize provides its own type definitions, so you do not need this installed.",
|
||||||
|
"dev": true,
|
||||||
|
"dependencies": {
|
||||||
|
"react-textarea-autosize": "*"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/@types/scheduler": {
|
"node_modules/@types/scheduler": {
|
||||||
"version": "0.16.3",
|
"version": "0.16.3",
|
||||||
"resolved": "https://registry.npmmirror.com/@types/scheduler/-/scheduler-0.16.3.tgz",
|
"resolved": "https://registry.npmmirror.com/@types/scheduler/-/scheduler-0.16.3.tgz",
|
||||||
|
@ -40,6 +40,7 @@
|
|||||||
"@types/react": "^18.0.28",
|
"@types/react": "^18.0.28",
|
||||||
"@types/react-dom": "^18.0.11",
|
"@types/react-dom": "^18.0.11",
|
||||||
"@types/react-katex": "^3.0.0",
|
"@types/react-katex": "^3.0.0",
|
||||||
|
"@types/react-textarea-autosize": "^8.0.0",
|
||||||
"@types/spark-md5": "^3.0.2",
|
"@types/spark-md5": "^3.0.2",
|
||||||
"cross-env": "^7.0.3",
|
"cross-env": "^7.0.3",
|
||||||
"eslint": "^8.36.0",
|
"eslint": "^8.36.0",
|
||||||
|
@ -1345,6 +1345,13 @@
|
|||||||
dependencies:
|
dependencies:
|
||||||
"@types/react" "*"
|
"@types/react" "*"
|
||||||
|
|
||||||
|
"@types/react-textarea-autosize@^8.0.0":
|
||||||
|
version "8.0.0"
|
||||||
|
resolved "https://registry.npmmirror.com/@types/react-textarea-autosize/-/react-textarea-autosize-8.0.0.tgz"
|
||||||
|
integrity sha512-KVqk+/+RMQB3ZDpk7ZTpYHauU3Ue+Y0f09POvGaEpaGb+izzbpoM47tkDGlbF37iT7JYZ8QFwLzqiOPYbQaztA==
|
||||||
|
dependencies:
|
||||||
|
react-textarea-autosize "*"
|
||||||
|
|
||||||
"@types/react@*", "@types/react@^16.8 || ^17.0 || ^18.0", "@types/react@^18.0.28", "@types/react@>=16":
|
"@types/react@*", "@types/react@^16.8 || ^17.0 || ^18.0", "@types/react@^18.0.28", "@types/react@>=16":
|
||||||
version "18.0.31"
|
version "18.0.31"
|
||||||
resolved "https://registry.npmmirror.com/@types/react/-/react-18.0.31.tgz"
|
resolved "https://registry.npmmirror.com/@types/react/-/react-18.0.31.tgz"
|
||||||
@ -4244,7 +4251,7 @@ react-redux@^8.0.4:
|
|||||||
react-is "^18.0.0"
|
react-is "^18.0.0"
|
||||||
use-sync-external-store "^1.0.0"
|
use-sync-external-store "^1.0.0"
|
||||||
|
|
||||||
react-textarea-autosize@^8.4.1:
|
react-textarea-autosize@*, react-textarea-autosize@^8.4.1:
|
||||||
version "8.4.1"
|
version "8.4.1"
|
||||||
resolved "https://registry.npmmirror.com/react-textarea-autosize/-/react-textarea-autosize-8.4.1.tgz"
|
resolved "https://registry.npmmirror.com/react-textarea-autosize/-/react-textarea-autosize-8.4.1.tgz"
|
||||||
integrity sha512-aD2C+qK6QypknC+lCMzteOdIjoMbNlgSFmJjCV+DrfTPwp59i/it9mMNf2HDzvRjQgKAyBDPyLJhcrzElf2U4Q==
|
integrity sha512-aD2C+qK6QypknC+lCMzteOdIjoMbNlgSFmJjCV+DrfTPwp59i/it9mMNf2HDzvRjQgKAyBDPyLJhcrzElf2U4Q==
|
||||||
|
Loading…
Reference in New Issue
Block a user