else if ( previousBlock && ( node = previousBlock.getParent() ) && node.is( 'li' ) )\r
{\r
previousBlock.breakParent( node );\r
- range.moveToElementEditStart( previousBlock.getNext() );\r
+ node = previousBlock.getNext();\r
+ range.moveToElementEditStart( node );\r
previousBlock.move( previousBlock.getPrevious() );\r
}\r
\r
{\r
// Otherwise, duplicate the previous block.\r
newBlock = previousBlock.clone();\r
+ // Value attribute of list item should not be duplicated (#7330).\r
+ newBlock.is( 'li' ) && newBlock.removeAttribute( 'value' );\r
}\r
}\r
else if ( nextBlock )\r
\r
if ( !newBlock )\r
{\r
- newBlock = doc.createElement( blockTag );\r
- if ( previousBlock && ( newBlockDir = previousBlock.getDirection() ) )\r
- newBlock.setAttribute( 'dir', newBlockDir );\r
+ // We have already created a new list item. (#6849)\r
+ if ( node && node.is( 'li' ) )\r
+ newBlock = node;\r
+ else\r
+ {\r
+ newBlock = doc.createElement( blockTag );\r
+ if ( previousBlock && ( newBlockDir = previousBlock.getDirection() ) )\r
+ newBlock.setAttribute( 'dir', newBlockDir );\r
+ }\r
}\r
// Force the enter block unless we're talking of a list item.\r
else if ( forceMode && !newBlock.is( 'li' ) )\r
if ( !CKEDITOR.env.ie )\r
newBlock.appendBogus();\r
\r
- range.insertNode( newBlock );\r
+ if ( !newBlock.getParent() )\r
+ range.insertNode( newBlock );\r
\r
// This is tricky, but to make the new block visible correctly\r
// we must select it.\r
range.deleteContents();\r
range.insertNode( lineBreak );\r
\r
- // A text node is required by Gecko only to make the cursor blink.\r
- // We need some text inside of it, so the bogus <br> is properly\r
- // created.\r
- if ( !CKEDITOR.env.ie )\r
- doc.createText( '\ufeff' ).insertAfter( lineBreak );\r
-\r
- // If we are at the end of a block, we must be sure the bogus node is available in that block.\r
- if ( isEndOfBlock && !CKEDITOR.env.ie )\r
- lineBreak.getParent().appendBogus();\r
-\r
- // Now we can remove the text node contents, so the caret doesn't\r
- // stop on it.\r
- if ( !CKEDITOR.env.ie )\r
- lineBreak.getNext().$.nodeValue = '';\r
// IE has different behavior regarding position.\r
if ( CKEDITOR.env.ie )\r
range.setStartAt( lineBreak, CKEDITOR.POSITION_AFTER_END );\r
else\r
+ {\r
+ // A text node is required by Gecko only to make the cursor blink.\r
+ // We need some text inside of it, so the bogus <br> is properly\r
+ // created.\r
+ doc.createText( '\ufeff' ).insertAfter( lineBreak );\r
+\r
+ // If we are at the end of a block, we must be sure the bogus node is available in that block.\r
+ if ( isEndOfBlock )\r
+ lineBreak.getParent().appendBogus();\r
+\r
+ // Now we can remove the text node contents, so the caret doesn't\r
+ // stop on it.\r
+ lineBreak.getNext().$.nodeValue = '';\r
+\r
range.setStartAt( lineBreak.getNext(), CKEDITOR.POSITION_AFTER_START );\r
\r
- // Scroll into view, for non IE.\r
- if ( !CKEDITOR.env.ie )\r
- {\r
+ // Scroll into view, for non IE.\r
var dummy = null;\r
\r
// BR is not positioned in Opera and Webkit.\r
return true;\r
}\r
\r
-\r
function getRange( editor )\r
{\r
// Get the selection ranges.\r