Move apiKanjiFind implementation into Backend
This commit is contained in:
parent
8dff73679e
commit
5cceba15e2
@ -105,11 +105,8 @@ async function apiTextParseMecab(text, optionsContext) {
|
||||
return results;
|
||||
}
|
||||
|
||||
async function apiKanjiFind(text, optionsContext) {
|
||||
const options = await apiOptionsGet(optionsContext);
|
||||
const definitions = await utilBackend().translator.findKanji(text, options);
|
||||
definitions.splice(options.general.maxResults);
|
||||
return definitions;
|
||||
function apiKanjiFind(text, optionsContext) {
|
||||
return utilBackend()._onApiKanjiFind({text, optionsContext});
|
||||
}
|
||||
|
||||
async function apiDefinitionAdd(definition, mode, context, optionsContext) {
|
||||
|
@ -240,8 +240,11 @@ class Backend {
|
||||
this.onOptionsUpdated(source);
|
||||
}
|
||||
|
||||
_onApiKanjiFind({text, optionsContext}) {
|
||||
return apiKanjiFind(text, optionsContext);
|
||||
async _onApiKanjiFind({text, optionsContext}) {
|
||||
const options = await this.getOptions(optionsContext);
|
||||
const definitions = await this.translator.findKanji(text, options);
|
||||
definitions.splice(options.general.maxResults);
|
||||
return definitions;
|
||||
}
|
||||
|
||||
_onApiTermsFind({text, details, optionsContext}) {
|
||||
|
Loading…
Reference in New Issue
Block a user