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

doc: 子应用富文本编辑器(wangEditor/slate)解决方案汇总 #791

Open
AttackXiaoJinJin opened this issue Jan 30, 2024 · 2 comments

Comments

@AttackXiaoJinJin
Copy link

feat: 支持微前端 iframe 沙箱

修改子应用缓存

修复isCollapsed 始终为true的问题

该插件修复了wujie框架下UI事件由子应用传递时,target会指向到WUJIE-APP标签问题

我自己用的 slate,然后通过 pnpm path 修改 slate、wujie 库源码发布临时版本+上面 2 个插件,暂时使用正常,感谢 @keuby @jardenliu @rickx81

@aidenchen8
Copy link

safari 下正常么,safari 的 shadowDom 没有实现 Selection API

@alvin0804
Copy link

可以通过 内嵌一个iframe 绕过Selection API 的问题。

  1. 在iframe内实现wangeditor的交互
  2. 如果需要传参,可以通过window.parent 上挂载传参
  3. 如果需要通讯,可以动过window.parent 添加事件监听逻辑

// 父页面代码
// 父级页面添加事件监听
window.parent.document.addEventListener("wangeditor-inner-page-ready", () => { });

// 子页面代码
// 触发父页面监听的事件
const dispatch = (name: string, data?: any) => {
window.parent.document.dispatchEvent(new CustomEvent(name, data));
};
dispatch("wangeditor-inner-page-ready");

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

3 participants