mirror of
https://github.com/danny-avila/LibreChat.git
synced 2025-12-17 08:50:15 +01:00
🔧 fix(useTextarea): duplicate text when pasting on chromium (#1951)
This commit is contained in:
parent
78f52859c4
commit
7d633f4018
1 changed files with 3 additions and 1 deletions
|
|
@ -1,5 +1,5 @@
|
||||||
import debounce from 'lodash/debounce';
|
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 { EModelEndpoint } from 'librechat-data-provider';
|
||||||
import type { TEndpointOption } from 'librechat-data-provider';
|
import type { TEndpointOption } from 'librechat-data-provider';
|
||||||
import type { SetterOrUpdater } from 'recoil';
|
import type { SetterOrUpdater } from 'recoil';
|
||||||
|
|
@ -158,6 +158,8 @@ export default function useTextarea({
|
||||||
|
|
||||||
const handlePaste = useCallback(
|
const handlePaste = useCallback(
|
||||||
(e: React.ClipboardEvent<HTMLTextAreaElement>) => {
|
(e: React.ClipboardEvent<HTMLTextAreaElement>) => {
|
||||||
|
e.preventDefault();
|
||||||
|
|
||||||
const pastedData = e.clipboardData.getData('text/plain');
|
const pastedData = e.clipboardData.getData('text/plain');
|
||||||
const textArea = textAreaRef.current;
|
const textArea = textAreaRef.current;
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue