Skip to content

feat(input): contenteditable 的圆点贴文字末尾,用与逐段按钮共用的行盒测量,多行与行内混排都对(#671) - #721

Merged
Teeeeeeeerry merged 2 commits into
mainfrom
feat/671-editable-dot-end
Oct 7, 2026
Merged

Teeeeeeeerry merged 2 commits into
mainfrom
feat/671-editable-dot-end

Conversation

@Teeeeeeeerry

Copy link
Copy Markdown
Owner

问题

contenteditable 富文本框(包括受控编辑器)里的圆点还停在回落位置(框内侧右下角),和多行、单行文本框(贴文字末尾)不一致。

根因

圆点位置只给文本框接了镜像测量,contenteditable 直接走回落。

修复

验证

  • TC-E2E-141: 每一步的真值都是光标放到最后一个文本节点末尾时的矩形,断言圆点在它右侧 4px、竖直居中,误差不超过 2px。
    • 单行,以及换行后的第二行。
    • 末尾是加粗、末尾是链接、多行加行内混排。
    • 框限高可滚动:滚到顶时圆点钳在可见区里、不消失;滚回底,圆点重新贴末尾。
    • 修复前第一步就差 308px。
  • TC-E2E-128: 原来断言回落位置(框右下半区),改为“整颗在框里”,位置真值交给 TC-141。这是规格变化,不是放宽。
  • 单元测试: 新增一条,覆盖 contenteditable 的停手对齐,走回落分支观察。
  • 测试结果:
    • pnpm test:115 个文件、1427 条,全部通过。
    • pnpm typecheck 通过。
    • pnpm test:e2e:core:98 条通过,2 条跳过。

Closes #671

Teeeeeeeerry and others added 2 commits October 7, 2026 13:08
contenteditable 有真实的文本节点,末尾取共用行盒测量(#634)里最后一个有
高度的行盒:行内混排时它是最后那段文字自己的行盒,不是外层元素的边框盒;
LTR 取右边缘、RTL 取左边缘。坐标已是屏幕坐标,不另养镜像。与光标并排
(#667)、钳边(#669)、停手对齐(#670)、测不出回落(#668)都走文本框
那一套。

TC-E2E-128 的回落位置断言改为“整颗在框里”,位置真值交给 TC-E2E-141。

Co-Authored-By: zhexuancai-uts <261878103+zhexuancai-uts@users.noreply.github.com>
Co-Authored-By: zhexuancai-uts <261878103+zhexuancai-uts@users.noreply.github.com>
@Teeeeeeeerry
Teeeeeeeerry merged commit 1c57ed9 into main Oct 7, 2026
6 checks passed
@Teeeeeeeerry
Teeeeeeeerry deleted the feat/671-editable-dot-end branch October 7, 2026 02:13
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.

输入翻译:contenteditable 的圆点贴文字末尾(#633)

1 participant