X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;f=ang%2FcrmUtil.js;h=8cb6242689a559b5027862bffdcd8c816e7147ec;hb=251deab387295085fe3d86165de0a58b0de4194f;hp=b6a0d013104490866993547922f3a2a4368b7ea1;hpb=f9c505543e6e06508b9567e1d04f439e16d6642f;p=civicrm-core.git diff --git a/ang/crmUtil.js b/ang/crmUtil.js index b6a0d01310..8cb6242689 100644 --- a/ang/crmUtil.js +++ b/ang/crmUtil.js @@ -2,8 +2,8 @@ (function (angular, $, _) { angular.module('crmUtil', []); - // usage: - // crmApi('Entity', 'action', {...}).then(function(apiResult){...}) + // Angular implementation of CRM.api3 + // @link http://wiki.civicrm.org/confluence/display/CRMDOC/AJAX+Interface#AJAXInterface-CRM.api3 // // Note: To mock API results in unit-tests, override crmApi.backend, e.g. // var apiSpy = jasmine.createSpy('crmApi'); @@ -16,10 +16,15 @@ var deferred = $q.defer(); var p; var backend = crmApi.backend || CRM.api3; + if (params && params.body_html) { + // CRM-18474 - remove Unicode Character 'LINE SEPARATOR' (U+2028) + // and 'PARAGRAPH SEPARATOR' (U+2029) from the html if present. + params.body_html = params.body_html.replace(/([\u2028]|[\u2029])/g, '\n'); + } if (_.isObject(entity)) { // eval content is locally generated. /*jshint -W061 */ - p = backend(eval('('+angular.toJson(entity)+')'), message); + p = backend(eval('('+angular.toJson(entity)+')'), action); } else { // eval content is locally generated. /*jshint -W061 */