Expand all

abstract ve.ui.MWDefinedTransclusionContextItem

Extends

Constructor

new ve.ui.MWDefinedTransclusionContextItem(context, model, [config])abstract #

Context item for a defined MWTransclusion.

Templates are defined on-wiki using the message page [[MediaWiki:Visualeditor-template-tools-definition.json]]

Example: { // This key is the static name of the ve.ui.ContextItem "citationNeeded": [ { // Normalized title string, or list of strings (for redirects) "title": [ "Citation needed", "cn" ], // Extra params. This whole object can be accessed // via #getMatchedTool "params": { "reason": "reason", "date": "date" } }, { "title": "Cite quote", "params": { "date": "date" } } ] }

Parameters:

Name Type Attributes Description
context ve.ui.LinearContext

Context the item is in

model ve.dm.Model

Model the item is related to

config Object optional
Source:
Context item for a defined MWTransclusion.

Properties

templatestatic #

Only display item for single-template transclusions of these templates.

Properties:

Type Description
string | Array.<string> | null
Source:
Only display item for single-template transclusions of these templates.

Methods

getCanonicalParam(name) → {string|null} #

Get a template param using its canonical name

Parameters:

Name Type Description
name string

Canonical parameter name

Source:

Returns:

Param wikitext, null if not found

Type
string | null
Get a template param using its canonical name

toggleLoadingVisualization([isLoading])private #

Parameters:

Name Type Attributes Default Description
isLoading boolean optional
false
Inherited from:
Source:

getMatchedTool(model) → {Object|null}static #

Get the tool definition that matches a specific model, if any

Parameters:

Name Type Description
model ve.dm.Model
Source:

Returns:

Tool definition, or null if no match

Type
Object | null
Get the tool definition that matches a specific model, if any

getToolsByTitle() → {Object}static #

Get tool definitions, indexed by normalized title

Source:

Returns:

Collection of tool definitions

Type
Object
Get tool definitions, indexed by normalized title