/*! * VisualEditor DataModel MWInlineImage class. * * @copyright 2011-2019 VisualEditor Team and others; see AUTHORS.txt * @license The MIT License (MIT); see LICENSE.txt */ /** * DataModel MediaWiki image node. * * @class * @extends ve.dm.LeafNode * @mixins ve.dm.MWImageNode * * @constructor * @param {Object} [element] Reference to element in linear model */ ve.dm.MWInlineImageNode = function VeDmMWInlineImageNode() { // Parent constructor ve.dm.MWInlineImageNode.super.apply( this, arguments ); // Mixin constructors ve.dm.MWImageNode.call( this ); }; /* Inheritance */ OO.inheritClass( ve.dm.MWInlineImageNode, ve.dm.LeafNode ); // Need to mixin base class as well (T92540) OO.mixinClass( ve.dm.MWInlineImageNode, ve.dm.GeneratedContentNode ); OO.mixinClass( ve.dm.MWInlineImageNode, ve.dm.MWImageNode ); /* Static Properties */ ve.dm.MWInlineImageNode.static.isContent = true; ve.dm.MWInlineImageNode.static.name = 'mwInlineImage'; ve.dm.MWInlineImageNode.static.preserveHtmlAttributes = function ( attribute ) { var attributes = [ 'typeof', 'class', 'src', 'resource', 'width', 'height', 'href', 'data-mw' ]; return attributes.indexOf( attribute ) === -1; }; // is here for backwards compatibility with Parsoid content that may be // stored in RESTBase. This is now generated as . It should // be safe to remove when verion 1.5 content is no longer acceptable. ve.dm.MWInlineImageNode.static.matchTagNames = [ 'span', 'figure-inline' ]; ve.dm.MWInlineImageNode.static.blacklistedAnnotationTypes = [ 'link' ]; ve.dm.MWInlineImageNode.static.toDataElement = function ( domElements, converter ) { var dataElement, attributes, types, figureInline = domElements[ 0 ], imgWrapper = figureInline.children[ 0 ], // or img = imgWrapper.children[ 0 ], // ,