From 464a060ca044fee08c1a0d9ae4ce0a1c8baa61fb Mon Sep 17 00:00:00 2001 From: Andreas Fernandez <a.fernandez@scripting-base.de> Date: Tue, 3 Mar 2020 17:59:12 +0100 Subject: [PATCH] [BUGFIX] Allow sending test mails via pressing enter key MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The form for sending test mails in the Install Tool now listens to the `submit` event which allows to trigger the submit via pressing the "enter" key. Resolves: #90312 Releases: master, 9.5 Change-Id: Id37e285702d2bb8abc790d8b092598cf3201b8aa Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/63539 Tested-by: TYPO3com <noreply@typo3.com> Tested-by: Christian Eßl <indy.essl@gmail.com> Tested-by: Daniel Goerz <daniel.goerz@posteo.de> Reviewed-by: Christian Eßl <indy.essl@gmail.com> Reviewed-by: Daniel Goerz <daniel.goerz@posteo.de> --- .../Public/TypeScript/Module/Environment/MailTest.ts | 4 ++++ .../Public/JavaScript/Module/Environment/MailTest.js | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/Build/Sources/TypeScript/install/Resources/Public/TypeScript/Module/Environment/MailTest.ts b/Build/Sources/TypeScript/install/Resources/Public/TypeScript/Module/Environment/MailTest.ts index 436400cbe343..7de52187f165 100644 --- a/Build/Sources/TypeScript/install/Resources/Public/TypeScript/Module/Environment/MailTest.ts +++ b/Build/Sources/TypeScript/install/Resources/Public/TypeScript/Module/Environment/MailTest.ts @@ -37,6 +37,10 @@ class MailTest extends AbstractInteractableModule { e.preventDefault(); this.send(); }); + currentModal.on('submit', 'form', (e: JQueryEventObject): void => { + e.preventDefault(); + this.send(); + }); } private getData(): void { diff --git a/typo3/sysext/install/Resources/Public/JavaScript/Module/Environment/MailTest.js b/typo3/sysext/install/Resources/Public/JavaScript/Module/Environment/MailTest.js index f289425e5ccc..8d8988b27dcb 100644 --- a/typo3/sysext/install/Resources/Public/JavaScript/Module/Environment/MailTest.js +++ b/typo3/sysext/install/Resources/Public/JavaScript/Module/Environment/MailTest.js @@ -10,4 +10,4 @@ * * The TYPO3 project - inspiring people to share! */ -define(["require","exports","../AbstractInteractableModule","TYPO3/CMS/Backend/Modal","TYPO3/CMS/Backend/Notification","TYPO3/CMS/Core/Ajax/AjaxRequest","../../Renderable/InfoBox","../../Renderable/ProgressBar","../../Renderable/Severity","../../Router","bootstrap"],(function(t,e,n,s,a,r,o,i,l,c){"use strict";class d extends n.AbstractInteractableModule{constructor(){super(...arguments),this.selectorOutputContainer=".t3js-mailTest-output",this.selectorMailTestButton=".t3js-mailTest-execute"}initialize(t){this.currentModal=t,this.getData(),t.on("click",this.selectorMailTestButton,t=>{t.preventDefault(),this.send()})}getData(){const t=this.getModalBody();new r(c.getUrl("mailTestGetData")).get({cache:"no-cache"}).then(async e=>{const n=await e.resolve();!0===n.success?(t.empty().append(n.html),s.setButtons(n.buttons)):a.error("Something went wrong")},e=>{c.handleAjaxError(e,t)})}send(){const t=this.getModuleContent().data("mail-test-token"),e=this.findInModal(this.selectorOutputContainer),n=i.render(l.loading,"Loading...","");e.empty().html(n),new r(c.getUrl()).post({install:{action:"mailTest",token:t,email:this.findInModal(".t3js-mailTest-email").val()}}).then(async t=>{const n=await t.resolve();e.empty(),Array.isArray(n.status)?n.status.forEach(t=>{const n=o.render(t.severity,t.title,t.message);e.html(n)}):a.error("Something went wrong")},()=>{a.error("Something went wrong")})}}return new d})); \ No newline at end of file +define(["require","exports","../AbstractInteractableModule","TYPO3/CMS/Backend/Modal","TYPO3/CMS/Backend/Notification","TYPO3/CMS/Core/Ajax/AjaxRequest","../../Renderable/InfoBox","../../Renderable/ProgressBar","../../Renderable/Severity","../../Router","bootstrap"],(function(t,e,n,s,a,r,o,i,l,c){"use strict";class u extends n.AbstractInteractableModule{constructor(){super(...arguments),this.selectorOutputContainer=".t3js-mailTest-output",this.selectorMailTestButton=".t3js-mailTest-execute"}initialize(t){this.currentModal=t,this.getData(),t.on("click",this.selectorMailTestButton,t=>{t.preventDefault(),this.send()}),t.on("submit","form",t=>{t.preventDefault(),this.send()})}getData(){const t=this.getModalBody();new r(c.getUrl("mailTestGetData")).get({cache:"no-cache"}).then(async e=>{const n=await e.resolve();!0===n.success?(t.empty().append(n.html),s.setButtons(n.buttons)):a.error("Something went wrong")},e=>{c.handleAjaxError(e,t)})}send(){const t=this.getModuleContent().data("mail-test-token"),e=this.findInModal(this.selectorOutputContainer),n=i.render(l.loading,"Loading...","");e.empty().html(n),new r(c.getUrl()).post({install:{action:"mailTest",token:t,email:this.findInModal(".t3js-mailTest-email").val()}}).then(async t=>{const n=await t.resolve();e.empty(),Array.isArray(n.status)?n.status.forEach(t=>{const n=o.render(t.severity,t.title,t.message);e.html(n)}):a.error("Something went wrong")},()=>{a.error("Something went wrong")})}}return new u})); \ No newline at end of file -- GitLab