Tune block with popup: move, align, change block tag, and another options
Plugin settings allow you to set a set of options for any tag that the user clicks on.
This is done through the option tuneBlock.popup
For example, let's set the ability in the editor in the tune block to switch the direction of the text.
CopyJodit.make('#editor', { tuneBlock: { popup: { p: Jodit.atom(['align', 'tune.up', 'tune.remove', 'tune.down']) } } });
Tune block has several button options by default, here they are:
tune.up
- move block uptune.remove
- delete blocktune.down
- move block downtune.h1
- make from block Heading 1tune.h2
- make from block Heading 2tune.h3
- make from block Heading 3tune.h4
- make from block Heading 4tune.h5
- make from block Heading 5tune.h6
- make from block Heading 6Also you can use any buttons provided by other plugins:
CopyJodit.make('#editor2', { tuneBlock: { popup: { table: Jodit.atom(['brush', 'image', 'align']) } } });
And of course you can add your own button, just like this done for the main toolbar
CopyJodit.make('#editor2', { tuneBlock: { popup: { table: [ { icon: 'brush', name: 'Brush table in red', exec(editor, tableElm) { tableElm.querySelectorAll('td').forEach((td) => { td.style.backgroundColor = 'red'; }); editor.e.fire('afterExecTune.tune'); // close the tuner } } ] } } });
In order to deactivate a plugin, you can set:
Copyimport JoditEditor from 'jodit-react'; <JoditEditor config={{ disablePlugins: ['tune-block'] }} />;
If you want to deactivate the plugin for any one type of tags, then simply set its value to null.
CopyJodit.make('#editor3', { tuneBlock: { popup: { h3: null // No tune-block will be shown for H3 tag } } });
Alternatively, you can disable the plugin for all tags by simply specifying:
CopyJodit.make('#editor3', { tuneBlock: { popup: Jodit.atom({}) // We erase all default values } });