Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: use addEventListener to bind iframe event handlers #169

Merged
merged 2 commits into from
May 31, 2024

Conversation

ccloli
Copy link
Contributor

@ccloli ccloli commented May 31, 2024

调整沙箱事件绑定的实现,从直接在 DOM 上定义事件属性改为使用 addEventListener 注册事件回调函数。

例如,以前的事件定义类似于 iframe.contentDocument.onkeydown = handler,现在的方式改为了 iframe.contentDocument.addEventListener('keydown', handler)

调整后,可以修复和避免平台或沙箱内部的页面使用相同的方式(即 document.onkeydown = pageHandler)绑定事件时,沙箱自身 useDnd() 里的回调函数会被覆盖的问题。

@wwsun wwsun merged commit c1306e2 into NetEase:main May 31, 2024
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants