AI OnAI Off
Hi,
Actually, empty value for "force_root_block" is invalid => Still get "p" as default value in this case. "force_br_newlines" and "forced_p_newlines" seems be legacy. You can use this setting to use "br" instead of "p" once breaking new line
config.Default().Clone()
.AddSetting("newline_behavior", "linebreak");
I am working with a
TestBlock
in Optimizely CMS 12 and trying to configure theTitle
field with limited RichText settings. TheTitle
field is defined as follows:[CultureSpecific]
[Required]
[Display(Name = "Title", Order = 20, GroupName = CmsTabNames.Content)]
public virtual XhtmlString Title { get; set; }
My goal is to prevent TinyMCE from wrapping the content in
<p>
tags. However, despite configuring theforced_root_block
setting, TinyMCE still automatically adds<p>
tags when I add text to the field. Below is the configuration I am using:context.Services.Configure<TinyMceConfiguration>(config =>
{
// Text Styles
var textStyles = new
{
title = "Text",
items = new object[]
{
new { title = "Small Text", block = "small" },
new { title = "Blockquote", block = "blockquote" }
}
};
// Default configuration
config.Default()
.Height(200)
.AddEpiserverSupport()
.ContentCss("/assets/css/editor.css")
.AddPlugin("table")
.RemovePlugin("paste")
.AddExternalPlugin("powerpaste", "/plugins/powerpaste/plugin.js")
.Menubar("edit table")
.AddSetting("paste_enable_default_filters", false)
.AddPlugin("epi-link code epi-image-editor epi-dnd-processor epi-personalized-content media wordcount anchor textcolor colorpicker preview paste")
.Toolbar("formatselect styleselect | bold italic underline strikethrough subscript superscript | alignleft aligncenter alignright alignjustify | numlist bullist indent outdent | " +
"table | epi-link anchor | image epi-image-editor media | epi-personalized-content | removeformat | searchreplace fullscreen preview | code | help")
.StyleFormats(textStyles)
.BlockFormats("Paragraph=p;Heading 1=h1;Heading 2=h2;Heading 3=h3;Heading 4=h4;Heading 5=h5;Heading 6=h6");
// Limited RichText settings
var limitedRichTextSettings = config.Default().Clone()
.AddEpiserverSupport()
.ContentCss("/assets/css/editor.css")
.AddSetting("forced_root_block", "")
.AddSetting("force_br_newlines", false)
.AddSetting("force_p_newlines", false)
.AddSetting("statusbar", false)
.AddPlugin("code wordcount preview") // add epi-link anchor if links are needed
.Toolbar("bold italic underline subscript superscript | code") // add epi-link anchor if links are needed
.BlockFormats("");
config.For<TestBlock>(m => m.Title, limitedRichTextSettings);
});
Problem: Even with these settings, the editor still wraps the content in
<p>
tags.Could someone advise on how to properly configure TinyMCE to prevent it from adding these
<p>
tags in this context?