SaaS CMS has officially launched! Learn more now.

TinyMCE Default Toolbar Not Applied

Vote:
 

Epi 11 TinyMCE v2

Hi I'm having an issue configuring the default toolbar for TinyMCE, using the simplified example below the formatselect dropdown is applied OK but the toolbar still contains the default buttons/options

config.Default()
  .AddEpiserverSupport()
  .Toolbar("formatselect cut copy paste")
  .BlockFormats("paragraph=p;")
  .Height(300)
  .Width(580);

If I apply the same settings to a specific page and property it's renders as expected

config.For<StandardPage>(t => t.MainBodyContent, config.Empty())
  .AddEpiserverSupport()
  .Toolbar("formatselect cut copy paste")
  .BlockFormats("paragraph=p;")
  .Height(300)
  .Width(580);

I can't see what I'm doing wrong for the default setting which I need to apply globally

Thanks,

Jason

#206346
Aug 16, 2019 1:51
Vote:
 

Hi Jason,

I'm guessing you're applying that configuration within the ConfigureContainer method of an IConfigurableModule? Have you specified a dependency on TinyMceInitialization with a [ModuleDependency(typeof(TinyMceInitialization))] like this?

[ModuleDependency(typeof(TinyMceInitialization))]
public class CustomizedTinyMceInitialization : IConfigurableModule
{
    public void Initialize(InitializationEngine context)
    {
    }

    public void Uninitialize(InitializationEngine context)
    {
    }

    public void ConfigureContainer(ServiceConfigurationContext context)
    {
        context.Services.Configure<TinyMceConfiguration>(config =>
        {
            config.Default()
                .AddEpiserverSupport()
                .Toolbar("formatselect cut copy paste")
                .BlockFormats("paragraph=p;")
                .Height(300)
                .Width(580);


        });
    }
}

Without that dependency your IConfigurableModule would most likely execute before the default TinyMCE initialisation so your settings would be overridden by the defaults.

#206358
Aug 16, 2019 11:25
Vote:
 

Hi Paul

Thanks for responding, yes the configuration is within a ConfigureContainer method of an IConfigurableModule and the ModuleDependency is set correctly.

The strange thing is that the .BlockFormats are applied as expected but not the toolbar, and the toolbar changes are applied correctly to a specific page type and property but not globally.

#206377
Aug 17, 2019 10:44
Vote:
 

Hi Jason,

My guess is that TinyMCE is being configured somewhere else in another IConfigurable module with the settings from screenshot n°1.

#206403
Aug 20, 2019 10:45
Jason McBratney - Aug 22, 2019 6:30
Thanks, you were right, ImageVault was overriding the custom settings.
Vote:
 

I'm working with Jason on this project and found the issue.

We're using ImageVault and found that we needed to have a module dependency of [ModuleDependency(typeof(ImageVaultTinyMceModule))] rather than of [ModuleDependency(typeof(TinyMceInitialization))] which was overriding our custom settings.

Changing this resolved the issue and our custom settings were then applied as expected.

#206467
Aug 22, 2019 6:17
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.