Index: trunk/extensions/VisualEditor/modules/es/models/es.SurfaceModel.js |
— | — | @@ -61,15 +61,21 @@ |
62 | 62 | */ |
63 | 63 | es.SurfaceModel.prototype.select = function( selection, isManual ) { |
64 | 64 | selection.normalize(); |
65 | | - |
66 | | - this.selection = selection; |
67 | | - |
68 | | - if ( isManual ) { |
69 | | - // check if the last thing is a selection, if so, swap it. |
70 | | - this.pushSelection( selection ); |
| 65 | + if ( |
| 66 | + // First selection |
| 67 | + !this.selection || |
| 68 | + // From changed |
| 69 | + selection.from !== this.selection.from || |
| 70 | + // To changed |
| 71 | + selection.to !== this.selection.to |
| 72 | + ) { |
| 73 | + this.selection = selection; |
| 74 | + if ( isManual ) { |
| 75 | + // check if the last thing is a selection, if so, swap it. |
| 76 | + this.pushSelection( selection ); |
| 77 | + } |
| 78 | + this.emit( 'select', this.selection.clone() ); |
71 | 79 | } |
72 | | - |
73 | | - this.emit( 'select', this.selection.clone() ); |
74 | 80 | }; |
75 | 81 | |
76 | 82 | /** |