Move addClass calls to setup in GeneratedContentNodes

Ensures classes persist on content update.

Change-Id: I4828ad3208351e4b00e0be1f905b7eafd5e5e93b
This commit is contained in:
Ed Sanders 2014-11-12 19:02:57 +00:00
parent 9d256000e2
commit ef38ce8c8c
2 changed files with 26 additions and 10 deletions

View file

@ -15,12 +15,9 @@
* @param {ve.dm.MWAlienExtensionNode} model Model to observe
* @param {Object} [config] Configuration options
*/
ve.ce.MWAlienExtensionNode = function VeCeMWAlienExtensionNode( model, config ) {
ve.ce.MWAlienExtensionNode = function VeCeMWAlienExtensionNode() {
// Parent constructor
ve.ce.MWBlockExtensionNode.call( this, model, config );
// DOM changes
this.$element.addClass( 've-ce-mwAlienExtensionNode' );
ve.ce.MWAlienExtensionNode.super.apply( this, arguments );
};
/* Inheritance */
@ -42,6 +39,17 @@ ve.ce.MWAlienExtensionNode.static.getDescription = function ( model ) {
return model.getExtensionName();
};
/* Methods */
/**
* @inheritdoc
*/
ve.ce.MWAlienExtensionNode.prototype.onSetup = function () {
ve.ce.MWAlienExtensionNode.super.prototype.onSetup.call( this );
// DOM changes
this.$element.addClass( 've-ce-mwAlienExtensionNode' );
};
/* Registration */
ve.ce.nodeFactory.register( ve.ce.MWAlienExtensionNode );

View file

@ -15,12 +15,9 @@
* @param {ve.dm.MWGalleryNode} model Model to observe
* @param {Object} [config] Configuration options
*/
ve.ce.MWGalleryNode = function VeCeMWGalleryNode( model, config ) {
ve.ce.MWGalleryNode = function VeCeMWGalleryNode() {
// Parent constructor
ve.ce.MWBlockExtensionNode.call( this, model, config );
// DOM changes
this.$element.addClass( 've-ce-mwGalleryNode' );
ve.ce.MWGalleryNode.super.apply( this, arguments );
};
/* Inheritance */
@ -37,6 +34,17 @@ ve.ce.MWGalleryNode.static.primaryCommandName = 'gallery';
/* Methods */
/**
* @inheritdoc
*/
ve.ce.MWGalleryNode.prototype.onSetup = function () {
// Parent method
ve.ce.MWGalleryNode.super.prototype.onSetup.call( this );
// DOM changes
this.$element.addClass( 've-ce-mwGalleryNode' );
};
/**
* @inheritdoc ve.ce.GeneratedContentNode
*/