From f0e37e04fabdf879f2f30183336e5362cc7b12ac Mon Sep 17 00:00:00 2001 From: Dirk Seefeld Date: Tue, 27 May 2025 12:50:42 +0200 Subject: [PATCH] fix issue 19341 --- .../ValueConverters/ColorPickerValueConverter.cs | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/src/Umbraco.Core/PropertyEditors/ValueConverters/ColorPickerValueConverter.cs b/src/Umbraco.Core/PropertyEditors/ValueConverters/ColorPickerValueConverter.cs index 6b6181f67a..89c5fff300 100644 --- a/src/Umbraco.Core/PropertyEditors/ValueConverters/ColorPickerValueConverter.cs +++ b/src/Umbraco.Core/PropertyEditors/ValueConverters/ColorPickerValueConverter.cs @@ -22,34 +22,29 @@ public class ColorPickerValueConverter : PropertyValueConverterBase => propertyType.EditorAlias.InvariantEquals(Constants.PropertyEditors.Aliases.ColorPicker); public override Type GetPropertyValueType(IPublishedPropertyType propertyType) - => UseLabel(propertyType) ? typeof(PickedColor) : typeof(string); + => typeof(PickedColor); public override PropertyCacheLevel GetPropertyCacheLevel(IPublishedPropertyType propertyType) => PropertyCacheLevel.Element; public override object? ConvertSourceToIntermediate(IPublishedElement owner, IPublishedPropertyType propertyType, object? source, bool preview) { - var useLabel = UseLabel(propertyType); - if (source is null) { - return useLabel ? null : string.Empty; + return null; } var value = source.ToString()!; if (value.DetectIsJson()) { PickedColor? convertedValue = _jsonSerializer.Deserialize(value); - return useLabel ? convertedValue : convertedValue?.Color; + return convertedValue; } - - // This seems to be something old old where it may not be json at all. - if (useLabel) + else { + // This seems to be something old old where it may not be json at all. return new PickedColor(value, value); } - - return value; } private bool UseLabel(IPublishedPropertyType propertyType) => ConfigurationEditor