2014-01-15 03:04:58 +00:00
|
|
|
|
/*!
|
|
|
|
|
* VisualEditor ContentEditable MWGalleryNode class.
|
|
|
|
|
*
|
|
|
|
|
* @copyright 2011–2014 VisualEditor Team and others; see AUTHORS.txt
|
|
|
|
|
* @license The MIT License (MIT); see LICENSE.txt
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* ContentEditable MediaWiki gallery node.
|
|
|
|
|
*
|
|
|
|
|
* @class
|
2014-05-20 11:56:37 +00:00
|
|
|
|
* @extends ve.ce.MWBlockExtensionNode
|
2014-01-15 03:04:58 +00:00
|
|
|
|
*
|
|
|
|
|
* @constructor
|
|
|
|
|
* @param {ve.dm.MWGalleryNode} model Model to observe
|
|
|
|
|
* @param {Object} [config] Configuration options
|
|
|
|
|
*/
|
|
|
|
|
ve.ce.MWGalleryNode = function VeCeMWGalleryNode( model, config ) {
|
|
|
|
|
// Parent constructor
|
2014-05-20 11:56:37 +00:00
|
|
|
|
ve.ce.MWBlockExtensionNode.call( this, model, config );
|
2014-06-11 13:31:27 +00:00
|
|
|
|
|
|
|
|
|
// DOM changes
|
|
|
|
|
this.$element.addClass( 've-ce-mwGalleryNode' );
|
2014-01-15 03:04:58 +00:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
/* Inheritance */
|
|
|
|
|
|
2014-05-20 11:56:37 +00:00
|
|
|
|
OO.inheritClass( ve.ce.MWGalleryNode, ve.ce.MWBlockExtensionNode );
|
2014-01-15 03:04:58 +00:00
|
|
|
|
|
|
|
|
|
/* Static Properties */
|
|
|
|
|
|
|
|
|
|
ve.ce.MWGalleryNode.static.name = 'mwGallery';
|
|
|
|
|
|
|
|
|
|
ve.ce.MWGalleryNode.static.tagName = 'div';
|
|
|
|
|
|
2013-12-20 23:25:24 +00:00
|
|
|
|
ve.ce.MWGalleryNode.static.primaryCommandName = 'gallery';
|
|
|
|
|
|
2014-06-16 10:52:37 +00:00
|
|
|
|
/* Methods */
|
|
|
|
|
|
|
|
|
|
/**
|
2014-07-24 09:54:22 +00:00
|
|
|
|
* @inheritdoc ve.ce.GeneratedContentNode
|
2014-06-16 10:52:37 +00:00
|
|
|
|
*/
|
2014-07-24 09:54:22 +00:00
|
|
|
|
ve.ce.MWGalleryNode.prototype.getFocusableElement = function () {
|
|
|
|
|
var $gallery = this.$element.find( '.gallery' ).addBack( '.gallery' );
|
|
|
|
|
return $gallery.length ? $gallery.children() : this.$element;
|
2014-06-16 10:52:37 +00:00
|
|
|
|
};
|
|
|
|
|
|
2014-01-15 03:04:58 +00:00
|
|
|
|
/* Registration */
|
|
|
|
|
|
|
|
|
|
ve.ce.nodeFactory.register( ve.ce.MWGalleryNode );
|