feat(core): highlight doc title in search result (#7786)

This commit is contained in:
EYHN 2024-08-08 08:56:50 +00:00
parent 03fd23de39
commit c7aabd3a8d
No known key found for this signature in database
GPG Key ID: 46C9E26A75AB276C
2 changed files with 7 additions and 3 deletions

View File

@ -86,7 +86,10 @@ export class DocsQuickSearchSession
)
.map(([doc, docRecord]) => {
const { title, icon, updatedDate } =
this.docDisplayMetaService.getDocDisplayMeta(docRecord);
this.docDisplayMetaService.getDocDisplayMeta(
docRecord,
'title' in doc ? doc.title : undefined
);
return {
id: 'doc:' + docRecord.id,
source: 'docs',

View File

@ -10,7 +10,7 @@ export class DocDisplayMetaService extends Service {
super();
}
getDocDisplayMeta(docRecord: DocRecord) {
getDocDisplayMeta(docRecord: DocRecord, originalTitle?: string) {
const journalDateString = this.propertiesAdapter.getJournalPageDateString(
docRecord.id
);
@ -22,7 +22,8 @@ export class DocDisplayMetaService extends Service {
const title = journalDateString
? i18nTime(journalDateString, { absolute: { accuracy: 'day' } })
: docRecord.meta$.value.title ||
: originalTitle ||
docRecord.meta$.value.title ||
({
key: 'Untitled',
} as const);