From 5db0d5d59ac794430a886a41eeb4ba18a9ee635a Mon Sep 17 00:00:00 2001 From: Alex Yatskov Date: Thu, 7 Apr 2016 22:41:16 -0700 Subject: WIP --- ext/fg/js/client.js | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) (limited to 'ext/fg/js/client.js') diff --git a/ext/fg/js/client.js b/ext/fg/js/client.js index 56d43c3e..6b618bde 100644 --- a/ext/fg/js/client.js +++ b/ext/fg/js/client.js @@ -113,9 +113,11 @@ class Client { } showPopup(range) { - const selection = window.getSelection(); - selection.removeAllRanges(); - selection.addRange(range); + if (this.options.highlightText) { + const selection = window.getSelection(); + selection.removeAllRanges(); + selection.addRange(range); + } const pos = getPopupPositionForRange(this.popup, range, this.popupOffset); @@ -130,8 +132,10 @@ class Client { return; } - const selection = window.getSelection(); - selection.removeAllRanges(); + if (this.options.highlightText) { + const selection = window.getSelection(); + selection.removeAllRanges(); + } this.popupText = ''; this.popup.style.visibility = 'hidden'; -- cgit v1.2.3