fix: remove useRef in menu & tooltip (#4369)

This commit is contained in:
Qi
2023-09-16 03:29:55 +08:00
committed by GitHub
parent c41c3c81c8
commit 4577fb7e1a
18 changed files with 59 additions and 133 deletions
@@ -212,9 +212,6 @@ export const PageMenu = ({ rename, pageId }: PageMenuProps) => {
<FlexWrapper alignItems="center" justifyContent="center" ref={ref}>
<Menu
items={EditMenu}
portalOptions={{
container: ref.current,
}}
contentOptions={{
align: 'center',
}}
@@ -4,7 +4,7 @@ import { Tooltip } from '@toeverything/components/tooltip';
import { useBlockSuitePageMeta } from '@toeverything/hooks/use-block-suite-page-meta';
import { useAtom } from 'jotai';
import type { CSSProperties } from 'react';
import { useEffect, useRef } from 'react';
import { useEffect } from 'react';
import { pageSettingFamily } from '../../../atoms';
import type { BlockSuiteWorkspace } from '../../../shared';
@@ -40,7 +40,6 @@ export const EditorModeSwitch = ({
meta => meta.id === pageId
);
const t = useAFFiNEI18N();
const ref = useRef(null);
assertExists(pageMeta);
const { trash } = pageMeta;
useEffect(() => {
@@ -71,17 +70,11 @@ export const EditorModeSwitch = ({
}, [setSetting, t, trash]);
return (
<Tooltip
content={<TooltipContent />}
portalOptions={{
container: ref.current,
}}
>
<Tooltip content={<TooltipContent />}>
<StyledEditorModeSwitch
style={style}
switchLeft={currentMode === 'page'}
showAlone={trash}
ref={ref}
>
<PageSwitchItem
data-testid="switch-page-mode-button"