Customization
Options
Optionally, you can customize a few of the attributes by passing them as attributes to the <richer-text-editor>
tag.
Option | Default | Allowed values | Notes | |
---|---|---|---|---|
serializer | “html” | “html”, “json” | ||
input | ”” | Form field id | ||
content | ”” | String | ||
placeholder | “Start typing…” | String | ||
callouts | “false” | “true”, “false” | ||
tables | “false” | “true”, “false” | ||
emoji | “true” | “true”, “false” | ||
mentionable-users-path | ”” | URL path to .json endpoint | ||
embeds-path | “/embeds” | URL path to controller endpoint | ||
oembed | “false” | “true”, “false” | When present, embeds-path must be provided |
JSON Serializer
Richer Text allows you to take full control of storing, and rendering content by using JSON to serialize the content instead of the default (HTML) serializer.
JSON output:
<richer-text-editor
serializer="json"
content='{"type":"doc","content":[{"type":"paragraph","attrs":{"textAlign":"left"},"content":[{"type":"text","text":"Hello from the "},{"type":"text","marks":[{"type":"bold"}],"text":"JSON"},{"type":"text","text":" serializer."}]}]}'
>
</richer-text-editor>