r104825 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r104824‎ | r104825 | r104826 >
Date:01:33, 1 December 2011
Author:inez
Status:deferred
Tags:
Comment:
Added undo and redo buttons to toolbar
Modified paths:
  • /trunk/extensions/VisualEditor/VisualEditor.php (modified) (history)
  • /trunk/extensions/VisualEditor/demo/index.html (modified) (history)
  • /trunk/extensions/VisualEditor/modules/es/styles/es.ToolbarView.css (modified) (history)
  • /trunk/extensions/VisualEditor/modules/es/tools/es.HistoryButtonTool.js (added) (history)
  • /trunk/extensions/VisualEditor/modules/es/views/es.ToolbarView.js (modified) (history)

Diff [purge]

Index: trunk/extensions/VisualEditor/VisualEditor.php
@@ -103,7 +103,8 @@
104104 'es/tools/es.Tool.js',
105105 'es/tools/es.ButtonTool.js',
106106 'es/tools/es.AnnotationButtonTool.js',
107 - 'es/tools/es.ClearButtonTool.js'
 107+ 'es/tools/es.ClearButtonTool.js',
 108+ 'es/tools/es.HistoryButtonTool.js'
108109 ),
109110 'styles' => array(
110111 'es/styles/es.SurfaceView.css',
Index: trunk/extensions/VisualEditor/demo/index.html
@@ -136,6 +136,7 @@
137137 <script src="../modules/es/tools/es.ButtonTool.js"></script>
138138 <script src="../modules/es/tools/es.AnnotationButtonTool.js"></script>
139139 <script src="../modules/es/tools/es.ClearButtonTool.js"></script>
 140+ <script src="../modules/es/tools/es.HistoryButtonTool.js"></script>
140141
141142 <!-- Demo -->
142143 <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 @@
5151 background-position: top left;
5252 background-repeat: repeat-x;
5353 }
 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+}
5460 .es-toolbarButtonTool-bold:before {
5561 background-image: url(../images/bold.png);
5662 }
Index: trunk/extensions/VisualEditor/modules/es/views/es.ToolbarView.js
@@ -49,6 +49,7 @@
5050
5151 this.config = config || [
5252 { 'name': 'textStyle', 'items' : [ 'bold', 'italic', 'formatting', 'clear' ] },
 53+ { 'name': 'history', 'items' : [ 'undo', 'redo' ] }
5354 ];
5455 this.setup();
5556 };

Status & tagging log