X-Git-Url: https://jasonwoof.com/gitweb/?a=blobdiff_plain;ds=sidebyside;f=_source%2Fplugins%2Flist%2Fplugin.js;h=be747020723e065c34dfb27c4874567f6c33899e;hb=8665a7c6c60586526e32e8941fe2896739b6ebfb;hp=0a55231edd833f99507b870a8f62039501ba24ed;hpb=e7789c1ad838194d45eeee6ac2eb6e55f5cf35a1;p=ckeditor.git diff --git a/_source/plugins/list/plugin.js b/_source/plugins/list/plugin.js index 0a55231..be74702 100644 --- a/_source/plugins/list/plugin.js +++ b/_source/plugins/list/plugin.js @@ -234,6 +234,8 @@ For licensing, see LICENSE.html or http://ckeditor.com/license newList.listNode.replace( groupObj.root ); } + var headerTagRegex = /^h[1-6]$/; + function createList( editor, groupObj, listsCreated ) { var contents = groupObj.contents, @@ -285,8 +287,17 @@ For licensing, see LICENSE.html or http://ckeditor.com/license { var contentBlock = listContents.shift(), listItem = doc.createElement( 'li' ); - contentBlock.moveChildren( listItem ); - contentBlock.remove(); + + // Preserve heading structure when converting to list item. (#5271) + if ( headerTagRegex.test( contentBlock.getName() ) ) + contentBlock.appendTo( listItem ); + else + { + contentBlock.copyAttributes( listItem ); + contentBlock.moveChildren( listItem ); + contentBlock.remove(); + } + listItem.appendTo( listNode ); // Append a bogus BR to force the LI to render at full height