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: 修复外部通过 ref 传递参数导致不兼容的 Bug #27

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

cexoso
Copy link

@cexoso cexoso commented Jun 19, 2024

当外部使用 const editor = ref() 来保存 editor 实例时,editor 会被封装成 reactive(editor) 这是一个 Proxy 对象。core 中通过
weakMap.get(ProxyHandler) 会存在取不到值的问题

通过 vue 的 toRaw 可以将一个 reactive 对象还原成原始的对象,该会方法对传递
editor 时会原生返回

toRaw 方法见:https://cn.vuejs.org/api/reactivity-advanced.html#toraw

当外部使用 const editor = ref() 来保存 editor 实例时,editor 会被封装成
reactive(editor) 这是一个 Proxy 对象。core 中通过
weakMap.get(ProxyHandler<editor>) 会存在取不到值的问题

通过 vue 的 toRaw 可以将一个 reactive 对象还原成原始的对象,该会方法对传递
editor 时会原生返回

toRaw 方法见:https://cn.vuejs.org/api/reactivity-advanced.html#toraw
@cycleccc
Copy link

@cexoso 你好,可以将这个pr和到 wangEditor-next/editor-for-vue3 吗,我fork了全套的wangeidtor,正在做维护和功能更新。
不方便的话我自己拉你的分支进去也行😂

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.

None yet

2 participants