editablejs / editable

🌱 A collaborative rich-text editor framework that focuses on stability, controllability, extensibility, and performance. 一款强到离谱的富文本编辑器框架,专注于稳定性、可控性、扩展性和性能。
https://docs.editablejs.com
Apache License 2.0
1.8k stars 121 forks source link

Fix incorrect caret position in iOS #82

Closed YaoKaiLun closed 1 year ago

YaoKaiLun commented 1 year ago

Description

When focus at the start of a middle line in a paragraph, getBoundingClientRect wil get an incorrect height and using getClientRects can get the correct height

image

After fixing:

image

Issue

Fixes: #81

Checks

changeset-bot[bot] commented 1 year ago

🦋 Changeset detected

Latest commit: c912782e91124f5e07af6e4ed152a240645fe3c6

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 23 packages | Name | Type | | ----------------------------------- | ----- | | @editablejs/editor | Patch | | @editablejs/docs | Patch | | @editablejs/plugin-align | Patch | | @editablejs/plugin-background-color | Patch | | @editablejs/plugin-blockquote | Patch | | @editablejs/plugin-codeblock | Patch | | @editablejs/plugin-context-menu | Patch | | @editablejs/plugin-font-color | Patch | | @editablejs/plugin-font-size | Patch | | @editablejs/plugin-heading | Patch | | @editablejs/plugin-history | Patch | | @editablejs/plugin-hr | Patch | | @editablejs/plugin-image | Patch | | @editablejs/plugin-indent | Patch | | @editablejs/plugin-leading | Patch | | @editablejs/plugin-link | Patch | | @editablejs/plugin-list | Patch | | @editablejs/plugin-mark | Patch | | @editablejs/plugin-mention | Patch | | @editablejs/plugins | Patch | | @editablejs/plugin-table | Patch | | @editablejs/plugin-toolbar | Patch | | @editablejs/plugin-yjs | Patch |

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

YaoKaiLun commented 1 year ago

In some situations, clientRects will be empty, like inserting an image. image