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

tango是哪些类在处理codesandbox的事件 #138

Open
maxwls opened this issue Apr 25, 2024 · 1 comment
Open

tango是哪些类在处理codesandbox的事件 #138

maxwls opened this issue Apr 25, 2024 · 1 comment

Comments

@maxwls
Copy link
Contributor

maxwls commented Apr 25, 2024

tango修改了codesandbox-client,在其index.html中添加了下面的代码:

        // 修改 domain,以便让外部页面和 iframe 页面在同一个域名下,主要目的是为了直接监听 iframe 页面的事件
        document.domain = window.location.hostname.split('.').slice(-2).join('.');

tango是哪些类在处理codesandbox的事件?

@maxwls maxwls changed the title tango主要监听了codesandbox-client的哪些事件 tango是哪些类在处理codesandbox的事件 Apr 25, 2024
@ccloli
Copy link
Contributor

ccloli commented Apr 25, 2024

如果我没有理解错的话,Tango 的拖拽引擎是通过 监听沙箱内的一系列事件 实现的,这些事件的回调函数会在初始化沙箱时 传入到封装好的沙箱组件内,然后沙箱组件 在 iframe 内注册这些事件,以监听沙箱内部的用户操作(如拖拽等),从而实现引擎的核心能力(如节点增改、拖拽移动等)。

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

No branches or pull requests

2 participants