var path = new CKEDITOR.dom.elementPath( range.startContainer ),\r
block = path.block;\r
\r
- if ( block.is( 'li' ) || block.getParent().is( 'li' ) )\r
+ if ( block && ( block.is( 'li' ) || block.getParent().is( 'li' ) ) )\r
{\r
editor.execCommand( 'outdent' );\r
return;\r
// Do not enter this block if it's a header tag, or we are in\r
// a Shift+Enter (#77). Create a new block element instead\r
// (later in the code).\r
- if ( previousBlock.is( 'li' ) ||\r
- !( forceMode || headerTagRegex.test( previousBlock.getName() ) ) )\r
+ if ( previousBlock.is( 'li' ) || !headerTagRegex.test( previousBlock.getName() ) )\r
{\r
// Otherwise, duplicate the previous block.\r
newBlock = previousBlock.clone();\r
\r
if ( !newBlock )\r
newBlock = doc.createElement( blockTag );\r
+ // Force the enter block unless we're talking of a list item.\r
+ else if ( forceMode && !newBlock.is( 'li' ) )\r
+ newBlock.renameNode( blockTag );\r
\r
// Recreate the inline elements tree, which was available\r
// before hitting enter, so the same styles will be available in\r
\r
function shiftEnter( editor )\r
{\r
- // On SHIFT+ENTER we want to enforce the mode to be respected, instead\r
+ // Only effective within document.\r
+ if ( editor.mode != 'wysiwyg' )\r
+ return false;\r
+\r
+ // On SHIFT+ENTER:\r
+ // 1. We want to enforce the mode to be respected, instead\r
// of cloning the current block. (#77)\r
- return enter( editor, editor.config.shiftEnterMode, true );\r
+ // 2. Always perform a block break when inside <pre> (#5402).\r
+ if ( editor.getSelection().getStartElement().hasAscendant( 'pre', true ) )\r
+ {\r
+ setTimeout( function() { enterBlock( editor, editor.config.enterMode, null, true ); }, 0 );\r
+ return true;\r
+ }\r
+ else\r
+ return enter( editor, editor.config.shiftEnterMode, true );\r
}\r
\r
function enter( editor, mode, forceMode )\r