diff --git a/mindmup-editabletable.js b/mindmup-editabletable.js index 36be540..dd08e8c 100644 --- a/mindmup-editabletable.js +++ b/mindmup-editabletable.js @@ -15,14 +15,24 @@ $.fn.editableTableWidget = function (options) { showEditor = function (select) { active = element.find('td:focus'); if (active.length) { - editor.val(active.text()) - .removeClass('error') - .show() - .offset(active.offset()) - .css(active.css(activeOptions.cloneProperties)) - .width(active.width()) - .height(active.height()) - .focus(); + if(active.find(':input').length){ + active.find(':input').focus().blur( function(){} ).keydown(function (e) { + if (e.which === ENTER || e.which === ESC ) { + $(this).parent('td').focus(); + e.preventDefault(); + e.stopPropagation(); + } + }); + }else{ + editor.val(active.text()) + .removeClass('error') + .show() + .offset(active.offset()) + .css(active.css(activeOptions.cloneProperties)) + .width(active.width()) + .height(active.height()) + .focus(); + } if (select) { editor.select(); }