mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-14 05:14:54 +00:00
fix(core): dont show config properties in peek view (#8594)
view service is undefined in center peek.
This commit is contained in:
@@ -23,6 +23,7 @@ import {
|
||||
DocsService,
|
||||
useLiveData,
|
||||
useService,
|
||||
useServiceOptional,
|
||||
} from '@toeverything/infra';
|
||||
import clsx from 'clsx';
|
||||
import type React from 'react';
|
||||
@@ -245,7 +246,7 @@ export const DocPropertiesTableBody = forwardRef<
|
||||
const t = useI18n();
|
||||
const docsService = useService(DocsService);
|
||||
const workbenchService = useService(WorkbenchService);
|
||||
const viewService = useService(ViewService);
|
||||
const viewService = useServiceOptional(ViewService);
|
||||
const properties = useLiveData(docsService.propertyList.sortedProperties$);
|
||||
const [propertyCollapsed, setPropertyCollapsed] = useState(true);
|
||||
|
||||
@@ -312,20 +313,22 @@ export const DocPropertiesTableBody = forwardRef<
|
||||
{t['com.affine.page-properties.add-property']()}
|
||||
</Button>
|
||||
</Menu>
|
||||
<Button
|
||||
variant="plain"
|
||||
prefix={<PropertyIcon />}
|
||||
className={clsx(
|
||||
styles.propertyActionButton,
|
||||
styles.propertyConfigButton
|
||||
)}
|
||||
onClick={() => {
|
||||
viewService.view.activeSidebarTab('properties');
|
||||
workbenchService.workbench.openSidebar();
|
||||
}}
|
||||
>
|
||||
{t['com.affine.page-properties.config-properties']()}
|
||||
</Button>
|
||||
{viewService ? (
|
||||
<Button
|
||||
variant="plain"
|
||||
prefix={<PropertyIcon />}
|
||||
className={clsx(
|
||||
styles.propertyActionButton,
|
||||
styles.propertyConfigButton
|
||||
)}
|
||||
onClick={() => {
|
||||
viewService.view.activeSidebarTab('properties');
|
||||
workbenchService.workbench.openSidebar();
|
||||
}}
|
||||
>
|
||||
{t['com.affine.page-properties.config-properties']()}
|
||||
</Button>
|
||||
) : null}
|
||||
</div>
|
||||
</PropertyCollapsibleContent>
|
||||
</PropertyCollapsibleSection>
|
||||
|
||||
Reference in New Issue
Block a user