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

DiscussionComposer

Extends:

src/common/Component.js~ComponentComposerBody → DiscussionComposer

The DiscussionComposer component displays the composer content for starting a new discussion. It adds a text field as a header control so the user can enter the title of their discussion. It also overrides the submit and willExit actions to account for the title.

Attrs

  • All of the attrs for ComposerBody
  • titlePlaceholder

Static Method Summary

Static Public Methods
public static

initAttrs(attrs: *)

Member Summary

Public Members
public
public

The value of the title input.

Method Summary

Public Methods
public

Get the data to submit to the server when the discussion is saved.

public

hasChanges(): *

public
public

oninit(vnode: *)

public

onkeydown(e: Event)

Handle the title input's keydown event. When the return key is pressed, move the focus to the start of the text editor.

public

Inherited Summary

From class ComposerBody
public
public

content: *

this member was deprecated. BC layer, remove in Beta 15.
public

editor: *

public

Whether or not the component is loading.

public

Check if there is any unsaved data.

public

Build an item list for the composer's header.

public

loaded()

Stop loading.

public

oninit(vnode: *)

public abstract

Handle the submit event of the text editor.

public

view(): *

Static Public Methods

public static initAttrs(attrs: *) source

Params:

NameTypeAttributeDescription
attrs *

Public Members

public loading: boolean source

Whether or not the component is loading.

Override:

ComposerBody#loading

public title: Function source

The value of the title input.

Public Methods

public data(): Object source

Get the data to submit to the server when the discussion is saved.

Return:

Object

public hasChanges(): * source

Check if there is any unsaved data.

Override:

ComposerBody#hasChanges

Return:

*

public headerItems(): * source

Build an item list for the composer's header.

Override:

ComposerBody#headerItems

Return:

*

public oninit(vnode: *) source

Override:

ComposerBody#oninit

Params:

NameTypeAttributeDescription
vnode *

public onkeydown(e: Event) source

Handle the title input's keydown event. When the return key is pressed, move the focus to the start of the text editor.

Params:

NameTypeAttributeDescription
e Event

public onsubmit() source

Handle the submit event of the text editor.

Override:

ComposerBody#onsubmit