mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-25 10:22:55 +08:00
feat(core): highlight doc title in search result (#7786)
This commit is contained in:
@@ -86,7 +86,10 @@ export class DocsQuickSearchSession
|
|||||||
)
|
)
|
||||||
.map(([doc, docRecord]) => {
|
.map(([doc, docRecord]) => {
|
||||||
const { title, icon, updatedDate } =
|
const { title, icon, updatedDate } =
|
||||||
this.docDisplayMetaService.getDocDisplayMeta(docRecord);
|
this.docDisplayMetaService.getDocDisplayMeta(
|
||||||
|
docRecord,
|
||||||
|
'title' in doc ? doc.title : undefined
|
||||||
|
);
|
||||||
return {
|
return {
|
||||||
id: 'doc:' + docRecord.id,
|
id: 'doc:' + docRecord.id,
|
||||||
source: 'docs',
|
source: 'docs',
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ export class DocDisplayMetaService extends Service {
|
|||||||
super();
|
super();
|
||||||
}
|
}
|
||||||
|
|
||||||
getDocDisplayMeta(docRecord: DocRecord) {
|
getDocDisplayMeta(docRecord: DocRecord, originalTitle?: string) {
|
||||||
const journalDateString = this.propertiesAdapter.getJournalPageDateString(
|
const journalDateString = this.propertiesAdapter.getJournalPageDateString(
|
||||||
docRecord.id
|
docRecord.id
|
||||||
);
|
);
|
||||||
@@ -22,7 +22,8 @@ export class DocDisplayMetaService extends Service {
|
|||||||
|
|
||||||
const title = journalDateString
|
const title = journalDateString
|
||||||
? i18nTime(journalDateString, { absolute: { accuracy: 'day' } })
|
? i18nTime(journalDateString, { absolute: { accuracy: 'day' } })
|
||||||
: docRecord.meta$.value.title ||
|
: originalTitle ||
|
||||||
|
docRecord.meta$.value.title ||
|
||||||
({
|
({
|
||||||
key: 'Untitled',
|
key: 'Untitled',
|
||||||
} as const);
|
} as const);
|
||||||
|
|||||||
Reference in New Issue
Block a user