REECT:如何使用``contineDistable div''divent'gruments捕获“输入”事件?
我需要从inputevent
捕获historyundo
historyedo 。问题是,我的可满足的
div为我提供了formevent
而不是inputevent
。
const inputChanged = (e: InputEvent) => {
//Error here because e is FormEvent type not InputEvent
if(e.inputType === 'historyUndo' || e.inputType === 'historyRedo')
{
....
}
}
return <div contentEditable={true} onInput={(e) => inputChanged(e)}>
....
</div>
如何在Div Contendedible上捕获inputevent
?
I need to catch historyUndo
and historyRedo
from InputEvent
. The problem is, my contentEditable
div is giving me FormEvent
not InputEvent
.
const inputChanged = (e: InputEvent) => {
//Error here because e is FormEvent type not InputEvent
if(e.inputType === 'historyUndo' || e.inputType === 'historyRedo')
{
....
}
}
return <div contentEditable={true} onInput={(e) => inputChanged(e)}>
....
</div>
How can I catch InputEvent
on div contentEditable?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您要做的是访问事件的
nativeEvent
属性。类似的东西。What you want to do is access the
nativeEvent
property of the event. Something similar to this.