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( table-module issue 4376): 修复 点击 table 左边边缘处报错无效 slate #5836

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

Conversation

cycleccc
Copy link

相关issue #4376

还有更多相关issue,待合并后关闭

相关 slate issue ianstormtaylor/slate#3421

之前也提了个pr,但是后续测试有问题 #5829
这次过了一遍单元测试已经手动点击测试

@cycleccc
Copy link
Author

bug成因:

packages\core\src\editor\dom-editor.ts 中的 DOMSelectionToEditor 函数 中的 toSlatePoint 函数需要找到可编辑的 textNode, 而 table 标签的 [colgroup标签] (https://developer.mozilla.org/en-US/docs/Web/HTML/Element/colgroup)是个定义行展示的标签,从语意上来讲并不支持编辑。

解决思路:

给 colgroup 标签添加 contentEditable = false ,设置为不可编辑标签,让 normalizeDOMPoint 函数 找到正确的 tbody 标签下的 tr标签下的可编辑 textNode

@cycleccc cycleccc mentioned this pull request May 7, 2024
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

1 participant