Skip to content

Commit 160710b

Browse files
authored
Fix parsing exception for RTEs (#18085)
1 parent 0562757 commit 160710b

File tree

1 file changed

+3
-10
lines changed

1 file changed

+3
-10
lines changed

src/Umbraco.Infrastructure/PropertyEditors/RichTextPropertyEditor.cs

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,6 @@ internal class RichTextPropertyValueEditor : BlockValuePropertyValueEditorBase<R
9292
private readonly HtmlLocalLinkParser _localLinkParser;
9393
private readonly RichTextEditorPastedImages _pastedImages;
9494
private readonly IJsonSerializer _jsonSerializer;
95-
private readonly IBlockEditorElementTypeCache _elementTypeCache;
9695
private readonly IRichTextRequiredValidator _richTextRequiredValidator;
9796
private readonly ILogger<RichTextPropertyValueEditor> _logger;
9897

@@ -122,12 +121,12 @@ public RichTextPropertyValueEditor(
122121
_localLinkParser = localLinkParser;
123122
_pastedImages = pastedImages;
124123
_htmlSanitizer = htmlSanitizer;
125-
_elementTypeCache = elementTypeCache;
126124
_richTextRequiredValidator = richTextRequiredValidator;
127125
_jsonSerializer = jsonSerializer;
128126
_logger = logger;
129127

130-
Validators.Add(new RichTextEditorBlockValidator(propertyValidationService, CreateBlockEditorValues(), elementTypeCache, jsonSerializer, logger));
128+
BlockEditorValues = new(new RichTextEditorBlockDataConverter(_jsonSerializer), elementTypeCache, logger);
129+
Validators.Add(new RichTextEditorBlockValidator(propertyValidationService, BlockEditorValues, elementTypeCache, jsonSerializer, logger));
131130
}
132131

133132
public override IValueRequiredValidator RequiredValidator => _richTextRequiredValidator;
@@ -340,12 +339,6 @@ private RichTextEditorValue CleanAndMapBlocks(RichTextEditorValue richTextEditor
340339
}
341340

342341
private BlockEditorData<RichTextBlockValue, RichTextBlockLayoutItem>? ConvertAndClean(RichTextBlockValue blockValue)
343-
{
344-
BlockEditorValues<RichTextBlockValue, RichTextBlockLayoutItem> blockEditorValues = CreateBlockEditorValues();
345-
return blockEditorValues.ConvertAndClean(blockValue);
346-
}
347-
348-
private BlockEditorValues<RichTextBlockValue, RichTextBlockLayoutItem> CreateBlockEditorValues()
349-
=> new(new RichTextEditorBlockDataConverter(_jsonSerializer), _elementTypeCache, _logger);
342+
=> BlockEditorValues.ConvertAndClean(blockValue);
350343
}
351344
}

0 commit comments

Comments
 (0)