How do I override anchor.js from ClientResources

Member since: 2010

Hi, after I have updated the code with .16 version of EPiServer, anchors inside TinyMCE were added a validation with Regex. However, the regex doesn't include Swedish letters, so now my application doesn't work as intended.

What I want to do is to replace [a-z][a-z0-9\-\_:\.] with [\w][\w \-] inside xx/secret/CMS/2.1.82/ClientResources/editor/tiny_mce/themes/advanced/js/anchor.js

This is placed inside VPP folder under 2.1.82 version. If I add an IHttpHandler, I would need to add this path /secret/CMS/2.1.82/ClientResources/editor/tiny_mce/themes/advanced/js/ to it and when EPiServer issues a new update I would need to change the number.

Is this the best way or there is a better one?

The other option is to change the file manually in VPP, which is even worse.

#75172 Sep 19, 2013 11:17
  • Member since: 2010

    Actually, I needed to change this with [a-zA-ZåäöÅÄÖ][a-zA-ZåäöÅÄÖ0-9\-\_:\.]

    I added this to web.config:

      <location path="secret/CMS/2.1.82/ClientResources/editor/tiny_mce/themes/advanced/js">
        <system.webServer>
          <handlers>
            <add name="TinyMceExtendedValidElements" path="/secret/CMS/2.1.82/ClientResources/editor/tiny_mce/themes/advanced/js/anchor.js" verb="GET" type="KemI.Web.Business.EPiServerUI.TinyMceConfig.AnchorFileHandler, KemI.Web" />
          </handlers>
        </system.webServer>
      </location>

        

    And the AnchorFileHandler looks like this:

        public class AnchorFileHandler : IHttpHandler
        {
            public bool IsReusable
            {
                get { return true; }
            }
    
            public void ProcessRequest(HttpContext context)
            {
                var newUrl = "/ClientResources/editor/tiny_mce/themes/advanced/js/anchor.js";
                context.Server.Transfer(newUrl);
            }
        }

        

    This means that when the version changes, I need to update the web.config file.

    If someone has a better idea, I would appreciate it!

    #75194 Sep 19, 2013 17:51