Skip to content

Commit

Permalink
Bypass select modal if single match found (issue #6)
Browse files Browse the repository at this point in the history
  • Loading branch information
nickynicolson committed Nov 30, 2023
1 parent 4cdfb0a commit 6468b3e
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -160,8 +160,11 @@ export default class WikidataSidebarPlugin extends Plugin {
async searchWikidataMetadataByProperty(propertyname: string, propertyvalue: string): Promise<WikidataEntity> {
const searchResults = await this.serviceProvider.getByProperty(propertyname, propertyvalue);
console.log(`Found ${searchResults.length}`);
console.log('hello');
return await this.openWikidataSuggestModal(searchResults);
if (searchResults.length == 1) {
return searchResults[0];
} else {
return await this.openWikidataSuggestModal(searchResults);
}
}

async openWikidataSuggestModal(items: WikidataEntity[]): Promise<WikidataEntity> {
Expand Down

0 comments on commit 6468b3e

Please sign in to comment.