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-15 17:54:49 +00:00
|
|
|
// Properties
|
2013-04-10 19:56:20 +00:00
|
|
|
this.$ = $( '<' + ( model.getAttribute( 'isLinked' ) ? 'a' : 'span' ) + '>' );
|
2013-03-27 22:56:54 +00:00
|
|
|
|
|
|
|
// Initialization
|
2013-04-15 17:54:49 +00:00
|
|
|
this.$
|
|
|
|
.attr( 'contenteditable', false )
|
|
|
|
.addClass( 've-ce-mwImageNode' )
|
|
|
|
.append( this.$image )
|
|
|
|
.data( 'view', this.$image.data( 'view' ) );
|
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 */
|
|
|
|
|
|
|
|
/* Registration */
|
|
|
|
|
|
|
|
ve.ce.nodeFactory.register( ve.ce.MWImageNode );
|