TinyMCE plugin in add-on

Member since: 2006


I would like to add a TinyMCE plugin inside an Episerver add-on.

The add-on itself works just fine, and it properly registers the TinyMCE plugin like so (additional attribute parameters excluded for brevity):

[TinyMCEPluginNonVisual(PlugInName = "mycustomplugin")]
public class MyCustomTinyMcePlugin


However, the plugin itself fails to load. Episerver simply returns a 404 when trying to get the plugin from: /Util/Editor/tinymce/plugins/mycustomplugin/editor_plugin.js

My add-on is contained within a zip file, which in turn contains the TinyMCE plugin.

I can access the plugin JavaScript file if I request the add-on VPP path configured for the add-on, like:


However, this doesn't help as the TinyMCE editor always loads plugins from:


Is there any way to make files in my add-on available under the /Util path, or is there some other clever way of enabling the plugin?

I would like to avoid registering a VirtualPathProvider, as my add-on won't be able to tell what the actual path will be (the add-on is supposed to be re-usable).

Any tips or pointers are greatly appreciated! :)

#147667 Apr 20, 2016 20:53
  • Ted
    Member since: 2006

    For now I'll just do something like this in an IHttpInitializableModule in the add-on assembly (this way the plugin script file will be served by the VPP automatically registered for the add-on zip file):

    public void InitializeHttpEvents(HttpApplication application)
       application.BeginRequest += RewritePluginPath;
    private void RewritePluginPath(object sender, EventArgs e)
       const string pluginFolderPath = "/Util/Editor/tinymce/plugins/mycustomplugin/editor_plugin.js";
       if (HttpContext.Current.Request.Url.AbsolutePath.StartsWith(pluginFolderPath))
          HttpContext.Current.RewritePath(string.Concat("/Episerver/My.Custom.Addon/", pluginFolderPath));
    #147698 Edited, Apr 21, 2016 14:40