Skip to main content

EditorEventsContext

withEditorContext#

withEditorContext is a High-Order component, allowing to trigger publish event when content editing is done.

Return value is a promise with finalized content.

editorEvents: {
publish: () => Promise<DraftContent>
}

Usage Example#

import { withEditorContext } from 'wix-rich-content-editor-common/libs/EditorEventsContext';
const YourComponent = ({ editorEvents }) => {
const onPublish = async () => {
const content = await editorEvents.publish();
alert(JSON.stringify(content));
};
return (
<>
<RicosEditor content={content} />
<input type="button" onClick={onPublish} value="publish" />
</>
);
};
export default withEditorContext(YourComponent);

Hi there! I'm Ricos, your rich content framework. ๐Ÿ‘พ