mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-14 13:25:12 +00:00
fix(core): should display date as original title of journal (#11375)
Closes: [BS-2991](https://linear.app/affine-design/issue/BS-2991/linked-journal添加alias后,toolbar上获取不到标题)
This commit is contained in:
@@ -15,7 +15,12 @@ import {
|
||||
} from '@blocksuite/icons/lit';
|
||||
import { LifeCycleWatcher, StdIdentifier } from '@blocksuite/std';
|
||||
import type { Store } from '@blocksuite/store';
|
||||
import { computed, type Signal, signal } from '@preact/signals-core';
|
||||
import {
|
||||
computed,
|
||||
type ReadonlySignal,
|
||||
type Signal,
|
||||
signal,
|
||||
} from '@preact/signals-core';
|
||||
import type { TemplateResult } from 'lit';
|
||||
|
||||
import { referenceToNode } from '../utils/reference.js';
|
||||
@@ -44,11 +49,11 @@ export interface DocDisplayMetaExtension {
|
||||
icon: (
|
||||
docId: string,
|
||||
referenceInfo?: DocDisplayMetaParams
|
||||
) => Signal<TemplateResult>;
|
||||
) => ReadonlySignal<TemplateResult>;
|
||||
title: (
|
||||
docId: string,
|
||||
referenceInfo?: DocDisplayMetaParams
|
||||
) => Signal<string>;
|
||||
) => ReadonlySignal<string>;
|
||||
}
|
||||
|
||||
export const DocDisplayMetaProvider = createIdentifier<DocDisplayMetaExtension>(
|
||||
@@ -93,11 +98,11 @@ export class DocDisplayMetaService
|
||||
icon(
|
||||
pageId: string,
|
||||
{ params, title, referenced }: DocDisplayMetaParams = {}
|
||||
): Signal<TemplateResult> {
|
||||
): ReadonlySignal<TemplateResult> {
|
||||
const doc = this.std.workspace.getDoc(pageId);
|
||||
|
||||
if (!doc) {
|
||||
return signal(DocDisplayMetaService.icons.deleted);
|
||||
return computed(() => DocDisplayMetaService.icons.deleted);
|
||||
}
|
||||
|
||||
const store = doc.getStore();
|
||||
@@ -160,11 +165,14 @@ export class DocDisplayMetaService
|
||||
});
|
||||
}
|
||||
|
||||
title(pageId: string, { title }: DocDisplayMetaParams = {}): Signal<string> {
|
||||
title(
|
||||
pageId: string,
|
||||
{ title }: DocDisplayMetaParams = {}
|
||||
): ReadonlySignal<string> {
|
||||
const doc = this.std.workspace.getDoc(pageId);
|
||||
|
||||
if (!doc) {
|
||||
return signal(title || 'Deleted doc');
|
||||
return computed(() => title || 'Deleted doc');
|
||||
}
|
||||
|
||||
const store = doc.getStore();
|
||||
|
||||
Reference in New Issue
Block a user