X-Git-Url: https://jasonwoof.com/gitweb/?a=blobdiff_plain;f=_source%2Fplugins%2Fenterkey%2Fplugin.js;fp=_source%2Fplugins%2Fenterkey%2Fplugin.js;h=cce120845273ce847a3ef1547c12e26a60e745e6;hb=e7789c1ad838194d45eeee6ac2eb6e55f5cf35a1;hp=0127ede7f1afb7089c554ddc6324facdfd7a6259;hpb=059b4c2fef02528bf1af189f7996e80652faddfb;p=ckeditor.git
diff --git a/_source/plugins/enterkey/plugin.js b/_source/plugins/enterkey/plugin.js
index 0127ede..cce1208 100644
--- a/_source/plugins/enterkey/plugin.js
+++ b/_source/plugins/enterkey/plugin.js
@@ -26,6 +26,19 @@ For licensing, see LICENSE.html or http://ckeditor.com/license
var doc = range.document;
+ // Exit the list when we're inside an empty list item block. (#5376)
+ if ( range.checkStartOfBlock() && range.checkEndOfBlock() )
+ {
+ var path = new CKEDITOR.dom.elementPath( range.startContainer ),
+ block = path.block;
+
+ if ( block.is( 'li' ) || block.getParent().is( 'li' ) )
+ {
+ editor.execCommand( 'outdent' );
+ return;
+ }
+ }
+
// Determine the block element to be used.
var blockTag = ( mode == CKEDITOR.ENTER_DIV ? 'div' : 'p' );
@@ -80,13 +93,6 @@ For licensing, see LICENSE.html or http://ckeditor.com/license
}
else
{
-
- if ( isStartOfBlock && isEndOfBlock && previousBlock.is( 'li' ) )
- {
- editor.execCommand( 'outdent' );
- return;
- }
-
var newBlock;
if ( previousBlock )
@@ -94,7 +100,8 @@ For licensing, see LICENSE.html or http://ckeditor.com/license
// Do not enter this block if it's a header tag, or we are in
// a Shift+Enter (#77). Create a new block element instead
// (later in the code).
- if ( !forceMode && !headerTagRegex.test( previousBlock.getName() ) )
+ if ( previousBlock.is( 'li' ) ||
+ !( forceMode || headerTagRegex.test( previousBlock.getName() ) ) )
{
// Otherwise, duplicate the previous block.
newBlock = previousBlock.clone();
@@ -219,7 +226,8 @@ For licensing, see LICENSE.html or http://ckeditor.com/license
isPre = ( startBlockTag == 'pre' );
- if ( isPre )
+ // Gecko prefers
as line-break inside
(#4711). + if ( isPre && !CKEDITOR.env.gecko ) lineBreak = doc.createText( CKEDITOR.env.ie ? '\r' : '\n' ); else lineBreak = doc.createElement( 'br' ); @@ -290,6 +298,8 @@ For licensing, see LICENSE.html or http://ckeditor.com/license function enter( editor, mode, forceMode ) { + forceMode = editor.config.forceEnterMode || forceMode; + // Only effective within document. if ( editor.mode != 'wysiwyg' ) return false;