Skip to content

Commit

Permalink
Always show 20 suggestions if no search text is entered
Browse files Browse the repository at this point in the history
  • Loading branch information
roman-r-m committed Feb 3, 2021
1 parent 2bee55d commit 8d559ff
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -1,19 +1,21 @@
import joplin from 'api';
import { ContentScriptType, Path } from 'api/types';

const NUM_RESULTS = 21;

async function getNotes(prefix: string): Promise<any[]> {
if (prefix === "") {
const notes = await joplin.data.get(['notes'], {
fields: ['id', 'title'],
order_by: 'updated_time',
order_dir: 'DESC',
limit: 11,
limit: NUM_RESULTS,
});
return notes.items;
} else {
const notes = await joplin.data.get(['search'], {
fields: ['id', 'title'],
limit: 21,
limit: NUM_RESULTS,
query: `title:${prefix.trimRight()}*`,
});
return notes.items;
Expand Down

0 comments on commit 8d559ff

Please sign in to comment.