mirror of
https://github.com/fastmail/Squire.git
synced 2024-12-22 15:23:29 -05:00
Add secondary path if setBaseAndExtent undefined
This commit is contained in:
parent
fe0dfdf6c4
commit
00e3482815
1 changed files with 11 additions and 6 deletions
|
@ -639,12 +639,17 @@ class Squire {
|
||||||
} else {
|
} else {
|
||||||
const selection = window.getSelection();
|
const selection = window.getSelection();
|
||||||
if (selection) {
|
if (selection) {
|
||||||
selection.setBaseAndExtent(
|
if ('setBaseAndExtent' in Selection.prototype) {
|
||||||
range.startContainer,
|
selection.setBaseAndExtent(
|
||||||
range.startOffset,
|
range.startContainer,
|
||||||
range.endContainer,
|
range.startOffset,
|
||||||
range.endOffset,
|
range.endContainer,
|
||||||
);
|
range.endOffset,
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
selection.removeAllRanges();
|
||||||
|
selection.addRange(range);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return this;
|
return this;
|
||||||
|
|
Loading…
Reference in a new issue