diff options
author | toasted-nutbread <toasted-nutbread@users.noreply.github.com> | 2021-02-28 14:18:18 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-02-28 14:18:18 -0500 |
commit | 4806414f957ca324fad7d152ef04e34602a7bdbd (patch) | |
tree | 77e28414d19a5a417a208ea13e1a1d492c2404a3 /ext/js/background | |
parent | 6f76645f4cf0005ddb1022406fdf259a5117ce26 (diff) |
Text source element scanning improvements (#1464)
* Add api.textHasJapaneseCharacters
* Add support for empty query
* Add support for showing the query parser for TextSourceElement
with content that does not start with Japanese text
Diffstat (limited to 'ext/js/background')
-rw-r--r-- | ext/js/background/backend.js | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/ext/js/background/backend.js b/ext/js/background/backend.js index 484473c7..3d8c4c4a 100644 --- a/ext/js/background/backend.js +++ b/ext/js/background/backend.js @@ -127,7 +127,8 @@ class Backend { ['getOrCreateSearchPopup', {async: true, contentScript: true, handler: this._onApiGetOrCreateSearchPopup.bind(this)}], ['isTabSearchPopup', {async: true, contentScript: true, handler: this._onApiIsTabSearchPopup.bind(this)}], ['triggerDatabaseUpdated', {async: false, contentScript: true, handler: this._onApiTriggerDatabaseUpdated.bind(this)}], - ['testMecab', {async: true, contentScript: true, handler: this._onApiTestMecab.bind(this)}] + ['testMecab', {async: true, contentScript: true, handler: this._onApiTestMecab.bind(this)}], + ['textHasJapaneseCharacters', {async: false, contentScript: true, handler: this._onApiTextHasJapaneseCharacters.bind(this)}] ]); this._messageHandlersWithProgress = new Map([ ]); @@ -727,6 +728,10 @@ class Backend { return true; } + _onApiTextHasJapaneseCharacters({text}) { + return this._japaneseUtil.isStringPartiallyJapanese(text); + } + // Command handlers async _onCommandOpenSearchPage(params) { |