X-Git-Url: https://git.mdrn.pl/redakcja.git/blobdiff_plain/1cc3cb0514586ece78aa7b03bf19e83e7b3789a3..461c5c048f565ffbc0d9fad72f642c9de8704079:/src/redakcja/static/js/wiki/base.js diff --git a/src/redakcja/static/js/wiki/base.js b/src/redakcja/static/js/wiki/base.js index ad0ca835..3ee92c4b 100644 --- a/src/redakcja/static/js/wiki/base.js +++ b/src/redakcja/static/js/wiki/base.js @@ -249,9 +249,7 @@ var self = this; /* bind buttons */ - $('button[data-ui-action]', self.$elem).click(function(event) { - event.preventDefault(); - + function dataUiAction(elem) { var action = $(this).attr('data-ui-action'); console.log("Button pressed, action: ", action); @@ -263,6 +261,15 @@ if(action == 'cancel') self.hide(); } + } + $('button[data-ui-action]', self.$elem).click(function(event) { + event.preventDefault(); + dataUiAction(this); + }).on('keydown'), function(event) { + if (event.key == 'Enter') { + event.preventDefault(); + dataUiAction(this); + } }); }