mediawiki-extensions-Visual.../modules/ve/ce/nodes/ve.ce.MWImageNode.js
Trevor Parscal b3cd473f33 Allow resizing nodes
Actually really resizing the image

Show bounding box on mouseover with 4 handles. Bounding box is resizable. Image resizes to match bounding box on mouse up.

Change-Id: I1f3dac64eb86dd1f258937e4915af101b3ac19d8
2013-04-19 12:44:33 -07:00

45 lines
979 B
JavaScript

/*!
* 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
* @extends ve.ce.ImageNode
* @constructor
* @param {ve.dm.MWImageNode} model Model to observe
*/
ve.ce.MWImageNode = function VeCeMWImageNode( model ) {
// Parent constructor
ve.ce.ImageNode.call( this, model );
// Properties
this.$ = $( '<' + ( model.getAttribute( 'isLinked' ) ? 'a' : 'span' ) + '>' );
// Initialization
this.$
.attr( 'contenteditable', false )
.addClass( 've-ce-mwImageNode' )
.append( this.$image )
.data( 'view', this.$image.data( 'view' ) );
this.onUpdate();
};
/* Inheritance */
ve.inheritClass( ve.ce.MWImageNode, ve.ce.ImageNode );
/* Static Properties */
ve.ce.MWImageNode.static.name = 'MWimage';
/* Methods */
/* Registration */
ve.ce.nodeFactory.register( ve.ce.MWImageNode );