Add cmd+s support

This commit is contained in:
2025-07-20 21:31:31 +01:00
parent a21481c795
commit c8a9691d6e

View File

@@ -357,10 +357,10 @@ const Editor = () => {
} }
}, [lang]); }, [lang]);
// Add keyboard shortcut for Ctrl+S // 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.key === 's') { if ((event.ctrlKey || event.metaKey) && event.key === 's') {
event.preventDefault(); event.preventDefault();
if (action === 'edit') { if (action === 'edit') {
save(); save();