Skip to content

Commit c12f395

Browse files
authored
v1.28.24
2 parents e15f381 + 22f4362 commit c12f395

File tree

14 files changed

+77
-22
lines changed

14 files changed

+77
-22
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "automa",
3-
"version": "1.28.23",
3+
"version": "1.28.24",
44
"description": "An extension for automating your browser by connecting blocks",
55
"repository": {
66
"type": "git",

src/components/newtab/workflow/edit/EditPressKey.vue

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -76,12 +76,11 @@
7676
@change="updateData({ keysToPress: $event })"
7777
/>
7878
<ui-input
79-
:model-value="Math.min(data.pressTime || 0, 0)"
79+
:model-value="data.pressTime || 0"
8080
:label="t('workflow.blocks.press-key.press-time')"
81-
type="number"
8281
class="w-full mt-2"
8382
:placeholder="t('common.millisecond')"
84-
@change="updateData({ pressTime: +$event })"
83+
@change="updateData({ pressTime: $event })"
8584
/>
8685
</div>
8786
</template>

src/components/newtab/workflow/editor/EditorLocalActions.vue

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@
131131
:class="[
132132
{ 'cursor-default': isDataChanged },
133133
workflow.testingMode
134-
? 'bg-primary bg-primary bg-opacity-20 text-primary'
134+
? 'bg-primary bg-opacity-20 text-primary'
135135
: 'hoverable',
136136
]"
137137
class="rounded-lg p-2"
@@ -333,6 +333,7 @@ import { useToast } from 'vue-toastification';
333333
import browser from 'webextension-polyfill';
334334
import { fetchApi } from '@/utils/api';
335335
import { useUserStore } from '@/stores/user';
336+
import { useStore } from '@/stores/main';
336337
import { useWorkflowStore } from '@/stores/workflow';
337338
import { useTeamWorkflowStore } from '@/stores/teamWorkflow';
338339
import { useSharedWorkflowStore } from '@/stores/sharedWorkflow';
@@ -381,6 +382,7 @@ const { t } = useI18n();
381382
const toast = useToast();
382383
const router = useRouter();
383384
const dialog = useDialog();
385+
const mainStore = useStore();
384386
const userStore = useUserStore();
385387
const packageStore = usePackageStore();
386388
const workflowStore = useWorkflowStore();
@@ -468,6 +470,11 @@ function updateWorkflowDescription(value) {
468470
state.showEditDescription = false;
469471
}
470472
function executeCurrWorkflow() {
473+
if (mainStore.settings.editor.saveWhenExecute && props.isDataChanged) {
474+
// eslint-disable-next-line no-use-before-define
475+
saveWorkflow();
476+
}
477+
471478
executeWorkflow({
472479
...props.workflow,
473480
isTesting: props.isDataChanged,

src/content/blocksHandler/handlerElementScroll.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,13 @@ import handleSelector from '../handleSelector';
22

33
function isElScrollable(element) {
44
const excludedTags = ['SCRIPT', 'STYLE', 'SVG', 'HEAD'];
5-
6-
const isOverflow = /scroll|auto/.test(getComputedStyle(element).overflow);
75
const isScrollable =
86
element.scrollHeight > element.clientHeight ||
97
element.scrollWidth > element.clientWidth;
108
const isExcluded =
119
element.tagName.includes('-') || excludedTags.includes(element.tagName);
1210

13-
return isOverflow && isScrollable && !isExcluded;
11+
return isScrollable && !isExcluded;
1412
}
1513

1614
function findScrollableElement(

src/content/blocksHandler/handlerPressKey.js

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -60,11 +60,13 @@ async function pressKeyWithJs({ element, keys, pressTime }) {
6060
const isTextField = textFieldTags.includes(element.tagName);
6161

6262
if (isEditable || isTextField) {
63-
const isDigit = /^[0-9]$/.test(key);
6463
const contentKey = isEditable ? 'textContent' : 'value';
65-
66-
if (isLetter || isDigit) {
67-
element[contentKey] += key;
64+
if (isLetter || (keyDefinitions[key] && key.length === 1)) {
65+
if (isEditable && document.execCommand) {
66+
document.execCommand('insertText', false, key);
67+
} else {
68+
element[contentKey] += key;
69+
}
6870

6971
return;
7072
}
@@ -174,7 +176,7 @@ async function pressKey({ data, debugMode, activeTabId }) {
174176
element,
175177
activeTabId,
176178
actionType: data.action,
177-
pressTime: Number.isNaN(+data.pressTime) ? 0 : +data.pressTime,
179+
pressTime: Number.isNaN(+data.pressTime) ? 0 : Math.abs(+data.pressTime),
178180
});
179181

180182
return '';

src/locales/en/newtab.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,10 @@
123123
"snapGrid": {
124124
"title": "Snap to the grid",
125125
"description": "Snap to the grid when moving a block"
126+
},
127+
"saveWhenExecute": {
128+
"title": "Auto-save when execute workflow",
129+
"description": "Workflow changes will be saved when executing the workflow"
126130
}
127131
},
128132
"deleteLog": {

src/newtab/pages/settings/SettingsBackup.vue

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -416,7 +416,10 @@ async function restoreWorkflows() {
416416
};
417417
418418
reader.onload = ({ target }) => {
419-
const payload = parseJSON(window.decodeURIComponent(target.result), null);
419+
let payload = parseJSON(target.result, null);
420+
if (!payload)
421+
payload = parseJSON(window.decodeURIComponent(target.result), null);
422+
420423
if (!payload) return;
421424
422425
const storageTables = parseJSON(payload.storageTables, null);

src/newtab/pages/settings/SettingsEditor.vue

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,17 @@
5454
/>
5555
</div>
5656
</transition-expand>
57+
<ui-list-item small>
58+
<ui-switch v-model="settings.saveWhenExecute" />
59+
<div class="ml-4 flex-1">
60+
<p class="leading-tight">
61+
{{ t('settings.editor.saveWhenExecute.title') }}
62+
</p>
63+
<p class="text-sm leading-tight text-gray-600 dark:text-gray-200">
64+
{{ t('settings.editor.saveWhenExecute.description') }}
65+
</p>
66+
</div>
67+
</ui-list-item>
5768
</ui-list>
5869
</div>
5970
</template>

src/newtab/pages/workflows/[id].vue

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -296,6 +296,7 @@ import {
296296
computed,
297297
onMounted,
298298
shallowRef,
299+
onDeactivated,
299300
onBeforeUnmount,
300301
} from 'vue';
301302
import cloneDeep from 'lodash.clonedeep';
@@ -1529,7 +1530,7 @@ function checkWorkflowUpdate() {
15291530
/* eslint-disable consistent-return */
15301531
function onBeforeLeave() {
15311532
// disselect node before leave
1532-
const selectedNodes = editor.value.getSelectedNodes.value;
1533+
const selectedNodes = editor.value?.getSelectedNodes?.value;
15331534
selectedNodes?.forEach((node) => {
15341535
node.selected = false;
15351536
});
@@ -1579,6 +1580,12 @@ watch(
15791580
}
15801581
);
15811582
1583+
onDeactivated(() => {
1584+
const selectedNodes = editor.value?.getSelectedNodes?.value;
1585+
selectedNodes?.forEach((node) => {
1586+
node.selected = false;
1587+
});
1588+
});
15821589
onBeforeRouteLeave(onBeforeLeave);
15831590
onMounted(() => {
15841591
if (!workflow.value) {

src/stores/main.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ export const useStore = defineStore('main', {
2525
arrow: true,
2626
snapToGrid: false,
2727
lineType: 'default',
28+
saveWhenExecute: false,
2829
snapGrid: { 0: 15, 1: 15 },
2930
},
3031
},

0 commit comments

Comments
 (0)