From: Coleman Watts Date: Wed, 29 Apr 2015 05:10:23 +0000 (-0600) Subject: CRM-16354 - Replace-plain fix X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=0bd65d9bf5893069fa9d20cf431394b6e5c3db36;p=civicrm-core.git CRM-16354 - Replace-plain fix --- diff --git a/js/wysiwyg/crm.wysiwyg.js b/js/wysiwyg/crm.wysiwyg.js index 2ca137829a..9be69a88f7 100644 --- a/js/wysiwyg/crm.wysiwyg.js +++ b/js/wysiwyg/crm.wysiwyg.js @@ -31,18 +31,24 @@ $(item).triggerHandler('change'); CRM.wysiwyg.focus(item); }, + // Create a "collapsed" textarea that expands into a wysiwyg when clicked createCollapsed: function(item) { $(item) .hide() - .after('
') .on('blur', function () { CRM.wysiwyg.destroy(item); $(item).hide().next('.replace-plain').show().html($(item).val()); + }) + .after('
'); + $(item).next('.replace-plain') + .attr('title', ts('Click to edit')) + .html($(item).val()) + .on('click keypress', function (e) { + // Stop browser from opening clicked links + e.preventDefault(); + $(item).show().next('.replace-plain').hide(); + CRM.wysiwyg.create(item); }); - $(item).next('.replace-plain').attr('title', ts('Click to edit')).on('click keypress', function () { - $(item).show().next('.replace-plain').hide(); - CRM.wysiwyg.create(item); - }); } }; })(CRM.$, CRM._);