浏览代码

feat: double click to edit condition

Ahmad Kholid 2 年之前
父节点
当前提交
1cfc9699dc

+ 1 - 0
src/components/block/BlockConditions.vue

@@ -29,6 +29,7 @@
         v-for="item in data.conditions"
         :key="item.id"
         class="flex items-center flex-1 p-2 bg-box-transparent rounded-lg w-full relative"
+        @dblclick.stop="$emit('edit', { editCondition: item.id })"
       >
         <p
           v-if="item.name"

+ 1 - 0
src/components/newtab/workflow/WorkflowEditBlock.vue

@@ -39,6 +39,7 @@
       v-model:data="blockData"
       :block-id="data.blockId"
       v-bind="{
+        fullData: data.id === 'conditions' ? data : null,
         editor: data.id === 'conditions' ? editor : null,
         connections: data.id === 'wait-connections' ? data.connections : null,
       }"

+ 11 - 0
src/components/newtab/workflow/edit/EditConditions.vue

@@ -140,6 +140,10 @@ const props = defineProps({
     type: Object,
     default: () => ({}),
   },
+  fullData: {
+    type: Object,
+    default: () => ({}),
+  },
   blockId: {
     type: String,
     default: '',
@@ -205,6 +209,13 @@ watch(
 );
 
 onMounted(() => {
+  if (props.fullData?.editCondition) {
+    const index = props.data.conditions.findIndex(
+      (item) => item.id === props.fullData.editCondition
+    );
+    if (index !== -1) editCondition(index);
+  }
+
   const condition = props.data.conditions[0];
   if (condition && condition.conditions) return;