JasonWoof Got questions, comments, patches, etc.? Contact Jason Woofenden
vanilla ckeditor-3.6.3
[ckeditor.git] / _source / plugins / indent / plugin.js
index b0c82bf..1e3ec49 100644 (file)
@@ -1,5 +1,5 @@
 /*\r
-Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved.\r
+Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.\r
 For licensing, see LICENSE.html or http://ckeditor.com/license\r
 */\r
 \r
@@ -425,6 +425,25 @@ For licensing, see LICENSE.html or http://ckeditor.com/license
                                        }\r
                                }\r
                        });\r
+\r
+                       editor.on( 'key', function( evt )\r
+                       {\r
+                               // Backspace at the beginning of  list item should outdent it.\r
+                               if ( editor.mode == 'wysiwyg' && evt.data.keyCode == 8 )\r
+                               {\r
+                                       var sel = editor.getSelection(),\r
+                                               range = sel.getRanges()[ 0 ],\r
+                                               li;\r
+\r
+                                       if ( range.collapsed &&\r
+                                                ( li = range.startContainer.getAscendant( 'li', 1 ) ) &&\r
+                                                range.checkBoundaryOfElement( li, CKEDITOR.START ) )\r
+                                       {\r
+                                               editor.execCommand( 'outdent' );\r
+                                               evt.cancel();\r
+                                       }\r
+                               }\r
+                       });\r
                },\r
 \r
                requires : [ 'domiterator', 'list' ]\r