Try our conversational search powered by Generative AI!

Define Tiny MCE settings in code and then use them on specific xhtmlstring properties?




I have looked everywhere, and found only little bits of information.  I am trying to figure out how to define tinymce settings (for the editor) for specific buttons to appear, etc in specific instances.  Say on one page type we may only have a need for the HTML button to appear, but on another page type, we want that xhtmlstring's editor to have way more options/buttons available.  

I was wondering how I would go about creating these custom settings in CODE (much like we do in the admin interface) and then how i would decorate a property declaration to use that specific setting i defined?

Any help is appreciated, thanks!


Mar 30, 2013 16:12

I am honestly looking to do something just like this (although this is related to 6 and pagetypebuilder), but also be able, once this setting is defined, to decorate an xhtmlstring property in my pagedata model to use the custom setting i've defined.  Anyone know how to do all this in 7??

Apr 01, 2013 22:29

Hi Mike!

There are a settings object stored in the Dynamic Data Store with public properties that holds the configuration for both global reusable settings and those just defined on a property. They all implements a

You use the PropertySettingsRepository to mange these settings objects. You can find an example here that also updates the default settings:

There are currently (EPi 7 initial release) no functionality built-in to bind this to your typed model with attributes.

Apr 01, 2013 23:15

Hey Fredrik,

Thanks for the reply!

I was able to do as you suggested and i'm able to inject Tiny MCE property settings (as global settings) like so:

            PageTypeRepository PageTypeRepository = EPiServer.ServiceLocation.ServiceLocator.Current.GetInstance<PageTypeRepository>();
            IPropertyDefinitionRepository PropertyDefinitionRepository = EPiServer.ServiceLocation.ServiceLocator.Current.GetInstance<IPropertyDefinitionRepository>();
            IPropertySettingsRepository PropertySettingsRepository = EPiServer.ServiceLocation.ServiceLocator.Current.GetInstance<IPropertySettingsRepository>();

            PropertySettingsWrapper wrapper = new PropertySettingsWrapper();
            wrapper.Id = new Guid("52CC63CA-28AD-4194-B136-A44111D556F6");
            wrapper.DisplayName = "BBB Video Embed ONLY Settings";
            wrapper.IsGlobal = true;

            TinyMCESettings settings = new TinyMCESettings();
            wrapper.PropertySettings = settings;

            string[] row1 = new string[] { "code", "media"};

            settings.ToolbarRows.Add(new ToolbarRow(row1));



With the above code run in an initialization module, I'm able to add and keep current the settings (because I have defined my GUID, everytime I save, it just updates that global value)


The only thing left for me to do is figure out how to apply that specific setting to a content type's property definition.  I've looked into the  property definition repository and page type repository and tried to edit the value of the SettingID on the property definition and saved it successfully, but this alone does not apply the global setting to the xhtml string property.

If you have any more clue's that could lead me in the right direction, that'd be lovely.  Hopefully support for custom settings from code and application of them to property definitions on content types is in scope for a future release!

Apr 03, 2013 4:14

I see this question is just a day shy of a year old, but I'm wondering, did you ever figure this out? I'm having the same issue myself.

Apr 02, 2014 9:47
Apr 08, 2014 21:49
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.