fix: cmd/ctrl+s to save workflow

This commit is contained in:
Shariq Ansari 2023-05-02 18:29:26 +05:30
parent 654c941635
commit 13e5031c3c

View file

@ -7,6 +7,7 @@ import ActionNode from "./components/ActionNode.vue";
import ConnectionLine from "./components/ConnectionLine.vue";
import { useStore } from "./store";
import { nextTick, onMounted, watch } from "vue";
import { useMagicKeys, whenever } from "@vueuse/core";
let store = useStore();
let {
@ -28,6 +29,15 @@ let {
vueFlowRef
} = useVueFlow();
// cmd/ctrl + s to save the form
const { meta_s, ctrl_s } = useMagicKeys();
whenever(
() => meta_s.value || ctrl_s.value,
() => {
store.save_changes();
}
);
onNodeDragStop(() => {
nextTick(() => store.ref_history.commit());
});