Skip to content
Permalink
Browse files

Merge branch 't/11897'

  • Loading branch information...
Reinmar committed Jun 27, 2014
2 parents 89f4a31 + 9a3b014 commit e0542d2e1bc07fb6d6f9bad543aa2fa6fd4b4f4e
Showing with 57 additions and 8 deletions.
  1. +1 −0 CHANGES.md
  2. +18 −8 plugins/enterkey/plugin.js
  3. +38 −0 tests/plugins/enter/list.js
@@ -6,6 +6,7 @@ CKEditor 4 Changelog
Fixed Issues:

* [#12110](http://dev.ckeditor.com/ticket/12110): Fixed: Editor crash after deleting a table. Thanks to [Alin Purcaru](https://github.com/mesmerizero)!
* [#11897](http://dev.ckeditor.com/ticket/11897): Fixed: Enter key in an empty formatted list item, creates a new line instead of breaking the list. Thanks to [noam-si](https://github.com/noam-si)!

## CKEditor 4.4.2

@@ -58,6 +58,10 @@
if ( atBlockStart && atBlockEnd ) {
// Exit the list when we're inside an empty list item block. (#5376)
if ( block && ( block.is( 'li' ) || block.getParent().is( 'li' ) ) ) {
// Make sure to point to the li when dealing with empty list item.
if ( !block.is( 'li' ) )
block = block.getParent();

var blockParent = block.getParent(),
blockGrandParent = blockParent.getParent(),

@@ -175,17 +179,23 @@

block.remove();
} else {
// Use <div> block for ENTER_BR and ENTER_DIV.
newBlock = doc.createElement( mode == CKEDITOR.ENTER_P ? 'p' : 'div' );
// Original path block is the list item, create new block for the list item content.
if ( path.block.is( 'li' ) ) {
// Use <div> block for ENTER_BR and ENTER_DIV.
newBlock = doc.createElement( mode == CKEDITOR.ENTER_P ? 'p' : 'div' );

if ( dirLoose )
newBlock.setAttribute( 'dir', orgDir );
if ( dirLoose )
newBlock.setAttribute('dir', orgDir);

style && newBlock.setAttribute( 'style', style );
className && newBlock.setAttribute( 'class', className );
style && newBlock.setAttribute( 'style', style );
className && newBlock.setAttribute( 'class', className );

// Move all the child nodes to the new block.
block.moveChildren( newBlock );
// Move all the child nodes to the new block.
block.moveChildren( newBlock );
}
// The original path block is not a list item, just copy the block to out side of the list.
else
newBlock = path.block;

// If block is the first or last child of the parent
// list, move it out of the list:
@@ -514,6 +514,44 @@
true, 'Direction should be preserved if different than cointainer\'s.', true );
},

'test enterkey: leaves empty list item with h1 format': function() {
assertEnter( 'enterP',
'<ul>' +
'<li>x</li>' +
'<li><h1>^</h1></li>' +
'<li>y</li>' +
'</ul>',

'<ul>' +
'<li>x</li>' +
'</ul>' +
'<h1>^&nbsp;</h1>' +
'<ul>' +
'<li>y</li>' +
'</ul>',

true, 'List should be split and format preserved.', true );
},

'test enterkey: leaves empty list item with a paragraph': function() {
assertEnter( 'enterP',
'<ul>' +
'<li>x</li>' +
'<li><p>^</p></li>' +
'<li>y</li>' +
'</ul>',

'<ul>' +
'<li>x</li>' +
'</ul>' +
'<p>^&nbsp;</p>' +
'<ul>' +
'<li>y</li>' +
'</ul>',

true, 'List should be split.', true );
},

'test enterkey: force block: style (ENTER_BR)': function() {
assertEnter( 'enterBR',
'<ul>' +

0 comments on commit e0542d2

Please sign in to comment.
You can’t perform that action at this time.