fix: Cannot navigate to document out of present mode (#11952)

This commit is contained in:
Tom Moor
2026-04-04 09:05:16 -04:00
committed by GitHub
parent 81ef635f36
commit f901435226
2 changed files with 14 additions and 3 deletions
+3 -2
View File
@@ -14,7 +14,7 @@ type Params = {
export default function useEditorClickHandlers({ shareId }: Params) {
const history = useHistory();
const { documents } = useStores();
const { documents, ui } = useStores();
const handleClickLink = useCallback(
(href: string, event?: MouseEvent) => {
// on page hash
@@ -81,6 +81,7 @@ export default function useEditorClickHandlers({ shareId }: Params) {
!event ||
(!isModKey(event) && !event.shiftKey && event.button !== 1)
) {
ui.setPresentingDocument(null);
history.push(navigateTo, { sidebarContext: "collections" }); // optimistic preference of "collections"
} else {
window.open(navigateTo, "_blank");
@@ -89,7 +90,7 @@ export default function useEditorClickHandlers({ shareId }: Params) {
window.open(href, "_blank");
}
},
[history, shareId]
[history, shareId, documents, ui]
);
return { handleClickLink };
@@ -331,7 +331,13 @@ function PresentationMode({ title, icon, iconColor, data, onClose }: Props) {
</Tooltip>
</RightButtons>
</TopBar>
<SlideArea onClick={goNext}>
<SlideArea
onClick={(event: React.MouseEvent) => {
if (!(event.target as HTMLElement).closest("a")) {
goNext();
}
}}
>
<SlideContent ref={slideContentRef}>
{slide.type === "title" ? (
<TitleSlide>
@@ -395,6 +401,10 @@ const Container = styled.div<{ $background: string; $idle: boolean }>`
* {
cursor: inherit;
}
a[href] {
cursor: ${(props) => (props.$idle ? "none" : "pointer")};
}
`;
const SlideArea = styled.div`