From 00e3482815ef7d0d14aadafe8ceecd280134009d Mon Sep 17 00:00:00 2001 From: Joe Woods Date: Mon, 30 Jan 2023 23:50:29 +0000 Subject: [PATCH] Add secondary path if setBaseAndExtent undefined --- source/Editor.ts | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/source/Editor.ts b/source/Editor.ts index 8c768ce..bad81b6 100644 --- a/source/Editor.ts +++ b/source/Editor.ts @@ -639,12 +639,17 @@ class Squire { } else { const selection = window.getSelection(); if (selection) { - selection.setBaseAndExtent( - range.startContainer, - range.startOffset, - range.endContainer, - range.endOffset, - ); + if ('setBaseAndExtent' in Selection.prototype) { + selection.setBaseAndExtent( + range.startContainer, + range.startOffset, + range.endContainer, + range.endOffset, + ); + } else { + selection.removeAllRanges(); + selection.addRange(range); + } } } return this;