mirror of
https://github.com/streetwriters/notesnook.git
synced 2026-09-01 19:49:54 +02:00
web: force list pane to be visible when reveal item in list is called
This commit is contained in:
@@ -132,7 +132,6 @@ function DesktopAppContents() {
|
||||
const isFocusMode = useStore((store) => store.isFocusMode);
|
||||
const isListPaneVisible = useStore((store) => store.isListPaneVisible);
|
||||
const isTablet = useTablet();
|
||||
// const [isNarrow, setIsNarrow] = useState(isTablet || false);
|
||||
const navPane = useRef<SplitPaneImperativeHandle>(null);
|
||||
|
||||
useEffect(() => {
|
||||
@@ -140,6 +139,23 @@ function DesktopAppContents() {
|
||||
else if (navPane.current?.isCollapsed(0)) navPane.current?.expand(0);
|
||||
}, [isTablet]);
|
||||
|
||||
useEffect(() => {
|
||||
const event = AppEventManager.subscribe(
|
||||
AppEvents.revealItemInList,
|
||||
async (id?: string) => {
|
||||
if (!useStore.getState().isListPaneVisible) {
|
||||
useStore.getState().toggleListPane(true);
|
||||
setTimeout(() => {
|
||||
AppEventManager.publish(AppEvents.revealItemInList, id);
|
||||
}, 500);
|
||||
}
|
||||
}
|
||||
);
|
||||
return () => {
|
||||
event.unsubscribe();
|
||||
};
|
||||
}, []);
|
||||
|
||||
return (
|
||||
<>
|
||||
<Flex
|
||||
|
||||
Reference in New Issue
Block a user