All files / src/ui ve.ui.Action.js

100% Statements 5/5
100% Branches 0/0
100% Functions 1/1
100% Lines 5/5

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49                                      1x   130x 130x         1x                                       1x  
/*!
 * VisualEditor UserInterface Action class.
 *
 * @copyright See AUTHORS.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.ui.Surface.prototype.execute}.
 *
 * @class
 *
 * @constructor
 * @param {ve.ui.Surface} surface Surface to act on
 * @param {string} [source] Label for the source of the action.
 *  One of 'trigger', 'sequence', 'tool', or 'context'
 */
ve.ui.Action = function VeUiAction( surface, source ) {
	// Properties
	this.surface = surface;
	this.source = source;
};
 
/* Inheritance */
 
OO.initClass( ve.ui.Action );
 
/* Static Properties */
 
/**
 * List of allowed methods for the action.
 *
 * To avoid use of methods not intended to be executed via surface.execute(), the allowed methods
 * must be listed here. This information is checked by ve.ui.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 {string[]}
 * @inheritable
 */
ve.ui.Action.static.methods = [];