Text selection fixes (#511)

* select matched text in Frontend.findKanji

* blur search query input when setting content
This commit is contained in:
siikamiika 2020-05-07 01:49:42 +03:00 committed by GitHub
parent 253dcf8b38
commit a88501ff10
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 0 deletions

View File

@ -301,6 +301,11 @@ class DisplaySearch extends Display {
this.queryParser.setText(interpretedQuery); this.queryParser.setText(interpretedQuery);
} }
async setContent(type, details) {
this.query.blur();
await super.setContent(type, details);
}
setIntroVisible(visible, animate) { setIntroVisible(visible, animate) {
if (this.introVisible === visible) { if (this.introVisible === visible) {
return; return;

View File

@ -257,6 +257,8 @@ class Frontend {
const definitions = await apiKanjiFind(searchText, optionsContext); const definitions = await apiKanjiFind(searchText, optionsContext);
if (definitions.length === 0) { return null; } if (definitions.length === 0) { return null; }
textSource.setEndOffset(1);
return {definitions, type: 'kanji'}; return {definitions, type: 'kanji'};
} }