Try our conversational search powered by Generative AI!

TinyMCE custom styles not working inside PropertyList

Vote:
 

I've a block, which holds a property list, and one of the property list properties is an XHtmlString, which invokes the TinyMCE control on the front end, but the list of styles that is present in the rest of the site's TinyMCE's are not present for the property list property.

Example with Screenshots:

Block has an XHtmlString property, TinyMCE has picked up the custom styles with no problems...

PropertyList on the Block... XHtmlString's TinyMCE has not picked up the custom styles. 

 

Is there special requirements for get TinyMCE to pick up the styles?

#202052
Mar 12, 2019 16:06
Vote:
 

Found the solution, answering my own question:

public class DefaultTinyMceSettings : PropertySettings<TinyMCESettings> 
{
        public override TinyMCESettings GetPropertySettings()
        {
            var settings = new TinyMCESettings();

            //much code removed, such small, wow

            settings.ContentCss = "~/static/css/editor.css";  // new line of code

            return settings;
        }
}

we already had an DefaultTinyMceSettings class, what I've added (with an example above) is the line about ContentCss. Thats fixed my issue. That css file defines all the custom TinyMCE styles that are in use.

[PropertySettings(typeof(Models.Properties.DefaultTinyMceSettings))]  // new line fixes the issue      
public virtual XhtmlString Body { get; set; }
#202054
Edited, Mar 12, 2019 17:16
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.