diff options
author | toasted-nutbread <toasted-nutbread@users.noreply.github.com> | 2020-08-09 13:19:42 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-08-09 13:19:42 -0400 |
commit | e87cc5c37d6ae2f845af7bd28720cb47372589bc (patch) | |
tree | 6dcee5e3975cb4deab514eaca7fa24aaf9a6250e /ext/mixed/js/display.js | |
parent | b3eb2cb1ef9fd28ea2dadb9eda8568a3b6958e9c (diff) |
Query parser text scanner options refactor (#717)
* Add _setSelectedParser helper
* Update TextScanner internal options representation
* Update QueryParser internal options representation
Diffstat (limited to 'ext/mixed/js/display.js')
-rw-r--r-- | ext/mixed/js/display.js | 28 |
1 files changed, 23 insertions, 5 deletions
diff --git a/ext/mixed/js/display.js b/ext/mixed/js/display.js index 418707ca..927c2c2c 100644 --- a/ext/mixed/js/display.js +++ b/ext/mixed/js/display.js @@ -218,11 +218,29 @@ class Display extends EventDispatcher { } async updateOptions() { - this._options = await api.optionsGet(this.getOptionsContext()); - this._updateDocumentOptions(this._options); - this._updateTheme(this._options.general.popupTheme); - this.setCustomCss(this._options.general.customPopupCss); - this._queryParser.setOptions(this._options); + const options = await api.optionsGet(this.getOptionsContext()); + const scanning = options.scanning; + this._options = options; + + this._updateDocumentOptions(options); + this._updateTheme(options.general.popupTheme); + this.setCustomCss(options.general.customPopupCss); + + this._queryParser.setOptions({ + selectedParser: options.parsing.selectedParser, + scanLength: scanning.length, + sentenceExtent: options.anki.sentenceExt, + layoutAwareScan: scanning.layoutAwareScan, + termSpacing: options.parsing.termSpacing, + scanning: { + deepContentScan: scanning.deepDomScan, + selectText: scanning.selectText, + modifier: scanning.modifier, + useMiddleMouse: scanning.middleMouse, + delay: scanning.delay, + touchInputEnabled: scanning.touchInputEnabled + } + }); } addMultipleEventListeners(selector, type, listener, options) { |