Skip to content

[Textarea] 的粘贴事件有问题,无法获得粘贴的文件 #3849

Open

Description

@mystraybird

tdesign-react 版本

是

重现链接

No response

重现步骤

粘贴系统文件时,不管是 onPaste 或者是 onPasteCapture 事件,都无法获取到 e.clipboardData

import { Textarea } from 'tdesign-react'

function App() {

  const handlePaste = (content: string, e: React.ClipboardEvent<HTMLTextAreaElement>) => {
    console.log('handlePaste',[content, e, e.clipboardData])
  }
  const handlePasteCapture = (content: string, e: React.ClipboardEvent<HTMLTextAreaElement>) => {
    console.log('handlePasteCapture',[content, e, e.clipboardData])
  }
  return (
    <>
      <div>
        <Textarea onPaste={handlePaste} onPasteCapture={handlePasteCapture} />
      </div>
    </>
  )
}

期望结果

No response

实际结果

No response

框架版本

No response

浏览器版本

No response

系统版本

No response

Node版本

No response

补充说明

No response

Activity

  1. github-actions commented on Sep 28, 2025

    @github-actions
    Contributor

    👋 @mystraybird,感谢给 TDesign 提出了 issue。
    请根据 issue 模版确保背景信息的完善,我们将调查并尽快回复你。

  2. RylanBot commented on Sep 28, 2025

    @RylanBot
    Collaborator

    目前不在文档上的原生事件 ts 有些问题,第二个参数格式如下,可以这么获取:

    // @ts-ignore
    onPaste={(value, { e }) => {
      console.log('onPaste', e.clipboardData);
    }}
  3. mystraybird commented on Sep 29, 2025

    @mystraybird
    Author

    目前不在文档上的原生事件 ts 有些问题,第二个参数格式如下,可以这么获取:

    // @ts-ignore
    onPaste={(value, { e }) => {
    console.log('onPaste', e.clipboardData);
    }}

    可以运行了,后续请更新类型声明和文档吧

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    • Status
      No status

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions