mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/Math
synced 2024-12-01 10:46:36 +00:00
a182a9d332
Primary command name is used by double click and enter. Make this launch the default edit action 'mathDialog'. Change-Id: Ie7a87914a55ecc87769c4a1aa029b36966b83a04
56 lines
1.2 KiB
JavaScript
56 lines
1.2 KiB
JavaScript
/*!
|
|
* VisualEditor ContentEditable MWMathNode class.
|
|
*
|
|
* @copyright 2011-2015 VisualEditor Team and others; see AUTHORS.txt
|
|
* @license The MIT License (MIT); see LICENSE.txt
|
|
*/
|
|
|
|
/**
|
|
* ContentEditable MediaWiki math node.
|
|
*
|
|
* @class
|
|
* @extends ve.ce.MWInlineExtensionNode
|
|
*
|
|
* @constructor
|
|
* @param {ve.dm.MWMathNode} model Model to observe
|
|
* @param {Object} [config] Configuration options
|
|
*/
|
|
ve.ce.MWMathNode = function VeCeMWMathNode() {
|
|
// Parent constructor
|
|
ve.ce.MWMathNode.super.apply( this, arguments );
|
|
};
|
|
|
|
/* Inheritance */
|
|
|
|
OO.inheritClass( ve.ce.MWMathNode, ve.ce.MWInlineExtensionNode );
|
|
|
|
/* Static Properties */
|
|
|
|
ve.ce.MWMathNode.static.name = 'mwMath';
|
|
|
|
ve.ce.MWMathNode.static.primaryCommandName = 'mathDialog';
|
|
|
|
/* Methods */
|
|
|
|
/**
|
|
* @inheritdoc
|
|
*/
|
|
ve.ce.MWMathNode.prototype.onSetup = function () {
|
|
// Parent method
|
|
ve.ce.MWMathNode.super.prototype.onSetup.call( this );
|
|
|
|
// DOM changes
|
|
this.$element.addClass( 've-ce-mwMathNode' );
|
|
};
|
|
|
|
/**
|
|
* @inheritdoc ve.ce.GeneratedContentNode
|
|
*/
|
|
ve.ce.MWMathNode.prototype.validateGeneratedContents = function ( $element ) {
|
|
return !( $element.find( '.error' ).addBack( '.error' ).length );
|
|
};
|
|
|
|
/* Registration */
|
|
|
|
ve.ce.nodeFactory.register( ve.ce.MWMathNode );
|