Ignore macros completely in deliveryapi (#14262)
* Hack a fix for MNTP that saves content in configuration instead of document * Ignore macro parsing in delivery api, instead of exploding
This commit is contained in:
@@ -204,6 +204,13 @@ public class MultiNodeTreePickerValueConverter : PropertyValueConverterBase, IDe
|
||||
IPublishedSnapshot publishedSnapshot = _publishedSnapshotAccessor.GetRequiredPublishedSnapshot();
|
||||
|
||||
var entityType = GetEntityType(propertyType);
|
||||
|
||||
if (entityType == "content")
|
||||
{
|
||||
// TODO Why do MNTP config saves "content" and not "document"?
|
||||
entityType = Constants.UdiEntityType.Document;
|
||||
}
|
||||
|
||||
GuidUdi[] entityTypeUdis = udis.Where(udi => udi.EntityType == entityType).OfType<GuidUdi>().ToArray();
|
||||
return entityType switch
|
||||
{
|
||||
|
||||
@@ -90,7 +90,7 @@ public class RteMacroRenderingValueConverter : SimpleTinyMceValueConverter, IDel
|
||||
{
|
||||
return new RichTextModel
|
||||
{
|
||||
Markup = Convert(inter, preview) ?? string.Empty
|
||||
Markup = Convert(inter, preview, false) ?? string.Empty
|
||||
};
|
||||
}
|
||||
|
||||
@@ -129,7 +129,7 @@ public class RteMacroRenderingValueConverter : SimpleTinyMceValueConverter, IDel
|
||||
}
|
||||
}
|
||||
|
||||
private string? Convert(object? source, bool preview)
|
||||
private string? Convert(object? source, bool preview, bool handleMacros = true)
|
||||
{
|
||||
if (source == null)
|
||||
{
|
||||
@@ -144,7 +144,10 @@ public class RteMacroRenderingValueConverter : SimpleTinyMceValueConverter, IDel
|
||||
sourceString = _imageSourceParser.EnsureImageSources(sourceString);
|
||||
|
||||
// ensure string is parsed for macros and macros are executed correctly
|
||||
sourceString = RenderRteMacros(sourceString, preview);
|
||||
if (handleMacros)
|
||||
{
|
||||
sourceString = RenderRteMacros(sourceString, preview);
|
||||
}
|
||||
|
||||
// find and remove the rel attributes used in the Umbraco UI from img tags
|
||||
var doc = new HtmlDocument();
|
||||
|
||||
@@ -93,7 +93,9 @@ public class MultiNodeTreePickerValueConverterTests : PropertyValueConverterTest
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void MultiNodeTreePickerValueConverter_RendersContentProperties()
|
||||
[TestCase(Constants.UdiEntityType.Document)]
|
||||
[TestCase("content")]
|
||||
public void MultiNodeTreePickerValueConverter_RendersContentProperties(string entityType)
|
||||
{
|
||||
var content = new Mock<IPublishedContent>();
|
||||
|
||||
@@ -112,7 +114,7 @@ public class MultiNodeTreePickerValueConverterTests : PropertyValueConverterTest
|
||||
.Setup(pcc => pcc.GetById(key))
|
||||
.Returns(content.Object);
|
||||
|
||||
var publishedDataType = MultiNodePickerPublishedDataType(false, Constants.UdiEntityType.Document);
|
||||
var publishedDataType = MultiNodePickerPublishedDataType(false, entityType);
|
||||
var publishedPropertyType = new Mock<IPublishedPropertyType>();
|
||||
publishedPropertyType.SetupGet(p => p.DataType).Returns(publishedDataType);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user