Index: trunk/extensions/VisualEditor/demos/playground/playground.js |
— | — | @@ -32,9 +32,9 @@ |
33 | 33 | 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>");
|
34 | 34 | this.$editor.addClass('leafNode');
|
35 | 35 |
|
| 36 | + this.keydown = false;
|
| 37 | + this.keyup = false;
|
36 | 38 | this.keypress = false;
|
37 | | - this.keyup = false;
|
38 | | - this.keydown = false;
|
39 | 39 | this.mousedown = false;
|
40 | 40 | this.inime = false;
|
41 | 41 | this.prevText = app.getDOMText(this.$editor[0]);
|
— | — | @@ -44,31 +44,31 @@ |
45 | 45 | }, 100);
|
46 | 46 | };
|
47 | 47 |
|
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;
|
51 | 51 | if ( e.which === 229 ) {
|
52 | 52 | this.inime = true;
|
53 | | - }
|
| 53 | + }
|
54 | 54 | };
|
55 | 55 |
|
56 | | -app.prototype.onKeyUp = function() {
|
57 | | - //console.log("onKeyUp");
|
| 56 | +app.prototype.onKeyUp = function( e ) {
|
| 57 | + console.log("onKeyUp");
|
58 | 58 | this.keyup = true;
|
59 | 59 | if ( this.inime ) {
|
60 | 60 | this.inime = false;
|
61 | 61 | }
|
62 | 62 | };
|
63 | 63 |
|
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;
|
67 | 67 | if ( e.which === 229 ) {
|
68 | 68 | this.inime = true;
|
69 | | - }
|
| 69 | + }
|
70 | 70 | };
|
71 | 71 |
|
72 | | -app.prototype.onMouseDown = function() {
|
| 72 | +app.prototype.onMouseDown = function( e ) {
|
73 | 73 | this.mousedown = true;
|
74 | 74 |
|
75 | 75 | if ( this.inime ) {
|
— | — | @@ -81,6 +81,24 @@ |
82 | 82 |
|
83 | 83 | if(text != this.prevText) {
|
84 | 84 |
|
| 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 | +
|
85 | 103 | var selection = rangy.getSelection();
|
86 | 104 |
|
87 | 105 |
|
— | — | @@ -116,6 +134,7 @@ |
117 | 135 | this.keyup = false;
|
118 | 136 | this.keydown = false;
|
119 | 137 | this.mousedown = false;
|
| 138 | + */
|
120 | 139 | };
|
121 | 140 |
|
122 | 141 | app.getDOMText = function( elem ) {
|