2013-03-27 22:56:54 +00:00
|
|
|
/*!
|
|
|
|
* VisualEditor ContentEditable MWEntityNode class.
|
|
|
|
*
|
|
|
|
* @copyright 2011-2013 VisualEditor Team and others; see AUTHORS.txt
|
|
|
|
* @license The MIT License (MIT); see LICENSE.txt
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* ContentEditable MediaWiki image node.
|
|
|
|
*
|
|
|
|
* @class
|
2013-04-10 19:56:20 +00:00
|
|
|
* @extends ve.ce.ImageNode
|
2013-03-27 22:56:54 +00:00
|
|
|
* @constructor
|
|
|
|
* @param {ve.dm.MWImageNode} model Model to observe
|
|
|
|
*/
|
|
|
|
ve.ce.MWImageNode = function VeCeMWImageNode( model ) {
|
|
|
|
// Parent constructor
|
2013-04-10 19:56:20 +00:00
|
|
|
ve.ce.ImageNode.call( this, model );
|
2013-03-27 22:56:54 +00:00
|
|
|
|
2013-04-10 19:56:20 +00:00
|
|
|
// Initialization
|
2013-03-27 22:56:54 +00:00
|
|
|
this.$.addClass( 've-ce-MWImageNode' );
|
2013-04-10 19:56:20 +00:00
|
|
|
this.$image = this.$;
|
|
|
|
this.$ = $( '<' + ( model.getAttribute( 'isLinked' ) ? 'a' : 'span' ) + '>' );
|
2013-03-27 22:56:54 +00:00
|
|
|
|
|
|
|
// Initialization
|
2013-04-10 19:56:20 +00:00
|
|
|
this.$.attr( 'contenteditable', false ).append( this.$image );
|
2013-03-27 22:56:54 +00:00
|
|
|
this.onUpdate();
|
|
|
|
};
|
|
|
|
|
|
|
|
/* Inheritance */
|
|
|
|
|
2013-04-10 19:56:20 +00:00
|
|
|
ve.inheritClass( ve.ce.MWImageNode, ve.ce.ImageNode );
|
2013-03-27 22:56:54 +00:00
|
|
|
|
|
|
|
/* Static Properties */
|
|
|
|
|
|
|
|
ve.ce.MWImageNode.static.name = 'MWimage';
|
|
|
|
|
|
|
|
/* Methods */
|
|
|
|
|
|
|
|
ve.ce.MWImageNode.prototype.onUpdate = function () {
|
|
|
|
// ...
|
|
|
|
};
|
|
|
|
|
|
|
|
/* Registration */
|
|
|
|
|
|
|
|
ve.ce.nodeFactory.register( ve.ce.MWImageNode );
|