From 2d95541126e56d41fa3f97aacc6da163dd6470f4 Mon Sep 17 00:00:00 2001 From: wareya Date: Thu, 27 Feb 2020 10:12:32 -0500 Subject: [PATCH] fix another source of the selection/clicking bug --- manifest.json | 2 +- texthook.js | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/manifest.json b/manifest.json index b82eb39..6229b68 100644 --- a/manifest.json +++ b/manifest.json @@ -1,7 +1,7 @@ { "manifest_version": 2, "name": "nazeka", - "version": "0.4.6", + "version": "0.4.7", "author": "Wareya", "homepage_url": "https://github.com/wareya/nazeka", "description": "A rikai replacement.", diff --git a/texthook.js b/texthook.js index 3ecfb3d..18709e7 100644 --- a/texthook.js +++ b/texthook.js @@ -1800,8 +1800,10 @@ function grab_more_text(textNode, selection_range, direction = 1) function grab_text(textNode, offset, elemental) { let selection_range = window.getSelection(); - if(selection_range) + if(selection_range && selection_range.rangeCount > 0) selection_range = selection_range.getRangeAt(0); + else + selection_range = undefined; if(selection_filter_enabled(selection_range) && selection_rejects_node(selection_range, textNode, offset)) selection_range = undefined;