Skip to content

A reactive notebook for Python — run reproducible experiments, query with SQL, execute as a script, deploy as an app, and version with git. Stored as pure Python. All in a modern, AI-native editor.

feat: added collapseAll and expandAll hotkeys (#4814)

Joaquin Coromina966076bea035
diff --git a/frontend/src/components/editor/actions/useNotebookActions.tsx b/frontend/src/components/editor/actions/useNotebookActions.tsx
index ea0436d2a9..4331050bb4 100644
--- a/frontend/src/components/editor/actions/useNotebookActions.tsx
+++ b/frontend/src/components/editor/actions/useNotebookActions.tsx
@@ -381,11 +381,13 @@ export function useNotebookActions() {
{
icon: <ChevronRightCircleIcon size={14} strokeWidth={1.5} />,
label: "Collapse all sections",
+ hotkey: "global.collapseAllSections",
handle: collapseAllCells,
},
{
icon: <ChevronDownCircleIcon size={14} strokeWidth={1.5} />,
label: "Expand all sections",
+ hotkey: "global.expandAllSections",
handle: expandAllCells,
},
{
diff --git a/frontend/src/core/edit-app.tsx b/frontend/src/core/edit-app.tsx
index 604a48237f..8a278c9342 100644
--- a/frontend/src/core/edit-app.tsx
+++ b/frontend/src/core/edit-app.tsx
@@ -60,7 +60,8 @@ export const EditApp: React.FC<AppProps> = ({
}) => {
useJotaiEffect(cellIdsAtom, CellEffects.onCellIdsChange);
- const { setCells, mergeAllColumns } = useCellActions();
+ const { setCells, mergeAllColumns, collapseAllCells, expandAllCells } =
+ useCellActions();
const viewState = useAtomValue(viewStateAtom);
const numColumns = useAtomValue(numColumnsAtom);
const hasCells = useAtomValue(hasCellsAtom);
@@ -125,6 +126,12 @@ export const EditApp: React.FC<AppProps> = ({
useHotkey("global.runAll", () => {
runAllCells();
});
+ useHotkey("global.collapseAllSections", () => {
+ collapseAllCells();
+ });
+ useHotkey("global.expandAllSections", () => {
+ expandAllCells();
+ });
const editableCellsArray = (
<CellArray
diff --git a/frontend/src/core/hotkeys/hotkeys.ts b/frontend/src/core/hotkeys/hotkeys.ts
index 9b284c4b0e..37fbd32543 100644
--- a/frontend/src/core/hotkeys/hotkeys.ts
+++ b/frontend/src/core/hotkeys/hotkeys.ts
@@ -338,6 +338,16 @@ const DEFAULT_HOT_KEY = {
group: "Other",
key: "Ctrl-`",
},
+ "global.collapseAllSections": {
+ name: "Collapse all sections",
+ group: "Editing",
+ key: "Mod-Shift-\\",
+ },
+ "global.expandAllSections": {
+ name: "Expand all sections",
+ group: "Editing",
+ key: "Mod-Shift-/",
+ },
// Global Navigation
"global.focusTop": {