mirror of
https://github.com/supabase/supabase.git
synced 2026-10-07 10:25:06 +03:00
### Context Adds a keyboard shortcut for saving a notebook in the explorer <img width="269" height="112" alt="image" src="https://github.com/user-attachments/assets/c9ab1c4b-fbb3-40ed-8f10-47301e16e6b3" /> Also shifts the keyboard shortcuts for queue operations into the table editor registry - more contextual to there since queue operations is specifically for the table editor only <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **New Features** - Added a keyboard shortcut (`Mod+S`) for saving notebooks in Explorer. - The save toolbar action now displays its keyboard shortcut. - Restored table editing shortcuts for saving pending edits, toggling the operation queue, and undoing changes (`Mod+S`, `Mod+.`, and `Mod+Z`). <!-- end of auto-generated comment: release notes by coderabbit.ai -->
184 lines
7.0 KiB
TypeScript
184 lines
7.0 KiB
TypeScript
import { RegistryDefinations } from '../types'
|
|
|
|
export const TABLE_EDITOR_SHORTCUT_IDS = {
|
|
TABLE_EDITOR_JUMP_FIRST_ROW: 'table-editor.jump-first-row',
|
|
TABLE_EDITOR_JUMP_LAST_ROW: 'table-editor.jump-last-row',
|
|
TABLE_EDITOR_JUMP_FIRST_COL: 'table-editor.jump-first-col',
|
|
TABLE_EDITOR_JUMP_LAST_COL: 'table-editor.jump-last-col',
|
|
TABLE_EDITOR_TOGGLE_ROW_SELECTION: 'table-editor.toggle-row-selection',
|
|
TABLE_EDITOR_TOGGLE_ALL_ROW_SELECTION: 'table-editor.toggle-all-row-selection',
|
|
TABLE_EDITOR_SELECT_ALL_IN_TABLE: 'table-editor.select-all-in-table',
|
|
TABLE_EDITOR_DELETE_SELECTED_ROWS: 'table-editor.delete-selected-rows',
|
|
TABLE_EDITOR_START_NAVIGATION_DOWN: 'table-editor.start-navigation-down',
|
|
TABLE_EDITOR_START_NAVIGATION_UP: 'table-editor.start-navigation-up',
|
|
TABLE_EDITOR_EXIT_SELECTION: 'table-editor.exit-selection',
|
|
TABLE_EDITOR_INSERT_ROW: 'table-editor.insert-row',
|
|
TABLE_EDITOR_INSERT_COLUMN: 'table-editor.insert-column',
|
|
TABLE_EDITOR_IMPORT_CSV: 'table-editor.import-csv',
|
|
TABLE_EDITOR_FOCUS_FILTERS: 'table-editor.focus-filters',
|
|
TABLE_EDITOR_CLEAR_FILTERS: 'table-editor.clear-filters',
|
|
TABLE_EDITOR_CLEAR_SORT: 'table-editor.clear-sort',
|
|
TABLE_EDITOR_REFRESH: 'table-editor.refresh',
|
|
TABLE_EDITOR_FOCUS_SCHEMA: 'table-editor.focus-schema',
|
|
OPERATION_QUEUE_SAVE: 'operation-queue.save',
|
|
OPERATION_QUEUE_TOGGLE: 'operation-queue.toggle',
|
|
OPERATION_QUEUE_UNDO: 'operation-queue.undo',
|
|
}
|
|
|
|
export type TableEditorShortcutId =
|
|
(typeof TABLE_EDITOR_SHORTCUT_IDS)[keyof typeof TABLE_EDITOR_SHORTCUT_IDS]
|
|
|
|
export const tableEditorRegistry: RegistryDefinations<TableEditorShortcutId> = {
|
|
[TABLE_EDITOR_SHORTCUT_IDS.TABLE_EDITOR_JUMP_FIRST_ROW]: {
|
|
id: TABLE_EDITOR_SHORTCUT_IDS.TABLE_EDITOR_JUMP_FIRST_ROW,
|
|
label: 'Jump to first row',
|
|
sequence: ['Mod+ArrowUp'],
|
|
showInSettings: false,
|
|
options: { ignoreInputs: true },
|
|
},
|
|
[TABLE_EDITOR_SHORTCUT_IDS.TABLE_EDITOR_JUMP_LAST_ROW]: {
|
|
id: TABLE_EDITOR_SHORTCUT_IDS.TABLE_EDITOR_JUMP_LAST_ROW,
|
|
label: 'Jump to last row',
|
|
sequence: ['Mod+ArrowDown'],
|
|
showInSettings: false,
|
|
options: { ignoreInputs: true },
|
|
},
|
|
[TABLE_EDITOR_SHORTCUT_IDS.TABLE_EDITOR_JUMP_FIRST_COL]: {
|
|
id: TABLE_EDITOR_SHORTCUT_IDS.TABLE_EDITOR_JUMP_FIRST_COL,
|
|
label: 'Jump to first column',
|
|
sequence: ['Mod+ArrowLeft'],
|
|
showInSettings: false,
|
|
options: { ignoreInputs: true },
|
|
},
|
|
[TABLE_EDITOR_SHORTCUT_IDS.TABLE_EDITOR_JUMP_LAST_COL]: {
|
|
id: TABLE_EDITOR_SHORTCUT_IDS.TABLE_EDITOR_JUMP_LAST_COL,
|
|
label: 'Jump to last column',
|
|
sequence: ['Mod+ArrowRight'],
|
|
showInSettings: false,
|
|
options: { ignoreInputs: true },
|
|
},
|
|
[TABLE_EDITOR_SHORTCUT_IDS.TABLE_EDITOR_TOGGLE_ROW_SELECTION]: {
|
|
id: TABLE_EDITOR_SHORTCUT_IDS.TABLE_EDITOR_TOGGLE_ROW_SELECTION,
|
|
label: 'Toggle selection on current row',
|
|
sequence: ['Shift+Space'],
|
|
showInSettings: false,
|
|
options: { ignoreInputs: true },
|
|
},
|
|
[TABLE_EDITOR_SHORTCUT_IDS.TABLE_EDITOR_TOGGLE_ALL_ROW_SELECTION]: {
|
|
id: TABLE_EDITOR_SHORTCUT_IDS.TABLE_EDITOR_TOGGLE_ALL_ROW_SELECTION,
|
|
label: 'Toggle selection on all displayed rows',
|
|
sequence: ['Mod+A'],
|
|
showInSettings: false,
|
|
options: { ignoreInputs: true },
|
|
},
|
|
[TABLE_EDITOR_SHORTCUT_IDS.TABLE_EDITOR_SELECT_ALL_IN_TABLE]: {
|
|
id: TABLE_EDITOR_SHORTCUT_IDS.TABLE_EDITOR_SELECT_ALL_IN_TABLE,
|
|
label: 'Toggle selection on all rows in table',
|
|
sequence: ['Mod+Shift+A'],
|
|
showInSettings: false,
|
|
options: { ignoreInputs: true },
|
|
},
|
|
[TABLE_EDITOR_SHORTCUT_IDS.TABLE_EDITOR_DELETE_SELECTED_ROWS]: {
|
|
id: TABLE_EDITOR_SHORTCUT_IDS.TABLE_EDITOR_DELETE_SELECTED_ROWS,
|
|
label: 'Delete selected rows',
|
|
sequence: ['Mod+Backspace'],
|
|
showInSettings: false,
|
|
options: { ignoreInputs: true },
|
|
},
|
|
[TABLE_EDITOR_SHORTCUT_IDS.TABLE_EDITOR_START_NAVIGATION_DOWN]: {
|
|
id: TABLE_EDITOR_SHORTCUT_IDS.TABLE_EDITOR_START_NAVIGATION_DOWN,
|
|
label: 'Start grid navigation (down)',
|
|
sequence: ['ArrowDown'],
|
|
showInSettings: false,
|
|
options: { ignoreInputs: true },
|
|
},
|
|
[TABLE_EDITOR_SHORTCUT_IDS.TABLE_EDITOR_START_NAVIGATION_UP]: {
|
|
id: TABLE_EDITOR_SHORTCUT_IDS.TABLE_EDITOR_START_NAVIGATION_UP,
|
|
label: 'Start grid navigation (up)',
|
|
sequence: ['ArrowUp'],
|
|
showInSettings: false,
|
|
options: { ignoreInputs: true },
|
|
},
|
|
[TABLE_EDITOR_SHORTCUT_IDS.TABLE_EDITOR_EXIT_SELECTION]: {
|
|
id: TABLE_EDITOR_SHORTCUT_IDS.TABLE_EDITOR_EXIT_SELECTION,
|
|
label: 'Exit grid selection',
|
|
sequence: ['Escape'],
|
|
showInSettings: false,
|
|
options: { ignoreInputs: true },
|
|
},
|
|
[TABLE_EDITOR_SHORTCUT_IDS.TABLE_EDITOR_INSERT_ROW]: {
|
|
id: TABLE_EDITOR_SHORTCUT_IDS.TABLE_EDITOR_INSERT_ROW,
|
|
label: 'Insert row',
|
|
sequence: ['I', 'R'],
|
|
showInSettings: false,
|
|
options: { ignoreInputs: true },
|
|
},
|
|
[TABLE_EDITOR_SHORTCUT_IDS.TABLE_EDITOR_INSERT_COLUMN]: {
|
|
id: TABLE_EDITOR_SHORTCUT_IDS.TABLE_EDITOR_INSERT_COLUMN,
|
|
label: 'Insert column',
|
|
sequence: ['I', 'C'],
|
|
showInSettings: false,
|
|
options: { ignoreInputs: true },
|
|
},
|
|
[TABLE_EDITOR_SHORTCUT_IDS.TABLE_EDITOR_IMPORT_CSV]: {
|
|
id: TABLE_EDITOR_SHORTCUT_IDS.TABLE_EDITOR_IMPORT_CSV,
|
|
label: 'Import data from CSV',
|
|
sequence: ['I', 'U'],
|
|
showInSettings: false,
|
|
options: { ignoreInputs: true },
|
|
},
|
|
[TABLE_EDITOR_SHORTCUT_IDS.TABLE_EDITOR_FOCUS_FILTERS]: {
|
|
id: TABLE_EDITOR_SHORTCUT_IDS.TABLE_EDITOR_FOCUS_FILTERS,
|
|
label: 'Focus filters',
|
|
sequence: ['Shift+F'],
|
|
showInSettings: false,
|
|
options: { ignoreInputs: true },
|
|
},
|
|
[TABLE_EDITOR_SHORTCUT_IDS.TABLE_EDITOR_CLEAR_FILTERS]: {
|
|
id: TABLE_EDITOR_SHORTCUT_IDS.TABLE_EDITOR_CLEAR_FILTERS,
|
|
label: 'Clear filters',
|
|
sequence: ['F', 'C'],
|
|
showInSettings: false,
|
|
options: { ignoreInputs: true },
|
|
},
|
|
[TABLE_EDITOR_SHORTCUT_IDS.TABLE_EDITOR_CLEAR_SORT]: {
|
|
id: TABLE_EDITOR_SHORTCUT_IDS.TABLE_EDITOR_CLEAR_SORT,
|
|
label: 'Clear sort',
|
|
sequence: ['S', 'C'],
|
|
showInSettings: false,
|
|
options: { ignoreInputs: true },
|
|
},
|
|
[TABLE_EDITOR_SHORTCUT_IDS.TABLE_EDITOR_REFRESH]: {
|
|
id: TABLE_EDITOR_SHORTCUT_IDS.TABLE_EDITOR_REFRESH,
|
|
label: 'Refresh table',
|
|
sequence: ['Shift+R'],
|
|
showInSettings: false,
|
|
options: { ignoreInputs: true },
|
|
},
|
|
[TABLE_EDITOR_SHORTCUT_IDS.TABLE_EDITOR_FOCUS_SCHEMA]: {
|
|
id: TABLE_EDITOR_SHORTCUT_IDS.TABLE_EDITOR_FOCUS_SCHEMA,
|
|
label: 'Focus schema selector',
|
|
sequence: ['S', 'S'],
|
|
showInSettings: false,
|
|
options: { ignoreInputs: true },
|
|
},
|
|
[TABLE_EDITOR_SHORTCUT_IDS.OPERATION_QUEUE_SAVE]: {
|
|
id: TABLE_EDITOR_SHORTCUT_IDS.OPERATION_QUEUE_SAVE,
|
|
label: 'Save pending table edits',
|
|
sequence: ['Mod+S'],
|
|
showInSettings: false,
|
|
},
|
|
[TABLE_EDITOR_SHORTCUT_IDS.OPERATION_QUEUE_TOGGLE]: {
|
|
id: TABLE_EDITOR_SHORTCUT_IDS.OPERATION_QUEUE_TOGGLE,
|
|
label: 'Toggle operation queue panel',
|
|
sequence: ['Mod+.'],
|
|
showInSettings: false,
|
|
},
|
|
[TABLE_EDITOR_SHORTCUT_IDS.OPERATION_QUEUE_UNDO]: {
|
|
id: TABLE_EDITOR_SHORTCUT_IDS.OPERATION_QUEUE_UNDO,
|
|
label: 'Undo latest table edit',
|
|
sequence: ['Mod+Z'],
|
|
showInSettings: false,
|
|
},
|
|
}
|