Fixes data type pre-value issues with MNTP, removes unecessary contentpicker.html and memberpicker.html overlays since treepicker.html is all that should be used, cleans up the treepicker one to be more inline with our current angular standards. Removes uneeded event handling from treepicker

This commit is contained in:
Shannon
2018-04-12 21:29:36 +10:00
parent 80d682c22a
commit fddea8c815
23 changed files with 388 additions and 391 deletions

View File

@@ -44,6 +44,7 @@ namespace Umbraco.Core.PropertyEditors
Key = string.IsNullOrWhiteSpace(attribute.Key) ? property.Name : attribute.Key,
Name = attribute.Name,
PropertyName = property.Name,
PropertyType = property.PropertyType,
Description = attribute.Description,
HideLabel = attribute.HideLabel,
View = attribute.View
@@ -67,6 +68,7 @@ namespace Umbraco.Core.PropertyEditors
fields.Add(field);
field.PropertyName = property.Name;
field.PropertyType = property.PropertyType;
if (!string.IsNullOrWhiteSpace(attribute.Key))
field.Key = attribute.Key;
@@ -137,7 +139,25 @@ namespace Umbraco.Core.PropertyEditors
// only keep fields that have a non-null/empty value
// rest will fall back to default during ToObject()
if (editorValues.TryGetValue(field.Key, out var value) && value != null && (!(value is string stringValue) || !string.IsNullOrWhiteSpace(stringValue)))
o[field.PropertyName] = value is JToken jtoken ? jtoken : JToken.FromObject(value);
{
if (value is JToken jtoken)
{
//if it's a jtoken then set it
o[field.PropertyName] = jtoken;
}
else if (field.PropertyType == typeof(bool) && value is string sBool)
{
//if it's a boolean property type but a string is found, try to do a conversion
var converted = sBool.TryConvertTo<bool>();
if (converted)
o[field.PropertyName] = converted.Result;
}
else
{
//default behavior
o[field.PropertyName] = JToken.FromObject(value);
}
}
}
return o.ToObject<TConfiguration>();