From bb8d953ef1a86105f527e5c32a6a9556dfa3bc09 Mon Sep 17 00:00:00 2001 From: Coleman Watts Date: Sat, 7 Feb 2015 17:49:39 -0500 Subject: [PATCH] Fix crmEditable conversion of plain text to html and vice-versa --- js/jquery/jquery.crmeditable.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/js/jquery/jquery.crmeditable.js b/js/jquery/jquery.crmeditable.js index 459f274317..79fe3232b6 100644 --- a/js/jquery/jquery.crmeditable.js +++ b/js/jquery/jquery.crmeditable.js @@ -1,5 +1,5 @@ // https://civicrm.org/licensing -(function($) { +(function($, _) { // 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 +68,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 +210,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) { @@ -235,4 +235,4 @@ $('.crm-editable', e.target).crmEditable(); }); -})(jQuery); +})(jQuery, CRM._); -- 2.25.1