diff --git a/src/src/app/services/app.service.ts b/src/src/app/services/app.service.ts index a88568ab..66924993 100644 --- a/src/src/app/services/app.service.ts +++ b/src/src/app/services/app.service.ts @@ -157,7 +157,7 @@ export class AppService extends createStateService(reducer, initialState) { async updateCards(queries: IStorable) { const cards: CardItem[] = []; for (const q of queries.value) { - const card = await this.getCardByQuery(q.qry, q.type); + const card = await this.getCardByQuery(q.qry.trim(), q.type); cards.push(card); } this.dispatch( @@ -170,9 +170,19 @@ export class AppService extends createStateService(reducer, initialState) { } private async getCardByQuery(qry: string, type?: CardType): Promise { - if (qry.startsWith('note:') || (type !== undefined && type === CardType.Note)) { - const id = qry.replace('note:', ''); - const data = this.getState().notes.value.find((o) => o.id === id); + if (qry.startsWith('note:')) { + const q = qry.toLocaleLowerCase().trim().replace('note:', ''); + const data = this.getState().notes.value.find((o) => o.title.toLowerCase().indexOf(q) > -1); + if (!data) { + return; + } + return { + qry, + type: CardType.Note, + data, + } as CardItem; + } else if (type !== undefined && type === CardType.Note) { + const data = this.getState().notes.value.find((o) => o.id === qry); if (!data) { return; }