r112157 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r112156‎ | r112157 | r112158 >
Date:22:16, 22 February 2012
Author:inez
Status:deferred
Tags:
Comment:
Initial implementation of logic to recognize if edit is coming from keyboard or somewhere else (spellcheck)
Modified paths:
  • /trunk/extensions/VisualEditor/playground/playground.js (modified) (history)

Diff [purge]

Index: trunk/extensions/VisualEditor/playground/playground.js
@@ -25,6 +25,8 @@
2626 // Set initial content for the "editor"
2727 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>");
2828
 29+ this.keydown = false;
 30+ this.mousedown = false;
2931 this.prevText = app.getDOMText(this.$editor[0]);
3032
3133 setInterval(function() {
@@ -33,21 +35,32 @@
3436 };
3537
3638 app.prototype.onKeyDown = function() {
37 - console.log("onKeyDown");
 39+ this.keydown = true;
 40+ //console.log("onKeyDown");
3841 };
3942
4043 app.prototype.onMouseDown = function() {
41 - console.log("onMouseDown");
 44+ this.mousedown = true;
 45+ //console.log("onMouseDown");
4246 };
4347
4448 app.prototype.loopFunc = function() {
4549 var text = app.getDOMText(this.$editor[0]);
4650
4751 if(text != this.prevText) {
48 - console.log(text);
 52+ //console.log(text);
4953
 54+ if(this.keydown) {
 55+ console.log("change from keyboard");
 56+ } else {
 57+ console.log("change not from keyboard");
 58+ }
 59+
5060 this.prevText = text;
5161 }
 62+
 63+ this.keydown = false;
 64+ this.mousedown = false;
5265 };
5366
5467 app.getDOMText = function( elem ) {

Status & tagging log