X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;f=js%2Fjquery%2Fjquery.crmeditable.js;h=c957fc74a4068c88118a25e74983b0ce5a9e2b59;hb=21d4ed8c91dd91ac0012b662c954473f28f8db00;hp=860f9f3d69dbf9b0abbac542633b0058d2038cbb;hpb=9fab7c013cc2bc4908e3a77df8994c465a1ddbe1;p=civicrm-core.git diff --git a/js/jquery/jquery.crmeditable.js b/js/jquery/jquery.crmeditable.js index 860f9f3d69..c957fc74a4 100644 --- a/js/jquery/jquery.crmeditable.js +++ b/js/jquery/jquery.crmeditable.js @@ -1,5 +1,8 @@ // https://civicrm.org/licensing -(function($) { +(function($, _) { + "use strict"; + /* jshint validthis: true */ + // TODO: We'll need a way to clear this cache if options are edited. // Maybe it should be stored in the CRM object so other parts of the app can use it. // Note that if we do move it, we should also change the format of option lists to our standard sequential arrays @@ -68,7 +71,7 @@ if ($i.data('refresh')) { CRM.refreshParent($i); } else { - value = value === '' ? settings.placeholder : value; + value = value === '' ? settings.placeholder : _.escape(value); $i.html(value); } } @@ -210,9 +213,9 @@ }); } return formatOptions(optionsCache[hash]); - } - return value.replace(/<(?:.|\n)*?>/gm, ''); + // Unwrap contents then replace html special characters with plain text + return _.unescape(value.replace(/<(?:.|\n)*?>/gm, '')); } function formatOptions(options) { @@ -224,7 +227,7 @@ } function restoreContainer() { - errorMsg && errorMsg.close && errorMsg.close(); + if (errorMsg && errorMsg.close) errorMsg.close(); $i.removeClass('crm-editable-saving crm-editable-editing'); } @@ -232,7 +235,7 @@ }; $(document).on('crmLoad', function(e) { - $('.crm-editable', e.target).crmEditable(); - }) + $('.crm-editable', e.target).not('thead *').crmEditable(); + }); -})(jQuery); +})(jQuery, CRM._);