From f7428affaca64b43a2227f470d6caabaa5d524a7 Mon Sep 17 00:00:00 2001 From: Aaryan Khandelwal Date: Thu, 17 Apr 2025 17:03:54 +0530 Subject: [PATCH 1/2] chore: remove border when toolbar is hidden --- .../components/pages/editor/toolbar/mobile-root.tsx | 9 +++++++-- web/core/components/pages/editor/toolbar/root.tsx | 7 ++++--- .../components/pages/editor/toolbar/toolbar.tsx | 13 +++++++++++-- 3 files changed, 22 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 a3cde27f4ce..ccc04ab6ebb 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 3618600e955..54ecb87bb1d 100644 --- a/web/core/components/pages/editor/toolbar/root.tsx +++ b/web/core/components/pages/editor/toolbar/root.tsx @@ -33,16 +33,17 @@ export const PageEditorToolbarRoot: React.FC = observer((props) => {
- {isStickyToolbarEnabled && editorReady && isContentEditable && editorRef.current && ( - + {editorReady && isContentEditable && editorRef.current && ( + )}
diff --git a/web/core/components/pages/editor/toolbar/toolbar.tsx b/web/core/components/pages/editor/toolbar/toolbar.tsx index 8d378acdb13..a9c374f685a 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 ( -
+
From d5fc7ff74035aab7e1817cbe98c91cf4b82685bd Mon Sep 17 00:00:00 2001 From: Aaryan Khandelwal Date: Thu, 17 Apr 2025 17:09:45 +0530 Subject: [PATCH 2/2] chore: add stricter conditions --- web/core/components/pages/editor/toolbar/root.tsx | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/web/core/components/pages/editor/toolbar/root.tsx b/web/core/components/pages/editor/toolbar/root.tsx index 54ecb87bb1d..901ce7f5ea5 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; @@ -36,14 +37,14 @@ export const PageEditorToolbarRoot: React.FC = observer((props) => { "hidden md:flex items-center relative min-h-[52px] page-toolbar-content px-page-x border-b border-transparent transition-all duration-200 ease-in-out", { "wide-layout": isFullWidth, - "border-custom-border-200": isStickyToolbarEnabled, + "border-custom-border-200": true, } )} >
- {editorReady && isContentEditable && editorRef.current && ( - + {editorReady && resolvedEditorRef && ( + )}