AB3326 - Made MediaPickerPropertyValueEditor nested and internal and handle null values
This commit is contained in:
@@ -60,7 +60,7 @@ namespace Umbraco.Web.PropertyEditors
|
||||
private readonly HtmlImageSourceParser _imageSourceParser;
|
||||
private readonly RichTextEditorPastedImages _pastedImages;
|
||||
private readonly RichTextPropertyEditor.RichTextPropertyValueEditor _richTextPropertyValueEditor;
|
||||
private readonly MediaPickerPropertyValueEditor _mediaPickerPropertyValueEditor;
|
||||
private readonly MediaPickerPropertyEditor.MediaPickerPropertyValueEditor _mediaPickerPropertyValueEditor;
|
||||
|
||||
public GridPropertyValueEditor(DataEditorAttribute attribute,
|
||||
IUmbracoContextAccessor umbracoContextAccessor,
|
||||
@@ -73,7 +73,7 @@ namespace Umbraco.Web.PropertyEditors
|
||||
_imageSourceParser = imageSourceParser;
|
||||
_pastedImages = pastedImages;
|
||||
_richTextPropertyValueEditor = new RichTextPropertyEditor.RichTextPropertyValueEditor(attribute, umbracoContextAccessor, imageSourceParser, localLinkParser, pastedImages);
|
||||
_mediaPickerPropertyValueEditor = new MediaPickerPropertyValueEditor(attribute);
|
||||
_mediaPickerPropertyValueEditor = new MediaPickerPropertyEditor.MediaPickerPropertyValueEditor(attribute);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -32,19 +32,23 @@ namespace Umbraco.Web.PropertyEditors
|
||||
protected override IConfigurationEditor CreateConfigurationEditor() => new MediaPickerConfigurationEditor();
|
||||
|
||||
protected override IDataValueEditor CreateValueEditor() => new MediaPickerPropertyValueEditor(Attribute);
|
||||
}
|
||||
|
||||
public class MediaPickerPropertyValueEditor : DataValueEditor, IDataValueReference
|
||||
{
|
||||
public MediaPickerPropertyValueEditor(DataEditorAttribute attribute) : base(attribute)
|
||||
internal class MediaPickerPropertyValueEditor : DataValueEditor, IDataValueReference
|
||||
{
|
||||
}
|
||||
public MediaPickerPropertyValueEditor(DataEditorAttribute attribute) : base(attribute)
|
||||
{
|
||||
}
|
||||
|
||||
public IEnumerable<UmbracoEntityReference> GetReferences(object value)
|
||||
{
|
||||
var asString = value == null ? string.Empty : value is string str ? str : value.ToString();
|
||||
public IEnumerable<UmbracoEntityReference> GetReferences(object value)
|
||||
{
|
||||
if (value == null) yield break;
|
||||
|
||||
yield return new UmbracoEntityReference(Udi.Parse(asString));
|
||||
var asString = value is string str ? str : value.ToString();
|
||||
|
||||
yield return new UmbracoEntityReference(Udi.Parse(asString));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user