mirror of
https://github.com/silverstripe/silverstripe-blog
synced 2024-10-22 11:05:58 +02:00
FIX Prevent the CMS Hijacking the return keypress in gridfieldaddbydbfield
This commit is contained in:
parent
9526e13e5c
commit
2c0e1a73ed
@ -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