mediawiki-extensions-Visual.../modules/ve/ui/actions/ve.ui.HistoryAction.js
Trevor Parscal 3e460a02df Cleanup action methods
Changes:
* Remove reference to inspector close method, which didn't actually exist
* Use more spacy array syntax for all action methods

Change-Id: I08ee2d262acc7b39456766fb4a0b490da88ad041
2013-09-11 10:25:46 -07:00

64 lines
1.2 KiB
JavaScript

/*!
* VisualEditor UserInterface HistoryAction class.
*
* @copyright 2011-2013 VisualEditor Team and others; see AUTHORS.txt
* @license The MIT License (MIT); see LICENSE.txt
*/
/**
* History action.
*
* @class
* @extends ve.ui.Action
* @constructor
* @param {ve.ui.Surface} surface Surface to act on
*/
ve.ui.HistoryAction = function VeUiHistoryAction( surface ) {
// Parent constructor
ve.ui.Action.call( this, surface );
};
/* Inheritance */
ve.inheritClass( ve.ui.HistoryAction, ve.ui.Action );
/* Static Properties */
/**
* List of allowed methods for the action.
*
* @static
* @property
*/
ve.ui.HistoryAction.static.methods = [ 'undo', 'redo' ];
/* Methods */
/**
* Step backwards in time.
*
* @method
*/
ve.ui.HistoryAction.prototype.undo = function () {
var range = this.surface.getModel().undo();
if ( range ) {
this.surface.getModel().change( null, range );
}
};
/**
* Step forwards in time.
*
* @method
*/
ve.ui.HistoryAction.prototype.redo = function () {
var range = this.surface.getModel().redo();
if ( range ) {
this.surface.getModel().change( null, range );
}
};
/* Registration */
ve.ui.actionFactory.register( 'history', ve.ui.HistoryAction );