Rich Text Editor Settings#
In this chapter we will learn how to change settings for the Rich Text Editor. We will add a button to the toolbar to underline the selected text.
In the config.js
file we will create a new button.
import React from 'react';
import createInlineStyleButton from 'draft-js-buttons/lib/utils/createInlineStyleButton';
import Icon from '@plone/volto/components/theme/Icon/Icon';
import underlineSVG from '@plone/volto/icons/underline.svg';
const UnderlineButton = createInlineStyleButton({
style: 'UNDERLINE',
children: <Icon name={underlineSVG} size="24px" />,
});
Next we will add the button to the toolbar.
export const settings = {
...defaultSettings,
richTextEditorInlineToolbarButtons: [
UnderlineButton,
...defaultSettings.richTextEditorInlineToolbarButtons,
],
};
Exercise#
Add a button to the toolbar to style a text selection as CODE
.