r112268 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r112267‎ | r112268 | r112269 >
Date:23:20, 23 February 2012
Author:inez
Status:deferred
Tags:
Comment:
Recogonize if input came from spellcheck or from keyboard (Chrome)
Modified paths:
  • /trunk/extensions/VisualEditor/demos/playground/playground.js (modified) (history)

Diff [purge]

Index: trunk/extensions/VisualEditor/demos/playground/playground.js
@@ -32,9 +32,9 @@
3333 this.$editor.html("<b>Lorem Ipsum is simply dummy text</b> of the printing and typesetting industry. <b>Lorem Ipsum has been the <i>industry's</i> standard</b> dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it <u>to <b>make <i>a type</i> specimen</b> book.</u>");
3434 this.$editor.addClass('leafNode');
3535
 36+ this.keydown = false;
 37+ this.keyup = false;
3638 this.keypress = false;
37 - this.keyup = false;
38 - this.keydown = false;
3939 this.mousedown = false;
4040 this.inime = false;
4141 this.prevText = app.getDOMText(this.$editor[0]);
@@ -44,31 +44,31 @@
4545 }, 100);
4646 };
4747
48 -app.prototype.onKeyPress = function() {
49 - //console.log("onKeyPress");
50 - this.keypress = true;
 48+app.prototype.onKeyDown = function( e ) {
 49+ console.log("onKeyDown");
 50+ this.keydown = true;
5151 if ( e.which === 229 ) {
5252 this.inime = true;
53 - }
 53+ }
5454 };
5555
56 -app.prototype.onKeyUp = function() {
57 - //console.log("onKeyUp");
 56+app.prototype.onKeyUp = function( e ) {
 57+ console.log("onKeyUp");
5858 this.keyup = true;
5959 if ( this.inime ) {
6060 this.inime = false;
6161 }
6262 };
6363
64 -app.prototype.onKeyDown = function( e ) {
65 - //console.log("onKeyDown");
66 - this.keydown = true;
 64+app.prototype.onKeyPress = function( e ) {
 65+ //console.log("onKeyPress");
 66+ this.keypress = true;
6767 if ( e.which === 229 ) {
6868 this.inime = true;
69 - }
 69+ }
7070 };
7171
72 -app.prototype.onMouseDown = function() {
 72+app.prototype.onMouseDown = function( e ) {
7373 this.mousedown = true;
7474
7575 if ( this.inime ) {
@@ -81,6 +81,24 @@
8282
8383 if(text != this.prevText) {
8484
 85+ console.log("text is different");
 86+
 87+ if(this.keydown) {
 88+ console.log("keyboard");
 89+ } else {
 90+ console.log("not keyboard");
 91+ }
 92+
 93+ this.prevText = text;
 94+ }
 95+
 96+ this.keypress = false;
 97+ this.keyup = false;
 98+ this.keydown = false;
 99+ this.mousedown = false;
 100+
 101+ /*
 102+
85103 var selection = rangy.getSelection();
86104
87105
@@ -116,6 +134,7 @@
117135 this.keyup = false;
118136 this.keydown = false;
119137 this.mousedown = false;
 138+ */
120139 };
121140
122141 app.getDOMText = function( elem ) {

Status & tagging log