Try our conversational search powered by Generative AI!

Tiny MCE default buttons


Hi all,

I have to specify the list of available buttons by default, using code. (A similar result can be obtained by performing a sequence of actions in the admin panel: Admin\Page type\Page with XHTML string field\select field with XHTML string type\Custom settings\Use custom settings\{add/delete some buttons}). For example to add a "HTML" button and remove the "Undo" button.

Thanks for your time

Sep 04, 2013 21:36

Don't have any exact code at the moment, but for some inspiration you could create an EditorDescriptor based on the class EPiServer.Cms.Shell.UI.ObjectEditing.EditorDescriptors.XhtmlStringEditorDescriptor found in EPiServer.Cms.Shell.UI.dll (usually found in the Modules-path among your VPP) for some inspiration.

You should be able to populate the TinyMCESettings object with buttons or other settings programmatically.

This is the default behaviour of XhtmlStringEditorDescriptor:

    public override void ModifyMetadata(ExtendedMetadata metadata, IEnumerable<Attribute> attributes)
      base.ModifyMetadata(metadata, attributes);
      TinyMCESettings settings = (TinyMCESettings) ((PropertyData) metadata.Model).GetSetting(typeof (TinyMCESettings));
      ExtendedMetadata mostContentMetadata = ExtendedMetadataExtensions.FindTopMostContentMetadata(metadata);
      IContent content = mostContentMetadata != null ? mostContentMetadata.Model as IContent : (IContent) null;
      TinyMCEInitOptions tinyMceInitOptions = new TinyMCEInitOptions(TinyMCEInitOptions.InitType.EditMode, settings, content);
      if (metadata.IsReadOnly)
        tinyMceInitOptions.InitOptions["readonly"] = (object) true;
        tinyMceInitOptions.InitOptions["body_class"] = (object) "mceReadOnly";
      metadata.EditorConfiguration.Add("width", tinyMceInitOptions.InitOptions["width"]);
      metadata.EditorConfiguration.Add("height", tinyMceInitOptions.InitOptions["height"]);
      metadata.EditorConfiguration.Add("settings", (object) tinyMceInitOptions.InitOptions);


Sep 04, 2013 22:48

While TinyMCE allows setting default buttons in code this way, the official response from the dev team (as of April 2013, anyway) is that EPiServer CMS 7 does not fully support this functionality. You can find some example code in this thread:

Instead, you might consider setting default available buttons through the property settings in admin mode, as described in Mark Everard's blog post

More info on configuring TinyMCE (such as adding your own TinyMCE editor buttons) in EPiServer CMS 7 documentation



Sep 04, 2013 22:55

What they discourage from in that post is to have a TinyMCE plugin that tampers with the TinyMCE settings.

My interpretation of the question was that these settings was only to be set on specific properties with as little manual settings as possible.
Hence my suggestion about EditorDescriptor which returns the the tinymce settings as if you would have created some settings as an administrator.

We had that in PageTypeBuilder though PTB added it directly to the database as a setting instead of adding it while loading the TinyMCE property.

Sep 04, 2013 23:10

Dear Alf Nilsson,

I decided to try to implement the proposed solution and episerver
did not find a module by assembly EPiServer.Cms.Shell.UI.ObjectEditing. I use episerver 7 patch 3 MVC project. Can you tell me what to put for solutions to solve this problem with dll. I would appreciate your help.


Edited, Sep 05, 2013 8:25


This .dll file is not found in the bin-foder. It is a part of the UI and can be located inside the ModulesRepository in your VPP. In my case it is located in VPP\ModulesRepository\Shell.2.0.86\lib\EPiServer.Shell.UI.dll but it depends on which version of the EPiServer 7 user interface you have installed.

I recommend that you don't refer it in your .csproj, instead open it with your favourite decompiling tool such as Reflector, DotPeek, ILSpy or similar and look at the code for some inspiration how you can instantiate your hard coded TinyMCESettings.

Otherwise the concept with EditorDescriptors and UIHints are the same as always.

Sep 05, 2013 9:52


I found a couple of articles with a description of what I want. But I did not find the interface IUpdateGlobalPropertySettings.




How add global settings to the Tiny MCE in EPiServer 7?


Best regards,


Sep 14, 2013 18:21

Those articles concern PageTypeBuilder which is a tool for episerver 5 and 6 created by Joel Abrahamsson.

PageTypeBuilder does not exist in EPiServer since similar functionality is built in to EPiServer 7. Though some functions such as creating Property Settings is not included.

Sep 14, 2013 18:25
This thread is locked and should be used for reference only. Please use the Episerver CMS 7 and earlier versions forum to open new discussions.
* 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.