diff --git a/packages/frontend/src/page/document_page.css b/packages/frontend/src/page/document_page.css index e6481640b..9e226b3a5 100644 --- a/packages/frontend/src/page/document_page.css +++ b/packages/frontend/src/page/document_page.css @@ -46,6 +46,25 @@ flex-direction: row; height: 100%; min-height: 0; + outline: none; + position: relative; +} + +.document-pane-layout::after { + content: ""; + position: absolute; + bottom: 8px; + left: 2px; + width: 10px; + height: 10px; + border-radius: 50%; + background: var(--color-alert-question); + opacity: 0; + pointer-events: none; +} + +.document-pane-layout:focus-within::after { + opacity: 1; } .document-pane-content { diff --git a/packages/frontend/src/page/document_page.tsx b/packages/frontend/src/page/document_page.tsx index f7236bd64..1a216f62f 100644 --- a/packages/frontend/src/page/document_page.tsx +++ b/packages/frontend/src/page/document_page.tsx @@ -221,7 +221,11 @@ function SplitPaneToolbar(props: { - + e.preventDefault()} + tooltip="Toggle history" + > @@ -233,6 +237,7 @@ function SplitPaneToolbar(props: { > e.preventDefault()} tooltip="Toggle history" > @@ -288,7 +293,11 @@ function SecondaryToolbar(props: { > {(secondary) => (
- + e.preventDefault()} + tooltip="Toggle history" + > props.docRef.refId); + let paneRef: HTMLDivElement | undefined; + + createEffect(() => { + if (props.historySidebarOpen) { + paneRef?.focus(); + } + }); + + const onKeyDown = (evt: KeyboardEvent) => { + const mod = evt.metaKey || evt.ctrlKey; + if (!mod || evt.altKey) { + return; + } + + if (evt.key === "z" || evt.key === "Z") { + if (evt.shiftKey) { + if (history.canRedo()) { + evt.preventDefault(); + history.onRedo(); + } + } else { + if (history.canUndo()) { + evt.preventDefault(); + history.onUndo(); + } + } + } + }; + // oxlint-disable solid/reactivity -- Context.Provider value getter is reactive return ( props.docRef.refId}> -
+
-
+
{ + e.preventDefault(); + paneRef?.focus(); + }} + >
diff --git a/packages/frontend/src/page/history_sidebar.tsx b/packages/frontend/src/page/history_sidebar.tsx index 50b1db463..614c9c551 100644 --- a/packages/frontend/src/page/history_sidebar.tsx +++ b/packages/frontend/src/page/history_sidebar.tsx @@ -1,6 +1,9 @@ import { HistoryNavigator } from "catcolab-ui-components"; import type { SnapshotHistory } from "./use_snapshot_history"; +const isMac = typeof navigator !== "undefined" && /Mac|iPhone|iPad/.test(navigator.userAgent); +const mod = isMac ? "\u2318" : "Ctrl"; + export function HistorySidebar(props: { history: SnapshotHistory }) { return ( ); }