From fa87ff14b7abcaddc7d53e56fe97d0c6602d2c72 Mon Sep 17 00:00:00 2001 From: Aaryan Khandelwal <65252264+aaryan610@users.noreply.github.com> Date: Thu, 17 Apr 2025 17:13:21 +0530 Subject: [PATCH] [WIKI-319] chore: remove bottom border when toolbar is hidden (#6943) * chore: remove border when toolbar is hidden * chore: add stricter conditions --- .../components/pages/editor/toolbar/mobile-root.tsx | 9 +++++++-- web/core/components/pages/editor/toolbar/root.tsx | 8 +++++--- .../components/pages/editor/toolbar/toolbar.tsx | 13 +++++++++++-- 3 files changed, 23 insertions(+), 7 deletions(-) diff --git a/web/core/components/pages/editor/toolbar/mobile-root.tsx b/web/core/components/pages/editor/toolbar/mobile-root.tsx index a3cde27f4c..ccc04ab6eb 100644 --- a/web/core/components/pages/editor/toolbar/mobile-root.tsx +++ b/web/core/components/pages/editor/toolbar/mobile-root.tsx @@ -1,8 +1,11 @@ import { observer } from "mobx-react"; +// plane imports import { EditorRefApi } from "@plane/editor"; -// components import { Header, EHeaderVariant } from "@plane/ui"; +// components import { PageExtraOptions, PageToolbar } from "@/components/pages"; +// hooks +import { usePageFilters } from "@/hooks/use-page-filters"; // plane web hooks import { EPageStoreType } from "@/plane-web/hooks/store"; // store @@ -18,6 +21,8 @@ export const PageEditorMobileHeaderRoot: React.FC = observer((props) => { const { editorRef, page, storeType } = props; // derived values const { isContentEditable } = page; + // page filters + const { isStickyToolbarEnabled } = usePageFilters(); return ( <> @@ -25,7 +30,7 @@ export const PageEditorMobileHeaderRoot: React.FC = observer((props) => {
- {isContentEditable && editorRef && } + {isContentEditable && editorRef && }
); diff --git a/web/core/components/pages/editor/toolbar/root.tsx b/web/core/components/pages/editor/toolbar/root.tsx index 3618600e95..901ce7f5ea 100644 --- a/web/core/components/pages/editor/toolbar/root.tsx +++ b/web/core/components/pages/editor/toolbar/root.tsx @@ -26,6 +26,7 @@ export const PageEditorToolbarRoot: React.FC = observer((props) => { const { isFullWidth, isStickyToolbarEnabled } = usePageFilters(); // derived values const resolvedEditorRef = editorRef.current; + const shouldHideToolbar = !isStickyToolbarEnabled || !isContentEditable; if (!resolvedEditorRef) return null; @@ -33,16 +34,17 @@ export const PageEditorToolbarRoot: React.FC = observer((props) => {
- {isStickyToolbarEnabled && editorReady && isContentEditable && editorRef.current && ( - + {editorReady && resolvedEditorRef && ( + )}
diff --git a/web/core/components/pages/editor/toolbar/toolbar.tsx b/web/core/components/pages/editor/toolbar/toolbar.tsx index 8d378acdb1..a9c374f685 100644 --- a/web/core/components/pages/editor/toolbar/toolbar.tsx +++ b/web/core/components/pages/editor/toolbar/toolbar.tsx @@ -15,6 +15,7 @@ import { cn } from "@/helpers/common.helper"; type Props = { editorRef: EditorRefApi; + isHidden: boolean; }; type ToolbarButtonProps = { @@ -63,7 +64,8 @@ ToolbarButton.displayName = "ToolbarButton"; const toolbarItems = TOOLBAR_ITEMS.document; -export const PageToolbar: React.FC = ({ editorRef }) => { +export const PageToolbar: React.FC = (props) => { + const { editorRef, isHidden } = props; // states const [activeStates, setActiveStates] = useState>({}); @@ -96,7 +98,14 @@ export const PageToolbar: React.FC = ({ editorRef }) => { ); return ( -
+