mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/VisualEditor
synced 2024-12-01 17:36:35 +00:00
9510440640
ve.ce.ImageNode.js * Moved in generic stuff from MWImageNode * Added drag end handler (empty, will be used soon) ve.ce.MWImageNode.js * Changed to inherit ImageNode * Moved generic stuff out ve.dm.ImageNode.js * Added attribute extraction/preservation for src, width and height ve.dm.MWImageNode.js * Changed to inherit ImageNode * Re-using ImageNode's attribute handling to extract/preserve attributes on both the image and wrapper level Change-Id: Ied4e1ece24e6804220eac35330790f7084df55de
47 lines
1 KiB
JavaScript
47 lines
1 KiB
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 );
|
|
|
|
// Initialization
|
|
this.$.addClass( 've-ce-MWImageNode' );
|
|
this.$image = this.$;
|
|
this.$ = $( '<' + ( model.getAttribute( 'isLinked' ) ? 'a' : 'span' ) + '>' );
|
|
|
|
// Initialization
|
|
this.$.attr( 'contenteditable', false ).append( this.$image );
|
|
this.onUpdate();
|
|
};
|
|
|
|
/* Inheritance */
|
|
|
|
ve.inheritClass( ve.ce.MWImageNode, ve.ce.ImageNode );
|
|
|
|
/* Static Properties */
|
|
|
|
ve.ce.MWImageNode.static.name = 'MWimage';
|
|
|
|
/* Methods */
|
|
|
|
ve.ce.MWImageNode.prototype.onUpdate = function () {
|
|
// ...
|
|
};
|
|
|
|
/* Registration */
|
|
|
|
ve.ce.nodeFactory.register( ve.ce.MWImageNode );
|