Wrap RTE content in a dedicated model for future expansion (#14258)

This commit is contained in:
Kenn Jacobsen
2023-05-16 19:08:38 +02:00
committed by GitHub
parent c632908a51
commit c5e524c9b9
2 changed files with 11 additions and 2 deletions

View File

@@ -82,13 +82,16 @@ public class RteMacroRenderingValueConverter : SimpleTinyMceValueConverter, IDel
public Type GetDeliveryApiPropertyValueType(IPublishedPropertyType propertyType)
=> _deliveryApiSettings.RichTextOutputAsJson
? typeof(IRichTextElement)
: typeof(string);
: typeof(RichTextModel);
public object? ConvertIntermediateToDeliveryApiObject(IPublishedElement owner, IPublishedPropertyType propertyType, PropertyCacheLevel referenceCacheLevel, object? inter, bool preview)
{
if (_deliveryApiSettings.RichTextOutputAsJson is false)
{
return Convert(inter, preview) ?? string.Empty;
return new RichTextModel
{
Markup = Convert(inter, preview) ?? string.Empty
};
}
var sourceString = inter?.ToString();