Changeset 2207
- Timestamp:
- 07/11/08 12:57:03 (5 years ago)
- Location:
- FCKeditor/branches/features/div_container/editor
- Files:
-
- 3 edited
-
_source/classes/fckdomrange.js (modified) (2 diffs)
-
_source/internals/fckdomtools.js (modified) (3 diffs)
-
dialog/fck_div.html (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
FCKeditor/branches/features/div_container/editor/_source/classes/fckdomrange.js
r2206 r2207 43 43 // For text nodes, the node itself is the StartNode. 44 44 var eStart = innerRange.startContainer ; 45 var eEnd = innerRange.endContainer ;46 45 47 46 var oElementPath = new FCKElementPath( eStart ) ; … … 51 50 this.StartBlockLimit = oElementPath.BlockLimit ; 52 51 53 if ( eStart != eEnd ) 54 oElementPath = new FCKElementPath( eEnd ) ; 55 56 // The innerRange.endContainer[ innerRange.endOffset ] is not 57 // usually part of the range, but the marker for the range end. So, 58 // let's get the previous available node as the real end. 59 var eEndNode = eEnd ; 60 if ( innerRange.endOffset == 0 ) 52 if ( innerRange.collapsed ) 61 53 { 62 while ( eEndNode && !eEndNode.previousSibling ) 63 eEndNode = eEndNode.parentNode ; 64 65 if ( eEndNode ) 66 eEndNode = eEndNode.previousSibling ; 54 this.EndNode = this.StartNode ; 55 this.EndContainer = this.StartContainer ; 56 this.EndBlock = this.StartBlock ; 57 this.EndBlockLimit = this.StartBlockLimit ; 67 58 } 68 else if ( eEndNode.nodeType == 1 )59 else 69 60 { 70 if ( innerRange.endContainer != innerRange.startContainer || innerRange.endOffset != innerRange.startOffset ) 61 var eEnd = innerRange.endContainer ; 62 63 if ( eStart != eEnd ) 64 oElementPath = new FCKElementPath( eEnd ) ; 65 66 // The innerRange.endContainer[ innerRange.endOffset ] is not 67 // usually part of the range, but the marker for the range end. So, 68 // let's get the previous available node as the real end. 69 var eEndNode = eEnd ; 70 if ( innerRange.endOffset == 0 ) 71 { 72 while ( eEndNode && !eEndNode.previousSibling ) 73 eEndNode = eEndNode.parentNode ; 74 75 if ( eEndNode ) 76 eEndNode = eEndNode.previousSibling ; 77 } 78 else if ( eEndNode.nodeType == 1 ) 71 79 eEndNode = eEndNode.childNodes[ innerRange.endOffset - 1 ] ; 72 else 73 eEndNode = eEndNode.childNodes[ innerRange.endOffset ] ; 80 81 this.EndNode = eEndNode ; 82 this.EndContainer = eEnd ; 83 this.EndBlock = oElementPath.Block ; 84 this.EndBlockLimit = oElementPath.BlockLimit ; 74 85 } 75 76 this.EndNode = eEndNode ;77 this.EndContainer = eEnd ;78 this.EndBlock = oElementPath.Block ;79 this.EndBlockLimit = oElementPath.BlockLimit ;80 86 } 81 87 -
FCKeditor/branches/features/div_container/editor/_source/internals/fckdomtools.js
r2206 r2207 1029 1029 range.MoveToSelection() ; 1030 1030 1031 var startNode = range. StartNode;1032 var endNode = range. EndNode;1031 var startNode = range.GetTouchedStartNode() ; 1032 var endNode = range.GetTouchedEndNode() ; 1033 1033 var currentNode = startNode ; 1034 1034 … … 1037 1037 while ( endNode.nodeType == 1 && endNode.lastChild ) 1038 1038 endNode = endNode.lastChild ; 1039 endNode = FCKDomTools.GetNextSource Element( endNode ) ;1040 } 1041 1042 while ( currentNode && currentNode != endNode && currentNode != endNode.parentNode)1039 endNode = FCKDomTools.GetNextSourceNode( endNode ) ; 1040 } 1041 1042 while ( currentNode && currentNode != endNode ) 1043 1043 { 1044 1044 var path = new FCKElementPath( currentNode ) ; … … 1047 1047 currentBlocks.push( blockLimit ) ; 1048 1048 1049 currentNode = FCKDomTools.GetNextSource Element( currentNode ) ;1049 currentNode = FCKDomTools.GetNextSourceNode( currentNode ) ; 1050 1050 } 1051 1051 -
FCKeditor/branches/features/div_container/editor/dialog/fck_div.html
r2206 r2207 111 111 // Popuplate the style menu 112 112 var styles = FCKStyles.GetStyles() ; 113 var match = null ;114 113 var selectableStyles = {} ; 114 for ( var i in styles ) 115 { 116 if ( ! /^_FCK_/.test( i ) && styles[i].Element == 'div' ) 117 selectableStyles[i] = styles[i] ; 118 } 115 119 if ( CurrentContainers.length <= 1 ) 116 120 { 117 121 var target = CurrentContainers[0] ; 118 for ( var i in styles ) 119 { 120 if ( ! /^_FCK_/.test( i ) && styles[i].Element == 'div' ) 121 { 122 if ( target && styles[i].CheckElementRemovable( target, true ) ) 123 match = i ; 124 selectableStyles[i] = styles[i] ; 125 } 122 var match = null ; 123 for ( var i in selectableStyles ) 124 { 125 if ( target && styles[i].CheckElementRemovable( target, true ) ) 126 match = i ; 126 127 } 127 128 if ( !match ) … … 145 146 else 146 147 { 147 GetE( 'txtId' ).disabled = GetE( 'selStyle' ).disabled = true ; 148 GetE( 'txtId' ).disabled = true ; 149 AddStyleOption( "" ) ; 150 for ( var i in selectableStyles ) 151 AddStyleOption( i ) ; 148 152 } 149 153 }
Note: See TracChangeset
for help on using the changeset viewer.
