mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/VisualEditor
synced 2024-11-25 23:05:35 +00:00
cb704dee84
* A subclass of MenuItemWidget from OOUI, MWLinkMenuItemWidget, is introduced that, when used in MWLinkTargetInputWidget for both external and internal links, returns actual page links. * MWInternalLinkMenuItemWidget is extended from MWLinkMenuItemWidget to support the internal links. * LinkCache is being used in MWInternalLinkMenuItemWidet to stylize the links. Thus, getting rid of some old css classes. Bug: 51205 Change-Id: I3ac18dabd514ca539fff1db3c67ae97931c3d4fc
35 lines
1,019 B
JavaScript
35 lines
1,019 B
JavaScript
/*!
|
|
* VisualEditor UserInterface MWLinkMenuItemWidget class
|
|
*
|
|
* @copyright 2011-2014 VisualEditor Team and others; see http://ve.mit-license.org
|
|
*/
|
|
|
|
/**
|
|
* Creates a ve.ui.MWInternalLinkMenuItemWidget object.
|
|
*
|
|
* @class
|
|
* @extends ve.ui.MWLinkMenuItemWidget
|
|
*
|
|
* @constructor
|
|
* @param {Mixed} data Item data
|
|
* @param {Object} [config] Configuration options
|
|
* @cfg {string} [pagename] Pagename to return the names of internal pages
|
|
*/
|
|
ve.ui.MWInternalLinkMenuItemWidget = function VeUiMWInternalLinkMenuItemWidget( data, config ) {
|
|
// Config intialization
|
|
config = config || {};
|
|
|
|
// Properties
|
|
this.pagename = config.pagename;
|
|
|
|
// Parent constructor
|
|
ve.ui.MWLinkMenuItemWidget.call( this, data, $.extend( { label: this.pagename, href: mw.util.getUrl( this.pagename ) }, config ) );
|
|
|
|
// Style based on link cache information
|
|
ve.init.platform.linkCache.styleElement( this.pagename, this.$link );
|
|
};
|
|
|
|
/* Inheritance */
|
|
|
|
OO.inheritClass( ve.ui.MWInternalLinkMenuItemWidget, ve.ui.MWLinkMenuItemWidget );
|