# Class: RichTextEditor

## Core.Annotations.FreeTextAnnotation. RichTextEditor

A class that represents controls used for editing contents of a freetext annotation

#### new RichTextEditor()

### Methods

#### <static> getEditorOptions()

  Gets the Quill editor options.

  ##### Returns:

  Quill options that are currently set.
  Type
    Core.Annotations.FreeTextAnnotation.RichTextEditor.QuillEditorOptions

#### <static> setEditorOptions(options)

  Sets the Quill editor options.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `options` | Core.Annotations.FreeTextAnnotation.RichTextEditor.QuillEditorOptions | Quill options to be set.

#### deleteText(index, length)

  Delete some content from the editor.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `index` | number | the start index of the range
  `length` | number | the length of the range

#### format(format, value)

  Format text at the current selection. If the current selection has length of 0, then the format will be set active.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `format` | Core.Annotations.FreeTextAnnotation.RichTextEditor.Format |
  `value` | Core.Annotations.FreeTextAnnotation.RichTextEditor.FormatValue |

#### getContents()

  Gets the current contents in the editor

  ##### Returns:

  Returns the current contents in the editor
  Type
    string

#### getFormat(index, length)

  Gets the format of the text in the given range.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `index` | number | the start index of the range
  `length` | number | the length of the range

  ##### Returns:

  Returns the format of the given range
  Type
    object

#### getSelection()

  Gets the current selection range in the editor.

  ##### Returns:

  Returns the current selection range
  Type
    Core.EditBoxManager.Range

#### hasFocus()

  Checks if the editor is being focused.

  ##### Returns:

  Whether the editor is focused
  Type
    boolean

#### insertText(index, contents)

  Insert the content in the editor.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `index` | number | the start index of the range
  `contents` | string | the contents that need to be updated in the editor

#### setSelection(index, length)

  Sets the current selection in the editor.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `index` | number | the start index of the range
  `length` | number | the length of the selection range

#### setText(contents)

  Sets the content in the editor.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `contents` | string | the contents that need to be updated in the editor

### Type Definitions

#### Format

  The available formats of an editor instance

  ##### Type:

  - 'color' | 'bold' | 'italic' | 'underline' | 'strike'

#### FormatValue

  The value of a format. The value should be a hex color string(e.g. #FF00FF) for the `color` format, and boolean for the rest of formats.

  ##### Type:

  - string | boolean

#### QuillEditorOptions

  ##### Properties:

  Name | Type | Description
  --- | --- | ---
  `bounds` | Element | DOM Element or a CSS selector for a DOM Element, within which the editor’s UI elements (i.e. tooltips, etc.) should be confined. Currently, it only considers left and right boundaries.
  `debug` | string | Shortcut for debug. Note debug is a static method and will affect other instances of Quill editors on the page. Only warning and error messages are enabled by default.
  `formats` | object | [WARNING: this is not fully supported by WebViewer and may result in unexpected behavior] Whitelist of formats to allow in the editor. See Formats for a complete list.
  `modules` | object | Collection of modules to include and respective options. See Modules for more information.
  `placeholder` | string | Placeholder text to show when editor is empty.
  `readOnly` | boolean | Whether to instantiate the editor in read-only mode.
  `scrollingContainer` | Element | DOM Element or a CSS selector for a DOM Element, specifying which container has the scrollbars (i.e. overflow-y: auto), if is has been changed from the default ql-editor with custom CSS. Necessary to fix scroll jumping bugs when Quill is set to auto grow its height, and another ancestor container is responsible from the scrolling.
  `theme` | string | [WARNING: this is not fully supported by WebViewer and may result in unexpected behavior] Themes to use for the editor.

#### Search results