2013-10-11 18:42:46 +00:00
|
|
|
/*!
|
|
|
|
* VisualEditor MediaWiki Initialization MobileViewTarget class.
|
|
|
|
*
|
2014-01-05 12:05:05 +00:00
|
|
|
* @copyright 2011-2014 VisualEditor Team and others; see AUTHORS.txt
|
2013-10-11 18:42:46 +00:00
|
|
|
* @license The MIT License (MIT); see LICENSE.txt
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*global mw*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
*
|
|
|
|
* @class
|
|
|
|
* @extends ve.init.mw.Target
|
|
|
|
*
|
|
|
|
* @constructor
|
|
|
|
* @param {jQuery} $container Container to render target into
|
|
|
|
*/
|
|
|
|
ve.init.mw.MobileViewTarget = function VeInitMwMobileViewTarget( $el ) {
|
|
|
|
var currentUri = new mw.Uri();
|
|
|
|
|
|
|
|
// Parent constructor
|
|
|
|
ve.init.mw.Target.call(
|
|
|
|
this, $el, mw.config.get( 'wgRelevantPageName' ), currentUri.query.oldid
|
|
|
|
);
|
2013-12-06 20:01:03 +00:00
|
|
|
|
|
|
|
// Events
|
|
|
|
this.connect( this, {
|
|
|
|
'surfaceReady': 'onSurfaceReady'
|
|
|
|
} );
|
2013-10-11 18:42:46 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
/* Inheritance */
|
|
|
|
|
|
|
|
OO.inheritClass( ve.init.mw.MobileViewTarget, ve.init.mw.Target );
|
|
|
|
|
|
|
|
/* Static Properties */
|
2014-02-06 23:33:21 +00:00
|
|
|
$.extend( ve.init.mw.Target.static.iconModuleStyles, {
|
|
|
|
'raster': [],
|
|
|
|
'vector': []
|
|
|
|
} );
|
2013-10-11 18:42:46 +00:00
|
|
|
|
|
|
|
ve.init.mw.MobileViewTarget.static.toolbarGroups = [
|
2014-02-06 23:33:21 +00:00
|
|
|
{ 'include': [ 'bold', 'italic' ] }
|
2013-10-11 18:42:46 +00:00
|
|
|
];
|
|
|
|
|
|
|
|
ve.init.mw.MobileViewTarget.static.surfaceCommands = [
|
|
|
|
'bold',
|
2014-02-06 23:33:21 +00:00
|
|
|
'italic'
|
2013-10-11 18:42:46 +00:00
|
|
|
];
|
2013-12-06 20:01:03 +00:00
|
|
|
|
|
|
|
/* Methods */
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Once surface is ready ready, init UI.
|
|
|
|
*/
|
|
|
|
ve.init.mw.MobileViewTarget.prototype.onSurfaceReady = function () {
|
|
|
|
this.$document[0].focus();
|
|
|
|
};
|
2014-02-06 23:33:21 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Show the toolbar.
|
|
|
|
*
|
|
|
|
* This also transplants the toolbar to a new location.
|
|
|
|
*
|
|
|
|
* @method
|
|
|
|
*/
|
|
|
|
ve.init.mw.Target.prototype.setUpToolbar = function () {
|
|
|
|
this.toolbar = new ve.ui.TargetToolbar( this, this.surface, { 'shadow': true, 'actions': true } );
|
|
|
|
this.toolbar.setup( this.constructor.static.toolbarGroups );
|
|
|
|
this.surface.addCommands( this.constructor.static.surfaceCommands );
|
|
|
|
this.toolbar.$element
|
|
|
|
.addClass( 've-init-mw-viewPageTarget-toolbar' )
|
2014-02-07 19:08:24 +00:00
|
|
|
.appendTo( '.overlay-header > .toolbar' );
|
2014-02-06 23:33:21 +00:00
|
|
|
};
|