Commit 79f1f5ac by HoMeTown

fix: 解决输入框复制有样式的问题

parent cbf58826
...@@ -67,6 +67,11 @@ const ChatEditorBase: React.FC<ChatEditorProps & WithAuthProps> = ({ checkAuth, ...@@ -67,6 +67,11 @@ const ChatEditorBase: React.FC<ChatEditorProps & WithAuthProps> = ({ checkAuth,
const handleCloseLoginModal = () => { const handleCloseLoginModal = () => {
isOpenLoginModalActions.setLeft() isOpenLoginModalActions.setLeft()
} }
const handlePaste = (event: React.ClipboardEvent<HTMLDivElement>) => {
event.preventDefault()
const text = event.clipboardData.getData('text/plain')
document.execCommand('insertText', false, text)
}
useEffect(() => { useEffect(() => {
startAnimation() startAnimation()
...@@ -92,6 +97,7 @@ const ChatEditorBase: React.FC<ChatEditorProps & WithAuthProps> = ({ checkAuth, ...@@ -92,6 +97,7 @@ const ChatEditorBase: React.FC<ChatEditorProps & WithAuthProps> = ({ checkAuth,
onInput={handleInput} onInput={handleInput}
onFocus={onFocus} onFocus={onFocus}
onKeyDown={handleKeyDown} onKeyDown={handleKeyDown}
onPaste={handlePaste}
suppressContentEditableWarning={true} suppressContentEditableWarning={true}
style={{ style={{
resize: 'none', resize: 'none',
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment