PERF: stop firing superfluous onSelectionChange
onSelectionChanged fires a debounced event that calls window.getSelection() window.getSelection() is reasonably expensive. There is no reason to do any of this work if we have an input field focused, that is not how quote works
This commit is contained in:
parent
7132c50f3b
commit
fa96054acf
|
@ -188,10 +188,16 @@ export default Component.extend({
|
|||
.on("mouseup.quote-button", () => {
|
||||
this._prevSelection = null;
|
||||
this._isMouseDown = false;
|
||||
onSelectionChanged();
|
||||
if (document.activeElement === document.body) {
|
||||
onSelectionChanged();
|
||||
}
|
||||
})
|
||||
.on("selectionchange.quote-button", () => {
|
||||
if (!this._isMouseDown && !this._reselected) {
|
||||
if (
|
||||
!this._isMouseDown &&
|
||||
!this._reselected &&
|
||||
document.activeElement === document.body
|
||||
) {
|
||||
onSelectionChanged();
|
||||
}
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue