Fix: Remove code modal shortcut for improvements
This commit is contained in:
parent
2305806c40
commit
07aa83e4e5
5 changed files with 0 additions and 77 deletions
|
|
@ -45,32 +45,6 @@ export default function App() {
|
||||||
const refreshStars = useDarkStore((state) => state.refreshStars);
|
const refreshStars = useDarkStore((state) => state.refreshStars);
|
||||||
const checkHasStore = useStoreStore((state) => state.checkHasStore);
|
const checkHasStore = useStoreStore((state) => state.checkHasStore);
|
||||||
|
|
||||||
const handleModalWShortcut = useFlowStore(
|
|
||||||
(state) => state.handleModalWShortcut
|
|
||||||
);
|
|
||||||
const nodes = useFlowStore((state) => state.nodes);
|
|
||||||
|
|
||||||
useEffect(() => {
|
|
||||||
const onKeyDown = (event: KeyboardEvent) => {
|
|
||||||
const selectedNode = nodes.filter((obj) => obj.selected);
|
|
||||||
if (
|
|
||||||
(event.ctrlKey || event.metaKey) &&
|
|
||||||
event.shiftKey &&
|
|
||||||
event.key === "C" &&
|
|
||||||
selectedNode.length > 0
|
|
||||||
) {
|
|
||||||
event.preventDefault();
|
|
||||||
handleModalWShortcut("code");
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
document.addEventListener("keydown", onKeyDown);
|
|
||||||
|
|
||||||
return () => {
|
|
||||||
document.removeEventListener("keydown", onKeyDown);
|
|
||||||
};
|
|
||||||
}, [handleModalWShortcut, nodes]);
|
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
refreshStars();
|
refreshStars();
|
||||||
refreshVersion();
|
refreshVersion();
|
||||||
|
|
|
||||||
|
|
@ -56,34 +56,6 @@ export default function CodeAreaModal({
|
||||||
}
|
}
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
const handleModalWShortcut = useFlowStore(
|
|
||||||
(state) => state.handleModalWShortcut
|
|
||||||
);
|
|
||||||
const openCodeModalWShortcut = useFlowStore(
|
|
||||||
(state) => state.openCodeModalWShortcut
|
|
||||||
);
|
|
||||||
const nodes = useFlowStore((state) => state.nodes);
|
|
||||||
|
|
||||||
useEffect(() => {
|
|
||||||
const onKeyDown = (event: KeyboardEvent) => {
|
|
||||||
const selectedNode = nodes.filter((obj) => obj.selected);
|
|
||||||
if (
|
|
||||||
(event.ctrlKey || event.metaKey) &&
|
|
||||||
event.shiftKey &&
|
|
||||||
event.key === "C" &&
|
|
||||||
selectedNode.length > 0
|
|
||||||
) {
|
|
||||||
event.preventDefault();
|
|
||||||
setOpen(openCodeModalWShortcut);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
document.addEventListener("keydown", onKeyDown);
|
|
||||||
|
|
||||||
return () => {
|
|
||||||
document.removeEventListener("keydown", onKeyDown);
|
|
||||||
};
|
|
||||||
}, []);
|
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (openModal) setOpen(true);
|
if (openModal) setOpen(true);
|
||||||
}, [openModal]);
|
}, [openModal]);
|
||||||
|
|
|
||||||
|
|
@ -90,17 +90,6 @@ export default function NodeToolbarComponent({
|
||||||
}, [showModalAdvanced]);
|
}, [showModalAdvanced]);
|
||||||
const updateNodeInternals = useUpdateNodeInternals();
|
const updateNodeInternals = useUpdateNodeInternals();
|
||||||
|
|
||||||
const openCodeModalWShortcut = useFlowStore(
|
|
||||||
(state) => state.openCodeModalWShortcut
|
|
||||||
);
|
|
||||||
const handleModalWShortcut = useFlowStore(
|
|
||||||
(state) => state.handleModalWShortcut
|
|
||||||
);
|
|
||||||
|
|
||||||
useEffect(() => {
|
|
||||||
setOpenModal(openCodeModalWShortcut);
|
|
||||||
}, [openCodeModalWShortcut, handleModalWShortcut]);
|
|
||||||
|
|
||||||
const setLastCopiedSelection = useFlowStore(
|
const setLastCopiedSelection = useFlowStore(
|
||||||
(state) => state.setLastCopiedSelection
|
(state) => state.setLastCopiedSelection
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -57,16 +57,6 @@ const useFlowStore = create<FlowStoreType>((set, get) => ({
|
||||||
flowPool: {},
|
flowPool: {},
|
||||||
inputs: [],
|
inputs: [],
|
||||||
outputs: [],
|
outputs: [],
|
||||||
openCodeModalWShortcut: false,
|
|
||||||
handleModalWShortcut: (modal) => {
|
|
||||||
switch (modal) {
|
|
||||||
case "code":
|
|
||||||
set((state) => ({
|
|
||||||
openCodeModalWShortcut: !state.openCodeModalWShortcut,
|
|
||||||
}));
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
},
|
|
||||||
setFlowPool: (flowPool) => {
|
setFlowPool: (flowPool) => {
|
||||||
set({ flowPool });
|
set({ flowPool });
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -40,8 +40,6 @@ export type FlowPoolType = {
|
||||||
};
|
};
|
||||||
|
|
||||||
export type FlowStoreType = {
|
export type FlowStoreType = {
|
||||||
openCodeModalWShortcut: boolean;
|
|
||||||
handleModalWShortcut: (modal: string) => void;
|
|
||||||
flowPool: FlowPoolType;
|
flowPool: FlowPoolType;
|
||||||
inputs: Array<{ type: string; id: string }>;
|
inputs: Array<{ type: string; id: string }>;
|
||||||
outputs: Array<{ type: string; id: string }>;
|
outputs: Array<{ type: string; id: string }>;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue