mediawiki-extensions-Visual.../modules/ve/ve.Action.js
Trevor Parscal 8d33a3de0d Major Documentation Cleanup
* Made method descriptions imperative: "Do this" rather than "Does this"
* Changed use of "this object" to "the object" in method documentation
* Added missing documentation
* Fixed incorrect documentation
* Fixed incorrect debug method names (as in those VeDmClassName tags we add to functions so they make sense when dumped into in the console)
* Normalized use of package names throughout
* Normalized class descriptions
* Removed incorrect @abstract tags
* Added missing @method tags
* Lots of other minor cleanup

Change-Id: I4ea66a2dd107613e2ea3a5f56ff54d675d72957e
2013-01-16 15:37:59 -08:00

48 lines
1.3 KiB
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 Properties */
/**
* @static
* @property
* @inheritable
*/
ve.Action.static = {};
/**
* List of allowed methods for the 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.
*
* If a method returns a value, it will be cast to boolean and be used to determine if the action
* was canceled. Not returning anything, or returning undefined will be treated the same as
* returning true. A canceled action will yield to other default behavior. For example, when
* triggering an action from a keystroke, a canceled action will allow normal insertion behavior to
* be carried out.
*
* @static
* @property
*/
ve.Action.static.methods = [];