- {
+ setEditedText(e.target.value);
+ }}
data-testid="message-text-editor"
- className="markdown prose dark:prose-invert light w-full whitespace-pre-wrap break-words border-none focus:outline-none"
+ className={cn(
+ 'markdown prose dark:prose-invert light whitespace-pre-wrap break-words dark:text-gray-20',
+ 'm-0 w-full resize-none border-0 bg-transparent p-0',
+ removeFocusOutlines,
+ )}
+ onPaste={(e) => {
+ const pastedData = e.clipboardData.getData('text/plain');
+ const textArea = textAreaRef.current;
+ if (!textArea) {
+ return;
+ }
+ const start = textArea.selectionStart;
+ const end = textArea.selectionEnd;
+ const newValue =
+ textArea.value.substring(0, start) + pastedData + textArea.value.substring(end);
+ setEditedText(newValue);
+ }}
contentEditable={true}
- ref={textEditor}
+ value={editedText}
suppressContentEditableWarning={true}
- >
- {text}
-
+ />