@@ -890,7 +890,7 @@ export class OdooEditor extends EventTarget {
890
890
891
891
let hiliteColor = params . hiliteColor ;
892
892
if ( ! hiliteColor ) {
893
- const sel = this . document . defaultView . getSelection ( ) ;
893
+ const sel = this . document . getSelection ( ) ;
894
894
if ( sel . rangeCount ) {
895
895
const endContainer = closestElement ( sel . getRangeAt ( 0 ) . endContainer ) ;
896
896
const hiliteColorRgb = getComputedStyle ( endContainer ) . backgroundColor ;
@@ -921,7 +921,7 @@ export class OdooEditor extends EventTarget {
921
921
* @returns {? }
922
922
*/
923
923
_applyRawCommand ( method , ...args ) {
924
- const sel = this . document . defaultView . getSelection ( ) ;
924
+ const sel = this . document . getSelection ( ) ;
925
925
if ( ! sel . isCollapsed && BACKSPACE_FIRST_COMMANDS . includes ( method ) ) {
926
926
this . deleteRange ( sel ) ;
927
927
if ( BACKSPACE_ONLY_COMMANDS . includes ( method ) ) {
@@ -1008,7 +1008,7 @@ export class OdooEditor extends EventTarget {
1008
1008
* @returns {Object }
1009
1009
*/
1010
1010
_computeHistoryCursor ( ) {
1011
- const sel = this . document . defaultView . getSelection ( ) ;
1011
+ const sel = this . document . getSelection ( ) ;
1012
1012
if ( ! sel . anchorNode ) {
1013
1013
return this . _latestComputedCursor ;
1014
1014
}
@@ -1072,7 +1072,7 @@ export class OdooEditor extends EventTarget {
1072
1072
this . toolbar . style . visibility = 'visible' ;
1073
1073
}
1074
1074
1075
- const sel = this . document . defaultView . getSelection ( ) ;
1075
+ const sel = this . document . getSelection ( ) ;
1076
1076
if ( ! sel . anchorNode ) {
1077
1077
show = false ;
1078
1078
}
@@ -1168,7 +1168,7 @@ export class OdooEditor extends EventTarget {
1168
1168
let isBottom = false ;
1169
1169
this . toolbar . classList . toggle ( 'toolbar-bottom' , false ) ;
1170
1170
this . toolbar . style . maxWidth = this . editable . offsetWidth - OFFSET * 2 + 'px' ;
1171
- const sel = this . document . defaultView . getSelection ( ) ;
1171
+ const sel = this . document . getSelection ( ) ;
1172
1172
const range = sel . getRangeAt ( 0 ) ;
1173
1173
const isSelForward =
1174
1174
sel . anchorNode === range . startContainer && sel . anchorOffset === range . startOffset ;
@@ -1255,7 +1255,7 @@ export class OdooEditor extends EventTarget {
1255
1255
}
1256
1256
} else if ( [ 'insertText' , 'insertCompositionText' ] . includes ( ev . inputType ) ) {
1257
1257
// insertCompositionText, courtesy of Samsung keyboard.
1258
- const selection = this . document . defaultView . getSelection ( ) ;
1258
+ const selection = this . document . getSelection ( ) ;
1259
1259
// Detect that text was selected and change behavior only if it is the case,
1260
1260
// since it is the only text insertion case that may cause problems.
1261
1261
if ( anchorNode !== focusNode || anchorOffset !== focusOffset ) {
@@ -1289,7 +1289,7 @@ export class OdooEditor extends EventTarget {
1289
1289
// representation of the key. In this case, call `deleteRange` before
1290
1290
// inserting the printed representation of the character.
1291
1291
if ( / ^ .$ / u. test ( ev . key ) && ! ev . ctrlKey && ! ev . metaKey ) {
1292
- const selection = this . document . defaultView . getSelection ( ) ;
1292
+ const selection = this . document . getSelection ( ) ;
1293
1293
if ( selection && ! selection . isCollapsed ) {
1294
1294
this . deleteRange ( selection ) ;
1295
1295
}
@@ -1336,7 +1336,7 @@ export class OdooEditor extends EventTarget {
1336
1336
// that to the command execution or the 'input' event handler.
1337
1337
this . _computeHistoryCursor ( ) ;
1338
1338
1339
- const selection = this . document . defaultView . getSelection ( ) ;
1339
+ const selection = this . document . getSelection ( ) ;
1340
1340
const isSelectionInEditable =
1341
1341
! selection . isCollapsed &&
1342
1342
this . editable . contains ( selection . anchorNode ) &&
@@ -1464,7 +1464,7 @@ export class OdooEditor extends EventTarget {
1464
1464
*/
1465
1465
_onDrop ( ev ) {
1466
1466
ev . preventDefault ( ) ;
1467
- const sel = this . document . defaultView . getSelection ( ) ;
1467
+ const sel = this . document . getSelection ( ) ;
1468
1468
let isInEditor = false ;
1469
1469
let ancestor = sel . anchorNode ;
1470
1470
while ( ancestor && ! isInEditor ) {
@@ -1488,7 +1488,7 @@ export class OdooEditor extends EventTarget {
1488
1488
const range = this . document . caretRangeFromPoint ( ev . clientX , ev . clientY ) ;
1489
1489
setCursor ( range . startContainer , range . startOffset ) ;
1490
1490
}
1491
- insertText ( this . document . defaultView . getSelection ( ) , pastedText ) ;
1491
+ insertText ( this . document . getSelection ( ) , pastedText ) ;
1492
1492
} ) ;
1493
1493
}
1494
1494
this . historyStep ( ) ;
@@ -1606,7 +1606,7 @@ export class OdooEditor extends EventTarget {
1606
1606
* Fix the current selection range in case the range start or end inside a fontAwesome node
1607
1607
*/
1608
1608
_fixFontAwesomeSelection ( ) {
1609
- const selection = this . document . defaultView . getSelection ( ) ;
1609
+ const selection = this . document . getSelection ( ) ;
1610
1610
if (
1611
1611
selection . isCollapsed ||
1612
1612
( selection . anchorNode &&
0 commit comments