[FIX] web_editor: patch for null selection in condition
Reproduction: 1. Go to any record with a chatter 2. Open full composer 3. Enter a special case for the text using shortcuts (CTRL+I for italic, CTRL+B for bold, etc) 4. exit the special case with the same shortcut 5. JS error Reason: A selection is not null check is missing in the condition Related PR: https://github.com/odoo/odoo/pull/136777 closes odoo/odoo#137499 X-original-commit: db0325503576d06521ab65a64d3c9cce837e66bc Signed-off-by: David Monjoie (dmo) <dmo@odoo.com> Signed-off-by: Jinjiu Liu (jili) <jili@odoo.com>
This commit is contained in:
@@ -741,7 +741,7 @@ export function getSelectedNodes(editable) {
|
||||
*/
|
||||
export function getDeepRange(editable, { range, sel, splitText, select, correctTripleClick } = {}) {
|
||||
sel = sel || editable.parentElement && editable.ownerDocument.getSelection();
|
||||
if (sel.isCollapsed && sel.anchorNode && sel.anchorNode.nodeName === "BR") {
|
||||
if (sel && sel.isCollapsed && sel.anchorNode && sel.anchorNode.nodeName === "BR") {
|
||||
setCursorStart(sel.anchorNode.parentElement, false);
|
||||
}
|
||||
range = range ? range.cloneRange() : sel && sel.rangeCount && sel.getRangeAt(0).cloneRange();
|
||||
|
||||
Reference in New Issue
Block a user