Index: trunk/extensions/VisualEditor/VisualEditor.php |
— | — | @@ -103,7 +103,8 @@ |
104 | 104 | 'es/tools/es.Tool.js', |
105 | 105 | 'es/tools/es.ButtonTool.js', |
106 | 106 | 'es/tools/es.AnnotationButtonTool.js', |
107 | | - 'es/tools/es.ClearButtonTool.js' |
| 107 | + 'es/tools/es.ClearButtonTool.js', |
| 108 | + 'es/tools/es.HistoryButtonTool.js' |
108 | 109 | ), |
109 | 110 | 'styles' => array( |
110 | 111 | 'es/styles/es.SurfaceView.css', |
Index: trunk/extensions/VisualEditor/demo/index.html |
— | — | @@ -136,6 +136,7 @@ |
137 | 137 | <script src="../modules/es/tools/es.ButtonTool.js"></script> |
138 | 138 | <script src="../modules/es/tools/es.AnnotationButtonTool.js"></script> |
139 | 139 | <script src="../modules/es/tools/es.ClearButtonTool.js"></script> |
| 140 | + <script src="../modules/es/tools/es.HistoryButtonTool.js"></script> |
140 | 141 | |
141 | 142 | <!-- Demo --> |
142 | 143 | <script src="../modules/sandbox/sandbox.js"></script> |
Index: trunk/extensions/VisualEditor/modules/es/tools/es.HistoryButtonTool.js |
— | — | @@ -0,0 +1,31 @@ |
| 2 | +es.HistoryButtonTool = function( toolbar, name, data ) {
|
| 3 | + es.ButtonTool.call( this, toolbar, name );
|
| 4 | + this.data = data;
|
| 5 | +};
|
| 6 | +
|
| 7 | +es.HistoryButtonTool.prototype.onClick = function() {
|
| 8 | + switch ( this.name ) {
|
| 9 | + case 'undo':
|
| 10 | + this.toolbar.surfaceView.model.undo( 1 );
|
| 11 | + break;
|
| 12 | + case 'redo':
|
| 13 | + this.toolbar.surfaceView.model.redo( 1 );
|
| 14 | + break;
|
| 15 | + }
|
| 16 | +};
|
| 17 | +
|
| 18 | +es.HistoryButtonTool.prototype.updateState = function( annotations ) {
|
| 19 | +};
|
| 20 | +
|
| 21 | +es.Tool.tools.undo = {
|
| 22 | + constructor: es.HistoryButtonTool,
|
| 23 | + name: 'undo'
|
| 24 | +};
|
| 25 | +
|
| 26 | +es.Tool.tools.redo = {
|
| 27 | + constructor: es.HistoryButtonTool,
|
| 28 | + name: 'redo'
|
| 29 | +};
|
| 30 | +
|
| 31 | +
|
| 32 | +es.extendClass( es.HistoryButtonTool, es.ButtonTool ); |
\ No newline at end of file |
Index: trunk/extensions/VisualEditor/modules/es/styles/es.ToolbarView.css |
— | — | @@ -50,6 +50,12 @@ |
51 | 51 | background-position: top left; |
52 | 52 | background-repeat: repeat-x; |
53 | 53 | } |
| 54 | +.es-toolbarButtonTool-undo:before { |
| 55 | + background-image: url(../images/undo.png); |
| 56 | +} |
| 57 | +.es-toolbarButtonTool-redo:before { |
| 58 | + background-image: url(../images/redo.png); |
| 59 | +} |
54 | 60 | .es-toolbarButtonTool-bold:before { |
55 | 61 | background-image: url(../images/bold.png); |
56 | 62 | } |
Index: trunk/extensions/VisualEditor/modules/es/views/es.ToolbarView.js |
— | — | @@ -49,6 +49,7 @@ |
50 | 50 | |
51 | 51 | this.config = config || [ |
52 | 52 | { 'name': 'textStyle', 'items' : [ 'bold', 'italic', 'formatting', 'clear' ] }, |
| 53 | + { 'name': 'history', 'items' : [ 'undo', 'redo' ] } |
53 | 54 | ]; |
54 | 55 | this.setup(); |
55 | 56 | }; |