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 #

Formatter converting image data into formats needed for output

Properties:

Type Description
EmbedFileFormatter
Source:
Formatter converting image data into formats needed for output

LARGE_IMAGE_HEIGHT_THRESHOLDstatic #

Properties:

Name Type Description
Height number

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

Source:

LARGE_IMAGE_WIDTH_THRESHOLDstatic #

Properties:

Name Type Description
Width number

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

Source:

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 Thumbnail

(can be just an empty object)

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: