Reference Source
import Composer from 'flarum/components/Composer'
public class | source

Composer

Extends:

Component → Composer

The Composer component displays the composer. It can be loaded with a content component with load and then its position/state can be altered with show, hide, close, minimize, fullScreen, and exitFullScreen.

Member Summary

Public Members
public
public

Whether or not the composer currently has focus.

public
public

handle: *

public

height: Integer

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

public

position: Composer.PositionEnum

The composer's current position.

Method Summary

Public Methods
public

animateToPosition(position: Composer.PositionEnum)

Animate the Composer into the given position.

public

changeHeight(height: Integer)

Save a new Composer height and update the DOM.

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

computedHeight(): Integer | String

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

public

config(isInitialized: *, context: *)

public

configHandle(element: DOMElement, isInitialized: Boolean)

Add the necessary event handlers to the composer's handle so that it can be used to resize the composer.

public

Build an item list for the composer's controls.

public

defaultHeight(): Integer

Default height of the Composer in case none is saved.

public

Exit fullscreen mode.

public

Take the composer into fullscreen mode.

public

hide()

Close the composer.

public

Hide the Composer backdrop.

public

init()

public

Initialize default Composer height.

public

Determine whether or not the Composer is covering the screen.

public

load(component: Component)

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

onmousemove(e: Event)

Resize the composer according to mouse movement.

public

Finish resizing the composer when the mouse is released.

public

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

public

show()

Show the composer.

public

Show the Composer backdrop.

public

Update the amount of padding-bottom on the body so that the page's content will still be visible above the composer when the page is scrolled right to the bottom.

public

Update the DOM to reflect the composer's current height. This involves setting the height of the composer's root element, and adjusting the height of any flexible elements inside the composer's body.

public

view(): *

Inherited Summary

From class Component
public static

component(props: Object, children: *): Object

Get a Mithril component object for this component, preloaded with props.

public static

initProps(props: Object)

Initialize the component's props.

public

element: *

The root DOM element for the component.

public

The properties passed into the component.

public

Whether or not to retain the component's subtree on redraw.

public

$(selector: String): jQuery

Returns a jQuery object for this component's element. If you pass in a selector string, this method will return a jQuery object, using the current element as its buffer.

For example, calling component.$('li') will return a jQuery object containing all of the li elements inside the DOM element of this component.

public

config(isInitialized: Boolean, context: Object, vdom: Object)

Called after the component's root element is redrawn. This hook can be used to perform any actions on the DOM, both on the initial draw and any subsequent redraws. See Mithril's documentation for more information.

public

Called when the component is destroyed, i.e.

public

Get the renderable virtual DOM that represents the component's view.

This should NOT be overridden by subclasses. Subclasses wishing to define their virtual DOM should override Component#view instead.

protected

init()

Called when the component is constructed.

protected

Get the virtual DOM that represents the component's view.

Public Members

public $backdrop: * source

public active: Boolean source

Whether or not the composer currently has focus.

public component: * source

Get a Mithril component object for this component, preloaded with props.

Override:

Component#component

public handle: * source

public height: Integer source

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

public position: Composer.PositionEnum source

The composer's current position.

Public Methods

public animateToPosition(position: Composer.PositionEnum) source

Animate the Composer into the given position.

Params:

NameTypeAttributeDescription
position Composer.PositionEnum

public changeHeight(height: Integer) source

Save a new Composer height and update the DOM.

Params:

NameTypeAttributeDescription
height Integer

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 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 config(isInitialized: *, context: *) source

Called after the component's root element is redrawn. This hook can be used to perform any actions on the DOM, both on the initial draw and any subsequent redraws. See Mithril's documentation for more information.

Override:

Component#config

Params:

NameTypeAttributeDescription
isInitialized *
context *

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

Add the necessary event handlers to the composer's handle so that it can be used to resize the composer.

Params:

NameTypeAttributeDescription
element DOMElement
isInitialized Boolean

public controlItems(): ItemList source

Build an item list for the composer's controls.

Return:

ItemList

public defaultHeight(): Integer source

Default height of the Composer in case none is saved.

Return:

Integer

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 hideBackdrop() source

Hide the Composer backdrop.

public init() source

Called when the component is constructed.

Override:

Component#init

public initializeHeight() source

Initialize default Composer height.

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 the Composer is positioned absolutely as on mobile devices.

Return:

Boolean

public load(component: Component) source

Load a content component into the composer.

Params:

NameTypeAttributeDescription
component Component

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 onmousemove(e: Event) source

Resize the composer according to mouse movement.

Params:

NameTypeAttributeDescription
e Event

public onmouseup() source

Finish resizing the composer when the mouse is released.

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.

public showBackdrop() source

Show the Composer backdrop.

public updateBodyPadding() source

Update the amount of padding-bottom on the body so that the page's content will still be visible above the composer when the page is scrolled right to the bottom.

public updateHeight() source

Update the DOM to reflect the composer's current height. This involves setting the height of the composer's root element, and adjusting the height of any flexible elements inside the composer's body.

public view(): * source

Get the virtual DOM that represents the component's view.

Override:

Component#view

Return:

*