Skip to content

Commit 96d71e1

Browse files
committed
Fixed #2286 window.getSelection first
1 parent f144c81 commit 96d71e1

File tree

1 file changed

+2
-1
lines changed
  • src/content_scripts/common

1 file changed

+2
-1
lines changed

src/content_scripts/common/api.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -398,8 +398,9 @@ function createAPI(clipboard, insert, normal, hints, visual, front, browser) {
398398
* searchSelectedWith('https://translate.google.com/?hl=en#auto/en/');
399399
*/
400400
function searchSelectedWith(se, onlyThisSite, interactive, alias) {
401+
let query = window.getSelection().toString();
401402
clipboard.read(function(response) {
402-
var query = window.getSelection().toString() || response.data;
403+
query = query || response.data;
403404
if (onlyThisSite) {
404405
query = "site:" + window.location.hostname + " " + query;
405406
}

0 commit comments

Comments
 (0)