2014-01-06 09:07:24 +00:00
|
|
|
/*!
|
|
|
|
* VisualEditor ContentEditable MWMathNode class.
|
|
|
|
*
|
2015-01-16 12:06:38 +00:00
|
|
|
* @copyright 2011-2015 VisualEditor Team and others; see AUTHORS.txt
|
2014-01-06 09:07:24 +00:00
|
|
|
* @license The MIT License (MIT); see LICENSE.txt
|
|
|
|
*/
|
|
|
|
|
2015-09-17 14:28:21 +00:00
|
|
|
/*global ve, OO */
|
2014-01-06 09:07:24 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* ContentEditable MediaWiki math node.
|
|
|
|
*
|
|
|
|
* @class
|
2014-05-20 14:52:46 +00:00
|
|
|
* @extends ve.ce.MWInlineExtensionNode
|
2014-01-06 09:07:24 +00:00
|
|
|
*
|
|
|
|
* @constructor
|
|
|
|
* @param {ve.dm.MWMathNode} model Model to observe
|
|
|
|
* @param {Object} [config] Configuration options
|
|
|
|
*/
|
2014-11-12 18:46:46 +00:00
|
|
|
ve.ce.MWMathNode = function VeCeMWMathNode() {
|
2014-01-06 09:07:24 +00:00
|
|
|
// Parent constructor
|
2014-11-12 18:46:46 +00:00
|
|
|
ve.ce.MWMathNode.super.apply( this, arguments );
|
2014-01-06 09:07:24 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
/* Inheritance */
|
|
|
|
|
2014-05-20 14:52:46 +00:00
|
|
|
OO.inheritClass( ve.ce.MWMathNode, ve.ce.MWInlineExtensionNode );
|
2014-01-06 09:07:24 +00:00
|
|
|
|
|
|
|
/* Static Properties */
|
|
|
|
|
|
|
|
ve.ce.MWMathNode.static.name = 'mwMath';
|
|
|
|
|
2014-03-20 02:31:41 +00:00
|
|
|
ve.ce.MWMathNode.static.primaryCommandName = 'math';
|
|
|
|
|
2014-01-06 09:07:24 +00:00
|
|
|
/* Methods */
|
|
|
|
|
2015-09-14 15:38:10 +00:00
|
|
|
/**
|
|
|
|
* @inheritdoc
|
|
|
|
*/
|
2014-11-12 18:46:46 +00:00
|
|
|
ve.ce.MWMathNode.prototype.onSetup = function () {
|
|
|
|
// Parent method
|
|
|
|
ve.ce.MWMathNode.super.prototype.onSetup.call( this );
|
|
|
|
|
|
|
|
// DOM changes
|
|
|
|
this.$element.addClass( 've-ce-mwMathNode' );
|
|
|
|
};
|
|
|
|
|
2015-03-23 15:54:13 +00:00
|
|
|
/**
|
2015-09-29 16:32:44 +00:00
|
|
|
* @inheritdoc ve.ce.GeneratedContentNode
|
2015-03-23 15:54:13 +00:00
|
|
|
*/
|
2015-09-29 16:32:44 +00:00
|
|
|
ve.ce.MWMathNode.prototype.validateGeneratedContents = function ( $element ) {
|
2015-10-01 20:09:50 +00:00
|
|
|
return !( $element.find( '.error' ).addBack( '.error' ).length );
|
2014-01-06 09:07:24 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
/* Registration */
|
|
|
|
|
|
|
|
ve.ce.nodeFactory.register( ve.ce.MWMathNode );
|