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??
http://world.episerver.com/Code/Johan-Kronberg/TinyMCE-global-setting-using-Page-Type-Builder/
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:
http://www.meridium.se/sv/blogg/2010/04/14/adding-buttons-to-the-tinymce-editor-in-episerver-6-programmatically
There are currently (EPi 7 initial release) no functionality built-in to bind this to your typed model with attributes.
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));
PropertySettingsRepository.SaveGlobal(wrapper);
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!
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.
Found a solution: http://world.episerver.com/Blogs/Torjus-Eidet/Dates/2014/4/Strongly-typed-TinyMCE-settings/
Correct url is here: http://world.episerver.com/Blogs/Torjus-Eidet/Dates/2014/4/Strongly-typed-TinyMCE-settings/
Hello,
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!