mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-08-02 18:09:58 +08:00
fix: getPageMeta
This commit is contained in:
@@ -7,6 +7,7 @@ import {
|
||||
} from './styles';
|
||||
import { Content } from '@/ui/layout';
|
||||
import { useEditor } from '@/providers/editor-provider';
|
||||
import { useAppState } from '@/providers/app-state-provider/context';
|
||||
import EditorModeSwitch from '@/components/editor-mode-switch';
|
||||
import QuickSearchButton from './quick-search-button';
|
||||
import Header from './header';
|
||||
@@ -14,8 +15,9 @@ import Header from './header';
|
||||
export const EditorHeader = () => {
|
||||
const [title, setTitle] = useState('');
|
||||
const [isHover, setIsHover] = useState(false);
|
||||
const { getPageMeta, currentPage, editor } = useAppState();
|
||||
|
||||
const { editor, onPropsUpdated, getPageMeta } = useEditor();
|
||||
const { onPropsUpdated } = useEditor();
|
||||
|
||||
useEffect(() => {
|
||||
onPropsUpdated(editor => {
|
||||
@@ -30,7 +32,7 @@ export const EditorHeader = () => {
|
||||
}, 300);
|
||||
}, [editor]);
|
||||
|
||||
const pageMeta = getPageMeta();
|
||||
const pageMeta = currentPage?.pageId ? getPageMeta(currentPage.pageId) : null;
|
||||
|
||||
return (
|
||||
<Header>
|
||||
|
||||
@@ -18,6 +18,7 @@ import {
|
||||
TrashIcon,
|
||||
} from '@blocksuite/icons';
|
||||
import { useEditor } from '@/providers/editor-provider';
|
||||
import { useAppState } from '@/providers/app-state-provider/context';
|
||||
import ThemeModeSwitch from '@/components/theme-mode-switch';
|
||||
import { IconButton, Button } from '@/ui/button';
|
||||
import CloseIcon from '@mui/icons-material/Close';
|
||||
@@ -29,18 +30,13 @@ import { SyncIcon } from './sync-icon';
|
||||
import { toast } from '@/components/toast';
|
||||
|
||||
const PopoverContent = () => {
|
||||
const {
|
||||
editor,
|
||||
mode,
|
||||
setMode,
|
||||
getPageMeta,
|
||||
page,
|
||||
toggleFavoritePage,
|
||||
toggleDeletePage,
|
||||
} = useEditor();
|
||||
const { getPageMeta, editor, currentPage } = useAppState();
|
||||
const { mode, setMode, toggleFavoritePage, toggleDeletePage } = useEditor();
|
||||
const { confirm } = useConfirm();
|
||||
|
||||
const { id, favorite, title } = getPageMeta(page?.id) ?? {
|
||||
const { id, favorite, title } = (currentPage?.id
|
||||
? getPageMeta(currentPage.id)
|
||||
: null) ?? {
|
||||
id: '',
|
||||
favorite: false,
|
||||
title: '',
|
||||
|
||||
Reference in New Issue
Block a user