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

AvatarEditor

Extends:

flarum/Component~Component → AvatarEditor

The AvatarEditor component displays a user's avatar along with a dropdown menu which allows the user to upload/remove the avatar.

Props

  • className
  • user

Static Method Summary

Static Public Methods
public static

initProps(props: *)

Member Summary

Public Members
public

Whether or not an avatar upload is in progress.

Method Summary

Public Methods
public

Get the items in the edit avatar dropdown menu.

public

init()

public

quickUpload(e: Event)

If the user doesn't have an avatar, there's no point in showing the controls dropdown, because only one option would be viable: uploading.

public

remove()

Remove the user's avatar.

public

upload()

Prompt the user to upload a new avatar.

public

view(): *

Protected Methods
protected

failure(response: Object)

If avatar upload/removal fails, stop loading.

protected

success(response: Object)

After a successful upload/removal, push the updated user data into the store, and force a recomputation of the user's avatar color.

Static Public Methods

public static initProps(props: *) source

Params:

NameTypeAttributeDescription
props *

Public Members

public loading: Boolean source

Whether or not an avatar upload is in progress.

Public Methods

public controlItems(): ItemList source

Get the items in the edit avatar dropdown menu.

Return:

ItemList

public init() source

public quickUpload(e: Event) source

If the user doesn't have an avatar, there's no point in showing the controls dropdown, because only one option would be viable: uploading. Thus, when the avatar editor's dropdown toggle button is clicked, we prompt the user to upload an avatar immediately.

Params:

NameTypeAttributeDescription
e Event

public remove() source

Remove the user's avatar.

public upload() source

Prompt the user to upload a new avatar.

public view(): * source

Return:

*

Protected Methods

protected failure(response: Object) source

If avatar upload/removal fails, stop loading.

Params:

NameTypeAttributeDescription
response Object

protected success(response: Object) source

After a successful upload/removal, push the updated user data into the store, and force a recomputation of the user's avatar color.

Params:

NameTypeAttributeDescription
response Object