mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/VisualEditor
synced 2024-09-25 19:26:46 +00:00
735ed96f5f
Moved implementation of all the tools into a reusable action system. To execute an action just call surface.execute( actionName, method, param1, param2, ... ); This helps keep tools simple, and opens the door to key commands reusing the same code. Change-Id: Ie786fa3d38d1ea17d39b5dfb8eeeb5f2256267ce
35 lines
870 B
JavaScript
35 lines
870 B
JavaScript
/**
|
|
* VisualEditor Action class.
|
|
*
|
|
* @copyright 2011-2012 VisualEditor Team and others; see AUTHORS.txt
|
|
* @license The MIT License (MIT); see LICENSE.txt
|
|
*/
|
|
|
|
/**
|
|
* Generic action.
|
|
*
|
|
* An action is built around a surface for one-time use. It is a generic way of extending the
|
|
* functionality of a surface. Actions are accessible via {ve.Surface.prototype.execute}.
|
|
*
|
|
* @class
|
|
* @constructor
|
|
* @param {ve.Surface} surface Surface to act on
|
|
*/
|
|
ve.Action = function VeAction( surface ) {
|
|
// Properties
|
|
this.surface = surface;
|
|
};
|
|
|
|
/* Static Members */
|
|
|
|
/**
|
|
* List of allowed methods for this action.
|
|
*
|
|
* To avoid use of methods not intended to be executed via surface.execute(), the methods must be
|
|
* whitelisted here. This information is checked by ve.Surface before executing an action.
|
|
*
|
|
* @static
|
|
* @member
|
|
*/
|
|
ve.FormatAction.static.methods = [];
|