Expand all

ve.ui.MWLanguageVariantOneWayInspector

Extends

Constructor

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

Parameters:

Name Type Attributes Description
config Object optional

Configuration options

Source:
Editor for "one-way" rules.

Properties

getContentFromInspector #

Convert the current inspector state to new content which can be used to update the ve.dm.SurfaceFragment backing this inspector.

Overrides:
Source:

Convert the current inspector state to new content which can be used to update the ve.dm.SurfaceFragment backing this inspector.

getDefaultVariantInfo #

Return a valid variantInfo object which will be used when a new node of this subclass is inserted. For instance, ve.ui.MWLanguageVariantDisabledInspector will return the appropriate object to use when the equivalent of wikitext -{}- is inserted in the document.

Overrides:
Source:

Return a valid variantInfo object which will be used when a new node of this subclass is inserted.

Methods

createItem([from], [lang], [to]) → {Object} #

Create widgets corresponding to a given mapping given by this rule.

Parameters:

Name Type Attributes Description
from string optional

The HTML source text.

lang string optional

The language code for the destination text.

to string optional

The HTML destination text.

Source:

Returns:

An object containing the required widgets and backing documents for this mapping item.

Type
Object
Create widgets corresponding to a given mapping given by this rule.

createTextTarget([placeholder]) → {ve.ui.TargetWidget} #

Helper function to create a subdocument editor for HTML embedded in the language variant node.

Parameters:

Name Type Attributes Description
placeholder string optional

Placeholder text for this editor.

Inherited from:
Source:

Returns:

Type
ve.ui.TargetWidget

Helper function to create a subdocument editor for HTML embedded in the language variant node.

getHtmlForDoc(doc) → {string} #

Helper function to serialize the document backing a ve.ui.TargetWidget back into HTML which can be embedded into the language variant node. This method needs to do a bit of hackery to remove unnecessary p-wrapping and (TODO) determine if an inline node needs to be converted to a block node or vice-versa.

Parameters:

Name Type Description
doc ve.dm.Document

The document backing an editor widget, as returned by ve.ui.MWLanguageVariantInspector#setupTextTargetDoc.

Inherited from:
Source:

Returns:

An HTML string appropriate for embedding into a language variant node.

Type
string

Helper function to serialize the document backing a ve.ui.TargetWidget back into HTML which can be embedded into the language variant node.

getSetupProcess([data]) → {OO.ui.Process} #

Handle the inspector being setup.

Parameters:

Name Type Attributes Description
data Object optional

Inspector opening data

Overrides:
Source:

Returns:

Type
OO.ui.Process
Handle the inspector being setup.

initialize() #

Handle frame ready events.

onAddButtonClick() #

Create a new mapping item in the inspector.

Source:
Create a new mapping item in the inspector.

onClearButtonClick(item) #

Remove a mapping item from the inspector.

Parameters:

Name Type Description
item Object
Source:
Remove a mapping item from the inspector.

setupTextTargetDoc([textTarget], [htmlString]) → {ve.dm.Document} #

Helper function to initialize a ve.ui.TargetWidget with a given HTML string extracted from the language variant node.

Parameters:

Name Type Attributes Description
textTarget ve.ui.TargetWidget optional

A subdocument editor widget created by ve.ui.MWLanguageVariantInspector#createTextTarget.

htmlString string optional

The HTML string extracted from this node.

Inherited from:
Source:

Returns:

The document model now backing the widget.

Type
ve.dm.Document

Helper function to initialize a ve.ui.TargetWidget with a given HTML string extracted from the language variant node.