mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/VisualEditor
synced 2024-11-29 16:44:51 +00:00
e20b47f84b
New changes: 69ecc8e Remove MW-specific mobile hack from core e556440 doc: Use wildcards for Desktop/Mobile …Context and …Surface for simplicity of extension Local change: Bring in MobileContext hack to filter out all tools except links and citations from core where it didn't belong. Change-Id: Ica837abd45f0ff02b49a44da617bc1fd8e9872d4
50 lines
1.4 KiB
JavaScript
50 lines
1.4 KiB
JavaScript
/*!
|
|
* VisualEditor UserInterface MobileContext class.
|
|
*
|
|
* @copyright 2011-2014 VisualEditor Team and others; see http://ve.mit-license.org
|
|
*/
|
|
|
|
/**
|
|
* UserInterface context that displays inspector full screen.
|
|
*
|
|
* @class
|
|
* @extends ve.ui.MobileContext
|
|
*
|
|
* @constructor
|
|
* @param {ve.ui.Surface} surface
|
|
* @param {Object} [config] Configuration options
|
|
*/
|
|
ve.ui.MWMobileContext = function VeUiMWMobileContext() {
|
|
// Parent constructor
|
|
ve.ui.MWMobileContext.super.apply( this, arguments );
|
|
|
|
// Initialization
|
|
this.$element.addClass( 've-ui-mwMobileContext' );
|
|
};
|
|
|
|
/* Inheritance */
|
|
|
|
OO.inheritClass( ve.ui.MWMobileContext, ve.ui.MobileContext );
|
|
|
|
/* Methods */
|
|
|
|
/**
|
|
* @inheritdoc
|
|
*/
|
|
ve.ui.MWMobileContext.prototype.getAvailableTools = function () {
|
|
var tools = ve.ui.MobileContext.super.prototype.getAvailableTools.call( this );
|
|
|
|
// Filter out tools not supported in mobile mode
|
|
// FIXME: This is a temporary hack. Ideally, we don't want to load any code
|
|
// that is not supported on a given platform. However, present implementation
|
|
// of citation dialog forces us to load tools that we don't want on mobile.
|
|
this.availableTools = tools.filter( function ( tool ) {
|
|
return (
|
|
tool.model instanceof ve.dm.LinkAnnotation ||
|
|
( tool.model instanceof ve.dm.MWReferenceNode && tool.tool !== ve.ui.MWReferenceDialogTool )
|
|
);
|
|
} );
|
|
|
|
return this.availableTools;
|
|
};
|