Quantcast
Channel: Developer to developer
Viewing all articles
Browse latest Browse all 9076

Prevent TinyMce from rewritting simple urls

$
0
0

Hey all,

We recently upgraded our .Net solution to CMS 12 which seems to have changed the behaviour of our TinyMce editor and how it transforms internal links.

  • sampleurl.html (the intended url)
  • /EPiServer/CMS/Content/Shop/sampleurl,,72193/?epieditmode=false (what the url is transformed to, after upgrade)

Our Custom Config:

    internal static class CustomTinyMceConfig
    {
        public static IServiceCollection ConfigureTinyMce(this IServiceCollection services)
        {
            services.Configure<TinyMceConfiguration>(config =>
            {
                config.Default()
                    .AddPlugin("media wordcount anchor link code table")
                    .Toolbar("formatselect | epi-personalized-content anchor link numlist bullist indent outdent bold italic underline alignleft aligncenter alignright | image epi-image-editor media code | epi-dnd-processor | removeformat | fullscreen | table | row_props cell_props row_after row_before delete_row col_after col_before delete_col split_cells merge_cells")
                    .AddSetting("image_caption", true)
                    .AddSetting("image_advtab", true)
                    .InitializationScript("/ClientResources/js/tinymce/custom-init.js");
            });
            return services;
        }
    }

custom-init.js

define([], function () {
    return function (settings) {
        return Object.assign(settings, {
            /* 
             * call back to overwrite tinymce and epi urlconvert implementations for internal links
             * 
             * links defined in TinyMCE CMS blocks should take the form:
             *      href="{ PAGE_SIMPLE_URL }.html"
             *      
             * */
            urlconverter_callback: function (url, node, on_save) {
                var rval = url;
                // convert internal urls only
                if (url.includes('.html') && !url.includes('http')) {
                    rval = url.replace(/^.*[\\\/]/, '');;
                }
                return rval;
            }
        });
    };
});

Any ideas what could be causing this issue? Have tried quite a few things, including adding the "convert_url":false parameter to our custom config, which did not seem to work.

Thank you!


Viewing all articles
Browse latest Browse all 9076

Trending Articles