diff --git a/package.json b/package.json
index b73f83240..92bdf9805 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "automa",
- "version": "0.17.0",
+ "version": "0.17.2",
"description": "An extension for automating your browser by connecting blocks",
"license": "MIT",
"repository": {
@@ -23,7 +23,7 @@
},
"dependencies": {
"@codemirror/basic-setup": "^0.19.1",
- "@codemirror/lang-javascript": "^0.19.3",
+ "@codemirror/lang-javascript": "0.19.1",
"@codemirror/lang-json": "^0.19.1",
"@codemirror/theme-one-dark": "^0.19.1",
"@medv/finder": "^2.1.0",
diff --git a/src/background/workflow-engine/blocks-handler/handler-conditions.js b/src/background/workflow-engine/blocks-handler/handler-conditions.js
index 4fd22f429..9ae9fd0b9 100644
--- a/src/background/workflow-engine/blocks-handler/handler-conditions.js
+++ b/src/background/workflow-engine/blocks-handler/handler-conditions.js
@@ -19,11 +19,8 @@ function conditions({ data, outputs }, { prevBlockData, refData }) {
data.conditions.forEach(({ type, value, compareValue }, index) => {
if (isConditionMatch) return;
- const firstValue = mustacheReplacer({
- str: compareValue ?? prevData,
- data: refData,
- });
- const secondValue = mustacheReplacer({ str: value, data: refData });
+ const firstValue = mustacheReplacer(compareValue ?? prevData, refData);
+ const secondValue = mustacheReplacer(value, refData);
const isMatch = compareBlockValue(type, firstValue, secondValue);
diff --git a/src/background/workflow-engine/blocks-handler/handler-new-tab.js b/src/background/workflow-engine/blocks-handler/handler-new-tab.js
index 48c521f87..cb35e3f1e 100644
--- a/src/background/workflow-engine/blocks-handler/handler-new-tab.js
+++ b/src/background/workflow-engine/blocks-handler/handler-new-tab.js
@@ -1,5 +1,6 @@
import browser from 'webextension-polyfill';
import { getBlockConnection } from '../helper';
+import { isWhitespace } from '@/utils/helper';
async function newTab(block) {
if (this.windowId) {
@@ -14,6 +15,16 @@ async function newTab(block) {
try {
const { updatePrevTab, url, active, inGroup } = block.data;
+ const isInvalidUrl = !/^https?/.test(url);
+
+ if (isInvalidUrl) {
+ const error = new Error(
+ isWhitespace(url) ? 'url-empty' : 'invalid-active-tab'
+ );
+ error.data = { url };
+
+ throw error;
+ }
if (updatePrevTab && this.activeTab.id) {
await browser.tabs.update(this.activeTab.id, { url, active });
@@ -54,6 +65,7 @@ async function newTab(block) {
};
} catch (error) {
console.error(error);
+ console.dir(error);
error.nextBlockId = nextBlockId;
throw error;
diff --git a/src/background/workflow-engine/blocks-handler/handler-new-window.js b/src/background/workflow-engine/blocks-handler/handler-new-window.js
index b2f83b90d..1b1ef34a1 100644
--- a/src/background/workflow-engine/blocks-handler/handler-new-window.js
+++ b/src/background/workflow-engine/blocks-handler/handler-new-window.js
@@ -6,11 +6,17 @@ export async function newWindow(block) {
try {
const { incognito, windowState } = block.data;
- const { id } = await browser.windows.create({
- incognito,
- state: windowState,
- });
+ const windowOptions = { incognito, state: windowState };
+ if (windowState === 'normal') {
+ ['top', 'left', 'height', 'width'].forEach((key) => {
+ if (block.data[key] <= 0) return;
+
+ windowOptions[key] = block.data[key];
+ });
+ }
+
+ const { id } = await browser.windows.create(windowOptions);
this.windowId = id;
return {
diff --git a/src/components/block/BlockBasic.vue b/src/components/block/BlockBasic.vue
index 9b45ae982..7db45516f 100644
--- a/src/components/block/BlockBasic.vue
+++ b/src/components/block/BlockBasic.vue
@@ -80,6 +80,7 @@ function handleStartDrag(event) {
data: block.data,
id: block.details.id,
blockId: block.id,
+ fromBlockBasic: true,
};
event.dataTransfer.setData('block', JSON.stringify(payload));
diff --git a/src/components/newtab/app/AppSidebar.vue b/src/components/newtab/app/AppSidebar.vue
index 39694245f..d81ffcfc8 100644
--- a/src/components/newtab/app/AppSidebar.vue
+++ b/src/components/newtab/app/AppSidebar.vue
@@ -2,7 +2,11 @@
diff --git a/src/content/element-selector/AppElementList.vue b/src/content/element-selector/AppElementList.vue
new file mode 100644
index 000000000..45e4ed2e3
--- /dev/null
+++ b/src/content/element-selector/AppElementList.vue
@@ -0,0 +1,34 @@
+
+
+ #{{ index + 1 }} {{ elementName }}
+
+
+
+
diff --git a/src/locales/en/blocks.json b/src/locales/en/blocks.json
index 2826d04b5..b22bc3489 100644
--- a/src/locales/en/blocks.json
+++ b/src/locales/en/blocks.json
@@ -32,7 +32,9 @@
"name": "Upload file",
"description": "Upload file into element",
"filePath": "File path",
- "addFile": "Add file"
+ "addFile": "Add file",
+ "requirement": "See the requirement before using this block",
+ "noFileAccess": "Automa doesn't have file access"
},
"browser-event": {
"name": "Browser event",
@@ -146,6 +148,11 @@
"new-window": {
"name": "New window",
"description": "Create a new window",
+ "top": "Top",
+ "left": "Left",
+ "height": "Height",
+ "width": "Width",
+ "note": "Note: use 0 to disable",
"windowState": {
"placeholder": "Window state",
"options": {
diff --git a/src/locales/en/newtab.json b/src/locales/en/newtab.json
index d14403b3f..14202a04f 100644
--- a/src/locales/en/newtab.json
+++ b/src/locales/en/newtab.json
@@ -18,7 +18,8 @@
"reloadPage": "Reload the page to take effect"
},
"menu": {
- "general": "General"
+ "general": "General",
+ "about": "About"
},
},
"workflow": {
diff --git a/src/newtab/App.vue b/src/newtab/App.vue
index 896f79bba..401306cfe 100644
--- a/src/newtab/App.vue
+++ b/src/newtab/App.vue
@@ -15,6 +15,8 @@