Ricos API
#
Ricos Common APIchildren
#
For backward compatibility. Any prop given to the child component will deeply override the matching prop created in Ricos' internal logic. Read more about backward compatibility in Migrating from rich-content
content
#
A DraftContent
is an immutable object that saves the entire content created by a RicosEditor
. For RicosViewer
this is a requirement, it will set the content to display. For the RicosEditor
this will set its initial state.
cssOverride
#
CSS class overriding that will be passed to RichContentEditor
or RichContentViewer
.
note
Works similarly to the theme
property of RichContentEditor
and RichContentViewer
.
warning
This API is deprecated in RCE@Next (aka Tiptap based Editor)
isMobile
#
Will render in mobile optimized mode
linkSettings
#
relValue
is Deprecated , please use rel
instead.
Defines the behavior of links. anchorTarget - as defined in HTMLAnchorElement.target relValue - as defined in HTMLAnchorElement.rel customAnchorScroll - enables overriding the default anchor scroll behavior
Examples:
- Links created by the User:
- Links created by UoU:
locale
#
Any two letter string representing a supported locale. Determines the language and text direction of modals and settings.
localeContent
#
Only needed when locale of content is different from UI locale. If not defined locale
prop will be used.
Any two letter string representing a supported locale. Determines the language and text direction of content.
mediaSettings
#
When changing fullscreen's background and foreground colors, make sure to choose colors that aren't too similar.
default colors are:
backgroundColor: 'white';
foregroundColor: 'black';
The string values should be css color strings (e.g 'black'
, '#2F2E2E'
, etc)
pauseMedia
#
When true
, media like videos will be paused.
A possible use case is for pausing videos on tab switch.
disableRightClick
(deprecated)#
Disables the mouse right click functionality for the gallery, video and image plugins.
disableDownload
#
Sets the initial value of disableDownload for image, gallery and video plugins. Images - disables right click. Gallery - disables right click. Video - removes the download option from context menu.
onError
#
TODO
plugins
#
For every plugin you install, import it and add it to the plugins array.
note
For rendering a viewer, import the plugin from the viewer entry point
wix-rich-content-plugin-video/viewer
theme
#
Adding theme to Ricos is possible with providing a RicosTheme
object.
Further read in Theming page.
iframeSandboxDomain
#
In order for the UGC source code to be rendered in an isolated environment, iframeSandboxDomain
config on viewer & editor must be supplied, and be easily changed by consumer in case of DDOS on domain or subdomain
textWrap
#
When a plugin is aligned left/right, text will be next to the plugin (image, galleries, and etc).
Default value:
#
Ricos Editor APIkeyboardShortcuts
#
Customizable keyboard shortcut for Return API, currently limited to Enter
-related shortcuts.
Allows to remap new line
/ soft new line
editor functionalities to Enter
-based combination, or to remap Enter
key to custom action.
name
#
Enter
-related shortcut name
description
#
Free text description, displayed in Shortcuts Sheet help dialog
keys
#
Platform-dependent key combination (common combination: { macOs: 'Shift+Enter', windows: 'Shift+Enter' }
, { macOs: 'Enter', windows: 'Enter' }
, { macOs: 'Meta+Enter', windows: 'Ctrl+Enter' }
)
command
#
Command triggered by shortcut
enabled
#
Enables the shortcut
Example:
rceNext
#
rceNext
: true allows you to enjoy the new Editor.
Please be aware, this is a temporary api!, it will be removed when Draft editor is fully deprecated.
schemaType
#
schemaType
prop, sets the schema type of the Editor, default value is Draft
.
schemaType
: 'RichContent' is used for deprecating Draft Editor, it should be used with rceNext
: true.
Please be aware, this is a temporary api!, it will be removed when Draft editor is fully deprecated.
draft-js props, as described in https://draftjs.org/docs/api-reference-editor
injectedContent
#
Similar to content prop; allows content to be injected to mounted RicosEditor without need for remount.
linkPanelSettings
#
Settings for the link panel component.
showNewTabCheckbox
#
Determines the 'Open link in a new tab' link panel checkbox visibility. By default, it's visible.
showNoFollowCheckbox
#
Determines the 'Add a nofollow tag' link panel checkbox visibility. By default, it's visible.
showSponsoredCheckbox
#
Determines the 'Mark as a sponsored link' link panel checkbox visibility. By default, it's hidden.
showNoReferrerCheckbox
#
Determines the 'Add a noreferrer tag' link panel checkbox visibility. By default, it's visible.
blankTargetToggleVisibilityFn
#
Deprecated , please use showNewTabCheckbox
instead.
Determines the 'Open link in a new tab' link panel checkbox visibility. By default, it's visible.
nofollowRelToggleVisibilityFn
#
Deprecated , please use showNoFollowCheckbox
instead.
Determines the 'Add a nofollow tag' link panel checkbox visibility. By default, it's visible.
placeholder
#
Determines the placeholder to use for the link panel.
By default, its value is "Enter a URL here"
translated by localization
externalPopups
#
Determines the position of the link modal. Passing true places the link modal on the topmost layer. By default, this value is false.
Examples:
- Links created by the User:
- Links created by UoU:
maxTextLength
#
Limits the editor text length to a given value. When the max text length is reached, further text input is ignored. Also, text paste action is canceled if the resulting text would exceed the max length.
modalSettings
#
Customize the ReactModal
of RicosEditor
, or alternatively provide callbacks to create your own Modal.
container
#
When used, container
will be the target of Ricos editor modal (using ReactDOM.createPortal)
ariaHiddenId
#
Accessibility prop.
Provides aria-hidden
attribute to a given DOM Element ID while the modal is open, making it hidden for screenreaders of users.
Passed directly into the ReactModal
's AppElement.
Default Value: body
openModal
& closeModal
#
Legacy RCE's openModal
, closeModal
(helpers)[rce_api/helpers].
note
Leave these empty if you don't plan to use a Modal Component of your own. Otherwise, RicosEditor
will assume you do, and won't handle the ReactModal
it's supplied with.
onBusyChange
#
A function that will be called with true
when the editor is busy, e.g. when a media plugin begins uploading, and will be called with false
when the editor becomes idle again.
onChange
#
A callback that runs whenever the editor's content is edited.
placeholder
#
This text will appear in the editor until content is created
ref
#
A react Ref. Use this to access editor functions.
Function | Description |
---|---|
focus(): void | Focuses the editor |
blur(): void | Blurs the editor |
getContent(): DraftContent | Retrieves current content |
getContentPromise(options: { flush?: boolean; publishId?: string}): Promise<DraftContent> | Retrieves current content promise |
getContentTraits(): { isEmpty: boolean; isContentChanged: boolean; isLastChangeEdit: boolean} | Retrieves current content traits |
getToolbarProps(options: { type: ToolbarType }): { buttons: ToolbarButtonProps[] } | button props for external toolbar |
#
Usage example:ref.getContentPromise
#
Returns (promise) of the Content Data (DraftContent type).
publishId - used for BI (onPublish
event), set it when called before publishing a an editor's content in your app.
flush - trigger blur of the editor to force changes (such as composition mode in android) before getting the content
toolbarSettings
#
getToolbarSettings
#
The getToolbarSettings
API allows to config toolbar appearance and behavior.
#
Built-in editor and plugin toolbars customization#
External toolbar customizationSometimes, the built-in toolbar customization is insufficient. The toolbar externalization API comes to solve these cases. It allows users to implement custom toolbars and buttons, providing all the required button props, e.g. onClick callback, button icon, label, tooltip, etc.
The getToolbarSettings
API allows to configure external toolbars as well. Since external toolbar could be used both for plugin insertion and text formatting, these roles are configured separately. Once the external toolbars are configured, the button props could be retrieved by the editor ref method getToolbarProps
.
#
Insert plugin toolbarThe plugin insertion toolbar configuration object should contain the name: TOOLBARS.INSERT_PLUGIN
field. By default, the shouldCreate
returns false for all the platforms, so it is crucial to override it for button props activation. The getButtons
is expected to return an array of INSERT_PLUGIN_BUTTONS enum values. The default list of the insert plugin button names is passed to the getToolbarSettings
via the pluginButtonNames
argument field.
#
Formatting toolbarThe formatting toolbar configuration object should contain the name: TOOLBARS.FORMATTING
field. By default, the shouldCreate
returns false for all the platforms, so it is crucial to override it for button props activation. The getButtons
is expected to return an array of FORMATTING_BUTTONS enum values. The default list of the button names is passed to the getToolbarSettings
via the textButtons
argument field.
textToolbarContainer
#
Given some container HTML element, the text toolbar will be rendered inside it.
Overrides useStaticTextToolbar
.
In this example we render the static text toolbar below the editor.
useStaticTextToolbar
#
The text toolbar appears inline when selecting some text and allows styling text. Set to true in order to render the text toolbar in a fixed position above the editor.
Hi there! I'm Ricos, your rich content framework. ๐พ
sideBlockComponent
#
When given, component will be placed on the side of every block.
#
Ricos Viewer APIpreview
#
warning
This API exists for backward compatibility, and on its way to deprecation. Please use Content API instead.
A preview decoration for RicosViewer. Read more in Preview
seoSettings
#
When given a truthy value, renders RicosViewer in a SEO optimized mode. An object allows extended configuration.
paywall
#
className - Content blocked by a payall will be marked up using this string (This class will be used by Googlebot to discern between paid and free content on a page level) index - number of free content blocks
addAnchors
#
TODO
textSelectionToolbar
#
When given a truthy value, text-selection-toolbar appears inline when selecting some text and allows tweet text.
Select some text below to see text-selection-toolbar