[FIX] web_editor: more robust getRangePosition
Ensure getRangePosition do not crash if the current selection is collapsed. task-2154624 Part-of: odoo/odoo#71878
This commit is contained in:
@@ -2109,7 +2109,7 @@ export function rgbToHex(rgb = '') {
|
||||
|
||||
export function getRangePosition(el, document, options = {}) {
|
||||
const selection = document.getSelection();
|
||||
if (!selection.isCollapsed || !selection.rangeCount) return;
|
||||
if (!selection.rangeCount) return;
|
||||
const range = selection.getRangeAt(0);
|
||||
|
||||
const marginRight = options.marginRight || 20;
|
||||
|
||||
Reference in New Issue
Block a user