Debian Codegraph @

extensions/VisualEditor/lib/ve/src/ui/actions/ve.ui.HistoryAction.js

raw symbols SCIP
1 /*!
2 * VisualEditor UserInterface HistoryAction class.
3 *
4 * @copyright See AUTHORS.txt
5 */
6
7 /**
8 * History action.
9 *
10 * @class
11 * @extends ve.ui.Action
12 *
13 * @constructor
14 * @param {ve.ui.Surface} surface Surface to act on
15 * @param {string} [source]
16 */
17 ve.ui.HistoryAction = function VeUiHistoryAction() {
18 // Parent constructor
19 ve.ui.HistoryAction.super.apply( this, arguments );
20 };
21
22 /* Inheritance */
23
24 OO.inheritClass( ve.ui.HistoryAction, ve.ui.Action );
25
26 /* Static Properties */
27
28 ve.ui.HistoryAction.static.name = 'history';
29
30 ve.ui.HistoryAction.static.methods = [ 'undo', 'redo' ];
31
32 /* Methods */
33
34 /**
35 * Step backwards in time.
36 *
37 * @return {boolean} Action was executed
38 */
39 ve.ui.HistoryAction.prototype.undo = function () {
40 this.surface.getModel().undo();
41 return true;
42 };
43
44 /**
45 * Step forwards in time.
46 *
47 * @return {boolean} Action was executed
48 */
49 ve.ui.HistoryAction.prototype.redo = function () {
50 this.surface.getModel().redo();
51 return true;
52 };
53
54 /* Registration */
55
56 ve.ui.actionFactory.register( ve.ui.HistoryAction );