[BUGFIX] Catch submit event while saving shortcut with enter 37/46737/2
authorWouter Wolters <typo3@wouterwolters.nl>
Tue, 16 Feb 2016 19:10:17 +0000 (20:10 +0100)
committerWouter Wolters <typo3@wouterwolters.nl>
Tue, 16 Feb 2016 22:34:47 +0000 (23:34 +0100)
To save the shortcut with an enter in the input field we need to
catch the submit event and use the same save mechanism as when
using the submit button.

Resolves: #73477
Releases: master,7.6
Change-Id: Icbe78ca2e3082e9eb9aa7a2b70c362d0aaa43934
Reviewed-on: https://review.typo3.org/46737
Reviewed-by: Wouter Wolters <typo3@wouterwolters.nl>
Tested-by: Wouter Wolters <typo3@wouterwolters.nl>
typo3/sysext/backend/Resources/Public/JavaScript/Toolbar/ShortcutMenu.js

index da09388..6f917db 100644 (file)
@@ -35,7 +35,8 @@ define(['jquery', 'TYPO3/CMS/Backend/Modal', 'TYPO3/CMS/Backend/Icons'], functio
                        shortcutFormTitleSelector: 'input[name="shortcut-title"]',
                        shortcutFormGroupSelector: 'select[name="shortcut-group"]',
                        shortcutFormSaveSelector: '.shortcut-form-save',
-                       shortcutFormCancelSelector: '.shortcut-form-cancel'
+                       shortcutFormCancelSelector: '.shortcut-form-cancel',
+                       shortcutFormSelector: '.shortcut-form'
                }
        };
 
@@ -189,6 +190,10 @@ define(['jquery', 'TYPO3/CMS/Backend/Modal', 'TYPO3/CMS/Backend/Icons'], functio
                        ShortcutMenu.editShortcut($(this).closest(ShortcutMenu.options.shortcutItemSelector));
                }).on('click', ShortcutMenu.options.shortcutFormSaveSelector, function(evt) {
                        ShortcutMenu.saveShortcutForm($(this).closest(ShortcutMenu.options.shortcutItemSelector));
+               }).on('submit', ShortcutMenu.options.shortcutFormSelector, function(evt) {
+                       evt.preventDefault();
+                       evt.stopImmediatePropagation();
+                       ShortcutMenu.saveShortcutForm($(this).closest(ShortcutMenu.options.shortcutItemSelector));
                }).on('click', ShortcutMenu.options.shortcutFormCancelSelector, function() {
                        // re-render the menu on canceling the update of a shortcut
                        ShortcutMenu.refreshMenu();