ckeditor / ckeditor5

Powerful rich text editor framework with a modular architecture, modern integrations, and features like collaborative editing.
https://ckeditor.com/ckeditor-5
Other
8.32k stars 3.6k forks source link

Menu bar items can't be removed by changing the `config.menuBar.removeItems` property in other plugins constructors #16326

Open Dumluregn opened 2 weeks ago

Dumluregn commented 2 weeks ago

📝 Provide detailed reproduction steps (if any)

  1. Add the following line in any plugin constructor (e.g. FontSizeEditing):
    editor.config.define( 'menuBar.removeItems', [ 'menuBar:bold' ] );
  2. Open any demo using the menu bar and the removed item, e.g. all-features ( yarn manual -f ckeditor5/all-features )
  3. Open menu Format=>Text.

✔️ Expected result

The "Bold" button is gone.

❌ Actual result

It's still visible.

❓ Possible solution

This happens because:

  1. Menu bar stores the config clone in the corresponding EditorUI plugin.
  2. This clone is created before the plugin initialization.
  3. Even if some plugin wants to change the menu bar config, it can't access the clone.

So currently, the only way to remove a menu bar item is doing so directly within the config passed to the editor creator function.

📃 Other details


If you'd like to see this fixed sooner, add a 👍 reaction to this post.