Removing configuration from bullet lists in TinyMC...
# help-with-umbraco
a
So i have a hard time removing the styling options from bullet lists in tinyMCE. I would only like to give the editor the options to insert a basic bullet list, not a square or hollow one. I looks like the "presentation" in tinmyMCE is enabled by a "advanced list" plugin. https://www.tiny.cloud/docs/tinymce/6/advlist/ But I have no idea how to remove a plugin? Its not configurable on the data type in the backoffice
Seems like it's a bug in umbraco... even though i add the following to appsettings:
Copy code
"RichTextEditor": {
        "Plugins": [ "anchor", "charmap", "table", "lists", "autolink", "directionality", "searchreplace" ],
      },
since the IOptions
Plugins
are configured like
public string[] Plugins { get; set; } = Default_plugins;
the options i supply is just appended to the list....
s
Hack: amend the CSS for the RTE and frontend to make all 3 look exactly the same, no matter which of the 3 they choose.
I'm still dreaming of being able to configure Tiny like one normal configures Tiny when it's not inside of Umbraco. (apparently that's difficult)
a
yeah thats the way we handle it currently - but i would really like the editor to not have the illution that it should look different. @Sebastiaan I actually made a PR to fix it in umbraco https://github.com/umbraco/Umbraco-CMS/pull/14547 but as Mike hinted it might be a breaking change? I can see how it would be, but also i would argue that it was intended to be customizable, IDK
s
Yeah that's super breaking. But maybe we just introduce new public methods instead to fix this. I am sure right now you could replace the whole
RichTextEditorSettings
class with dependency injection? Not sure.
a
hmmm could be yeah ?
hmm atleast
services.Configure<RichTextEditorSettings>(x => x.Plugins = new[] { "table", "code" });
doesn't work - again due to how default property initializers work. I guess an 'OverridePlugins' configuration would be more fitting?
s
Hmm.. can't replace the class? guess it's not an interface, because it was never meant to be public
More config options are never the answer (almost.. never)
a
No i agree, I'm just stumped on how to fix it so it won't be a breaking change? Even though I'm sure the original developer meant for the Plugins to be replaceable. Since it works with the default initializer for a string setting.
ah but i could do
Copy code
services.Configure<RichTextEditorSettings>(x =>
            {
                x.Plugins = new[] { "anchor", "charmap", "table", "lists", "autolink", "directionality", "searchreplace" };
                x.Commands = new[] { new RichTextEditorSettings.RichTextEditorCommand() { Alias = "bullist", Mode = RichTextEditorCommandMode.Insert, Name = "Bullet list" } };
            });
Okaaaay i'll relent and pull back my PR
s
Ooh..! Cool, maybe this should be documented! 💡
a
Agreed!
6 Views