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.
Our robust, flexible Design System provides hundreds of pre-built components you can use to build the presentation layer of your dreams.

Asset types
Module types
Page types
Brightspot is packaged with content types that get you up and running in a matter of days, including assets, modules and landing pages.

Content types
Modules
Landing pages
Everything you need to know when creating, managing, and administering content within Brightspot CMS.

Dashboards
Publishing
Workflows
Admin configurations
A guide for installing, supporting, extending, modifying and administering code on the Brightspot platform.

Field types
Content modeling
Rich-text elements
Images
A guide to configuring Brightspot's library of integrations, including pre-built options and developer-configured extensions.

Google Analytics
Shopify
Apple News