Expand all

abstract ve.dm.MWImageNode

Extends

Constructor

new ve.dm.MWImageNode()abstract #

DataModel MediaWiki image node.

Properties

tagsToSrcAttrs :Objectstatic #

Map media tags to source attributes

Type:

Source:
Map media tags to source attributes

Methods

createScalable() #

getFilename() → {string} #

Get the normalised filename of the image

Source:

Returns:

Filename (including namespace)

Type
string
Get the normalised filename of the image

getMediaType() → {string|undefined} #

Get symbolic name of media type.

Example values: "BITMAP" for JPEG or PNG images; "DRAWING" for SVG graphics

Source:

Returns:

Symbolic media type name, or undefined if empty

Type
string | undefined
Get symbolic name of media type.

getRdfa() → {string} #

Get RDFa type

Source:

Returns:

RDFa type

Type
string
Get RDFa type

onAttributeChange(key, from, to) #

Respond to attribute change. Update the rendering of the 'align', src', 'width' and 'height' attributes when they change in the model.

Parameters:

Name Type Description
key string

Attribute key

from string

Old value

to string

New value

Source:
Respond to attribute change.

getHashObjectForRendering()static #

getRdfa(mediaClass, frameType, isError) → {string}static #

Get RDFa type

Parameters:

Name Type Description
mediaClass string

Media class, one of 'File', 'Image', 'Video' or 'Audio'

frameType string

Frame type, one of 'none', 'frameless', 'thumb' or 'frame'

isError boolean

Whether the included media file is missing

Source:

Returns:

RDFa type

Type
string
Get RDFa type

getScalablePromise(filename) → {jQuery.Promise}static #

Get the scalable promise which fetches original dimensions from the API

Parameters:

Name Type Description
filename string

The image filename whose details the scalable will represent

Source:

Returns:

Promise which resolves after the image size details are fetched from the API

Type
jQuery.Promise
Get the scalable promise which fetches original dimensions from the API

resizeToBoundingBox(imageDimensions, boundingBox) → {Object}static #

Translate the image dimensions into new ones according to the bounding box.

Parameters:

Name Type Description
imageDimensions Object

Width and height of the image

boundingBox Object

The limit of the bounding box

Source:

Returns:

The new width and height of the scaled image.

Type
Object
Translate the image dimensions into new ones according to the bounding box.

scaleToThumbnailSize(dimensions, [mediaType]) → {Object}static #

Take the given dimensions and scale them to thumbnail size.

Parameters:

Name Type Attributes Description
dimensions Object

Width and height of the image

mediaType string optional

Media type 'DRAWING' or 'BITMAP'

Source:

Returns:

The new width and height of the scaled image

Type
Object
Take the given dimensions and scale them to thumbnail size.

syncScalableToType(type, mediaType, scalable)static #

Update image scalable properties according to the image type.

Parameters:

Name Type Description
type string

The new image type

mediaType string

Image media type 'DRAWING' or 'BITMAP'

scalable ve.dm.Scalable

The scalable object to update

Source:
Update image scalable properties according to the image type.