Fixes: U4-4425 Umbraco Macros break on quote, U4-4290 RTE changes Macro parameter values containing right angle brackets, U4-4442 Line break in macro text area breaks the Macro

This commit is contained in:
Shannon
2014-03-20 12:21:40 +11:00
parent fb6b234491
commit 2340adbe94
5 changed files with 17 additions and 8 deletions

View File

@@ -58,7 +58,11 @@ function macroResource($q, $http, umbRequestHelper) {
var json = angular.toJson(val);
//then we need to url encode it so that it's safe
val = encodeURIComponent(json);
}
}
else {
//we still need to encode the string, it could contain line breaks, etc...
val = encodeURIComponent(val);
}
query += "&macroParams[" + counter + "].key=" + key + "&macroParams[" + counter + "].value=" + val;
counter++;

View File

@@ -9,11 +9,11 @@
function macroService() {
return {
/** parses the special macro syntax like <?UMBRACO_MACRO macroAlias="Map" /> and returns an object with the macro alias and it's parameters */
parseMacroSyntax: function (syntax) {
var expression = /(<\?UMBRACO_MACRO macroAlias=["']([\w\.]+?)["'].+?)(\/>|>.*?<\/\?UMBRACO_MACRO>)/im;
var expression = /(<\?UMBRACO_MACRO macroAlias=["']([\w\.]+?)["'][\s\S]+?)(\/>|>.*?<\/\?UMBRACO_MACRO>)/i;
var match = expression.exec(syntax);
if (!match || match.length < 3) {
return null;
@@ -23,7 +23,8 @@ function macroService() {
//this will leave us with just the parameters
var paramsChunk = match[1].trim().replace(new RegExp("UMBRACO_MACRO macroAlias=[\"']" + alias + "[\"']"), "").trim();
var paramExpression = new RegExp("(\\w+?)=['\"](.*?)['\"]", "g");
var paramExpression = /(\w+?)=['\"]([\s\S]*?)['\"]/g;
var paramMatch;
var returnVal = {
macroAlias: alias,

View File

@@ -48,7 +48,8 @@ function InsertMacroController($scope, entityResource, macroResource, umbPropEdi
//create a dictionary for the macro params
var paramDictionary = {};
_.each($scope.macroParams, function (item) {
paramDictionary[item.alias] = item.value;
//each value needs to be xml escaped!! since the value get's stored as an xml attribute
paramDictionary[item.alias] = _.escape(item.value);
});
//need to find the macro alias for the selected id

View File

@@ -96,14 +96,14 @@ angular.module('umbraco')
$scope.model.value = trim($scope.ids.join(), ",");
//Validate!
if ($scope.model.config.minNumber && parseInt($scope.model.config.minNumber) > $scope.renderModel.length) {
if ($scope.model.config && $scope.model.config.minNumber && parseInt($scope.model.config.minNumber) > $scope.renderModel.length) {
$scope.contentPickerForm.minCount.$setValidity("minCount", false);
}
else {
$scope.contentPickerForm.minCount.$setValidity("minCount", true);
}
if ($scope.model.config.maxNumber && parseInt($scope.model.config.maxNumber) < $scope.renderModel.length) {
if ($scope.model.config && $scope.model.config.maxNumber && parseInt($scope.model.config.maxNumber) < $scope.renderModel.length) {
$scope.contentPickerForm.maxCount.$setValidity("maxCount", false);
}
else {