yvess
yvess

Reputation: 2114

how to limit allowed formatting options in hallo.js rich text editor

I want to limit the formatting options for the wagtail.wagtailcore.fields.RichTextField field. For example, how to limit the user so that he can only use bold, paragraph and links in the RichTextField. I found examples for extending the editor, but not for limiting.

Upvotes: 1

Views: 385

Answers (1)

Bikash kharel
Bikash kharel

Reputation: 521

You can limit options for RichTextField in wagtail by using keyword features as follows.

body = RichTextField(features=['bold','link'])

The list of all the available features are as follows:

  • h1, h2, h3, h4, h5, h6 - heading elements
  • bold, italic - bold / italic text
  • ol, ul - ordered / unordered lists
  • hr - horizontal rules
  • link - page, external and email links
  • document-link - links to documents
  • image - embedded images
  • embed - embedded media (see Embedded content)

Example and detail description can be found in it's official site.

Upvotes: 0

Related Questions