Reference Source
import TextEditor from 'flarum/components/TextEditor.js'
public class | source

TextEditor

Extends:

flarum/Component~Component → TextEditor

The TextEditor component displays a textarea with controls, including a submit button.

Props

  • submitLabel
  • value
  • placeholder
  • disabled

Member Summary

Public Members
public

value: [type]

The value of the textarea.

Method Summary

Public Methods
public

configTextarea(element: DOMElement, isInitialized: Boolean)

Configure the textarea element.

public

Build an item list for the text editor controls.

public

Get the selected range of the textarea.

public

init()

public

Insert content into the textarea at the position of the cursor.

public

oninput(value: String)

Handle input into the textarea.

public

Handle the submit button being clicked.

public

setSelectionRange(start: Integer, end: Integer)

Set the selected range of the textarea.

public

setValue(value: String)

Set the value of the text editor.

public

view(): *

Public Members

public value: [type] source

The value of the textarea.

Public Methods

public configTextarea(element: DOMElement, isInitialized: Boolean) source

Configure the textarea element.

Params:

NameTypeAttributeDescription
element DOMElement
isInitialized Boolean

public controlItems(): ItemList source

Build an item list for the text editor controls.

Return:

ItemList

public getSelectionRange(): Array source

Get the selected range of the textarea.

Return:

Array

public init() source

public insertAtCursor(insert: String) source

Insert content into the textarea at the position of the cursor.

Params:

NameTypeAttributeDescription
insert String

public oninput(value: String) source

Handle input into the textarea.

Params:

NameTypeAttributeDescription
value String

public onsubmit() source

Handle the submit button being clicked.

public setSelectionRange(start: Integer, end: Integer) source

Set the selected range of the textarea.

Params:

NameTypeAttributeDescription
start Integer
end Integer

public setValue(value: String) source

Set the value of the text editor.

Params:

NameTypeAttributeDescription
value String

public view(): * source

Return:

*