From 2361c2e8737289134e543a55775eac8590dc629d Mon Sep 17 00:00:00 2001 From: Coleman Watts Date: Fri, 2 Jan 2015 21:28:12 -0500 Subject: [PATCH] CRM-15759 - Fix crmEditable textarea handling --- js/jquery/jquery.crmeditable.js | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/js/jquery/jquery.crmeditable.js b/js/jquery/jquery.crmeditable.js index ac87b2a999..f1e0495519 100644 --- a/js/jquery/jquery.crmeditable.js +++ b/js/jquery/jquery.crmeditable.js @@ -168,12 +168,15 @@ // CRM-15759 - Workaround broken textarea handling in jeditable 1.7.1 $i.click(function() { $('textarea', this).off() - .on('blur', function() { - $i.find('button[type=cancel]').click(); + // Fix cancel-on-blur + .on('blur', function(e) { + if (!e.relatedTarget || !$(e.relatedTarget).is('.crm-editable-form button')) { + $i.find('button[type=cancel]').click(); + } }) + // Add support for ctrl-enter shortcut key .on('keydown', function (e) { if (e.ctrlKey && e.keyCode == 13) { - // Ctrl-Enter pressed $i.find('button[type=submit]').click(); e.preventDefault(); } -- 2.25.1