mirror of
https://github.com/toeverything/AFFiNE.git
synced 2024-12-02 14:33:54 +03:00
feat(core): highlight doc title in search result (#7786)
This commit is contained in:
parent
03fd23de39
commit
c7aabd3a8d
@ -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',
|
||||
|
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user