🔧 fix(useTextarea): duplicate text when pasting on chromium (#1951)

This commit is contained in:
Marco Beretta 2024-03-02 21:53:13 +01:00 committed by GitHub
parent 78f52859c4
commit 7d633f4018
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -1,5 +1,5 @@
import debounce from 'lodash/debounce';
import { useEffect, useRef, useCallback } from 'react';
import React, { useEffect, useRef, useCallback } from 'react';
import { EModelEndpoint } from 'librechat-data-provider';
import type { TEndpointOption } from 'librechat-data-provider';
import type { SetterOrUpdater } from 'recoil';
@ -158,6 +158,8 @@ export default function useTextarea({
const handlePaste = useCallback(
(e: React.ClipboardEvent<HTMLTextAreaElement>) => {
e.preventDefault();
const pastedData = e.clipboardData.getData('text/plain');
const textArea = textAreaRef.current;