CKEditor SDK

Applying Block-Level Text Formats Documentation

Block-level text formats are provided through the Format plugin which by default is available in the Standard and Full distributions.

When the plugin is enabled, the button is automatically added to the toolbar. Once clicked, it opens the drop-down list with text formats that can be applied to your document. The formats work on block level which means that you do not need to select any text in order to apply them and entire blocks will be affected by your choice. Read about basic text styles and the Styles drop-down list if you want to apply inline styles on selected text fragments.

Default Text Formats

Some basic text formats like paragraph or headings are pre-defined in CKEditor, as visible in the editor instance below. The default collection is set in the config.format_tags option, although normally in the Standard distribution a few of these formats are disabled. Refer to the Applying Block-Level Text Formats documentation for more information on how to enable them like in the instance below.

Custom Text Format Definition

CKEditor allows you to both decide which of the default text formats will be available in the Format drop-down list and adjust existing format definitions, for example by adding a custom class. Refer to the Applying Block-Level Text Formats documentation for more information on how to customize this feature.

The editor instance below contains a reduced list of available text formats when compared to the first example. Additionally, Heading 1, Heading 2 and Formatted text format definitions now include custom classes applying the colors and in case of headings, also a different font.

The text format feature is automatically integrated with Advanced Content Filter, so all custom format definitions are treated as allowed by the editor content filtering mechanism.

Related Features