Changeset 838
- Timestamp:
- 09/17/07 12:37:28 (6 years ago)
- Location:
- FCKeditor/trunk
- Files:
-
- 1 deleted
- 1 edited
-
_test/manual/fckdomrange (deleted)
-
editor/_source/classes/fckdomrange.js (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
FCKeditor/trunk/editor/_source/classes/fckdomrange.js
r834 r838 732 732 }, 733 733 734 // TODO : Remove this one, in favor of FCKDomRangeIterator.GetNextParagraph.735 GetParagraphs : function( forceBreakBr )736 {737 var retval = [] ;738 739 // Get and "expanded" clone of this range.740 var range = this.Clone() ;741 if ( forceBreakBr )742 range.Expand( 'list_contents' ) ;743 else744 range.Expand( 'block_contents' ) ;745 746 var currentNode = range.StartNode || range.StartContainer ;747 var lastNode = range.EndNode || range.EndContainer.lastChild || range.EndContainer ;748 749 var boundarySet = FCKListsLib.BlockBoundaries ;750 if ( forceBreakBr )751 boundarySet = FCKListsLib.ListBoundaries ;752 753 // Let's reuse this range754 range = null ;755 756 while ( currentNode )757 {758 // closeRange indicates that a paragraph boundary has been found,759 // so the range must be appended to the list.760 var closeRange = false ;761 762 var continueFromSibling = false ;763 764 // includeNode indicates that the current node is good to be part765 // of the range.766 var includeNode = ( currentNode.nodeType != 1 ) ;767 768 // If it is an element node, let's check if it can be part of the769 // range.770 if ( !includeNode )771 {772 var nodeName = currentNode.nodeName.toLowerCase() ;773 774 if ( boundarySet[ nodeName ] )775 {776 // <br> boundaries must be part of the range. It will777 // happen only if EnterMode='br'.778 if ( nodeName == 'br' )779 includeNode = true ;780 781 closeRange = true ;782 }783 else784 {785 // If we have child nodes, let's check them.786 if ( currentNode.firstChild )787 {788 currentNode = currentNode.firstChild ;789 continue ;790 }791 includeNode = true ;792 }793 }794 else if ( currentNode.nodeType == 3 )795 {796 // Ignore normal whitespaces (i.e. not including or797 // other unicode whitespaces) before/after a block node.798 if ( /^[\r\n\t ]+$/.test( currentNode.nodeValue ) )799 includeNode = false ;800 }801 802 // The current node is good to be part of the range and we are803 // starting a new range, initialize it first.804 if ( includeNode && !range )805 {806 range = new FCKDomRange( this.Window ) ;807 range.SetStart( currentNode, 3, true ) ;808 }809 810 // If we are in an element boundary, let's check if it is time811 // to close the range, otherwise we include the parent within it.812 if ( range && !closeRange )813 {814 var parentNode = currentNode.parentNode ;815 while ( currentNode == parentNode.lastChild && currentNode != lastNode )816 {817 if ( boundarySet[ parentNode.nodeName.toLowerCase() ] )818 {819 closeRange = true ;820 break ;821 }822 823 currentNode = parentNode ;824 continueFromSibling = true ;825 }826 }827 828 // Now finally include the node.829 if ( includeNode )830 range.SetEnd( currentNode, 4, true ) ;831 832 // We have found a block boundary. Let's add the range to the list,833 // and prepare it for the next one.834 if ( ( closeRange || currentNode == lastNode ) && range )835 {836 range._UpdateElementInfo() ;837 retval.push( range ) ;838 range = null ;839 }840 841 // Stop processing if this is the last one.842 if ( currentNode == lastNode )843 break ;844 845 currentNode = FCKDomTools.GetNextSourceNode( currentNode, continueFromSibling ) ;846 }847 848 return retval ;849 },850 851 734 GetText : function() 852 735 {
Note: See TracChangeset
for help on using the changeset viewer.
