mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/VisualEditor
synced 2024-11-15 02:23:58 +00:00
b197d0127b
Now that we don't wrap generated content nodes UL.gallery is likely to be the root, so use an appropriate jQuery selector. Change-Id: Ic9d9f4c0fc12daae6cf8252e4d6562366b3d2df2
52 lines
1.3 KiB
JavaScript
52 lines
1.3 KiB
JavaScript
/*!
|
||
* 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
|
||
* @extends ve.ce.MWBlockExtensionNode
|
||
*
|
||
* @constructor
|
||
* @param {ve.dm.MWGalleryNode} model Model to observe
|
||
* @param {Object} [config] Configuration options
|
||
*/
|
||
ve.ce.MWGalleryNode = function VeCeMWGalleryNode( model, config ) {
|
||
// Parent constructor
|
||
ve.ce.MWBlockExtensionNode.call( this, model, config );
|
||
|
||
// DOM changes
|
||
this.$element.addClass( 've-ce-mwGalleryNode' );
|
||
};
|
||
|
||
/* 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 () {
|
||
ve.ce.MWGalleryNode.super.prototype.onSetup.apply( this, arguments );
|
||
// The ul.gallery is 100% width, so don't give it a highlight
|
||
this.$element.find( '.gallery' ).addBack( '.gallery' ).addClass( 've-ce-noHighlight' );
|
||
};
|
||
|
||
/* Registration */
|
||
|
||
ve.ce.nodeFactory.register( ve.ce.MWGalleryNode );
|