https://www.mediawiki.org/wiki/Special:Code/MediaWiki/112157

Revision: 112157
Author:   inez
Date:     2012-02-22 22:16:44 +0000 (Wed, 22 Feb 2012)
Log Message:
-----------
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: trunk/extensions/VisualEditor/playground/playground.js
===================================================================
--- trunk/extensions/VisualEditor/playground/playground.js      2012-02-22 
22:14:17 UTC (rev 112156)
+++ trunk/extensions/VisualEditor/playground/playground.js      2012-02-22 
22:16:44 UTC (rev 112157)
@@ -25,6 +25,8 @@
        // Set initial content for the "editor"
        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>");
 
+       this.keydown = false;
+       this.mousedown = false;
        this.prevText = app.getDOMText(this.$editor[0]);
        
        setInterval(function() {
@@ -33,21 +35,32 @@
 };
 
 app.prototype.onKeyDown = function() {
-       console.log("onKeyDown");
+       this.keydown = true;
+       //console.log("onKeyDown");
 };
 
 app.prototype.onMouseDown = function() {
-       console.log("onMouseDown");
+       this.mousedown = true;
+       //console.log("onMouseDown");
 };
 
 app.prototype.loopFunc = function() {
        var text = app.getDOMText(this.$editor[0]);
        
        if(text != this.prevText) {
-               console.log(text);
+               //console.log(text);
                
+               if(this.keydown) {
+                       console.log("change from keyboard");
+               } else {
+                       console.log("change not from keyboard");
+               }
+               
                this.prevText = text;
        }
+       
+       this.keydown = false;
+       this.mousedown = false;
 };
 
 app.getDOMText = function( elem ) {


_______________________________________________
MediaWiki-CVS mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs

Reply via email to