Class: Editor

Annotations.FreeTextAnnotation. Editor

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

new Editor()

Methods


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 Annotations.FreeTextAnnotation.Editor.Format
value Annotations.FreeTextAnnotation.Editor.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
CoreControls.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