| 1 | /*! |
| 2 | * VisualEditor ContentEditable MWLatexNode class. |
| 3 | * |
| 4 | * An abstract class that has most of the common functionality |
| 5 | * for the different tags in the Math extension. |
| 6 | * |
| 7 | * @copyright See AUTHORS.txt |
| 8 | * @license MIT |
| 9 | */ |
| 10 | |
| 11 | /** |
| 12 | * ContentEditable MediaWiki abstract LaTeX node: <math>, <chem>, etc. |
| 13 | * |
| 14 | * @abstract |
| 15 | * @class |
| 16 | * @extends ve.ce.MWInlineExtensionNode |
| 17 | * |
| 18 | * @constructor |
| 19 | * @param {ve.dm.MWLatexNode} model Model to observe |
| 20 | * @param {Object} [config] Configuration options |
| 21 | */ |
| 22 | ve.ce.MWLatexNode = function VeCeMWLatexNode() { |
| 23 | // Parent constructor |
| 24 | ve.ce.MWLatexNode.super.apply( this, arguments ); |
| 25 | }; |
| 26 | |
| 27 | /* Inheritance */ |
| 28 | |
| 29 | OO.inheritClass( ve.ce.MWLatexNode, ve.ce.MWInlineExtensionNode ); |
| 30 | |
| 31 | /* Methods */ |
| 32 | |
| 33 | /** |
| 34 | * @inheritdoc |
| 35 | */ |
| 36 | ve.ce.MWLatexNode.prototype.onSetup = function () { |
| 37 | // Parent method |
| 38 | ve.ce.MWLatexNode.super.prototype.onSetup.call( this ); |
| 39 | |
| 40 | // DOM changes |
| 41 | this.$element.addClass( 've-ce-mwLatexNode' ); |
| 42 | }; |
| 43 | |
| 44 | /** |
| 45 | * @inheritdoc ve.ce.GeneratedContentNode |
| 46 | */ |
| 47 | ve.ce.MWLatexNode.prototype.validateGeneratedContents = function ( $element ) { |
| 48 | return !( $element.find( '.error' ).addBack( '.error' ).length ); |
| 49 | }; |