Open-source AI browser agent for Chrome and Firefox (monorepo) ðŸ§
JavaScript ai-agentai-agentsai-toolsbrowser-aibrowser-automationbrowser-extensionchrome-aichrome-devtoolschrome-extensionchrome-extensionsfirefox-addonfirefox-addonsfirefox-extensionfirefox-extensionsgemmagemma4minimaxoffline-aioffline-llmqwen
fix: stop shortcut save after invalid edits
Emre Sokullu409fe61fdb81
diff --git a/test/workflow-editor.mjs b/test/workflow-editor.mjsindex 5d8b7b32c..224f2ff89 100644--- a/test/workflow-editor.mjs+++ b/test/workflow-editor.mjs@@ -235,6 +235,15 @@ for (const [name, browserType] of Object.entries({ chromium, firefox })) {await page.getByLabel('Download filename').fill('keyboard-name.json');await page.getByLabel('Download filename').press('Control+s');assert.equal((await filenameDownload).suggestedFilename(), 'keyboard-name.json');+ let rejectedDownloads = 0;+ page.on('download', () => { rejectedDownloads++; });+ await page.getByRole('button', { name: 'Parameter 1: Email', exact: true }).click();+ await val(page, ['parameters', 0, 'id']).fill('Invalid ID');+ await val(page, ['parameters', 0, 'id']).press('Control+s');+ await page.waitForTimeout(100);+ assert.equal(rejectedDownloads, 0);+ assert.equal(await page.evaluate(() => editor.getValue().parameters[0].id), 'address');+ assert.match(await page.getByRole('status').innerText(), /Parameter ids must use/);await page.setViewportSize({ width: 390, height: 844 });await page.getByRole('button', { name: 'Workflow details', exact: true }).click();assert.equal(await page.evaluate(() => document.documentElement.scrollWidth <= innerWidth), true);diff --git a/web/workflow-editor/workflow-editor.js b/web/workflow-editor/workflow-editor.jsindex a2db5c681..4a09ecd21 100644--- a/web/workflow-editor/workflow-editor.js+++ b/web/workflow-editor/workflow-editor.js@@ -280,7 +280,11 @@const active = this.root.activeElement;if (active?.matches('.filename')) this.filename = active.value.trim() || 'workflow.json';// Keyboard save must include the text still focused in the form.- if (this.pendingField?.isConnected) this.pendingField.dispatchEvent(new Event('change', { bubbles: true }));+ if (this.pendingField?.isConnected) {+ const previousNotice = this.notice;+ this.pendingField.dispatchEvent(new Event('change', { bubbles: true }));+ if (this.notice !== previousNotice && this.notice?.error) return;+ }this.attempt(() => {const blob = new Blob([this.toJSON()], { type: 'application/json' });const url = URL.createObjectURL(blob);