Adding tinymce plugins to Orchard

Topics: Core, Writing modules
May 29, 2012 at 9:11 AM

tinymce has its own plugin infrastructure which add a number of features that users may find helpful.

Adding these at present however would seem to require modifying the tinymce module, and it doesn't seem possible to create a new module which provides tinymce plugins.

To meet this need, I've created an extensibility point in the tinymce module which allows modules to implement an interface to provide tinymce plugins.

It uses the event bus to allow modules to register plugins against tinymce, and these are then populated by the tinymce module.

Use in a module would work something like this (for the print plugin):

namespace Orchard.TinyMce.Print.Plugins

    using System.Collections.Generic;
    using Orchard.TinyMce.Plugins;
    public class PrintPlugin : ITinyMCEPlugin
        public IEnumerable<ExternalPlugin> GetPlugins()
            yield return 
                new ExternalPlugin() {
                    Name = "print",
                    URL = "/modules/TinyMce.Print/Scripts/editor_plugin.js",
                    Buttons2 = new string[] { "print" }

Any feedback appreciated, and I'd certainly appreciate it being considered for incorporation into the main repository so that I needn't maintain a separate fork!

May 29, 2012 at 9:10 PM

Nice work David. I altered the tiny mce js (core) file manually to add some plugins and noted that this would need looking at at some stage.

Is there any way it could be extended without having to write/alter modules? Ie: pick up some sort of plugin description text file and load each plugin that's listed.

It might be worth having both extensibility models so that individual modules can alter the functions of the editor as well as global changes.