Hi Brian,
Maybe you could use Settings Transformations?
https://world.episerver.com/blogs/magnus-stalberg/Dates/2018/5/tinymce-configuration-api-news/
Then your code will look like:
context.Services.Configure<TinyMceConfiguration>(config => { var extendedSettings = config.Default().Clone() .AddSettingsTransform("custom", (settings, content, propertyName) => { // Do lots of dynamic stuff; read from various files; etc. }); config.For<StartPage>(x => x.MainBody, extendedSettings); });
Thank you! I think that is going to work quite nicely. I'm going to have to implement my own caching layer though, since this is called every time.
One thing I'm noticing: when I do this to modify the default settings and then refresh the bowser on all-properties view for a page that contains multiple XhtmlString properties, the first editor has the old configuration, while all the rest of them have the updated settings.
EDIT: Cancel that. I just realized that inside my settings transform I was making modifications to defaultConfig instead of the actual parameter settings. Funny thing- the API works a lot better when you use it correctly.
Example code:
context.Services.Configure<TinyMceConfiguration>(config => { TinyMceSettings defaultConfig = config.Default().AddEpiserverSupport(); defaultConfig.AddSettingsTransform("Custom", (settings, content, propertyName) => { // Do lots of dynamic stuff; read from various files; etc. }); });
Using the latest version of Episerver.CMS.TinyMce (v2.6.1 at the time of writing this), is there any way to force Episerver to reload the customizations?
Suppose I have the following:
This code runs the first time a TinyMce editor is rendered, and the resulting configuration is cached/reused when subsequent editors are rendered. What happens if one of my files changes, and I want to recalculate all of the TinyMce configurations? Is there a way to force that to happen without restarting the whole IIS site?