Ahmad Kholid 3 سال پیش
والد
کامیت
71081cafb8

+ 1 - 1
package.json

@@ -1,6 +1,6 @@
 {
   "name": "automa",
-  "version": "1.0.0",
+  "version": "1.0.2",
   "description": "An extension for automating your browser by connecting blocks",
   "license": "MIT",
   "repository": {

+ 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>

+ 5 - 2
src/components/newtab/workflow/edit/EditInteractionBase.vue

@@ -26,7 +26,7 @@
         @change="updateData({ selector: $event })"
       />
       <ui-expand
-        v-if="!hideSelector && (data.findBy || 'cssSelector') === 'cssSelector'"
+        v-if="!hideSelector"
         hide-header-icon
         header-class="flex items-center w-full focus:ring-0"
       >
@@ -38,7 +38,10 @@
           />
           Selector options
         </template>
-        <div class="mt-1">
+        <div
+          v-if="(data.findBy || 'cssSelector') === 'cssSelector'"
+          class="mt-1"
+        >
           <ui-checkbox
             v-if="!data.disableMultiple && !hideMultiple"
             :title="t('workflow.blocks.base.multiple.title')"

+ 10 - 10
src/components/newtab/workflow/edit/EditLoopData.vue

@@ -52,16 +52,6 @@
       class="mt-2 w-full"
       @change="updateData({ elementSelector: $event })"
     />
-    <ui-input
-      v-if="data.loopThrough !== 'numbers'"
-      :model-value="data.maxLoop"
-      :label="t('workflow.blocks.loop-data.maxLoop.label')"
-      :title="t('workflow.blocks.loop-data.maxLoop.title')"
-      class="w-full mt-2"
-      min="0"
-      type="number"
-      @change="updateData({ maxLoop: +$event || 0 })"
-    />
     <ui-button
       v-else-if="data.loopThrough === 'custom-data'"
       class="w-full mt-4"
@@ -96,6 +86,16 @@
         "
       />
     </div>
+    <ui-input
+      v-if="data.loopThrough !== 'numbers'"
+      :model-value="data.maxLoop"
+      :label="t('workflow.blocks.loop-data.maxLoop.label')"
+      :title="t('workflow.blocks.loop-data.maxLoop.title')"
+      class="w-full mt-2"
+      min="0"
+      type="number"
+      @change="updateData({ maxLoop: +$event || 0 })"
+    />
     <ui-modal
       v-model="state.showDataModal"
       title="Data"

+ 0 - 8
src/content/blocks-handler/handler-javascript-code.js

@@ -1,13 +1,5 @@
 import { sendMessage } from '@/utils/message';
 
-/*
-setVariable(name, value);
-
-init => set variables to sessionStorage
-invoked => update the variable in the sessionStorage
-nextBlock => include the variables in payload
-*/
-
 function getAutomaScript(blockId) {
   return `
 function automaSetVariable(name, value) {

+ 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);
     }
   });