From the TinyMCE editor object, how do I load a named settings configuration?

Deane Barker
Member since: 2008
 

How do I load TinyMCE using custom settings?  I have created a custom configuration called "Comment Editor."  I want to load this in my template.  I have this code, which works:

var editor = new Editor.TinyMCE.Editor();
            editor.PropertySettings = (TinyMCESettings) CurrentPage.Property[0].GetSetting(typeof (TinyMCESettings));

    

But this loads the default settings, not my custom, named settings.  I can't figure out how to get at my named settings.

#63409 Nov 19, 2012 15:17
  • Johan Kronberg
    Member since: 2005
     

    Have you tried GetGlobals() to find the correct one?

    var p = new PropertySettingsRepository();
    var globals = p.GetGlobals(typeof( ...

        

    #63414 Edited, Nov 19, 2012 17:21
  • Deane Barker
    Member since: 2008
     

    I'm still fuzzy on how that gets me a named property setting...

    #63418 Nov 19, 2012 17:28
  • Johan Kronberg
    Member since: 2005
     
    foreach (var setting in globals)
        {
            if (setting.DisplayName.Equals("Comment Editor", StringComparison.OrdinalIgnoreCase))
            {

        

    #63419 Nov 19, 2012 17:30
  • Deane Barker
    Member since: 2008
     

    I actually found another way around it.  I create an new empty page of the Comment type, then pull the settings off the property I wanted.

    That probably makes sense, since those settings are bound to that property.  I do have a PageData object that I just throw away without saving, but I can't see how that's a problem.

    editor.PropertySettings = (TinyMCESettings)comment.Property["MainBody"].GetSetting(typeof (TinyMCESettings);

        

    #63429 Nov 19, 2012 19:02
  • Olga Björklund
    Member since: 2010
     

    Is there a way you could do the same with PageTypeBuilder? I mean just select the default settings for TinyMCE without creating the settings in code?

    #66102 Edited, Feb 20, 2013 10:58
  • Johan Kronberg
    Member since: 2005
     

    So, on startup you want anything that's not the Default setting to be set back to the Default setting?
    Or do you want all Setttings gone and revert to the out-of-the-box EPiServer config?

    The out-of-the-box toolbars are not optimal IMHO so I need an "own" setting anyway... Blogged about it a while back:
    http://krompaco.nu/2012/09/page-type-builder-and-tinymce-global-settings/

    #66104 Edited, Feb 20, 2013 11:25