FIX: Quote selection in IE11

This commit is contained in:
David Taylor 2018-12-31 13:53:29 +00:00
parent 70fdc10365
commit 27ed60bad0
2 changed files with 6 additions and 2 deletions

View File

@ -60,7 +60,7 @@ export default Ember.Component.extend({
// on Desktop, shows the button at the beginning of the selection
// on Mobile, shows the button at the end of the selection
const isMobileDevice = this.site.isMobileDevice;
const { isIOS, isAndroid, isSafari, isOpera } = this.capabilities;
const { isIOS, isAndroid, isSafari, isOpera, isIE11 } = this.capabilities;
const showAtEnd = isMobileDevice || isIOS || isAndroid || isOpera;
// Don't mess with the original range as it results in weird behaviours
@ -88,7 +88,10 @@ export default Ember.Component.extend({
const parent = markerElement.parentNode;
parent.removeChild(markerElement);
// merge back all text nodes so they don't get messed up
parent.normalize();
if (!isIE11) {
// Skip this fix in IE11 - .normalize causes the selection to change
parent.normalize();
}
// work around Safari that would sometimes lose the selection
if (isSafari) {

View File

@ -30,6 +30,7 @@ export default {
return p.toString() === "[object SafariRemoteNotification]";
})(!window["safari"] || safari.pushNotification);
caps.isChrome = !!window.chrome && !caps.isOpera;
caps.isIE11 = !!ua.match(/Trident.*rv\:11\./);
caps.canPasteImages = caps.isChrome || caps.isFirefox;
}