Index: trunk/extensions/VisualEditor/modules/ve/ce/ve.es.Surface.js |
— | — | @@ -42,27 +42,31 @@ |
43 | 43 | } |
44 | 44 | } ); |
45 | 45 | |
| 46 | + this.$ |
| 47 | + .on( 'cut copy', function( e ) { |
| 48 | + _this.onCutCopy( e ); |
| 49 | + } ) |
| 50 | + .on( 'paste', function( e ) { |
| 51 | + _this.onPaste( e ); |
| 52 | + } ) |
| 53 | + .on( 'mousedown', function( e ) { |
| 54 | + // return _this.onMouseDown( e ); |
| 55 | + } ) |
| 56 | + .on( 'compositionstart', function( e ) { |
| 57 | + console.log('comp start'); |
| 58 | + _this.onCompositionStart( e ); |
| 59 | + } ) |
| 60 | + .on( 'compositionend', function( e ) { |
| 61 | + console.log('comp end'); |
| 62 | + _this.onCompositionEnd( e ); |
| 63 | + } ) |
| 64 | + .on('dragover drop', function( e ) { |
| 65 | + e.preventDefault(); |
| 66 | + }); |
46 | 67 | |
47 | | - this.$.on('cut copy', function( e ) { |
48 | | - _this.onCutCopy( e ); |
49 | | - } ); |
50 | | - |
51 | | - this.$.on('paste', function( e ) { |
52 | | - _this.onPaste( e ); |
53 | | - } ); |
54 | | - |
55 | | - this.$.mousedown( function(e) { |
56 | | -// return _this.onMouseDown( e ); |
57 | | - } ); |
58 | | - |
59 | 68 | // Initialization |
60 | 69 | this.documentView.renderContent(); |
61 | 70 | |
62 | | - // Prevent dragging text |
63 | | - this.$.bind('dragover drop', function(e) { |
64 | | - e.preventDefault(); |
65 | | - }); |
66 | | - |
67 | 71 | this.poll = { |
68 | 72 | interval: null, |
69 | 73 | frequency: 100, |
— | — | @@ -73,19 +77,11 @@ |
74 | 78 | compositionStart: null, |
75 | 79 | compositionEnd: null |
76 | 80 | }; |
77 | | - |
78 | | - document.addEventListener( 'compositionstart', function( e ) { |
79 | | - _this.onCompositionStart( e ); |
80 | | - } ); |
81 | | - document.addEventListener( 'compositionend', function( e ) { |
82 | | - _this.onCompositionEnd( e ); |
83 | | - } ); |
84 | 81 | }; |
85 | 82 | |
86 | 83 | /* Methods */ |
87 | 84 | |
88 | 85 | ve.es.Surface.prototype.onCutCopy = function( e ) { |
89 | | - console.log('cut/copy'); |
90 | 86 | var _this = this, |
91 | 87 | rangySel = rangy.getSelection(), |
92 | 88 | key = rangySel.getRangeAt(0).toString().replace(/\s/gm,""); |