mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/Math
synced 2024-12-01 02:36:47 +00:00
848d762e24
The chemical and mathematical formula inspectors and dialogs have a lot of similar functionality, and the common parts are now moved to the common MWLatex class. MWMath* classes now inherit from MWLatex*, and so do the new MWChem* classes. Bug: T153365 Change-Id: I4452ceca55197fda5f1e1293a5741c6f5fb7c245
50 lines
1.2 KiB
JavaScript
50 lines
1.2 KiB
JavaScript
/*!
|
|
* VisualEditor ContentEditable MWLatexNode class.
|
|
*
|
|
* An abstract class that has most of the common functionality
|
|
* for the different tags in the Math extension.
|
|
*
|
|
* @copyright 2011-2015 VisualEditor Team and others; see AUTHORS.txt
|
|
* @license The MIT License (MIT); see LICENSE.txt
|
|
*/
|
|
|
|
/**
|
|
* ContentEditable MediaWiki abstract LaTeX node: <math>, <chem>, etc.
|
|
*
|
|
* @abstract
|
|
* @class
|
|
* @extends ve.ce.MWInlineExtensionNode
|
|
*
|
|
* @constructor
|
|
* @param {ve.dm.MWLatexNode} model Model to observe
|
|
* @param {Object} [config] Configuration options
|
|
*/
|
|
ve.ce.MWLatexNode = function VeCeMWLatexNode() {
|
|
// Parent constructor
|
|
ve.ce.MWLatexNode.super.apply( this, arguments );
|
|
};
|
|
|
|
/* Inheritance */
|
|
|
|
OO.inheritClass( ve.ce.MWLatexNode, ve.ce.MWInlineExtensionNode );
|
|
|
|
/* Methods */
|
|
|
|
/**
|
|
* @inheritdoc
|
|
*/
|
|
ve.ce.MWLatexNode.prototype.onSetup = function () {
|
|
// Parent method
|
|
ve.ce.MWLatexNode.super.prototype.onSetup.call( this );
|
|
|
|
// DOM changes
|
|
this.$element.addClass( 've-ce-mwLatexNode' );
|
|
};
|
|
|
|
/**
|
|
* @inheritdoc ve.ce.GeneratedContentNode
|
|
*/
|
|
ve.ce.MWLatexNode.prototype.validateGeneratedContents = function ( $element ) {
|
|
return !( $element.find( '.error' ).addBack( '.error' ).length );
|
|
};
|