Reference Source
import ComposerState from 'flarum/forum/states/ComposerState'
public class | source

ComposerState

Constructor Summary

Public Constructor
public

Member Summary

Public Members
public

The dynamic component being shown inside the composer.

public

editor: EditorDriverInterface | null

A reference to the text editor that allows text manipulation.

public

fields: {"content": *}

public

height: Integer

The composer's intended height, which can be modified by the user (by dragging the composer handle).

public

onExit: *

public

position: ComposerState.Position

The composer's current position.

Method Summary

Public Methods
public

bodyMatches(type: object, data: object): boolean

Determine whether the body matches the given component class and data.

public

clear()

Clear the composer's content component.

public

close()

Confirm with the user so they don't lose their content, then close the composer.

public

Check whether or not the user is currently composing a reply to a discussion.

public

computedHeight(): Integer | String

Computed the composer's current height, based on the intended height, and the composer's current state.

public

Exit fullscreen mode.

public

Take the composer into fullscreen mode.

public

hide()

Close the composer.

public

Determine whether or not the Composer is covering the screen.

public

Determine whether or not the Composer is visible.

public

load(componentClass: ComposerBody)

Load a content component into the composer.

public

maximumHeight(): Integer

Maxmimum height of the Composer.

public

Minimize the composer.

public

minimumHeight(): Integer

Minimum height of the Composer.

public

preventClosingWhen(callback: Function, message: String)

Configure when / what to ask the user before closing the composer.

public

Confirm with the user that they want to close the composer and lose their content.

public

show()

Show the composer.

Public Constructors

public constructor() source

Public Members

public body: Object source

The dynamic component being shown inside the composer.

public editor: EditorDriverInterface | null source

A reference to the text editor that allows text manipulation.

public fields: {"content": *} source

public height: Integer source

The composer's intended height, which can be modified by the user (by dragging the composer handle).

public onExit: * source

public position: ComposerState.Position source

The composer's current position.

Public Methods

public bodyMatches(type: object, data: object): boolean source

Determine whether the body matches the given component class and data.

Params:

NameTypeAttributeDescription
type object

The component class to check against. Subclasses are accepted as well.

data object

Return:

boolean

public clear() source

Clear the composer's content component.

public close() source

Confirm with the user so they don't lose their content, then close the composer.

public composingReplyTo(discussion: Discussion): Boolean source

Check whether or not the user is currently composing a reply to a discussion.

Params:

NameTypeAttributeDescription
discussion Discussion

Return:

Boolean

public computedHeight(): Integer | String source

Computed the composer's current height, based on the intended height, and the composer's current state. This will be applied to the composer's content's DOM element.

Return:

Integer | String

public exitFullScreen() source

Exit fullscreen mode.

public fullScreen() source

Take the composer into fullscreen mode. Has no effect if the composer is hidden.

public hide() source

Close the composer.

public isFullScreen(): Boolean source

Determine whether or not the Composer is covering the screen.

This will be true if the Composer is in full-screen mode on desktop, or if we are on a mobile device, where we always consider the composer as full-screen..

Return:

Boolean

public isVisible(): boolean source

Determine whether or not the Composer is visible.

True when the composer is displayed on the screen and has a body component. It could be open in "normal" or full-screen mode, or even minimized.

Return:

boolean

public load(componentClass: ComposerBody) source

Load a content component into the composer.

Params:

NameTypeAttributeDescription
componentClass ComposerBody

public maximumHeight(): Integer source

Maxmimum height of the Composer.

Return:

Integer

public minimize() source

Minimize the composer. Has no effect if the composer is hidden.

public minimumHeight(): Integer source

Minimum height of the Composer.

Return:

Integer

public preventClosingWhen(callback: Function, message: String) source

Configure when / what to ask the user before closing the composer.

The provided callback will be used to determine whether asking for confirmation is necessary. If the callback returns true at the time of closing, the provided text will be shown in a standard confirmation dialog.

Params:

NameTypeAttributeDescription
callback Function
message String

public preventExit(): Boolean source

Confirm with the user that they want to close the composer and lose their content.

Return:

Boolean

Whether or not the exit was cancelled.

public show() source

Show the composer.