- // Append a bogus BR to force the LI to render at full height\r
- if ( !CKEDITOR.env.ie )\r
- listItem.appendBogus();\r
+ // Preserve preformat block and heading structure when converting to list item. (#5335) (#5271)\r
+ if ( contentBlock.is( 'pre' ) || headerTagRegex.test( contentBlock.getName() ) )\r
+ contentBlock.appendTo( listItem );\r
+ else\r
+ {\r
+ if ( contentBlock.hasAttribute( 'dir' ) )\r
+ {\r
+ dir = dir || contentBlock.getAttribute( 'dir' );\r
+ contentBlock.removeAttribute( 'dir' );\r
+ }\r
+ contentBlock.copyAttributes( listItem );\r
+ contentBlock.moveChildren( listItem );\r
+ contentBlock.remove();\r
+\r
+ // Append a bogus BR to force the LI to render at full height\r
+ if ( !CKEDITOR.env.ie )\r
+ listItem.appendBogus();\r
+ }\r
+\r
+ listItem.appendTo( listNode );\r