1 Commits

Author SHA1 Message Date
64faf93a11 Show modal on Ctrl+Enter for new action in Editor
Added logic to display the modal when Ctrl+Enter is pressed and the current action is 'new', improving the user workflow for creating new items.
2025-08-06 23:59:50 +01:00

View File

@@ -360,10 +360,12 @@ const Editor = () => {
// Add keyboard shortcut for Ctrl+S (Windows/Linux) and Cmd+S (macOS) // Add keyboard shortcut for Ctrl+S (Windows/Linux) and Cmd+S (macOS)
useEffect(() => { useEffect(() => {
const handleKeyDown = (event: KeyboardEvent) => { const handleKeyDown = (event: KeyboardEvent) => {
if ((event.ctrlKey || event.metaKey) && event.key.toLowerCase() === 's') { if ((event.ctrlKey || event.metaKey) && event.key === 's') {
event.preventDefault(); event.preventDefault();
if (action === 'edit') { if (action === 'edit') {
save(); save();
} else if (action === 'new') {
setModalVisible(true);
} }
} }
}; };