mirror of
https://github.com/silverstripe/silverstripe-blog
synced 2024-10-22 11:05:58 +02:00
Merge pull request #371 from micmania1/266-fix-cms-hijacking-keypress
FIX Prevent the CMS Hijacking the return keypress in gridfieldaddbydb…
This commit is contained in:
commit
17429c043f
@ -147,6 +147,8 @@ class GridFieldAddByDBField implements GridField_ActionProvider, GridField_HTMLP
|
||||
*/
|
||||
public function getHTMLFragments($gridField)
|
||||
{
|
||||
Requirements::javascript(BLOGGER_DIR . '/js/gridfieldaddbydbfield.js');
|
||||
|
||||
/**
|
||||
* @var DataList $dataList
|
||||
*/
|
||||
@ -184,7 +186,6 @@ class GridFieldAddByDBField implements GridField_ActionProvider, GridField_HTMLP
|
||||
'add',
|
||||
'add'
|
||||
);
|
||||
|
||||
$addAction->setAttribute('data-icon', 'add');
|
||||
|
||||
$forTemplate = new ArrayData(array());
|
||||
|
20
js/gridfieldaddbydbfield.js
Normal file
20
js/gridfieldaddbydbfield.js
Normal file
@ -0,0 +1,20 @@
|
||||
(function ($) {
|
||||
|
||||
$.entwine('ss', function ($) {
|
||||
|
||||
/**
|
||||
* Prevent the CMS hijacking the return key
|
||||
*/
|
||||
$('.add-existing-autocompleter input.text').entwine({
|
||||
'onkeydown': function (e) {
|
||||
if(e.which == 13) {
|
||||
$parent = $(this).parents('.add-existing-autocompleter');
|
||||
$parent.find('button[type="submit"]').click();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
})(jQuery);
|
Loading…
Reference in New Issue
Block a user