O.require(['mail', 'compose'], function () { const composeController = FastMail.mail.screens.compose; const mailActions = FastMail.mail.actions; const mailToolbar = FastMail.views.mailToolbar; mailToolbar.registerView('sendArchive', new O.ButtonView({ type: 's-send', icon: 'icon-paper-plane', _isSending: O.bind(composeController, 'instance.isSending'), _mayMove: O.bind(mailActions, 'mayMove'), isDisabled: function () { return this.get('_isSending') || !this.get('_mayMove'); }.property('_isSending', '_mayMove'), label: O.loc('Send & Archive'), target: { doIt: function () { composeController.fire('send'); mailActions.archive(); } }, method: 'doIt', shortcut: 'cmd-shift-enter', // (Fairly arbitrarily chosen.) })); const config = O.clone(mailToolbar._configs.compose); config.left.splice(config.left.indexOf('send'), 0, 'sendArchive', '-'); mailToolbar.registerConfig('compose', config); });