summaryrefslogtreecommitdiff
path: root/ext/bg
diff options
context:
space:
mode:
Diffstat (limited to 'ext/bg')
-rw-r--r--ext/bg/js/query-parser.js9
-rw-r--r--ext/bg/search.html2
-rw-r--r--ext/bg/settings-popup-preview.html2
3 files changed, 7 insertions, 6 deletions
diff --git a/ext/bg/js/query-parser.js b/ext/bg/js/query-parser.js
index 6ca09a82..2ad88601 100644
--- a/ext/bg/js/query-parser.js
+++ b/ext/bg/js/query-parser.js
@@ -19,11 +19,10 @@
* QueryParserGenerator
* TextScanner
* api
- * docSentenceExtract
*/
class QueryParser extends EventDispatcher {
- constructor({getOptionsContext, setSpinnerVisible}) {
+ constructor({getOptionsContext, setSpinnerVisible, documentUtil}) {
super();
this._getOptionsContext = getOptionsContext;
this._setSpinnerVisible = setSpinnerVisible;
@@ -31,6 +30,7 @@ class QueryParser extends EventDispatcher {
this._scanLength = 1;
this._sentenceExtent = 1;
this._layoutAwareScan = false;
+ this._documentUtil = documentUtil;
this._parseResults = [];
this._queryParser = document.querySelector('#query-parser-content');
this._queryParserSelect = document.querySelector('#query-parser-select-container');
@@ -39,7 +39,8 @@ class QueryParser extends EventDispatcher {
node: this._queryParser,
ignoreElements: () => [],
ignorePoint: null,
- search: this._search.bind(this)
+ search: this._search.bind(this),
+ documentUtil
});
}
@@ -104,7 +105,7 @@ class QueryParser extends EventDispatcher {
const {definitions, length} = await api.termsFind(searchText, {}, optionsContext);
if (definitions.length === 0) { return null; }
- const sentence = docSentenceExtract(textSource, sentenceExtent, layoutAwareScan);
+ const sentence = this._documentUtil.extractSentence(textSource, sentenceExtent, layoutAwareScan);
textSource.setEndOffset(length, layoutAwareScan);
diff --git a/ext/bg/search.html b/ext/bg/search.html
index eb85e368..aff71835 100644
--- a/ext/bg/search.html
+++ b/ext/bg/search.html
@@ -79,7 +79,7 @@
<script src="/bg/js/dictionary.js"></script>
<script src="/bg/js/handlebars.js"></script>
- <script src="/fg/js/document.js"></script>
+ <script src="/fg/js/document-util.js"></script>
<script src="/fg/js/dom-text-scanner.js"></script>
<script src="/fg/js/source.js"></script>
<script src="/mixed/js/audio-system.js"></script>
diff --git a/ext/bg/settings-popup-preview.html b/ext/bg/settings-popup-preview.html
index 5b3a9692..3479efa4 100644
--- a/ext/bg/settings-popup-preview.html
+++ b/ext/bg/settings-popup-preview.html
@@ -127,7 +127,7 @@
<script src="/mixed/js/frame-client.js"></script>
<script src="/mixed/js/text-scanner.js"></script>
- <script src="/fg/js/document.js"></script>
+ <script src="/fg/js/document-util.js"></script>
<script src="/fg/js/dom-text-scanner.js"></script>
<script src="/fg/js/popup.js"></script>
<script src="/fg/js/source.js"></script>