From f4a422c0e9ec5f6364fd8096ea5bba7f10ec46aa Mon Sep 17 00:00:00 2001 From: JimmFly <447268514@qq.com> Date: Thu, 9 May 2024 08:26:32 +0000 Subject: [PATCH] fix(core): keep the delete button from being blocked (#6836) close #6718 --- .../src/components/workspace/index.css.ts | 5 +++++ .../core/src/components/workspace/index.tsx | 22 ++++++++++++++++++- 2 files changed, 26 insertions(+), 1 deletion(-) diff --git a/packages/frontend/core/src/components/workspace/index.css.ts b/packages/frontend/core/src/components/workspace/index.css.ts index 4a7866363..62dea2498 100644 --- a/packages/frontend/core/src/components/workspace/index.css.ts +++ b/packages/frontend/core/src/components/workspace/index.css.ts @@ -93,6 +93,11 @@ export const toolStyle = style({ display: 'flex', flexDirection: 'column', gap: '12px', + selectors: { + '&.trash': { + bottom: '78px', + }, + }, '@media': { 'screen and (max-width: 960px)': { right: 'calc((100vw - 640px) * 3 / 19 + 14px)', diff --git a/packages/frontend/core/src/components/workspace/index.tsx b/packages/frontend/core/src/components/workspace/index.tsx index dd24a0c3b..86ec13611 100644 --- a/packages/frontend/core/src/components/workspace/index.tsx +++ b/packages/frontend/core/src/components/workspace/index.tsx @@ -1,3 +1,9 @@ +import { + DocsService, + GlobalContextService, + useLiveData, + useService, +} from '@toeverything/infra'; import { clsx } from 'clsx'; import { useAtomValue } from 'jotai'; import type { HTMLAttributes, PropsWithChildren, ReactElement } from 'react'; @@ -63,7 +69,21 @@ export const MainContainer = forwardRef< MainContainer.displayName = 'MainContainer'; export const ToolContainer = (props: PropsWithChildren): ReactElement => { - return
{props.children}
; + const docId = useLiveData( + useService(GlobalContextService).globalContext.docId.$ + ); + const docRecordList = useService(DocsService).list; + const doc = useLiveData(docId ? docRecordList.doc$(docId) : undefined); + const inTrash = useLiveData(doc?.meta$)?.trash; + return ( +
+ {props.children} +
+ ); }; export const WorkspaceFallback = (): ReactElement => {