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
|
2013-04-24 23:46:34 +00:00
|
|
|
* @param {ve.dm.MWInlineImageNode} model Model to observe
|
2013-03-27 22:56:54 +00:00
|
|
|
*/
|
2013-04-24 23:46:34 +00:00
|
|
|
ve.ce.MWInlineImageNode = function VeCeMWInlineImageNode( model ) {
|
2013-03-27 22:56:54 +00:00
|
|
|
// 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 )
|
2013-04-24 23:46:34 +00:00
|
|
|
.addClass( 've-ce-mwInlineImageNode' )
|
2013-04-15 17:54:49 +00:00
|
|
|
.append( this.$image )
|
|
|
|
.data( 'view', this.$image.data( 'view' ) );
|
2013-03-27 22:56:54 +00:00
|
|
|
this.onUpdate();
|
|
|
|
};
|
|
|
|
|
|
|
|
/* Inheritance */
|
|
|
|
|
2013-04-24 23:46:34 +00:00
|
|
|
ve.inheritClass( ve.ce.MWInlineImageNode, ve.ce.ImageNode );
|
2013-03-27 22:56:54 +00:00
|
|
|
|
|
|
|
/* Static Properties */
|
|
|
|
|
2013-04-24 23:46:34 +00:00
|
|
|
ve.ce.MWInlineImageNode.static.name = 'MWinlineimage';
|
2013-03-27 22:56:54 +00:00
|
|
|
|
|
|
|
/* Methods */
|
|
|
|
|
|
|
|
/* Registration */
|
|
|
|
|
2013-04-24 23:46:34 +00:00
|
|
|
ve.ce.nodeFactory.register( ve.ce.MWInlineImageNode );
|