mediawiki-extensions-Visual.../modules/ve-mw/ce/nodes/ve.ce.MWGalleryNode.js
Ed Sanders ef38ce8c8c Move addClass calls to setup in GeneratedContentNodes
Ensures classes persist on content update.

Change-Id: I4828ad3208351e4b00e0be1f905b7eafd5e5e93b
2014-11-12 22:52:59 +00:00

59 lines
1.3 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/*!
* VisualEditor ContentEditable MWGalleryNode class.
*
* @copyright 20112014 VisualEditor Team and others; see AUTHORS.txt
* @license The MIT License (MIT); see LICENSE.txt
*/
/**
* ContentEditable MediaWiki gallery node.
*
* @class
* @extends ve.ce.MWBlockExtensionNode
*
* @constructor
* @param {ve.dm.MWGalleryNode} model Model to observe
* @param {Object} [config] Configuration options
*/
ve.ce.MWGalleryNode = function VeCeMWGalleryNode() {
// Parent constructor
ve.ce.MWGalleryNode.super.apply( this, arguments );
};
/* Inheritance */
OO.inheritClass( ve.ce.MWGalleryNode, ve.ce.MWBlockExtensionNode );
/* Static Properties */
ve.ce.MWGalleryNode.static.name = 'mwGallery';
ve.ce.MWGalleryNode.static.tagName = 'div';
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
*/
ve.ce.MWGalleryNode.prototype.getFocusableElement = function () {
var $gallery = this.$element.find( '.gallery' ).addBack( '.gallery' );
return $gallery.length ? $gallery.children() : this.$element;
};
/* Registration */
ve.ce.nodeFactory.register( ve.ce.MWGalleryNode );