mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-15 05:37:32 +00:00
fix: listen
This commit is contained in:
@@ -42,11 +42,11 @@ const Page: NextPageWithLayout = () => {
|
|||||||
let disposable: Disposable | undefined;
|
let disposable: Disposable | undefined;
|
||||||
|
|
||||||
const editor = createEditor?.current?.(currentPage!);
|
const editor = createEditor?.current?.(currentPage!);
|
||||||
|
const isFirstPage = currentWorkspace?.meta.pageMetas.length === 1;
|
||||||
if (editor) {
|
if (editor) {
|
||||||
editorContainer.current?.appendChild(editor);
|
editorContainer.current?.appendChild(editor);
|
||||||
setEditor?.current?.(editor);
|
setEditor?.current?.(editor);
|
||||||
if (currentPage!.isEmpty) {
|
if (currentPage!.isEmpty) {
|
||||||
const isFirstPage = currentWorkspace?.meta.pageMetas.length === 1;
|
|
||||||
// Can not use useCurrentPageMeta to get new title, cause meta title will trigger rerender, but the second time can not remove title
|
// Can not use useCurrentPageMeta to get new title, cause meta title will trigger rerender, but the second time can not remove title
|
||||||
const { title: metaTitle } = currentPage!.meta;
|
const { title: metaTitle } = currentPage!.meta;
|
||||||
const title = metaTitle ? metaTitle : isFirstPage ? firstPageTitle : '';
|
const title = metaTitle ? metaTitle : isFirstPage ? firstPageTitle : '';
|
||||||
@@ -72,12 +72,12 @@ const Page: NextPageWithLayout = () => {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
currentPage!.resetHistory();
|
currentPage!.resetHistory();
|
||||||
disposable = editor.pageBlockModel?.propsUpdated.on(() => {
|
|
||||||
document.title = isFirstPage
|
|
||||||
? firstPageTitle
|
|
||||||
: currentPage?.meta.title || 'Untitled';
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
disposable = editor.pageBlockModel?.propsUpdated.on(() => {
|
||||||
|
document.title = isFirstPage
|
||||||
|
? firstPageTitle
|
||||||
|
: currentPage?.meta.title || 'Untitled';
|
||||||
|
});
|
||||||
}
|
}
|
||||||
return () => {
|
return () => {
|
||||||
ret();
|
ret();
|
||||||
|
|||||||
Reference in New Issue
Block a user