mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
FIX: Selections getting deselected on FireFox.
This commit is contained in:
@@ -55,7 +55,8 @@ export default Ember.Component.extend({
|
||||
const { isIOS, isAndroid, isSafari } = this.capabilities;
|
||||
const showAtEnd = isMobileDevice || isIOS || isAndroid;
|
||||
|
||||
// used to work around Safari losing selection
|
||||
// Don't mess with the original range as it results in weird behaviours
|
||||
// where certain browsers will deselect the selection
|
||||
const clone = firstRange.cloneRange();
|
||||
|
||||
// create a marker element containing a single invisible character
|
||||
@@ -63,9 +64,9 @@ export default Ember.Component.extend({
|
||||
markerElement.appendChild(document.createTextNode("\ufeff"));
|
||||
|
||||
// on mobile, collapse the range at the end of the selection
|
||||
if (showAtEnd) { firstRange.collapse(); }
|
||||
if (showAtEnd) { clone.collapse(); }
|
||||
// insert the marker
|
||||
firstRange.insertNode(markerElement);
|
||||
clone.insertNode(markerElement);
|
||||
|
||||
// retrieve the position of the marker
|
||||
const $markerElement = $(markerElement);
|
||||
|
||||
Reference in New Issue
Block a user