X-Git-Url: https://jasonwoof.com/gitweb/?a=blobdiff_plain;f=_source%2Fplugins%2Findent%2Fplugin.js;h=1e3ec49dd45698e525abf2308c57a3c51a796c6f;hb=2f22c0c38f17e75be5541089076885442aaa2377;hp=7967c78b660676e917a4d3a96f299665f11c6923;hpb=1056598c95187351dc58f4991d331e2258d038b5;p=ckeditor.git diff --git a/_source/plugins/indent/plugin.js b/_source/plugins/indent/plugin.js index 7967c78..1e3ec49 100644 --- a/_source/plugins/indent/plugin.js +++ b/_source/plugins/indent/plugin.js @@ -1,5 +1,5 @@ /* -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 */ @@ -15,6 +15,9 @@ For licensing, see LICENSE.html or http://ckeditor.com/license function onSelectionChange( evt ) { + if ( evt.editor.readOnly ) + return null; + var editor = evt.editor, elementPath = evt.data.path, list = elementPath && elementPath.contains( listNodeNames ), @@ -77,7 +80,7 @@ For licensing, see LICENSE.html or http://ckeditor.com/license function isListItem( node ) { - return node.type = CKEDITOR.NODE_ELEMENT && node.is( 'li' ); + return node.type == CKEDITOR.NODE_ELEMENT && node.is( 'li' ); } indentCommand.prototype = { @@ -422,6 +425,25 @@ For licensing, see LICENSE.html or http://ckeditor.com/license } } }); + + 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(); + } + } + }); }, requires : [ 'domiterator', 'list' ]