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:
@@ -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 += "¯oParams[" + counter + "].key=" + key + "¯oParams[" + counter + "].value=" + val;
|
||||
counter++;
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user