mirror of
https://github.com/danny-avila/LibreChat.git
synced 2025-12-20 10:20:15 +01:00
✍️ fix(useTextarea): Rich Text Format paste from MS Word (#2530)
This commit is contained in:
parent
ca9a0fe629
commit
4121818124
1 changed files with 3 additions and 1 deletions
|
|
@ -180,15 +180,17 @@ export default function useTextarea({
|
|||
return;
|
||||
}
|
||||
|
||||
let richText = '';
|
||||
let includedText = '';
|
||||
const { types } = e.clipboardData;
|
||||
|
||||
if (types.indexOf('text/rtf') !== -1 || types.indexOf('Files') !== -1) {
|
||||
e.preventDefault();
|
||||
includedText = e.clipboardData.getData('text/plain');
|
||||
richText = e.clipboardData.getData('text/rtf');
|
||||
}
|
||||
|
||||
if (includedText && e.clipboardData.files.length > 0) {
|
||||
if (includedText && (e.clipboardData.files.length > 0 || richText)) {
|
||||
insertTextAtCursor(textAreaRef.current, includedText);
|
||||
forceResize(textAreaRef);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue