Ticket #3828: 3828.patch
File 3828.patch, 2.7 KB (added by , 14 years ago) |
---|
-
_source/core/dtd.js
85 85 $listItem : {dd:1,dt:1,li:1}, 86 86 87 87 /** 88 * List of list root elements. 89 * @type Object 90 * @example 91 */ 92 $list: { ul:1,ol:1,dl:1}, 93 94 /** 88 95 * Elements that accept text nodes, but are not possible to edit into 89 96 * the browser. 90 97 * @type Object -
_source/core/htmlparser/fragment.js
45 45 // parser fixing. 46 46 var nonBreakingBlocks = CKEDITOR.tools.extend( 47 47 {table:1,ul:1,ol:1,dl:1}, 48 CKEDITOR.dtd.table, CKEDITOR.dtd.ul, CKEDITOR.dtd.ol, CKEDITOR.dtd.dl ); 48 CKEDITOR.dtd.table, CKEDITOR.dtd.ul, CKEDITOR.dtd.ol, CKEDITOR.dtd.dl ), 49 listBlocks = CKEDITOR.dtd.$list, listItems = CKEDITOR.dtd.$listItem; 49 50 50 51 /** 51 52 * Creates a {@link CKEDITOR.htmlParser.fragment} from an HTML string. … … 189 190 if ( !currentName ) 190 191 return; 191 192 192 var reApply = false; 193 var reApply = false, 194 addPoint; // New position to start adding nodes. 193 195 196 // Fixing malformed nested lists(#3828). 197 if( tagName in listBlocks 198 && currentName in listBlocks ) 199 { 200 var children = currentNode.children, 201 lastChild = children[ children.length - 1 ]; 202 // Move inner list into to previous list item if any. 203 if( lastChild && lastChild.name in listItems ) 204 returnPoint = currentNode, addPoint = lastChild; 205 // Move inner list outside in the worst case. 206 else 207 addElement( currentNode, currentNode.parent ); 208 } 194 209 // If the element name is the same as the current element name, 195 210 // then just close the current one and append the new one to the 196 211 // parent. This situation usually happens with <p>, <li>, <dt> and 197 212 // <dd>, specially in IE. Do not enter in this if block in this case. 198 if ( tagName == currentName )213 else if ( tagName == currentName ) 199 214 { 200 215 addElement( currentNode, currentNode.parent ); 201 216 } … … 222 237 reApply = true; 223 238 } 224 239 225 // In any of the above cases, we'll be adding, or trying to 226 // add it to the parent. 227 currentNode = currentNode.returnPoint || currentNode.parent; 240 if( addPoint ) 241 currentNode = addPoint; 242 // Try adding it to the return point, or the parent element. 243 else 244 currentNode = currentNode.returnPoint || currentNode.parent; 228 245 229 246 if ( reApply ) 230 247 {