AB3789 - Moved some of the propertyEditor stuff
This commit is contained in:
@@ -6,7 +6,7 @@ namespace Umbraco.Core.PropertyEditors
|
||||
/// Indicates that this is a default property value converter (shipped with Umbraco)
|
||||
/// </summary>
|
||||
[AttributeUsage(AttributeTargets.Class, AllowMultiple = false, Inherited = false)]
|
||||
internal class DefaultPropertyValueConverterAttribute : Attribute
|
||||
public class DefaultPropertyValueConverterAttribute : Attribute
|
||||
{
|
||||
public DefaultPropertyValueConverterAttribute()
|
||||
{
|
||||
@@ -1,14 +1,21 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Newtonsoft.Json;
|
||||
using Umbraco.Core.Models.PublishedContent;
|
||||
using Umbraco.Core.Serialization;
|
||||
|
||||
namespace Umbraco.Core.PropertyEditors.ValueConverters
|
||||
{
|
||||
[DefaultPropertyValueConverter]
|
||||
public class CheckboxListValueConverter : PropertyValueConverterBase
|
||||
{
|
||||
private readonly IJsonSerializer _jsonSerializer;
|
||||
|
||||
public CheckboxListValueConverter(IJsonSerializer jsonSerializer)
|
||||
{
|
||||
_jsonSerializer = jsonSerializer;
|
||||
}
|
||||
|
||||
public override bool IsConverter(IPublishedPropertyType propertyType)
|
||||
=> propertyType.EditorAlias.InvariantEquals(Constants.PropertyEditors.Aliases.CheckBoxList);
|
||||
|
||||
@@ -25,7 +32,7 @@ namespace Umbraco.Core.PropertyEditors.ValueConverters
|
||||
if (string.IsNullOrEmpty(sourceString))
|
||||
return Enumerable.Empty<string>();
|
||||
|
||||
return JsonConvert.DeserializeObject<string[]>(sourceString);
|
||||
return _jsonSerializer.Deserialize<string[]>(sourceString);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -220,7 +220,6 @@
|
||||
<Compile Include="PropertyEditors\Validators\DelimitedValueValidator.cs" />
|
||||
<Compile Include="PropertyEditors\Validators\RegexValidator.cs" />
|
||||
<Compile Include="PropertyEditors\Validators\RequiredValidator.cs" />
|
||||
<Compile Include="PropertyEditors\ValueConverters\CheckboxListValueConverter.cs" />
|
||||
<Compile Include="PropertyEditors\ValueConverters\ColorPickerValueConverter.cs" />
|
||||
<Compile Include="PropertyEditors\ValueConverters\GridValueConverter.cs" />
|
||||
<Compile Include="PropertyEditors\ValueConverters\ImageCropperValue.cs" />
|
||||
@@ -357,7 +356,6 @@
|
||||
<Compile Include="PropertyEditors\ConfigurationEditor.cs" />
|
||||
<Compile Include="PropertyEditors\LabelConfigurationEditor.cs" />
|
||||
<Compile Include="PropertyEditors\LabelPropertyEditor.cs" />
|
||||
<Compile Include="PropertyEditors\PropertyEditorTagsExtensions.cs" />
|
||||
<Compile Include="ReflectionUtilities-Unused.cs" />
|
||||
<Compile Include="RuntimeOptions.cs" />
|
||||
<Compile Include="Runtime\CoreRuntime.cs" />
|
||||
|
||||
@@ -7,6 +7,7 @@ using Umbraco.Core.Models;
|
||||
using Umbraco.Core.Models.PublishedContent;
|
||||
using Umbraco.Core.PropertyEditors;
|
||||
using Umbraco.Core.PropertyEditors.ValueConverters;
|
||||
using Umbraco.Core.Serialization;
|
||||
using Umbraco.Web.PropertyEditors;
|
||||
using Umbraco.Web.PropertyEditors.ValueConverters;
|
||||
|
||||
@@ -72,7 +73,7 @@ namespace Umbraco.Tests.PropertyEditors
|
||||
[TestCase(null, new string[] { })]
|
||||
public void CanConvertCheckboxListPropertyEditor(object value, IEnumerable<string> expected)
|
||||
{
|
||||
var converter = new CheckboxListValueConverter();
|
||||
var converter = new CheckboxListValueConverter(new JsonNetSerializer());
|
||||
var result = converter.ConvertIntermediateToObject(null, null, PropertyCacheLevel.Unknown, value, false);
|
||||
|
||||
Assert.AreEqual(expected, result);
|
||||
|
||||
Reference in New Issue
Block a user