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: inline toolbar incorrectly calculates orientation #2477

Conversation

SneakiBrina
Copy link

@SneakiBrina SneakiBrina commented Sep 13, 2023

Summary

When calculating the inline toolbar orientation, the selection coordinates are being adjusted for the offset of the wrapper element however, the content coordinates are not.

const selectionRect = SelectionUtils.rect as DOMRect;
const wrapperOffset = this.Editor.UI.nodes.wrapper.getBoundingClientRect();
const newCoords = {
x: selectionRect.x - wrapperOffset.left,

const realRightCoord = newCoords.x + this.width / 2;

realRightCoord > this.Editor.UI.contentRect.right

Changes

  • take offset into account for comparison against content rects
  • added regression test

Resolves: #2476
Resolves: #2268

fixed-editorjs

@neSpecc
Copy link
Member

neSpecc commented Dec 22, 2023

Probably fixed via #2550. Please, test it in 2.29.0-rc.8

@SneakiBrina SneakiBrina closed this Jan 2, 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.

InlineToolbar incorrectly overflows on right edge Toolbar gets cut off
2 participants