summaryrefslogtreecommitdiff
path: root/ext/fg/js
diff options
context:
space:
mode:
authorsiikamiika <siikamiika@users.noreply.github.com>2020-05-05 00:13:43 +0300
committerGitHub <noreply@github.com>2020-05-05 00:13:43 +0300
commit7d7ff165ced305bc269b24aa0ce8664272d86fa6 (patch)
treeacfba82a6b71770263dae23ce2f1ecb2a617f256 /ext/fg/js
parent77b744e675f8abf17ff5e8433f4f1717e0c9ffb5 (diff)
Extract textSource text inside TextScanner (#500)
* extract text inside TextScanner * clone textSource before text extraction
Diffstat (limited to 'ext/fg/js')
-rw-r--r--ext/fg/js/frontend.js8
1 files changed, 2 insertions, 6 deletions
diff --git a/ext/fg/js/frontend.js b/ext/fg/js/frontend.js
index d979246d..b2cb0cd8 100644
--- a/ext/fg/js/frontend.js
+++ b/ext/fg/js/frontend.js
@@ -239,9 +239,7 @@ class Frontend {
}
async findTerms(textSource, optionsContext) {
- this._textScanner.setTextSourceScanLength(textSource, this._options.scanning.length);
-
- const searchText = textSource.text();
+ const searchText = this._textScanner.getTextSourceContent(textSource, this._options.scanning.length);
if (searchText.length === 0) { return null; }
const {definitions, length} = await apiTermsFind(searchText, {}, optionsContext);
@@ -253,9 +251,7 @@ class Frontend {
}
async findKanji(textSource, optionsContext) {
- this._textScanner.setTextSourceScanLength(textSource, 1);
-
- const searchText = textSource.text();
+ const searchText = this._textScanner.getTextSourceContent(textSource, 1);
if (searchText.length === 0) { return null; }
const definitions = await apiKanjiFind(searchText, optionsContext);