app/assets/javascripts/ckeditor/_source/plugins/indent/plugin.js in refinerycms-ckeditor-0.1.4 vs app/assets/javascripts/ckeditor/_source/plugins/indent/plugin.js in refinerycms-ckeditor-0.2.0

- old
+ new

@@ -1,7 +1,7 @@ /* -Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved. +Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved. For licensing, see LICENSE.html or http://ckeditor.com/license */ /** * @file Increse and decrease indent commands. @@ -420,9 +420,28 @@ var marginLeft = node.getStyle( 'margin-right' ), marginRight = node.getStyle( 'margin-left' ); marginLeft ? node.setStyle( 'margin-left', marginLeft ) : node.removeStyle( 'margin-left' ); marginRight ? node.setStyle( 'margin-right', marginRight ) : node.removeStyle( 'margin-right' ); + } + } + }); + + 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(); } } }); },