Ticket #2407: 2407.patch
File 2407.patch, 6.3 KB (added by , 16 years ago) |
---|
-
_whatsnew.html
42 42 <p> 43 43 Fixed Bugs:</p> 44 44 <ul> 45 <li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/24 07">#2407</a>] Fixed the issue45 <li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/2412">#2412</a>] Fixed the issue 46 46 where FCK.InsertHtml() is no longer removing selected contents after content insertion 47 47 in Firefox.</li> 48 <li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/2407">#2407</a>] Fixed the issue 49 where the Div container command and the blockquote command would break lists.</li> 48 50 </ul> 49 51 <h3> 50 52 Version 2.6.3 Beta</h3> -
editor/_source/commandclasses/fckblockquotecommand.js
83 83 84 84 if ( state == FCK_TRISTATE_OFF ) 85 85 { 86 iterator.EnforceRealBlocks = true ;87 86 var paragraphs = [] ; 88 87 while ( ( block = iterator.GetNextParagraph() ) ) 89 88 paragraphs.push( block ) ; … … 109 108 block = paragraphs[i] ; 110 109 commonParent = FCKDomTools.GetCommonParents( block.parentNode, commonParent ).pop() ; 111 110 } 111 112 // The common parent must not be the following tags: table, tbody, tr, ol, ul. 113 while ( commonParent.nodeName.IEquals( 'table', 'tbody', 'tr', 'ol', 'ul' ) ) 114 commonParent = commonParent.parentNode ; 115 116 // Reconstruct the block list to be processed such that all resulting blocks 117 // satisfy parentNode == commonParent. 112 118 var lastBlock = null ; 113 119 while ( paragraphs.length > 0 ) 114 120 { … … 150 156 else if ( state == FCK_TRISTATE_ON ) 151 157 { 152 158 var moveOutNodes = [] ; 159 var elementMarkers = {} ; 153 160 while ( ( block = iterator.GetNextParagraph() ) ) 154 161 { 155 162 var bqParent = null ; … … 165 172 block = block.parentNode ; 166 173 } 167 174 168 if ( bqParent && bqChild ) 175 // Remember the blocks that were recorded down in the moveOutNodes array 176 // to prevent duplicates. 177 if ( bqParent && bqChild && !bqChild._fckblockquotemoveout ) 178 { 169 179 moveOutNodes.push( bqChild ) ; 180 FCKDomTools.SetElementMarker( elementMarkers, bqChild, '_fckblockquotemoveout', true ) ; 181 } 170 182 } 183 FCKDomTools.ClearAllMarkers( elementMarkers ) ; 171 184 172 185 var movedNodes = [] ; 186 var processedBlockquoteBlocks = [], elementMarkers = {} ; 187 var noBlockLeft = function( bqBlock ) 188 { 189 for ( var i = 0 ; i < bqBlock.childNodes.length ; i++ ) 190 { 191 if ( FCKListsLib.BlockElements[ bqBlock.childNodes[i].nodeName.toLowerCase() ] ) 192 return false ; 193 } 194 return true ; 195 } 173 196 while ( moveOutNodes.length > 0 ) 174 197 { 175 198 var node = moveOutNodes.shift() ; … … 178 201 // If the node is located at the beginning or the end, just take it out without splitting. 179 202 // Otherwise, split the blockquote node and move the paragraph in between the two blockquote nodes. 180 203 if ( node == node.parentNode.firstChild ) 181 {182 204 bqBlock.parentNode.insertBefore( bqBlock.removeChild( node ), bqBlock ) ; 183 if ( ! bqBlock.firstChild )184 bqBlock.parentNode.removeChild( bqBlock ) ;185 }186 205 else if ( node == node.parentNode.lastChild ) 187 {188 206 bqBlock.parentNode.insertBefore( bqBlock.removeChild( node ), bqBlock.nextSibling ) ; 189 if ( ! bqBlock.firstChild )190 bqBlock.parentNode.removeChild( bqBlock ) ;191 }192 207 else 193 208 FCKDomTools.BreakParent( node, node.parentNode, range ) ; 194 209 210 // Remember the blockquote node so we can clear it later (if it becomes empty). 211 if ( !bqBlock._fckbqprocessed ) 212 { 213 processedBlockquoteBlocks.push( bqBlock ) ; 214 FCKDomTools.SetElementMarker( elementMarkers, bqBlock, '_fckbqprocessed', true ); 215 } 216 195 217 movedNodes.push( node ) ; 196 218 } 197 219 220 // Clear blockquote nodes that have become empty. 221 for ( var i = processedBlockquoteBlocks.length - 1 ; i >= 0 ; i-- ) 222 { 223 var bqBlock = processedBlockquoteBlocks[i] ; 224 if ( noBlockLeft( bqBlock ) ) 225 FCKDomTools.RemoveNode( bqBlock ) ; 226 } 227 FCKDomTools.ClearAllMarkers( elementMarkers ) ; 228 198 229 if ( FCKConfig.EnterMode.IEquals( 'br' ) ) 199 230 { 200 231 while ( movedNodes.length ) -
editor/dialog/fck_div.html
203 203 var iterator = new FCKDomRangeIterator( range ) ; 204 204 var block ; 205 205 206 iterator.EnforceRealBlocks = true ;207 206 var paragraphs = [] ; 207 while ( ( block = iterator.GetNextParagraph() ) ) 208 paragraphs.push( block ) ; 209 210 // Make sure all paragraphs have the same parent. 211 var commonParent = paragraphs[0].parentNode ; 212 var tmp = [] ; 213 for ( var i = 0 ; i < paragraphs.length ; i++ ) 214 { 215 block = paragraphs[i] ; 216 commonParent = FCKDomTools.GetCommonParents( block.parentNode, commonParent ).pop() ; 217 } 218 219 // The common parent must not be the following tags: table, tbody, tr, ol, ul. 220 while ( commonParent.nodeName.IEquals( 'table', 'tbody', 'tr', 'ol', 'ul' ) ) 221 commonParent = commonParent.parentNode ; 222 223 // Reconstruct the block list to be processed such that all resulting blocks 224 // satisfy parentNode == commonParent. 225 var lastBlock = null ; 226 while ( paragraphs.length > 0 ) 227 { 228 block = paragraphs.shift() ; 229 while ( block.parentNode != commonParent ) 230 block = block.parentNode ; 231 if ( block != lastBlock ) 232 tmp.push( block ) ; 233 lastBlock = block ; 234 } 235 paragraphs = tmp ; 236 237 // Split the paragraphs into groups depending on their BlockLimit element. 208 238 var groups = [] ; 209 239 var lastBlockLimit = null ; 210 while ( ( block = iterator.GetNextParagraph() ))240 for ( var i = 0 ; i < paragraphs.length ; i++ ) 211 241 { 242 block = paragraphs[i] ; 212 243 var elementPath = new FCKElementPath( block ) ; 213 244 if ( elementPath.BlockLimit != lastBlockLimit ) 214 245 { … … 218 249 groups[groups.length - 1].push( block ) ; 219 250 } 220 251 252 // Create a DIV container for each group. 221 253 for ( var i = 0 ; i < groups.length ; i++ ) 222 254 { 223 255 var divNode = FCK.EditorDocument.createElement( 'div' ) ;