aboutsummaryrefslogtreecommitdiff
path: root/ext/fg/js/client.js
diff options
context:
space:
mode:
authorAlex Yatskov <alex@foosoft.net>2016-04-23 21:09:33 -0700
committerAlex Yatskov <alex@foosoft.net>2016-04-23 21:09:33 -0700
commitdefe4e5759354178c8a16d9df0bee0817abae99b (patch)
tree29a0f117301f8be6dbfcc1755e340a6655426856 /ext/fg/js/client.js
parent8b097221db06cd9119acc405ec84794362899086 (diff)
WIP
Diffstat (limited to 'ext/fg/js/client.js')
-rw-r--r--ext/fg/js/client.js14
1 files changed, 6 insertions, 8 deletions
diff --git a/ext/fg/js/client.js b/ext/fg/js/client.js
index 3df713a3..7e9a9896 100644
--- a/ext/fg/js/client.js
+++ b/ext/fg/js/client.js
@@ -57,7 +57,7 @@ class Client {
if (this.enabled && (e.shiftKey || e.which === 2)) {
this.searchAt(this.lastMousePos);
} else {
- this.popup.hide();
+ this.hidePopup();
}
}
@@ -87,7 +87,7 @@ class Client {
return;
}
- if (this.lastRange !== null && this.lastRange.equalTo(range)) {
+ if (this.lastRange !== null && this.lastRange.equals(range)) {
return;
}
@@ -110,15 +110,13 @@ class Client {
}
showPopup(range, length, content) {
- if (this.options.highlightText) {
- range.setEnd(range.endContainer, range.startOffset + length);
+ this.popup.showNextTo(range, content);
- const selection = window.getSelection();
- selection.removeAllRanges();
- selection.addRange(range);
+ if (this.options.highlightText) {
+ this.range.select(length);
}
- this.popup.showNextTo(range, content);
+ this.lastRange = range;
}
hidePopup() {