Skip to content

Commit

Permalink
EZP-32387: Fixed text block toolbar alignment (#1778)
Browse files Browse the repository at this point in the history
* EZP-32387: Fixed text block toolbar alignment

* removed PB-related condition
  • Loading branch information
Konrad Oboza committed Jun 14, 2021
1 parent 0c71a29 commit 479e946
Showing 1 changed file with 9 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,18 @@ export default class EzConfigBase {

const range = document.createRange();
const scrollLeft = parseInt(block.$.scrollLeft, 10);
const blockLeftMargin = block.$.offsetLeft;
const blockWidth = block.$.offsetWidth;
const toolbarWidth = document.querySelector('.ae-toolbar-floating').offsetWidth;
const maxLeft = blockWidth - toolbarWidth;

range.selectNodeContents(positionReference.$);
left = range.getBoundingClientRect().left + scrollLeft;

if (left > maxLeft) {
left = maxLeft + blockLeftMargin;
}

if (empty) {
positionReference.remove();
}
Expand Down

0 comments on commit 479e946

Please sign in to comment.