mediawiki-extensions-Visual.../modules/ve-mw/init/targets/ve.init.mw.MobileViewTarget.js
Timo Tijhof 58c647e3ac Ensure we use our references to certain native or upstream methods
Checked:
 ve.cloneObject       (oo|OO).cloneObject
 ve.getObjectValues   (oo|OO).getObjectValues
 ve.getObjectKeys     Object.keys
 ve.compare           (oo|OO).compare
 ve.copy              (oo|OO).copy
 ve.isPlainObject     ($|jQuery).isPlainObject
 ve.isEmptyObject     ($|jQuery).isEmptyObject
 ve.isArray           Array.isArray
 ve.bind              ($|jQuery).proxy
 ve.indexOf           ($|jQuery).inArray
 ve.extendObject      ($|jQuery).extend

Fixed:
* ve.dm.MWBlockImageNode.js (added in Iebb2081de)
* ve.dm.MWInlineImageNode.js (aded in I62ec12a6b)
* ve.dm.MWConverter.test.js (added in I90273786a)
* ve.ui.MWMediaInsertDialog.js (added in Ia5ad9a8c0)
* ve.dm.MWTemplateSpecModel.js (added in Ic3eb66538)
* ve.init.mw.MobileViewTarget.js
* ve.init.mw.ViewPageTarget.js
* ve.init.mw.Target.js

Skipped:
* ve.init.mw.ViewPageTarget.init.js
  - Feature test (which is for the very references from ve.js
    being ensured in this commit).
  - Misc code using $.inArray (can't use ve.js yet since that
    isn't loaded yet there).

Change-Id: I73ae005d3692e871fdcaea938641558c0b98ec69
2014-02-20 22:30:29 +01:00

79 lines
1.8 KiB
JavaScript

/*!
* VisualEditor MediaWiki Initialization MobileViewTarget class.
*
* @copyright 2011-2014 VisualEditor Team and others; see AUTHORS.txt
* @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
* @param {Object} [config] Configuration options
* @cfg {number} [section] Number of the section target should scroll to
*/
ve.init.mw.MobileViewTarget = function VeInitMwMobileViewTarget( $container, config ) {
var currentUri = new mw.Uri();
config = config || {};
// Parent constructor
ve.init.mw.Target.call(
this, $container, mw.config.get( 'wgRelevantPageName' ), currentUri.query.oldid
);
this.section = config.section;
// Events
this.connect( this, {
'surfaceReady': 'onSurfaceReady'
} );
};
/* Inheritance */
OO.inheritClass( ve.init.mw.MobileViewTarget, ve.init.mw.Target );
/* Static Properties */
ve.extendObject( ve.init.mw.Target.static.iconModuleStyles, {
'raster': [],
'vector': []
} );
ve.init.mw.MobileViewTarget.static.toolbarGroups = [
{ 'include': [ 'bold', 'italic' ] }
];
ve.init.mw.MobileViewTarget.static.surfaceCommands = [
'bold',
'italic'
];
/* Methods */
/**
* Once surface is ready ready, init UI.
*/
ve.init.mw.MobileViewTarget.prototype.onSurfaceReady = function () {
this.$document[0].focus();
this.restoreEditSection();
};
/**
* @inheritdoc
*/
ve.init.mw.MobileViewTarget.prototype.setUpToolbar = function () {
// Parent method
ve.init.mw.Target.prototype.setUpToolbar.call( this );
this.toolbar.$element
// FIXME shouldn't be using viewPageTarget styles
.addClass( 've-init-mw-viewPageTarget-toolbar' )
// Move the toolbar to the overlay header
.appendTo( '.overlay-header > .toolbar' );
};