%PDF- %PDF-
Direktori : /www/varak.net/wiki.varak.net/extensions/VisualEditor/lib/ve/src/dm/nodes/ |
Current File : /www/varak.net/wiki.varak.net/extensions/VisualEditor/lib/ve/src/dm/nodes/ve.dm.AlienNode.js |
/*! * VisualEditor DataModel AlienNode, AlienBlockNode and AlienInlineNode classes. * * @copyright 2011-2016 VisualEditor Team and others; see http://ve.mit-license.org */ /** * DataModel alien node. * * @class * @abstract * @extends ve.dm.LeafNode * @mixins ve.dm.FocusableNode * @mixins ve.dm.TableCellableNode * * @constructor * @param {Object} [element] Reference to element in linear model */ ve.dm.AlienNode = function VeDmAlienNode() { // Parent constructor ve.dm.AlienNode.super.apply( this, arguments ); // Mixin constructors ve.dm.FocusableNode.call( this ); ve.dm.TableCellableNode.call( this ); }; /* Inheritance */ OO.inheritClass( ve.dm.AlienNode, ve.dm.LeafNode ); OO.mixinClass( ve.dm.AlienNode, ve.dm.FocusableNode ); OO.mixinClass( ve.dm.AlienNode, ve.dm.TableCellableNode ); /* Static members */ ve.dm.AlienNode.static.name = 'alien'; ve.dm.AlienNode.static.preserveHtmlAttributes = false; ve.dm.AlienNode.static.enableAboutGrouping = true; ve.dm.AlienNode.static.matchRdfaTypes = [ 've:Alien' ]; ve.dm.AlienNode.static.toDataElement = function ( domElements, converter ) { var element, isInline = this.isHybridInline( domElements, converter ), type = isInline ? 'alienInline' : 'alienBlock'; element = { type: type }; if ( domElements.length === 1 && [ 'td', 'th' ].indexOf( domElements[ 0 ].nodeName.toLowerCase() ) !== -1 ) { element.attributes = { cellable: true }; ve.dm.TableCellableNode.static.setAttributes( element.attributes, domElements ); } return element; }; ve.dm.AlienNode.static.toDomElements = function ( dataElement, doc, converter ) { return ve.copyDomElements( converter.getStore().value( dataElement.originalDomElementsIndex ) || [], doc ); }; /* Methods */ ve.dm.AlienNode.prototype.isCellable = function () { return !!this.getAttribute( 'cellable' ); }; /* Concrete subclasses */ /** * DataModel alienBlock node. * * @class * @extends ve.dm.AlienNode * * @constructor * @param {Object} [element] Reference to element in linear model */ ve.dm.AlienBlockNode = function VeDmAlienBlockNode() { // Parent constructor ve.dm.AlienBlockNode.super.apply( this, arguments ); }; OO.inheritClass( ve.dm.AlienBlockNode, ve.dm.AlienNode ); ve.dm.AlienBlockNode.static.name = 'alienBlock'; /** * DataModel alienInline node. * * @class * @extends ve.dm.AlienNode * * @constructor * @param {Object} [element] Reference to element in linear model */ ve.dm.AlienInlineNode = function VeDmAlienInlineNode() { // Parent constructor ve.dm.AlienInlineNode.super.apply( this, arguments ); }; OO.inheritClass( ve.dm.AlienInlineNode, ve.dm.AlienNode ); ve.dm.AlienInlineNode.static.name = 'alienInline'; ve.dm.AlienInlineNode.static.isContent = true; /* Registration */ ve.dm.modelRegistry.register( ve.dm.AlienBlockNode ); ve.dm.modelRegistry.register( ve.dm.AlienInlineNode );