r110044 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r110043‎ | r110044 | r110045 >
Date:01:47, 26 January 2012
Author:inez
Status:deferred (Comments)
Tags:visualeditor 
Comment:
Basic support for backspace button
Modified paths:
  • /trunk/extensions/VisualEditor/contentEditable/views/es.SurfaceView.js (modified) (history)

Diff [purge]

Index: trunk/extensions/VisualEditor/contentEditable/views/es.SurfaceView.js
@@ -22,13 +22,21 @@
2323 };
2424
2525 es.SurfaceView.prototype.onKeyDown = function( e ) {
26 - if ( e.which == 13 ) {
 26+ if ( e.which === 13 ) {
2727 e.preventDefault();
2828 var range = this.getSelection();
2929 if ( range.start === range.end ) {
3030 var tx = this.model.getDocument().prepareInsertion( range.start, [ { 'type': '/paragraph' }, { 'type': 'paragraph' } ]);
3131 this.model.transact( tx );
3232 }
 33+ } else if ( e.which === 8 ) {
 34+ console.log("A");
 35+ e.preventDefault();
 36+ var range = this.getSelection();
 37+ if ( range.start != range.end ) {
 38+ var tx = this.model.getDocument().prepareRemoval( range );
 39+ this.model.transact( tx );
 40+ }
3341 }
3442 };
3543

Comments

#Comment by Krinkle (talk | contribs)   05:11, 29 January 2012
+		console.log("A");

Not sure of VisualEditor has a polyfill for that, if not should prolly be removed from production code.

Status & tagging log