From c1b6d70b3dbf670eece1084ada8e721e8b7161fb Mon Sep 17 00:00:00 2001 From: Sodbileg Gansukh Date: Mon, 15 May 2023 16:47:07 +0800 Subject: [PATCH] Added enter key support to tier benefits closes https://github.com/TryGhost/Team/issues/2950 - when adding/editing tiers, benefits used to be added only when the plus button was pressed - this adds enter key support for adding new benefits, same as how the navigation items are added --- ghost/admin/app/components/modal-tier.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/ghost/admin/app/components/modal-tier.js b/ghost/admin/app/components/modal-tier.js index 24cd83f048..80fb8d06b0 100644 --- a/ghost/admin/app/components/modal-tier.js +++ b/ghost/admin/app/components/modal-tier.js @@ -6,6 +6,7 @@ import {currencies, getCurrencyOptions, getSymbol} from 'ghost-admin/utils/curre import {A as emberA} from '@ember/array'; import {htmlSafe} from '@ember/template'; import {inject} from 'ghost-admin/decorators/inject'; +import {run} from '@ember/runloop'; import {inject as service} from '@ember/service'; import {task} from 'ember-concurrency'; import {tracked} from '@glimmer/tracking'; @@ -316,4 +317,12 @@ export default class ModalTierPrice extends ModalBase { this.close(); } }; + + keyPress(event) { + // enter key + if (event.keyCode === 13) { + event.preventDefault(); + run.scheduleOnce('actions', this, this.send, 'addBenefit', this.newBenefit); + } + } }