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,
|
DocsService,
|
||||||
useLiveData,
|
useLiveData,
|
||||||
useService,
|
useService,
|
||||||
|
useServiceOptional,
|
||||||
} from '@toeverything/infra';
|
} from '@toeverything/infra';
|
||||||
import clsx from 'clsx';
|
import clsx from 'clsx';
|
||||||
import type React from 'react';
|
import type React from 'react';
|
||||||
@@ -245,7 +246,7 @@ export const DocPropertiesTableBody = forwardRef<
|
|||||||
const t = useI18n();
|
const t = useI18n();
|
||||||
const docsService = useService(DocsService);
|
const docsService = useService(DocsService);
|
||||||
const workbenchService = useService(WorkbenchService);
|
const workbenchService = useService(WorkbenchService);
|
||||||
const viewService = useService(ViewService);
|
const viewService = useServiceOptional(ViewService);
|
||||||
const properties = useLiveData(docsService.propertyList.sortedProperties$);
|
const properties = useLiveData(docsService.propertyList.sortedProperties$);
|
||||||
const [propertyCollapsed, setPropertyCollapsed] = useState(true);
|
const [propertyCollapsed, setPropertyCollapsed] = useState(true);
|
||||||
|
|
||||||
@@ -312,6 +313,7 @@ export const DocPropertiesTableBody = forwardRef<
|
|||||||
{t['com.affine.page-properties.add-property']()}
|
{t['com.affine.page-properties.add-property']()}
|
||||||
</Button>
|
</Button>
|
||||||
</Menu>
|
</Menu>
|
||||||
|
{viewService ? (
|
||||||
<Button
|
<Button
|
||||||
variant="plain"
|
variant="plain"
|
||||||
prefix={<PropertyIcon />}
|
prefix={<PropertyIcon />}
|
||||||
@@ -326,6 +328,7 @@ export const DocPropertiesTableBody = forwardRef<
|
|||||||
>
|
>
|
||||||
{t['com.affine.page-properties.config-properties']()}
|
{t['com.affine.page-properties.config-properties']()}
|
||||||
</Button>
|
</Button>
|
||||||
|
) : null}
|
||||||
</div>
|
</div>
|
||||||
</PropertyCollapsibleContent>
|
</PropertyCollapsibleContent>
|
||||||
</PropertyCollapsibleSection>
|
</PropertyCollapsibleSection>
|
||||||
|
|||||||
Reference in New Issue
Block a user