Index: trunk/parsers/wikidom/lib/es/es.Surface.js |
— | — | @@ -573,14 +573,21 @@ |
574 | 574 | }; |
575 | 575 | |
576 | 576 | Surface.prototype.insertContent = function( location, content ) { |
577 | | - if ( this.selection.from && this.selection.to ) { |
578 | | - this.deleteContent( this.selection ); |
| 577 | + if ( typeof location === 'undefined' ) { |
| 578 | + location = this.location; |
579 | 579 | } |
| 580 | + if ( !location.block || !location.offset ) { |
| 581 | + throw 'Invalid selection error. Properties for from and to locations expected.'; |
| 582 | + } |
| 583 | + this.deleteContent( this.selection ); |
580 | 584 | this.location.block.insertContent( location.offset, content ); |
581 | 585 | }; |
582 | 586 | |
583 | 587 | Surface.prototype.deleteContent = function( selection ) { |
584 | | - if ( !selection.from && !selection.to ) { |
| 588 | + if ( typeof selection === 'undefined' ) { |
| 589 | + selection = this.selection; |
| 590 | + } |
| 591 | + if ( !selection.from || !selection.to ) { |
585 | 592 | throw 'Invalid selection error. Properties for from and to locations expected.'; |
586 | 593 | } |
587 | 594 | selection.normalize(); |
— | — | @@ -620,11 +627,18 @@ |
621 | 628 | * @param selection {Selection} Range to apply annotation to |
622 | 629 | */ |
623 | 630 | Surface.prototype.annotateContent = function( method, annotation, selection ) { |
| 631 | +<<<<<<< .mine |
| 632 | + if ( typeof selection === 'undefined' ) { |
| 633 | + selection = this.selection; |
| 634 | + } |
| 635 | + if ( !selection.from || !selection.to ) { |
| 636 | +======= |
624 | 637 | if ( selection === undefined ) { |
625 | 638 | selection = this.selection; |
626 | 639 | } |
627 | 640 | /* |
628 | 641 | if ( !selection.from && !selection.to ) { |
| 642 | +>>>>>>> .r92506 |
629 | 643 | throw 'Invalid selection error. Properties for from and to locations expected.'; |
630 | 644 | } |
631 | 645 | */ |