epi_page_context in TinyMCE

Vote:
 

Hi, 

TL;DR: Is it possible to get the Episerver context in a custom TinyMCE plugin?

I'm trying to migrate a custom plugin in TinyMCE after upgrading to Episerver 11 and TinyMCE 2.8.0. 

The plugin uses epi_page_context which is available but empty in editor.settings after upgrading. In Episerver 10, SetPageDataContext could be used to set the context based on the supplied page https://world.episerver.com/documentation/Class-library/?documentId=cms/10/10AD80F5.

Are there any equivalent methods of getting the Episerver context in a custom TinyMCE plugin? 

#204504
Jun 04, 2019 14:52
Vote:
 

Eivind, 

Have you tried just using the _ContextMixin?

define([    
    "dojo/when",
    "epi-addon-tinymce/tinymce-loader",    
    "epi/shell/_ContextMixin"    
], function (    
    when,
    tinymce,
    _ContextMixin,
) {

    tinymce.PluginManager.add("custom-plugin", function (editor) {
        var context = new _ContextMixin();

        when(context.getCurrentContext()).then(function (content) {
            //TODO: custom code
        });
        
        return {
            getMetadata: function () {
                return {
                    name: "custom plugin",
                    url: "https://www.custom.com"
                };
            }
        };
    });
});
#210371
Nov 21, 2019 12:42
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.