This documentation is for a version that has reached its End Of Life. Such versions are no longer supported and don't receive security updates. Consider updating to a newer version.
Create custom Online Editor button¶
There are different ways to extend the Online Editor. Here you can learn how to add your own buttons.
Follow the procedure below to create a button that inserts an <hr>
element into
a RichText Field.
First, create the button file in assets/js/online_editor/buttons/hr.js
:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 |
|
Then, enable the button.
Add the following code in the webpack.config.js
file, under
// Put your config here
:
1 2 3 4 5 6 7 |
|
Finally, add the button to your Ibexa DXP configuration:
1 2 3 4 5 6 7 8 9 10 |
|
You have successfully created a custom Online Editor button.
You can now run the yarn encore dev
command to regenerate the assets, and create
a Content item with a RichText Field.
The new button appears in the Element toolbar and inserts an <hr>
element when clicked: