Skip to main content

API overview

RichText constructor

new richtext.RichText("#root", {
// configuration parameters
});

Parameters:

  • an HTML container (e.g., CSS selector or DOM element)
  • a configuration object (see properties)

RichText methods

NameDescription
getValue()Returns the RichText value
setValue()Applies a new value to RichText
setConfig()Applies new configuration parameters to RichText
setLocale()Applies a new locale to RichText
destructor()Removes all HTML elements of RichText, and detaches all related events

Event Bus methods

NameDescription
api.exec()Allows triggering inner events
api.intercept()Allows intercepting and preventing the inner events
api.on()Allows attaching a handler to the inner events
api.detach()Allows removing/detaching event handlers
api.setNext()Allows adding some action into the Event Bus order

State methods

NameDescription
api.getState()Returns an object with the StateStore properties of RichText
api.getReactiveState()Returns an object with the reactive properties of RichText

Events

NameDescription
alignFires when text alignment is changed via the menubar/toolbar or Event Bus methods
clear-text-formatFires when a text format is cleared via the menubar/toolbar or Event Bus methods
copyFires when copying selected text
create-newFires when pressing the "New" option within the menubar or via Event Bus methods
cutFires when cutting selected text
delete-linkFires when deleting a link
exportFires after pressing the "Export" option in the menubar or via Event Bus methods
importFires after pressing the "Import" option in the menubar or via Event Bus methods
indentFires when increasing block indention
insert-imageFires when inserting image
insert-lineFires when inserting horizontal line
insert-linkFires when inserting link
insert-listFires when inserting list
outdentFires when decreasing block indention
pasteFires when pasting content
printFires when printing document
redoFires when pressing the "Redo" button in the menubar/toolbar or via Event Bus methods
resize-imageFires when resizing image
set-font-familyFires when setting a font family
set-font-sizeFires when setting a font size
set-line-heightFires when setting a line height
set-text-colorFires when setting a text color and/or a background text color
set-text-formatFires when setting a text format
set-text-styleFires when setting a text style
show-popupFires when a popup is shown/hidden
subscriptFires when pressing the "Subscript" button in the menubar/toolbar or via Event Bus methods
superscriptFires when pressing the "Superscript" button in the menubar/toolbar or via Event Bus methods
toggle-fullscreen-modeFires when toggling the full screen mode
toggle-layout-modeFires when toggling the layout mode
toggle-shortcut-infoFires when toggling the shortcut info
undoFires when pressing the "Undo" button in the menubar/toolbar or via Event Bus methods
update-linkFires when updating link

Properties

NameDescription
defaultStylesOptional. Specifies default style values for specific block types
fullscreenModeOptional. Enables the RichText fullscreen mode
imageUploadUrlOptional. Specifies the URL which will be used for image upload
layoutModeOptional. Specifies the layout mode for the main editor area
localeOptional. An object that includes localization labels of RichText
menubarOptional. Enables the top menubar of RichText
toolbarOptional. Enables toolbar and allows users to specify/configure buttons displayed within toolbar
valueOptional. Specifies the initial value (content) displayed within the editor area of RichText