Jump to content

TinyMCE toolbar configuration : default vs field specific configuration


TomPich
 Share

Recommended Posts

Hello all,

I think I found a bug (or maybe I’m doing something wrong?) when trying to configure TinyMCE toolbar.

I made a copy of the TinyMCE default settings file defaults.json in the site/modules/ folder, entered the link to this field in TinyMCE module options (Default setting overrides JSON file) and customized the new file a bit. It worked perfectly. Then, I tried to delete some buttons (blockquote). But it is still visible. Tried to add some predefined one (removeformat). It didn’t show up.

Then I tried to do the same on the original defaults.json file (after removing the link to the customized setting file). Again, everything worked except when I try to modify the toolbar content. It sticks to the same buttons : "styles bold italic pwlink pwimage blockquote hr bullist numlist table anchor code" whatever I try. Is that a bug ? From TinyMCE itself? Or its integration in ProcessWire?

Please enlighten me,

Again, thanks in advance and good day to all.

Link to comment
Share on other sites

3 hours ago, TomPich said:

Then, I tried to delete some buttons (blockquote). But it is still visible. Tried to add some predefined one (removeformat). It didn’t show up.

My understanding is that the toolbar defaults are just the settings that get pulled in when you create a field. Once you edit a field's settings, it saves the toolbar config to the database and pulls it from there from then on. If you however prefix your settings with "replace_", "add_" or "remove_", it will still influence the field's behavior. So you should be able to e.g. put

{
  "add_toolbar": "removeformat"
}

into the " Default setting overrides JSON text" field in the module settings or into your site/modules defaults.php, and the removeformat button gets added to all fields.

  • Like 1
Link to comment
Share on other sites

OK, so that explains why I can get the updated toolbar buttons if I erase all content of the Field>Input>Toolbar. It recreates the buttons based on the default toolbar.

Thanks a lot. I will correct the title of the topic without mentionning a bug, because it’s not a bug! ?

Link to comment
Share on other sites

  • TomPich changed the title to TinyMCE toolbar configuration : default vs field specific configuration

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...