PERF: stop firing superfluous onSelectionChange

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

diff --git a/app/assets/javascripts/discourse/components/quote-button.js b/app/assets/javascripts/discourse/components/quote-button.js
index 8f7d464..1806540 100644
--- a/app/assets/javascripts/discourse/components/quote-button.js
+++ b/app/assets/javascripts/discourse/components/quote-button.js
@@ -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();
         }
       });

GitHub sha: fa96054a