Feat: make possible to change all nodes shortcuts
This commit is contained in:
parent
c2ae5e8831
commit
60dba48703
5 changed files with 23 additions and 22 deletions
|
|
@ -886,4 +886,5 @@ export const unavailableShortcutss = [
|
||||||
"CTRL + Z",
|
"CTRL + Z",
|
||||||
"CTRL + Y",
|
"CTRL + Y",
|
||||||
"CTRL + J",
|
"CTRL + J",
|
||||||
|
"CTRL + U",
|
||||||
];
|
];
|
||||||
|
|
|
||||||
|
|
@ -153,16 +153,19 @@ export default function NodeToolbarComponent({
|
||||||
const save = useShortcutsStore((state) => state.save);
|
const save = useShortcutsStore((state) => state.save);
|
||||||
const docs = useShortcutsStore((state) => state.docs);
|
const docs = useShortcutsStore((state) => state.docs);
|
||||||
const code = useShortcutsStore((state) => state.code);
|
const code = useShortcutsStore((state) => state.code);
|
||||||
|
const group = useShortcutsStore((state) => state.group);
|
||||||
|
const update = useShortcutsStore((state) => state.update);
|
||||||
|
const download = useShortcutsStore((state) => state.download);
|
||||||
|
|
||||||
useHotkeys(minimize, handleMinimizeWShortcut);
|
useHotkeys(minimize, handleMinimizeWShortcut);
|
||||||
useHotkeys("mod+u", handleUpdateWShortcut);
|
useHotkeys(update, handleUpdateWShortcut);
|
||||||
useHotkeys("mod+g", handleGroupWShortcut);
|
useHotkeys(group, handleGroupWShortcut);
|
||||||
useHotkeys(share, handleShareWShortcut);
|
useHotkeys(share, handleShareWShortcut);
|
||||||
useHotkeys(code, handleCodeWShortcut);
|
useHotkeys(code, handleCodeWShortcut);
|
||||||
useHotkeys(advanced, handleAdvancedWShortcut);
|
useHotkeys(advanced, handleAdvancedWShortcut);
|
||||||
useHotkeys(save, handleSaveWShortcut);
|
useHotkeys(save, handleSaveWShortcut);
|
||||||
useHotkeys(docs, handleDocsWShortcut);
|
useHotkeys(docs, handleDocsWShortcut);
|
||||||
useHotkeys("mod+j", handleDownloadWShortcut);
|
useHotkeys(download, handleDownloadWShortcut);
|
||||||
useHotkeys("space", handleCodeWShortcut);
|
useHotkeys("space", handleCodeWShortcut);
|
||||||
|
|
||||||
const isMinimal = numberOfHandles <= 1;
|
const isMinimal = numberOfHandles <= 1;
|
||||||
|
|
@ -612,24 +615,15 @@ export default function NodeToolbarComponent({
|
||||||
)}
|
)}
|
||||||
{isGroup && (
|
{isGroup && (
|
||||||
<SelectItem value="ungroup">
|
<SelectItem value="ungroup">
|
||||||
<div className="flex">
|
<ToolbarSelectItem
|
||||||
<IconComponent
|
shortcut={
|
||||||
name="Ungroup"
|
shortcuts.find((obj) => obj.name === "Group")?.shortcut!
|
||||||
className="relative top-0.5 mr-2 h-4 w-4 "
|
}
|
||||||
/>{" "}
|
isMac={navigator.userAgent.toUpperCase().includes("MAC")}
|
||||||
<span className="">Ungroup</span>{" "}
|
value={"Ungroup"}
|
||||||
{navigator.userAgent.toUpperCase().includes("MAC") ? (
|
icon={"Ungroup"}
|
||||||
<IconComponent
|
dataTestId="group-button-modal"
|
||||||
name="Command"
|
/>
|
||||||
className="absolute right-[1.15rem] top-[0.65em] h-3.5 w-3.5 stroke-2"
|
|
||||||
></IconComponent>
|
|
||||||
) : (
|
|
||||||
<span className="absolute right-[1.30rem] top-[0.40em] stroke-2">
|
|
||||||
Ctrl +{" "}
|
|
||||||
</span>
|
|
||||||
)}
|
|
||||||
<span className="absolute right-2 top-[0.43em]">G</span>
|
|
||||||
</div>
|
|
||||||
</SelectItem>
|
</SelectItem>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -25,11 +25,13 @@ export default function ShortcutsPage() {
|
||||||
headerCheckboxSelection: true,
|
headerCheckboxSelection: true,
|
||||||
checkboxSelection: true,
|
checkboxSelection: true,
|
||||||
showDisabledCheckboxes: true,
|
showDisabledCheckboxes: true,
|
||||||
|
resizable: false,
|
||||||
}, //This column will be twice as wide as the others
|
}, //This column will be twice as wide as the others
|
||||||
{
|
{
|
||||||
field: "shortcut",
|
field: "shortcut",
|
||||||
flex: 2,
|
flex: 2,
|
||||||
editable: false,
|
editable: false,
|
||||||
|
resizable: false,
|
||||||
},
|
},
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -27,6 +27,8 @@ export const useShortcutsStore = create<shortcutsStoreType>((set, get) => ({
|
||||||
cut: "mod+x",
|
cut: "mod+x",
|
||||||
paste: "mod+v",
|
paste: "mod+v",
|
||||||
api: "mod+r",
|
api: "mod+r",
|
||||||
|
update: "mod+u",
|
||||||
|
download: "mod+j",
|
||||||
updateUniqueShortcut: (name, combination) => {
|
updateUniqueShortcut: (name, combination) => {
|
||||||
set({
|
set({
|
||||||
[name]: combination,
|
[name]: combination,
|
||||||
|
|
|
||||||
|
|
@ -37,6 +37,8 @@ export type shortcutsStoreType = {
|
||||||
docs: string;
|
docs: string;
|
||||||
save: string;
|
save: string;
|
||||||
delete: string;
|
delete: string;
|
||||||
|
update: string;
|
||||||
|
download: string;
|
||||||
shortcuts: Array<{
|
shortcuts: Array<{
|
||||||
name: string;
|
name: string;
|
||||||
shortcut: string;
|
shortcut: string;
|
||||||
|
|
@ -44,6 +46,6 @@ export type shortcutsStoreType = {
|
||||||
unavailableShortcuts: string[];
|
unavailableShortcuts: string[];
|
||||||
setShortcuts: (
|
setShortcuts: (
|
||||||
newShortcuts: Array<{ name: string; shortcut: string }>,
|
newShortcuts: Array<{ name: string; shortcut: string }>,
|
||||||
unavailable: string[]
|
unavailable: string[],
|
||||||
) => void;
|
) => void;
|
||||||
};
|
};
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue