Only use Display.setContent

This commit is contained in:
toasted-nutbread 2019-12-27 17:42:36 -05:00
parent c53947a94a
commit dbbcfa5739
3 changed files with 5 additions and 5 deletions

View File

@ -220,12 +220,12 @@ class DisplaySearch extends Display {
this.updateSearchButton(); this.updateSearchButton();
if (valid) { if (valid) {
const {definitions} = await apiTermsFind(query, details, this.optionsContext); const {definitions} = await apiTermsFind(query, details, this.optionsContext);
this.setContentTerms(definitions, { this.setContent('terms', {definitions, context: {
focus: false, focus: false,
disableHistory: true, disableHistory: true,
sentence: {text: query, offset: 0}, sentence: {text: query, offset: 0},
url: window.location.href url: window.location.href
}); }});
} else { } else {
this.container.textContent = ''; this.container.textContent = '';
} }

View File

@ -35,7 +35,7 @@ class DisplayFloat extends Display {
onError(error) { onError(error) {
if (this._orphaned) { if (this._orphaned) {
this.setContentOrphaned(); this.setContent('orphaned');
} else { } else {
logError(error, true); logError(error, true);
} }

View File

@ -77,7 +77,7 @@ class Display {
}; };
const definitions = await apiKanjiFind(link.textContent, this.getOptionsContext()); const definitions = await apiKanjiFind(link.textContent, this.getOptionsContext());
this.setContentKanji(definitions, context); this.setContent('kanji', {definitions, context});
} catch (error) { } catch (error) {
this.onError(error); this.onError(error);
} }
@ -131,7 +131,7 @@ class Display {
}); });
} }
this.setContentTerms(definitions, context); this.setContent('terms', {definitions, context});
if (selectText) { if (selectText) {
textSource.select(); textSource.select();