Tinymce editor does not display block or image tools components

Vote:
 

Hi all,

Been scratching my head with this for some time now, for some reason, the tinymce editor does not display the block tools or the image tools functions in our site, and i can not figure out why. It does not show any error or such, those two specifgic buttons are just not there at all. I have tried a multitude of different configurations, but they all give the same result, its as if those two component are disabled globally by something I cant figure out. Note that the image editor component and all other episerver specific tools like epi-link and the personalised content widget works fine.

We use tinymce version 2.13.4, and here is the config:

public static void DefaultTinyMCEConfiguration(ServiceConfigurationContext context)
        {
            // tinymce config
            context.Services.Configure<TinyMceConfiguration>(config => {
                //default
                config.Default()
                      // .ClearPlugins()
                     // .AddEpiserverSupport() // doesnt matter if this is enabled or not, still no block or image tools
                      .AddPlugin("epi-block-tools epi-image-editor epi-image-tools epi-link epi-dnd-processor epi-personalized-content wordcount anchor visualblocks visualchars code")
                      // cleanup code seem to be built-in now, there is no button for it that i could find
                      // epi-block-tools (dynamic content) moved to first segment
                      // paste from word is a premium tinymce plugin that cost money https://www.tiny.cloud/docs/enterprise/paste-from-word/
                      .Toolbar(
                        "epi-dnd-processor epi-link anchor epi-personalized-content | epi-block-tools epi-image-editor epi-image-tools | " +
                        "cut copy paste pastetext blockquote | " +
                        "removeformat | " +
                        "bold italic | " +
                        "alignleft aligncenter | " +
                        "bullist numlist subscript superscript | " +
                        "styleselect | " +
                        "undo redo | " +
                        "searchreplace visualblocks visualchars")
                      .EnableImageTools() // doesnt matter if this is here or not, image tools will not show
                      //.AddSetting("epi_content_css", Paths.ToClientResource(typeof(TinyMceSettings), "ClientResources/epi-addon-tinymce/styles/content.css"))
                      .StyleFormats(new {
                          title = "Headings",
                          items = new[] {
                                            new {title = "Heading 1", block = "h1", classes = ""},
                                            new {title = "Heading 2", block = "h2", classes = ""},
                                            new {title = "Heading 3", block = "h3", classes = ""},
                                            new {title = "Heading 4", block = "h4", classes = ""},
                                            new {title = "Heading 5", block = "h5", classes = ""},
                                            new {title = "Heading 6", block = "h6", classes = ""}
                                        }
                      },
                                    new {
                                        title = "Inline",
                                        items = new[] {
                                            new {title = "Bold", inline = "strong", classes = ""},
                                            new {title = "Italic", inline = "em", classes = ""},
                                            new {title = "Superscript", inline = "sup", classes = ""},
                                            new {title = "subscript", inline = "sub", classes = ""},
                                            new {title = "Bordered image", inline = "img", classes = "Image--border"},
                                            new {title = "Link with arrow", inline = "a", classes = "Link--arrow"}
                                        }
                                    },
                                    new {
                                        title = "Blocks",
                                        items = new[] {
                                            new {title = "Paragraph", block = "p", classes = ""},
                                            new {title = "Paragraph, small text", block = "p", classes = "u-textXSmall"},
                                            new {title = "Preamble", block = "p", classes = "Lead"},
                                            new {title = "Blockquote", block = "blockquote", classes = ""}
                                        }
                                    },
                                    new {
                                        // these should be using styles = {text-align = "left|center"}, but i dont know how to format that as text-align obviously is invalid as a varaible name
                                        title = "Alignment",
                                        items = new[] {
                                            new {title = "Left", block = "p", classes = "u-textLeft", styles = new Dictionary<string, string> {{"text-align", "left"}}},
                                            new {title = "Center", block = "p", classes = "u-textCenter", styles = new Dictionary<string, string> {{"text-align", "center"}}}
                                        }
                                    })
                      .Width(580)
                      .Height(300)
                      .AddSetting("content_style", "html {background: #fff!important;}")
                      .ContentCss(Assets.Url("/assets/build/app.css"))
                      .AddSetting("style_formats_autohide", true) // hide styles when those can't be used
                      .AddSetting("style_formats_merge", false)// tinymce default styles + ours
                    .AddSettingsTransform("admin-code-button", (settings, content, propertyName) => {
                        var user = HttpContext.Current?.User;

                        if (user?.IsInRole("CmsAdmins") == true) {
                            //settings.AddPlugin("code");
                            settings.AppendToolbar("| code");
                        }
                    });

                //DefaultValues.EpiserverPlugins
                // light settings
                var lightConfig = config.Empty()
                                        //.DisableMenubar()
                                        .AddPlugin("wordcount epi-block-tools epi-dnd-processor visualblocks visualchars code")
                                        //.AppendToolbar("cut copy paste pastetext pasteword blockquote epi-block-tools")
                                        .Toolbar("cut copy paste pastetext blockquote epi-block-tools | removeformat | subscript superscript | undo redo | searchreplace visualblocks visualchars")
                                        .AddSetting("content_style", "html {background: #fff!important;}")
                                        .ContentCss(Assets.Url("/assets/build/app.css"))
                                        .Width(580)
                                        .Height(150)
                                        .AddSettingsTransform("admin-code-button", (settings, content, propertyName) => {
                                            var user = HttpContext.Current?.User;

                                            if (user?.IsInRole("CmsAdmins") == true) {
                                                settings.AddPlugin("code");
                                                settings.AppendToolbar("| code");
                                            }
                                        });


                var configFull = config.Default().Clone()
                                       .AddPlugin("table")
                                       .AppendToolbar("table")
                                       .AddSettingsTransform("admin-code-button", (settings, content, propertyName) => {
                                           var user = HttpContext.Current?.User;

                                           if (user?.IsInRole("CmsAdmins") == true) {
                                               settings.AddPlugin("code");
                                               settings.AppendToolbar("| code");
                                           }
                                       });
                TinyMCEEditorSettings.Add("light", lightConfig);
                TinyMCEEditorSettings.Add("full", configFull);
            });
#267284
Edited, Nov 24, 2021 9:30
Vote:
 

Hi.

I'm not sure if you saw this note on the Plug-Ins page in the CMS Developer's guide.

Note: The epi-image-tools plug-in is dependent on the TinyMCE plug-in imagetools. The TinyMCE imagetools plug-in is not fully compatible with Optimizely because it is not integrated with how Optimizely saves images, so in the default configuration we have also defined the imagetools_toolbar setting to only include Optimizely's epi-gotomedia button.

Do you have the imagetools TinyMCE plug-in installed? I don't know if it's included in the standard installation or if it's something you need to install separately.

Nick

#267542
Nov 29, 2021 17:28
Vote:
 

Hi,

Thanks for the suggestion, but it made no difference.

However, I went back and just removed all customization and checked what the default config is set to, and it seems that epi-image-tools and epi-block-tools are simply not soemthing the default config is using, and they dont seem to be available/supported anymore, at least not as toolbar items. The default config uses the toolbar item image to add (epi)image picker and config support (width/height, alt text etc). 

The block tools are still absent, but I dont need them myself, so this will have to do for now.

#267643
Dec 01, 2021 10:44
This topic was created over six months ago and has been resolved. If you have a similar question, please create a new topic and refer to this one.
* 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.