Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix hotkeys #357

Merged
merged 2 commits into from
Mar 7, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/components/EditorCanvas/Canvas.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -450,7 +450,7 @@ export default function Canvas() {
(e) => {
e.preventDefault();

if (e.ctrlKey) {
if (e.ctrlKey || e.metaKey) {
// How "eager" the viewport is to
// center the cursor's coordinates
const eagernessFactor = 0.05;
Expand Down
40 changes: 20 additions & 20 deletions src/components/EditorHeader/ControlPanel.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -1363,35 +1363,35 @@ export default function ControlPanel({
},
};

useHotkeys("ctrl+i, meta+i", fileImport, { preventDefault: true });
useHotkeys("ctrl+z, meta+z", undo, { preventDefault: true });
useHotkeys("ctrl+y, meta+y", redo, { preventDefault: true });
useHotkeys("ctrl+s, meta+s", save, { preventDefault: true });
useHotkeys("ctrl+o, meta+o", open, { preventDefault: true });
useHotkeys("ctrl+e, meta+e", edit, { preventDefault: true });
useHotkeys("ctrl+d, meta+d", duplicate, { preventDefault: true });
useHotkeys("ctrl+c, meta+c", copy, { preventDefault: true });
useHotkeys("ctrl+v, meta+v", paste, { preventDefault: true });
useHotkeys("ctrl+x, meta+x", cut, { preventDefault: true });
useHotkeys("mod+i", fileImport, { preventDefault: true });
useHotkeys("mod+z", undo, { preventDefault: true });
useHotkeys("mod+y", redo, { preventDefault: true });
useHotkeys("mod+s", save, { preventDefault: true });
useHotkeys("mod+o", open, { preventDefault: true });
useHotkeys("mod+e", edit, { preventDefault: true });
useHotkeys("mod+d", duplicate, { preventDefault: true });
useHotkeys("mod+c", copy, { preventDefault: true });
useHotkeys("mod+v", paste, { preventDefault: true });
useHotkeys("mod+x", cut, { preventDefault: true });
useHotkeys("delete", del, { preventDefault: true });
useHotkeys("ctrl+shift+g, meta+shift+g", viewGrid, { preventDefault: true });
useHotkeys("ctrl+up, meta+up", zoomIn, { preventDefault: true });
useHotkeys("ctrl+down, meta+down", zoomOut, { preventDefault: true });
useHotkeys("ctrl+shift+m, meta+shift+m", viewStrictMode, {
useHotkeys("mod+shift+g", viewGrid, { preventDefault: true });
useHotkeys("mod+up", zoomIn, { preventDefault: true });
useHotkeys("mod+down", zoomOut, { preventDefault: true });
useHotkeys("mod+shift+m", viewStrictMode, {
preventDefault: true,
});
useHotkeys("ctrl+shift+f, meta+shift+f", viewFieldSummary, {
useHotkeys("mod+shift+f", viewFieldSummary, {
preventDefault: true,
});
useHotkeys("ctrl+shift+s, meta+shift+s", saveDiagramAs, {
useHotkeys("mod+shift+s", saveDiagramAs, {
preventDefault: true,
});
useHotkeys("ctrl+alt+c, meta+alt+c", copyAsImage, { preventDefault: true });
useHotkeys("ctrl+r, meta+r", resetView, { preventDefault: true });
useHotkeys("ctrl+h, meta+h", () => window.open(socials.docs, "_blank"), {
useHotkeys("mod+alt+c", copyAsImage, { preventDefault: true });
useHotkeys("mod+r", resetView, { preventDefault: true });
useHotkeys("mod+h", () => window.open(socials.docs, "_blank"), {
preventDefault: true,
});
useHotkeys("ctrl+alt+w, meta+alt+w", fitWindow, { preventDefault: true });
useHotkeys("mod+alt+w", fitWindow, { preventDefault: true });

return (
<>
Expand Down