mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/VisualEditor
synced 2024-11-30 00:55:00 +00:00
5e5755f09c
Instead of using ve-ce-noHighlight we can just set and maintain this.$focusable using getFocusableNode. Change-Id: I0a6b2d6444df531b7c235ac9ff08a3ed8a0e99b3
51 lines
1.2 KiB
JavaScript
51 lines
1.2 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.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 );
|