Expand all

ve.ui.MWMediaDialog

Extends

Constructor

new ve.ui.MWMediaDialog([config]) #

Dialog for inserting and editing MediaWiki media.

Parameters:

Name Type Attributes Description
config Object optional

Configuration options

Source:
Dialog for inserting and editing MediaWiki media.

Methods

attachImageModel() #

Attach the image model to the dialog

Source:
Attach the image model to the dialog

buildMediaInfoPanel(imageinfo) #

Build the image info panel from the information in the API. Use the metadata info if it exists. Note: Some information in the metadata object needs to be safely stripped from its html wrappers.

Parameters:

Name Type Description
imageinfo Object

Image info

Source:
Build the image info panel from the information in the API.

checkChanged() #

When changes occur, enable the apply button.

Source:
When changes occur, enable the apply button.

chooseImageInfo(info) #

Choose image info for editing

Parameters:

Name Type Description
info Object

Image info

Source:
Choose image info for editing

cleanAPIresponse(html) → {string} #

Clean the API responses and return it in plaintext. If needed, truncate.

Parameters:

Name Type Description
html string

Raw response from the API

Source:

Returns:

Plaintext clean response

Type
string
Clean the API responses and return it in plaintext.

confirmSelectedImage(item) #

Handle new image being chosen.

Parameters:

Name Type Description
item mw.widgets.MediaResultWidget | null

Selected item

Source:
Handle new image being chosen.

fetchThumbnail(imageName, dimensions) → {jQuery.Promise} #

Fetch a bigger image thumbnail from the API.

Parameters:

Name Type Description
imageName string

Image source

dimensions Object

Image dimensions

Source:

Returns:

Thumbnail promise that resolves with new thumb url

Type
jQuery.Promise
Fetch a bigger image thumbnail from the API.

getFileType(url) → {string} #

Get the file type from the suffix of the url

Parameters:

Name Type Description
url string

Full file url

Source:

Returns:

File type

Type
string
Get the file type from the suffix of the url

getLicenseIcon(license) → {string} #

Get the proper icon for the license if it is recognized or general info icon if it is not recognized.

Parameters:

Name Type Description
license string

License short name

Source:

Returns:

Icon name

Type
string

Get the proper icon for the license if it is recognized or general info icon if it is not recognized.

getTeardownProcess() #

onAlternateTextChange(text) #

Respond to change in alternate text

Parameters:

Name Type Description
text string

New alternate text

Source:
Respond to change in alternate text

onBorderCheckboxChange(isSelected) #

Handle change event on the positionCheckbox element.

Parameters:

Name Type Description
isSelected boolean

Checkbox status

Source:
Handle change event on the positionCheckbox element.

onChangeSizeType(sizeType) #

Handle changeSizeType events from the MediaSizeWidget

Parameters:

Name Type Description
sizeType string

Size type

Source:
Handle changeSizeType events from the MediaSizeWidget

onImageModelAlignmentChange(alignment) #

Handle image model alignment change

Parameters:

Name Type Description
alignment string

Image alignment

Source:
Handle image model alignment change

onImageModelTypeChange(type) #

Handle image model type change

Parameters:

Name Type Description
type string

Image type

Source:
Handle image model type change

onInfoValid(isValid) #

Handle infoValid events

Parameters:

Name Type Description
isValid boolean

The panel is complete and valid

Source:
Handle infoValid events

onMediaUploadBookletSet(page) #

Handle panelNameSet events from the upload stack

Parameters:

Name Type Description
page OO.ui.PageLayout

Current page

Source:
Handle panelNameSet events from the upload stack

onPositionCheckboxChange(isSelected) #

Handle change event on the positionCheckbox element.

Parameters:

Name Type Description
isSelected boolean

Checkbox status

Source:
Handle change event on the positionCheckbox element.

onPositionSelectChoose(item) #

Handle change event on the positionSelect element.

Parameters:

Name Type Description
item OO.ui.ButtonOptionWidget

Selected item

Source:
Handle change event on the positionSelect element.

onSearchQueryChange(query) #

Handle query change events from the search input widget

Parameters:

Name Type Description
query string
Source:
Handle query change events from the search input widget

onSearchQueryClear() #

Handle clearing of search query by user clicking on indicator

Source:
Handle clearing of search query by user clicking on indicator

onSearchResultsChoose(item) #

Handle search results choose event.

Parameters:

Name Type Description
item mw.widgets.MediaResultWidget

Chosen item

Source:
Handle search results choose event.

onSearchTabsSet(tabPanel) #

Handle set events from the search tabs

Parameters:

Name Type Description
tabPanel OO.ui.TabPanelLayout

Current tabPanel

Source:
Handle set events from the search tabs

onTypeSelectChoose(item) #

Handle change event on the typeSelect element.

Parameters:

Name Type Description
item OO.ui.MenuOptionWidget

Selected item

Source:
Handle change event on the typeSelect element.

onUploadValid(isValid) #

Handle uploadValid events

Parameters:

Name Type Description
isValid boolean

The panel is complete and valid

Source:
Handle uploadValid events

resetCaption() #

Reset the caption surface

Source:
Reset the caption surface

switchPanels(panel, [noFocus]) #

Switch between the edit and insert/search panels

Parameters:

Name Type Attributes Default Description
panel string

Panel name

noFocus boolean optional
false

Do not put focus into the default field of the panel

Source:
Switch between the edit and insert/search panels

updateFilenameFieldset() #

Update the filename fieldset (link to media page)

Source:
Update the filename fieldset (link to media page)

uploadPageNameSet(pageName) #

The upload booklet's page name has changed

Parameters:

Name Type Description
pageName string

Page name

Source:
The upload booklet's page name has changed

getImportRules() → {Object}static #

Get the import rules for the surface widget in the dialog

Source:
See:

Returns:

Import rules

Type
Object
Get the import rules for the surface widget in the dialog