When you use the JavaScript SDK, you may need to handle rich content. Rich content is a block of content that incorporates multiple content types within a single block. For example, you may have a block of rich content made up of a heading, a paragraph, an image, and a caption.
A block of rich content is represented in the data as an object with nodes (sections) and decorations (styles), where each one can be a distinct type. Define rich content with a Ricos Document, which is a strictly defined JSON object structure. Learn more about Ricos.
Rich content is displayed in various parts of the Wix interface that display different media types and text formatting, such as blog posts.
Specify rich content in its own field in API calls. This enables you to save and retrieve your content while retaining its formatting.
Some of Ricos' types are universally supported, but the ones that aren't need a specific plugin to be enabled for the type to be rendered. Wix APIs that consume rich content specify which plugins are enabled in their rich content field description. In the Ricos playground, you can enable and disable plugins to match the plugins enabled by the API that's consuming your rich content.
For most cases, you can use the Ricos playground to build your Ricos document for you. You can build your content in the Editor tab, view it in the Viewer tab, and copy and paste it from the Document tab. Here's a mini version of the playground:
When developing sites or building an app with Blocks, you can display rich content using the RichContentViewer
element.