Index: trunk/extensions/VisualEditor/modules/ve/ce/ve.es.Surface.js |
— | — | @@ -88,7 +88,7 @@ |
89 | 89 | console.log('cut/copy'); |
90 | 90 | var _this = this, |
91 | 91 | rangySel = rangy.getSelection(), |
92 | | - key = rangySel.getRangeAt(0).toString().replace(/( |\r\n|\n|\r|\t)/gm,""); |
| 92 | + key = rangySel.getRangeAt(0).toString().replace(/\s/gm,""); |
93 | 93 | |
94 | 94 | _this.clipboard[key] = ve.copyArray( _this.documentView.model.getData( _this.getSelection() ) ); |
95 | 95 | |
— | — | @@ -107,22 +107,12 @@ |
108 | 108 | var _this = this, |
109 | 109 | insertionPoint = _this.getSelection().start, |
110 | 110 | node = rangy.getSelection().anchorNode; |
111 | | - |
112 | | -_this.stopPolling(); |
| 111 | + |
113 | 112 | $('#paste').html('').show().css( 'top', $(window).scrollTop() ).css(' left', $(window).scrollLeft() ).focus(); |
114 | 113 | |
115 | | - |
116 | | - |
117 | 114 | setTimeout( function() { |
| 115 | + var key = $('#paste').hide().text().replace(/\s/gm,""); |
118 | 116 | |
119 | | - console.log('key is: '); |
120 | | - console.log(_this.clipboard); |
121 | | - console.log('paste is: '); |
122 | | - console.log( $('#paste').hide().text().replace(/( |\r\n|\n|\r|\t)/gm,"") ); |
123 | | - |
124 | | - |
125 | | - var key = $('#paste').hide().text().replace(/( |\r\n|\n|\r|\t)/gm,""); |
126 | | - |
127 | 117 | if ( _this.clipboard[key] ) { |
128 | 118 | // transact |
129 | 119 | var tx = _this.documentView.model.prepareInsertion( insertionPoint, _this.clipboard[key]); |
— | — | @@ -130,12 +120,12 @@ |
131 | 121 | |
132 | 122 | // re-render |
133 | 123 | _this.getLeafNode( node ).data( 'view' ).renderContent(); |
| 124 | + |
| 125 | + // clear the prev information from poll object (probably a better way to do this) |
134 | 126 | _this.poll.prevText = _this.poll.prevHash = _this.poll.prevOffset = _this.poll.node = null; |
135 | 127 | |
136 | 128 | // place cursor |
137 | | - //_this.showCursorAt( insertionPoint + _this.clipboard[key].length ); |
138 | | - |
139 | | - //_this.startPolling(); |
| 129 | + _this.showCursorAt( insertionPoint + _this.clipboard[key].length ); |
140 | 130 | } else { |
141 | 131 | alert('i can only handle copy/paste from hybrid surface. sorry. :('); |
142 | 132 | } |