mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-08-18 02:21:51 +08: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,
|
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,20 +313,22 @@ export const DocPropertiesTableBody = forwardRef<
|
|||||||
{t['com.affine.page-properties.add-property']()}
|
{t['com.affine.page-properties.add-property']()}
|
||||||
</Button>
|
</Button>
|
||||||
</Menu>
|
</Menu>
|
||||||
<Button
|
{viewService ? (
|
||||||
variant="plain"
|
<Button
|
||||||
prefix={<PropertyIcon />}
|
variant="plain"
|
||||||
className={clsx(
|
prefix={<PropertyIcon />}
|
||||||
styles.propertyActionButton,
|
className={clsx(
|
||||||
styles.propertyConfigButton
|
styles.propertyActionButton,
|
||||||
)}
|
styles.propertyConfigButton
|
||||||
onClick={() => {
|
)}
|
||||||
viewService.view.activeSidebarTab('properties');
|
onClick={() => {
|
||||||
workbenchService.workbench.openSidebar();
|
viewService.view.activeSidebarTab('properties');
|
||||||
}}
|
workbenchService.workbench.openSidebar();
|
||||||
>
|
}}
|
||||||
{t['com.affine.page-properties.config-properties']()}
|
>
|
||||||
</Button>
|
{t['com.affine.page-properties.config-properties']()}
|
||||||
|
</Button>
|
||||||
|
) : null}
|
||||||
</div>
|
</div>
|
||||||
</PropertyCollapsibleContent>
|
</PropertyCollapsibleContent>
|
||||||
</PropertyCollapsibleSection>
|
</PropertyCollapsibleSection>
|
||||||
|
|||||||
Reference in New Issue
Block a user