CKEditor Configuration

CKEditor for Orchard provides some simple ways for you to configure the CKEditor application.

Settings Page

Once you've enabled CKEditor, in the Orchard Dashboard you'll find a CKEditor settings page. This allows you to modify a small number of options - we haven't added many yet!

Javacript config template

In the ~/Views folder there's a file called CKEditor.Config.cshtml. This writes out the Javascript config for the CKEDITOR.replace method. You can copy this file into the ~/Views folder of TheAdmin theme or your own module if you want to customise it.

Advanced Configuration with ICKEditorConfigProvider

We've provided a way to add and manipulate settings from code, so this is perfect to use from modules but can be used in themes as well.

You just need to implement the ICKEditorConfigProvider interface, and from there you can add key/value pairs into the configuration context. These will all get written as Javascript config when the CKEditor is displayed.
Example:
    public class SampleConfigProvider : ICKEditorConfigProvider
    {

        public SampleConfigProvider(
            )
        {
        }

        public void PopulateConfiguration(CKEditorConfigContext config)
        {
                    config.Add(new CKEditorConfigString("stringSetting","foo"));
                    config.Add(new CKEditorConfigStringList("listSetting", new[]{"foo","bar"}));
        }
    }


You can also look at the CKEditor module to see how existing settings are implemented in the Dashboard - contributions are welcome if you feel like adding any more of CKEditor's built-in settings!

Last edited Oct 5, 2011 at 2:45 PM by randompete, version 6

Comments

andrewmyhre Jun 11, 2012 at 11:55 AM 
Is it possible to use this to set the stylesheetParser_validSelectors property? (It's not a string type it's a JS regex type).