Ticket #4650: 4650.patch
File 4650.patch, 1.6 KB (added by , 13 years ago) |
---|
-
_source/plugins/selection/plugin.js
695 695 if ( cache.selectedElement !== undefined ) 696 696 return cache.selectedElement; 697 697 698 var node; 698 var node, 699 type = this.getType(); 699 700 700 if ( t his.getType()== CKEDITOR.SELECTION_ELEMENT )701 if ( type == CKEDITOR.SELECTION_ELEMENT ) 701 702 { 702 703 var sel = this.getNative(); 703 704 … … 715 716 node = range.startContainer.childNodes[ range.startOffset ]; 716 717 } 717 718 } 719 // Somtimes browser lies on selection type (e.g. text[<img />]), figure it 720 // out by further checking the range. 721 else if( type == CKEDITOR.SELECTION_TEXT ) 722 { 723 // Bookmark the selection first since 'getEnclosedNode' 724 // call below could alter it. 725 var bookmarks = this.createBookmarks(), 726 range = this.getRanges()[ 0 ]; 718 727 719 return cache.selectedElement = ( node ? new CKEDITOR.dom.element( node ) : null ); 728 node = range.getEnclosedNode(); 729 this.selectBookmarks( bookmarks ); 730 } 731 732 return ( cache.selectedElement = node && node.type == CKEDITOR.NODE_ELEMENT ? node : null ); 720 733 }, 721 734 722 735 lock : function() 723 736 { 724 737 // Call all cacheable function. 725 this.getRanges();726 this.getStartElement();727 738 this.getSelectedElement(); 739 this.getStartElement(); 740 this.getRanges(); 728 741 729 742 // The native selection is not available when locked. 730 743 this._.cache.nativeSel = {};