[FIX] web_editor: dynamicplaceholder at the end positions below the page
Reproduction: 1. Install Sales, Email Marketing 2. Go to Email template by searching 3. Click the Sales: Send Quotation template and make a duplicate 4. Add empty lines in the template, till it almost reaches the end of the page 5. Use slash command to add a Dynamic holder, and it’ll be positioned below the page Fix: compute the position by consider the height/width of the popover to make sure it’ll be always in the page opw-3373403 task-3442559 closes odoo/odoo#153969 X-original-commit: 583ef2441e6aa9a6d13f50991a0d1d3a54c31db1 Signed-off-by: Geelen Sébastien (sge) <sge@odoo.com>
This commit is contained in:
@@ -370,10 +370,16 @@ export class HtmlField extends Component {
|
||||
* @param {Object} position
|
||||
*/
|
||||
positionDynamicPlaceholder(popover, position) {
|
||||
let topPosition = this.wysiwygRangePosition.top;
|
||||
// make sure the popover won't be out(below) of the page
|
||||
const enoughSpaceBelow = window.innerHeight - popover.clientHeight - this.wysiwygRangePosition.top;
|
||||
let topPosition = (enoughSpaceBelow > 0) ? this.wysiwygRangePosition.top : this.wysiwygRangePosition.top + enoughSpaceBelow;
|
||||
|
||||
// Offset the popover to ensure the arrow is pointing at
|
||||
// the precise range location.
|
||||
let leftPosition = this.wysiwygRangePosition.left - 14;
|
||||
// make sure the popover won't be out(right) of the page
|
||||
const enoughSpaceRight = window.innerWidth - popover.clientWidth - leftPosition;
|
||||
leftPosition = (enoughSpaceRight > 0) ? leftPosition : leftPosition + enoughSpaceRight;
|
||||
|
||||
// Apply the position back to the element.
|
||||
popover.style.top = topPosition + 'px';
|
||||
|
||||
Reference in New Issue
Block a user