Fixes: U4-3880 Custom parameter editor with JSON valueType
This commit is contained in:
@@ -49,7 +49,17 @@ function macroResource($q, $http, umbRequestHelper) {
|
||||
var query = "macroAlias=" + macroAlias + "&pageId=" + pageId;
|
||||
if (macroParamDictionary) {
|
||||
var counter = 0;
|
||||
_.each(macroParamDictionary, function(val, key) {
|
||||
_.each(macroParamDictionary, function (val, key) {
|
||||
//check for null
|
||||
val = val ? val : "";
|
||||
//need to detect if the val is a string or an object
|
||||
if (!angular.isString(val)) {
|
||||
//if it's not a string we'll send it through the json serializer
|
||||
var json = angular.toJson(val);
|
||||
//then we need to url encode it so that it's safe
|
||||
val = encodeURIComponent(json);
|
||||
}
|
||||
|
||||
query += "¯oParams[" + counter + "].key=" + key + "¯oParams[" + counter + "].value=" + val;
|
||||
counter++;
|
||||
});
|
||||
|
||||
@@ -55,7 +55,21 @@ function macroService() {
|
||||
if (args.marcoParamsDictionary) {
|
||||
|
||||
_.each(args.marcoParamsDictionary, function (val, key) {
|
||||
var keyVal = key + "=\"" + (val ? val : "") + "\" ";
|
||||
//check for null
|
||||
val = val ? val : "";
|
||||
//need to detect if the val is a string or an object
|
||||
var keyVal;
|
||||
if (angular.isString(val)) {
|
||||
keyVal = key + "=\"" + (val ? val : "") + "\" ";
|
||||
}
|
||||
else {
|
||||
//if it's not a string we'll send it through the json serializer
|
||||
var json = angular.toJson(val);
|
||||
//then we need to url encode it so that it's safe
|
||||
var encoded = encodeURIComponent(json);
|
||||
keyVal = key + "=\"" + encoded + "\" ";
|
||||
}
|
||||
|
||||
macroString += keyVal;
|
||||
});
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
* @description
|
||||
* A service containing all logic for all of the Umbraco TinyMCE plugins
|
||||
*/
|
||||
function tinyMceService(dialogService, $log, imageHelper, $http, $timeout, macroResource, macroService, $routeParams, umbRequestHelper) {
|
||||
function tinyMceService(dialogService, $log, imageHelper, $http, $timeout, macroResource, macroService, $routeParams, umbRequestHelper, angularHelper) {
|
||||
return {
|
||||
|
||||
/**
|
||||
@@ -235,7 +235,9 @@ function tinyMceService(dialogService, $log, imageHelper, $http, $timeout, macro
|
||||
|
||||
var contentId = $routeParams.id;
|
||||
|
||||
macroResource.getMacroResultAsHtmlForEditor(macroData.macroAlias, contentId, macroData.marcoParamsDictionary)
|
||||
//need to wrap in safe apply since this might be occuring outside of angular
|
||||
angularHelper.safeApply($scope, function() {
|
||||
macroResource.getMacroResultAsHtmlForEditor(macroData.macroAlias, contentId, macroData.marcoParamsDictionary)
|
||||
.then(function (htmlResult) {
|
||||
|
||||
$macroDiv.removeClass("loading");
|
||||
@@ -244,6 +246,8 @@ function tinyMceService(dialogService, $log, imageHelper, $http, $timeout, macro
|
||||
$ins.html(htmlResult);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
/** Adds the button instance */
|
||||
|
||||
Reference in New Issue
Block a user