Skip to content

A fully open source & end-to-end encrypted note taking alternative to Evernote.

web: fix collapsed pane expanding on app reload

Abdullah Attad772d38dc720
diff --git a/7421.patch b/7421.patch
deleted file mode 100644
index b6854c485..000000000
--- a/7421.patch
+++ /dev/null
@@ -1,37 +0,0 @@
-From af88ee05e1620afb65c76148d347cb7efc32bded Mon Sep 17 00:00:00 2001
-From: 01zulfi <[email protected]>
-Date: Wed, 29 Jan 2025 12:22:32 +0500
-Subject: [PATCH] editor: fix hover styling in toolbar color buttons
- Signed-off-by: 01zulfi <[email protected]>
-
----
- packages/editor/src/toolbar/popups/color-picker.tsx | 2 +-
- packages/editor/src/toolbar/tools/colors.tsx | 2 +-
- 2 files changed, 2 insertions(+), 2 deletions(-)
-
-diff --git a/packages/editor/src/toolbar/popups/color-picker.tsx b/packages/editor/src/toolbar/popups/color-picker.tsx
-index 0abca19268..34209bd550 100644
---- a/packages/editor/src/toolbar/popups/color-picker.tsx
-+++ b/packages/editor/src/toolbar/popups/color-picker.tsx
-@@ -284,7 +284,7 @@ function PaletteButton(props: PaletteButtonProps) {
- ml: [2, 2, 1],
- bg,
- ":hover:not(:disabled):not(:active)": {
-- bg: bg?.startsWith("#") ? colord(bg).darken(5).toRgbString() : "hover"
-+ bg: bg?.startsWith("#") ? colord(bg).darken().toRgbString() : "hover"
- },
- ...sx
- }}
-diff --git a/packages/editor/src/toolbar/tools/colors.tsx b/packages/editor/src/toolbar/tools/colors.tsx
-index 08c6b41d8a..77ea660e75 100644
---- a/packages/editor/src/toolbar/tools/colors.tsx
-+++ b/packages/editor/src/toolbar/tools/colors.tsx
-@@ -137,7 +137,7 @@ export function ColorTool(props: ColorToolProps) {
- mr: 0,
- bg: activeColor || "transparent",
- ":hover:not(:disabled):not(:active)": {
-- bg: tColor ? tColor.darken(5).toRgbString() : "transparent"
-+ bg: tColor ? tColor.darken().toRgbString() : "transparent"
- }
- }}
- onOpen={toggle}
diff --git a/apps/web/package-lock.json b/apps/web/package-lock.json
index 549823a89..15bb44449 100644
--- a/apps/web/package-lock.json
+++ b/apps/web/package-lock.json
@@ -497,7 +497,7 @@
},
"../desktop": {
"name": "@notesnook/desktop",
- "version": "3.0.24",
+ "version": "3.0.25",
"hasInstallScript": true,
"license": "GPL-3.0-or-later",
"dependencies": {
diff --git a/apps/web/src/app.tsx b/apps/web/src/app.tsx
index 22c7ca332..9a2bf6e55 100644
--- a/apps/web/src/app.tsx
+++ b/apps/web/src/app.tsx
@@ -150,23 +150,9 @@ function DesktopAppContents({ show, setShow }: DesktopAppContentsProps) {
useEffect(() => {
if (isTablet) navPane.current?.collapse(0);
- else navPane.current?.expand(0);
+ else if (navPane.current?.isCollapsed(0)) navPane.current?.expand(0);
}, [isTablet]);
- // useEffect(() => {
- // if (show) middlePane.current?.expand();
- // else middlePane.current?.collapse();
- // }, [show]);
-
- // useEffect(() => {
- // if (isFocusMode) {
- // const middlePaneSize = middlePane.current?.getSize() || 20;
- // navPane.current?.collapse();
- // // the middle pane has to be resized because collapsing the nav
- // // pane increases the middle pane's size every time.
- // middlePane.current?.resize(middlePaneSize);
- // } else navPane.current?.expand();
- // }, [isFocusMode]);
return (
<>
<Flex
diff --git a/apps/web/src/components/split-pane/index.tsx b/apps/web/src/components/split-pane/index.tsx
index 87868e91c..33b608978 100644
--- a/apps/web/src/components/split-pane/index.tsx
+++ b/apps/web/src/components/split-pane/index.tsx
@@ -59,6 +59,7 @@ type PaneOptions = {
export type SplitPaneImperativeHandle = {
collapse: (index: number) => void;
expand: (index: number) => void;
+ isCollapsed: (index: number) => boolean;
};
export const SplitPane = React.forwardRef<
SplitPaneImperativeHandle,
@@ -165,7 +166,7 @@ export const SplitPane = React.forwardRef<
if (wrapSize.current === 0) return;
updatePaneLimitSizes(children);
- setSizes(paneSizes.current, wrapSize.current, false);
+ setSizes(paneSizes.current, wrapSize.current, true);
}, [children, childrenLength]);
const setSizes = useCallback(
@@ -266,6 +267,9 @@ export const SplitPane = React.forwardRef<
? lastCollapsedPaneSize.current
: paneSizes.current[index].initialSize;
setSizes(paneSizes.current, wrapSize.current);
+ },
+ isCollapsed: (index: number) => {
+ return paneSizes.current[index].collapsed;
}
};
},