Brightspot CMS Developer Guide

Rich text toolbar


To deploy a rich-text toolbar, you define it as a class and then assign the class to a field.


You can deploy customized rich-text editors that have certain controls for marking up text. For example, the following class provides only the boldface, italics, underline, and hyperlink buttons.

import com.psddev.cms.rte.RichTextToolbar;
import com.psddev.cms.rte.RichTextToolbarItem;
import com.psddev.cms.rte.RichTextToolbarStyle;

public class CustomRichTextToolbar implements RichTextToolbar { 1

    @Override
    public List<RichTextToolbarItem> getItems() { 2
        return Arrays.asList(
            RichTextToolbarStyle.BOLD,
            RichTextToolbarStyle.ITALIC,
            RichTextToolbarStyle.UNDERLINE);
    }
}
  • Specifies a class that implements RichTextToolbar.
  • Specifies the controls appearing in the toolbar.


You associate a customized rich-text editor with a text field using the @ToolUi.RichText annotation.

import com.psddev.cms.db.Content;
import com.psddev.cms.db.ToolUi;

public class Article extends Content  {

    @ToolUi.RichText(toolbar=CustomRichTextToolbar.class) 1

    private String body;

}
  • Applies the toolbar class created in Defining a toolbar class to the rich-text field body.

The following classes have controls which can be used in your customized rich-text toolbar's getItems method:

See also:

Previous Topic
Rich text
Next Topic
Rich-text elements
Was this topic helpful?
Thanks for your feedback.
The elements that get you up and running in a matter of days, from pre-built content types, to modules, to landing pages.

Content types
Modules
Landing pages
Everything you need to manage and administer content within Brightspot CMS, including plug-and-play integrations.

Dashboards
Publishing
Workflows
Admin configurations
A guide for installing, supporting and administering code on the Brightspot platform, including integrations requiring developer support to use.

Field types
Content modeling
Rich-text elements
Images