diff --git a/packages/editor/document-editor/src/ui/components/content-browser.tsx b/packages/editor/document-editor/src/ui/components/content-browser.tsx index 18a50a5a8..97231ea96 100644 --- a/packages/editor/document-editor/src/ui/components/content-browser.tsx +++ b/packages/editor/document-editor/src/ui/components/content-browser.tsx @@ -6,10 +6,16 @@ import { scrollSummary } from "src/utils/editor-summary-utils"; interface ContentBrowserProps { editor: Editor; markings: IMarking[]; + setSidePeekVisible?: (sidePeekState: boolean) => void; } export const ContentBrowser = (props: ContentBrowserProps) => { - const { editor, markings } = props; + const { editor, markings, setSidePeekVisible } = props; + + const handleOnClick = (marking: IMarking) => { + scrollSummary(editor, marking); + if (setSidePeekVisible) setSidePeekVisible(false); + } return (
@@ -18,11 +24,11 @@ export const ContentBrowser = (props: ContentBrowserProps) => { {markings.length !== 0 ? ( markings.map((marking) => marking.level === 1 ? ( - scrollSummary(editor, marking)} heading={marking.text} /> + handleOnClick(marking)} heading={marking.text} /> ) : marking.level === 2 ? ( - scrollSummary(editor, marking)} subHeading={marking.text} /> + handleOnClick(marking)} subHeading={marking.text} /> ) : ( - scrollSummary(editor, marking)} /> + handleOnClick(marking)} /> ) ) ) : ( diff --git a/packages/editor/document-editor/src/ui/components/summary-popover.tsx b/packages/editor/document-editor/src/ui/components/summary-popover.tsx index 12903bb3d..6ad7cad83 100644 --- a/packages/editor/document-editor/src/ui/components/summary-popover.tsx +++ b/packages/editor/document-editor/src/ui/components/summary-popover.tsx @@ -33,9 +33,8 @@ export const SummaryPopover: React.FC = (props) => {
)} diff --git a/web/layouts/app-layout/sidebar.tsx b/web/layouts/app-layout/sidebar.tsx index e211e7884..0ccbf2606 100644 --- a/web/layouts/app-layout/sidebar.tsx +++ b/web/layouts/app-layout/sidebar.tsx @@ -12,7 +12,7 @@ import { ProjectSidebarList } from "components/project"; import { useApplication } from "hooks/store"; import useOutsideClickDetector from "hooks/use-outside-click-detector"; -export interface IAppSidebar {} +export interface IAppSidebar { } export const AppSidebar: FC = observer(() => { // store hooks @@ -32,6 +32,9 @@ export const AppSidebar: FC = observer(() => { if (window.innerWidth <= 768) { themStore.toggleSidebar(true); } + if (window.innerWidth > 768) { + themStore.toggleSidebar(false); + } }; handleResize(); window.addEventListener("resize", handleResize);