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
| Name | Description |
|---|---|
| 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
| Name | Description |
|---|---|
| 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
| Name | Description |
|---|---|
| api.getState() | Returns an object with the StateStore properties of RichText |
| api.getReactiveState() | Returns an object with the reactive properties of RichText |
Events
| Name | Description |
|---|---|
| align | Fires when text alignment is changed via the menubar/toolbar or Event Bus methods |
| clear-text-format | Fires when a text format is cleared via the menubar/toolbar or Event Bus methods |
| copy | Fires when copying selected text |
| create-new | Fires when pressing the "New" option within the menubar or via Event Bus methods |
| cut | Fires when cutting selected text |
| delete-link | Fires when deleting a link |
| export | Fires after pressing the "Export" option in the menubar or via Event Bus methods |
| import | Fires after pressing the "Import" option in the menubar or via Event Bus methods |
| indent | Fires when increasing block indention |
| insert-image | Fires when inserting image |
| insert-line | Fires when inserting horizontal line |
| insert-link | Fires when inserting link |
| insert-list | Fires when inserting list |
| outdent | Fires when decreasing block indention |
| paste | Fires when pasting content |
| Fires when printing document | |
| redo | Fires when pressing the "Redo" button in the menubar/toolbar or via Event Bus methods |
| resize-image | Fires when resizing image |
| set-font-family | Fires when setting a font family |
| set-font-size | Fires when setting a font size |
| set-line-height | Fires when setting a line height |
| set-text-color | Fires when setting a text color and/or a background text color |
| set-text-format | Fires when setting a text format |
| set-text-style | Fires when setting a text style |
| show-popup | Fires when a popup is shown/hidden |
| subscript | Fires when pressing the "Subscript" button in the menubar/toolbar or via Event Bus methods |
| superscript | Fires when pressing the "Superscript" button in the menubar/toolbar or via Event Bus methods |
| toggle-fullscreen-mode | Fires when toggling the full screen mode |
| toggle-layout-mode | Fires when toggling the layout mode |
| toggle-shortcut-info | Fires when toggling the shortcut info |
| undo | Fires when pressing the "Undo" button in the menubar/toolbar or via Event Bus methods |
| update-link | Fires when updating link |
Properties
| Name | Description |
|---|---|
| defaultStyles | Optional. Specifies default style values for specific block types |
| fullscreenMode | Optional. Enables the RichText fullscreen mode |
| imageUploadUrl | Optional. Specifies the URL which will be used for image upload |
| layoutMode | Optional. Specifies the layout mode for the main editor area |
| locale | Optional. An object that includes localization labels of RichText |
| menubar | Optional. Enables the top menubar of RichText |
| toolbar | Optional. Enables toolbar and allows users to specify/configure buttons displayed within toolbar |
| value | Optional. Specifies the initial value (content) displayed within the editor area of RichText |