mediawiki-extensions-Visual.../modules/ve-mw/ui/contextitems/ve.ui.MWAlienExtensionContextItem.js
Ed Sanders fdcd42f73a Split AlienExtensionNode into inline and block
MWExtensionNode:
* Inherit from LeafNode at the top level. Inline and block only
  differ in CE where inline has isContent set.

MWAlienExtensionNode:
* Inhert from MW(Inline|Block)ExtensionNode respectively. Both
  mixin MWAlienExtensionNode.

Bonus:
* Bring in paragraph unwrapping on inline nodes from MWMathNode

Bug: T93712
Change-Id: Ib04234f740cf1f27c861d8b3cfeea5e323b94678
2015-04-09 16:32:02 +01:00

50 lines
1.3 KiB
JavaScript

/*!
* VisualEditor MWAlienExtensionContextItem class.
*
* @copyright 2011-2015 VisualEditor Team and others; see http://ve.mit-license.org
*/
/**
* Context item for a MWAlienExtension.
*
* @class
* @extends ve.ui.ContextItem
*
* @constructor
* @param {ve.ui.Context} context Context item is in
* @param {ve.dm.Model} model Model item is related to
* @param {Object} config Configuration options
*/
ve.ui.MWAlienExtensionContextItem = function VeMWAlienExtensionContextItem( context, model ) {
// Parent constructor
ve.ui.MWAlienExtensionContextItem.super.apply( this, arguments );
// Initialization
this.$element.addClass( 've-ui-mwAlienExtensionContextItem' );
this.setLabel( model.getExtensionName() );
};
/* Inheritance */
OO.inheritClass( ve.ui.MWAlienExtensionContextItem, ve.ui.ContextItem );
/* Static Properties */
ve.ui.MWAlienExtensionContextItem.static.name = 'alienExtension';
ve.ui.MWAlienExtensionContextItem.static.icon = 'alienextension';
ve.ui.MWAlienExtensionContextItem.static.modelClasses = [
ve.dm.MWAlienInlineExtensionNode,
ve.dm.MWAlienBlockExtensionNode
];
ve.ui.MWAlienExtensionContextItem.static.commandName = 'alienExtension';
/* Methods */
/* Registration */
ve.ui.contextItemFactory.register( ve.ui.MWAlienExtensionContextItem );