fix(core): fix getClosestPosition error when component nesting#285
Open
bcguan2008 wants to merge 1 commit intoalibaba:mainfrom
Open
fix(core): fix getClosestPosition error when component nesting#285bcguan2008 wants to merge 1 commit intoalibaba:mainfrom
bcguan2008 wants to merge 1 commit intoalibaba:mainfrom
Conversation
✅ Deploy Preview for designable-fusion ready!
To edit notification comments on pull requests, go to your Netlify site settings. |
✅ Deploy Preview for designable-antd ready!
To edit notification comments on pull requests, go to your Netlify site settings. |
Collaborator
|
现在main分支的最新版还存在这个问题吗 |
Author
有的, 比较容易复现(按问题描述里的配置方式修改 formily/antd/src/components/Card/preview.tsx) |
Author
|
这个 check 报错信息好像 main 上就有 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
问题
当组件嵌套了多个组件时,会发生 closestPosition 计算不对的问题
拿Card 举例,在 behavior 里设置了 Card 不能 append 到 Card
录制了一个 gif 图,拖拽滑动到子组件时光标位置计算不对。 拖拽到 input, textArea 和 password 分别发生了多次光标跳动,无法给予拖拽用户一个准确的预期
原因
getClosestPosition 方法做了 closestNode 的重计算(主要是 onMove 事件在方法外会修改 closestNode,所以重计算 closestNode 没有问题 ),但没有进行 isAfter 的重计算。
修复后效果

main.npm test).npm run lint) - we've done our best to make sure these rules match our internal linting guidelines.