FIX: safari would lose selection sometimes
This commit is contained in:
parent
37b256e7f2
commit
965b38ff2a
|
@ -38,6 +38,9 @@ export default Ember.Component.extend({
|
|||
}
|
||||
}
|
||||
|
||||
// used to work around Safari losing selection
|
||||
const clone = firstRange.cloneRange();
|
||||
|
||||
this.get("quoteState").setProperties({ postId, buffer: selectedText() });
|
||||
|
||||
// on Desktop, shows the button at the beginning of the selection
|
||||
|
@ -64,6 +67,11 @@ export default Ember.Component.extend({
|
|||
// remove the marker
|
||||
markerElement.parentNode.removeChild(markerElement);
|
||||
|
||||
// work around Safari that would sometimes lose the selection
|
||||
const s = window.getSelection();
|
||||
s.removeAllRanges();
|
||||
s.addRange(clone);
|
||||
|
||||
// change the position of the button
|
||||
Ember.run.scheduleOnce("afterRender", () => {
|
||||
let top = markerOffset.top;
|
||||
|
|
Loading…
Reference in New Issue