mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/VisualEditor
synced 2024-11-28 08:10:35 +00:00
d02c0bbf45
Like transclusions, extensions can contain nodes of other types. This hasn't been an issue because the legacy parser doesn't generate content with these annotations. But, moving forward, as Parsoid becoming responsible for more extensions. This is the case for the new ImageMap implementation. Matches I95767e466803f0744b6626204a0a3a1514fff174 Change-Id: I6ff81a01207e2734090c626b177e5f4d10bb6d61
48 lines
1.2 KiB
JavaScript
48 lines
1.2 KiB
JavaScript
/*!
|
|
* VisualEditor DataModel MWAlienExtensionNode class.
|
|
*
|
|
* @copyright 2011-2020 VisualEditor Team and others; see AUTHORS.txt
|
|
* @license The MIT License (MIT); see LICENSE.txt
|
|
*/
|
|
|
|
/**
|
|
* DataModel MediaWiki alien extension node.
|
|
*
|
|
* @class
|
|
* @abstract
|
|
*
|
|
* @constructor
|
|
*/
|
|
ve.dm.MWAlienExtensionNode = function VeDmMWAlienExtensionNode() {};
|
|
|
|
/* Inheritance */
|
|
|
|
OO.initClass( ve.dm.MWAlienExtensionNode );
|
|
|
|
/* Static members */
|
|
|
|
ve.dm.MWAlienExtensionNode.static.getMatchRdfaTypes = function () {
|
|
return [
|
|
/^mw:Extension/
|
|
];
|
|
};
|
|
|
|
// Similar to transclusions, extension encapsulation nodes can be of various types
|
|
ve.dm.MWAlienExtensionNode.static.allowedRdfaTypes = null;
|
|
|
|
ve.dm.MWAlienExtensionNode.static.toDataElement = function ( domElements, converter ) {
|
|
// 'Parent' method
|
|
var element = ve.dm.MWExtensionNode.static.toDataElement.call( this, domElements, converter ),
|
|
isInline = this.isHybridInline( domElements, converter );
|
|
|
|
element.type = isInline ? 'mwAlienInlineExtension' : 'mwAlienBlockExtension';
|
|
return element;
|
|
};
|
|
|
|
/**
|
|
* @inheritdoc ve.dm.MWExtensionNode
|
|
*/
|
|
ve.dm.MWAlienExtensionNode.static.getExtensionName = function ( dataElement ) {
|
|
return dataElement.attributes.mw.name;
|
|
};
|