Expand all

Embed

UI component that provides the user html/wikitext snippets needed to share and/or embed a media asset.

Constructor

new Embed($container) #

Parameters:

Name Type Description
$container jQuery
Source:

Properties

formatter :EmbedFileFormatter #

Formatter converting image data into formats needed for output

Type:

Source:
Formatter converting image data into formats needed for output

LARGE_IMAGE_HEIGHT_THRESHOLD :numberstatic #

Height threshold at which an image is to be considered "large"

Type:

  • number
Source:
Height threshold at which an image is to be considered "large"

LARGE_IMAGE_WIDTH_THRESHOLD :numberstatic #

Width threshold at which an image is to be considered "large"

Type:

  • number
Source:
Width threshold at which an image is to be considered "large"

Methods

attach() #

Registers listeners.

Source:
Registers listeners.

createSizePulldownMenus($container) #

Creates pulldown menus to select file sizes.

Parameters:

Name Type Description
$container jQuery
Source:
Creates pulldown menus to select file sizes.

createSnippetSelectionButtons($container) #

Creates snippet selection buttons.

Parameters:

Name Type Description
$container jQuery
Source:
Creates snippet selection buttons.

createSnippetTextAreas($container) #

Creates text areas for html and wikitext snippets.

Parameters:

Name Type Description
$container jQuery
Source:
Creates text areas for html and wikitext snippets.

getPossibleImageSizesForWikitext(width, height) → {Utils.ImageSizes} #

Calculates possible image sizes for wikitext snippets. It returns up to three possible snippet frame sizes (small, medium, large).

Parameters:

Name Type Description
width number
height number

Returns:

Type
Utils.ImageSizes
Source:
Calculates possible image sizes for wikitext snippets.

getSizeOptions(width, height) → {Embed.SizeOptions} #

Gets size options for html and wikitext snippets.

Parameters:

Name Type Description
width number
height number

Returns:

Type
Embed.SizeOptions
Source:
Gets size options for html and wikitext snippets.

handleSizeSwitch() #

Handles size menu change events.

Source:
Handles size menu change events.

handleTypeSwitch(value) #

Handles snippet type switch.

Parameters:

Name Type Description
value string

'html' or 'wikitext'

Source:
Handles snippet type switch.

resetCurrentSizeMenuToDefault() #

Reset current menu selection to default item.

Source:
Reset current menu selection to default item.

set(imageInfo, [caption], [alt]) #

Sets the data on the element.

Parameters:

Name Type Attributes Description
imageInfo ImageModel
caption string optional
alt string optional
Source:
Sets the data on the element.

unattach() #

Clears listeners.

Source:
Clears listeners.

updateEmbedHtml(thumbnail, width, height) #

Sets the HTML embed text.

Assumes that the set() method has already been called to update this.embedFileInfo

Parameters:

Name Type Description
thumbnail Object

object with a url property (can be empty)

width number

New width to set

height number

New height to set

Source:
Sets the HTML embed text.

updateEmbedWikitext(width) #

Updates the wikitext embed text with a new value for width.

Assumes that the set method has already been called.

Parameters:

Name Type Description
width number
Source:
Updates the wikitext embed text with a new value for width.

Type Definitions

SizeOptions #

Type:

Properties:

Name Type Description
html Utils.ImageSizes

Collection of possible image sizes for html snippets

wikitext Utils.ImageSizes

Collection of possible image sizes for wikitext snippets

Source: