Browse Source

fix: delay block not working

Ahmad Kholid 3 years ago
parent
commit
c24a759043
2 changed files with 3 additions and 9 deletions
  1. 2 8
      src/components/block/BlockDelay.vue
  2. 1 1
      src/utils/reference-data/index.js

+ 2 - 8
src/components/block/BlockDelay.vue

@@ -21,7 +21,7 @@
       :title="t('workflow.blocks.delay.input.title')"
       :placeholder="t('workflow.blocks.delay.input.placeholder')"
       class="px-4 py-2 rounded-lg w-36 bg-input"
-      type="number"
+      type="text"
       required
       @input="handleInput"
     />
@@ -45,13 +45,7 @@ const componentId = useComponentId('block-delay');
 const block = useEditorBlock(`#${componentId}`, props.editor);
 
 function handleInput({ target }) {
-  target.reportValidity();
-
-  const time = +target.value || 0;
-
-  if (time < 0) return;
-
-  props.editor.updateNodeDataFromId(block.id, { time });
+  props.editor.updateNodeDataFromId(block.id, { time: target.value });
   emitter.emit('editor:data-changed', block.id);
 }
 </script>

+ 1 - 1
src/utils/reference-data/index.js

@@ -15,7 +15,7 @@ export default function ({ block, refKeys, data }) {
       currentData.forEach((str, index) => {
         currentData[index] = mustacheReplacer(str, data);
       });
-    } else {
+    } else if (typeof currentData === 'string') {
       copyBlock.data[blockDataKey] = mustacheReplacer(currentData, data);
     }
   });