https://www.mediawiki.org/wiki/Special:Code/MediaWiki/102078
Revision: 102078
Author: inez
Date: 2011-11-05 00:59:20 +0000 (Sat, 05 Nov 2011)
Log Message:
-----------
Support for deleting text with backspace and delete
Modified Paths:
--------------
trunk/extensions/VisualEditor/modules/es/views/es.SurfaceView.js
Modified: trunk/extensions/VisualEditor/modules/es/views/es.SurfaceView.js
===================================================================
--- trunk/extensions/VisualEditor/modules/es/views/es.SurfaceView.js
2011-11-05 00:49:48 UTC (rev 102077)
+++ trunk/extensions/VisualEditor/modules/es/views/es.SurfaceView.js
2011-11-05 00:59:20 UTC (rev 102078)
@@ -195,8 +195,14 @@
this.moveCursor( 'down' );
break;
case 8: // Backspace
+ var transaction =
this.documentView.model.prepareRemoval( new es.Range( this.selection.to,
this.selection.to - 1 ) );
+ this.documentView.model.commit ( transaction );
+ this.selection.from = this.selection.to -= 1;
+ this.showCursor();
break;
case 46: // Delete
+ var transaction =
this.documentView.model.prepareRemoval( new es.Range( this.selection.to,
this.selection.to + 1 ) );
+ this.documentView.model.commit ( transaction );
break;
default: // Insert content (maybe)
if ( this.keyboard.keydownTimeout ) {
@@ -217,7 +223,7 @@
if ( val.length > 0 ) {
var transaction = this.documentView.model.prepareInsertion(
this.selection.to, val.split('') );
this.documentView.model.commit ( transaction );
- this.selection.to += val.length;
+ this.selection.from = this.selection.to += val.length;
this.showCursor();
}
};
_______________________________________________
MediaWiki-CVS mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs