Try our conversational search powered by Generative AI!

Hide TinyMce ToolBar only for a single TinyMce property

Vote:
 

Hi,

I want to Hide the tinyMce ToolBar in Edit Mode only for the Single TinyMce property.

i came across many post on goolge but not able to find for single property. They have code to disable for all tinyMce property present on the website.

Help would be appreciated.

#173485
Dec 29, 2016 8:16
Vote:
 

You can create some new propertysettings for the TinyMce editor like this.

    [ServiceConfiguration(ServiceType = typeof(PropertySettings))]
    public class NoToolbarEditorSettings : PropertySettings<TinyMCESettings>
    {
        public override Guid ID
        {
            get { return new Guid("86414FC8-0F1F-4A48-B6B6-04FE98E41488"); }
        }

        public NoToolbarEditorSettings()
        {
            DisplayName = "Editor without toolbar";
            Description = "This will show a TinyMce editor without any buttons";
            IsDefault = false;
        }

        public override TinyMCESettings GetPropertySettings()
        {
            var settings = new TinyMCESettings();
            settings.ToolbarRows.Add(new ToolbarRow(new List<string>()));
            return settings;
        }
    }

Make sure IsDefault=false 

Not configuring or clearing the ToolbarRows will not work, so insert an empty row. 

And assign these setting to the TinyMce property in question

[PropertySettings(typeof(NoToolbarEditorSettings))]
public virtual XhtmlString Text { get; set; }

Now you have an editor without a toolbar.

 

#173536
Dec 30, 2016 20:03
This topic was created over six months ago and has been resolved. If you have a similar question, please create a new topic and refer to this one.
* 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.