我有许多在页面编辑器中可编辑的字段。其中之一是富文本字段。这是html:
@foreach (var speaker in Model.Speakers)
{
<div class="speaker__item" id="@speaker.Id">
<div class="speaker__media">
@RenderImage(speaker, x => x.Speaker_Image, isEditable: true)
</div>
<div class="speaker__info">
@if (IsInEditingMode || !string.IsNullOrEmpty(speaker.Speaker_Name))
{
<h4 class="speaker__name">@Editable(speaker, x => x.Speaker_Name)</h4>
}
@if (IsInEditingMode || !string.IsNullOrEmpty(speaker.Speaker_Title))
{
<p class="speaker__title">@Editable(speaker, x => x.Speaker_Title)</p>
}
@if (IsInEditingMode || !string.IsNullOrEmpty(speaker.Speaker_Description))
{
<div class="speaker__bio">
<p>@Editable(speaker, x => x.Speaker_Description)</p>
</div>
}
@RenderLink(speaker, x => x.Speaker_Bio, attributes: new { @class = "speaker__link" }, isEditable: true)
</div>
</div>
}
富文本字段是 Speaker_Description。当字段中没有 HTML(即纯文本)时,它会正确呈现并且可以在页面编辑器中进行编辑。当该字段确实包含 html,例如包含在<p>
标签中或包含换行符时,它会正确呈现,但在页面上不可编辑。我仍然可以在 Sitecore 中编辑该字段,但该区域在页面编辑器中无法点击。