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

fix: The operation before hijacking the ownerdocument of the node #1235

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

Conversation

front-refined
Copy link

Closes #916

tinymce 编辑器是采用 iframe 的方式来作为编辑区域,源代码有大量的 ownerDocument 的判断,必须是 tinymce 的 iframe 的 document 才能保证一些代码的逻辑无误,
以下截图是回车滚动条移动的关键代码,ownerDocument 被劫持成 micro-app iframe 的 document ,所以导致位置计算错误。
image

以上仅仅作为一个例子。为了灵活扩展,这里新增了劫持方法前置拦截,更细粒度的处理元素的正确 ownerDocument

@bailicangdu
Copy link
Member

我们会研究一下,感谢pr

@feicm
Copy link

feicm commented Jun 25, 2024

我们会研究一下,感谢pr

遇到类似情况,appInstance 实例不存在时,应该返回主应用ownerDocument,即添加getCurrentAppName() 非空判断解决

rawDefineProperty(microRootNode.prototype, 'ownerDocument', { configurable: true, enumerable: true, get() { return this.__PURE_ELEMENT__ || this === microDocument || !getCurrentAppName() ? rawOwnerDocumentDesc.get.call(this) : microDocument; }, });

@trry-hub
Copy link

trry-hub commented Jul 17, 2024

有临时解决方案么?我现在生产环境的代码发现了这个问题,要怎么解决 @bailicangdu

@trry-hub
Copy link

Closes #916

tinymce 编辑器是采用 iframe 的方式来作为编辑区域,源代码有大量的 ownerDocument 的判断,必须是 tinymce 的 iframe 的 document 才能保证一些代码的逻辑无误, 以下截图是回车滚动条移动的关键代码,ownerDocument 被劫持成 micro-app iframe 的 document ,所以导致位置计算错误。 image

以上仅仅作为一个例子。为了灵活扩展,这里新增了劫持方法前置拦截,更细粒度的处理元素的正确 ownerDocument

有临时解决方案么

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.

主应用使用富文本组件回车后,滚动条位置会移到顶部
4 participants