Index: CKEditor/trunk/CHANGES.html
===================================================================
--- CKEditor/trunk/CHANGES.html (revision 7391)
+++ CKEditor/trunk/CHANGES.html (revision 7392)
@@ -63,4 +63,5 @@
#5527 : Don't encode "#" sent from the file browser.
#8014 : Autogrow now stretches to fit the content when switching editor modes.
+ #8249 : Fix inconsistent behavior when backspace key at the start of list item.
Index: CKEditor/trunk/_source/core/dom/range.js
===================================================================
--- CKEditor/trunk/_source/core/dom/range.js (revision 7391)
+++ CKEditor/trunk/_source/core/dom/range.js (revision 7392)
@@ -386,9 +386,10 @@
{
// Reject any text node unless it's being bookmark
- // OR it's spaces. (#3883)
- return node.type != CKEDITOR.NODE_TEXT
- && node.getName() in CKEDITOR.dtd.$removeEmpty
- || !CKEDITOR.tools.trim( node.getText() )
- || !!node.getParent().data( 'cke-bookmark' );
+ // OR it's spaces.
+ // Reject any element unless it's being invisible empty. (#3883)
+ return node.type == CKEDITOR.NODE_TEXT ?
+ !CKEDITOR.tools.trim( node.getText() ) ||
+ !!node.getParent().data( 'cke-bookmark' )
+ : node.getName() in CKEDITOR.dtd.$removeEmpty;
}
Index: CKEditor/trunk/_source/plugins/indent/plugin.js
===================================================================
--- CKEditor/trunk/_source/plugins/indent/plugin.js (revision 7391)
+++ CKEditor/trunk/_source/plugins/indent/plugin.js (revision 7392)
@@ -426,4 +426,23 @@
}
});
+
+ editor.on( 'key', function( evt )
+ {
+ // Backspace at the beginning of list item should outdent it.
+ if ( editor.mode == 'wysiwyg' && evt.data.keyCode == 8 )
+ {
+ var sel = editor.getSelection(),
+ range = sel.getRanges()[ 0 ],
+ li;
+
+ if ( range.collapsed &&
+ ( li = range.startContainer.getAscendant( 'li', 1 ) ) &&
+ range.checkBoundaryOfElement( li, CKEDITOR.START ) )
+ {
+ editor.execCommand( 'outdent' );
+ evt.cancel();
+ }
+ }
+ });
},