From d38889ddad3fe03d8acbb443bf8acb8458e783d8 Mon Sep 17 00:00:00 2001 From: Antonio Ortega <60252917@liferay.com> Date: Wed, 3 Mar 2021 10:30:26 +0100 Subject: [PATCH] fix: correct toolbar position in tables and images when editor is rendered in a modal window Fixes: https://issues.liferay.com/browse/LPS-128401 Related discussion: https://issues.liferay.com/browse/PTR-2282 Closes: #1466 --- src/selections/selection-position.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/selections/selection-position.js b/src/selections/selection-position.js index 0398e53847..4a2b5efeae 100644 --- a/src/selections/selection-position.js +++ b/src/selections/selection-position.js @@ -61,13 +61,16 @@ const centerToolbar = function(toolbar, rect) { } } + const scrollTop = uiNode ? uiNode.scrollTop : 0; + const endPosition = [ rect.left + rect.width / 2 - halfNodeWidth - scrollPosition.x, rect.top + offsetHeight - toolbarNode.offsetHeight + scrollPosition.y - - gutter.top, + gutter.top + + scrollTop, ]; if (endPosition[0] < 0) {