fix(core): keep the delete button from being blocked (#6836)

close #6718
This commit is contained in:
JimmFly
2024-05-09 08:26:32 +00:00
parent d8b3a0b6d5
commit f4a422c0e9
2 changed files with 26 additions and 1 deletions

View File

@@ -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)',

View File

@@ -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 <div className={toolStyle}>{props.children}</div>;
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 (
<div
className={clsx(toolStyle, {
trash: inTrash,
})}
>
{props.children}
</div>
);
};
export const WorkspaceFallback = (): ReactElement => {