Ticket #8249: 8249.patch

File 8249.patch, 945 bytes (added by Garry Yao, 12 years ago)
  • _source/plugins/indent/plugin.js

     
    425425                                        }
    426426                                }
    427427                        });
     428
     429                        editor.on( 'key', function( evt )
     430                        {
     431                                // Backspace at the beginning of  list item should outdent it.
     432                                if ( editor.mode == 'wysiwyg' && evt.data.keyCode == 8 )
     433                                {
     434                                        var sel = editor.getSelection(),
     435                                                start = sel.getStartElement(),
     436                                                path = new CKEDITOR.dom.elementPath( start ),
     437                                                block = path.block;
     438
     439                                        if ( block && ( block.is( 'li' ) || block.getParent().is( 'li' ) ) )
     440                                        {
     441                                                var range = sel.getRanges()[ 0 ];
     442                                                if ( range.checkStartOfBlock() )
     443                                                {
     444                                                        editor.execCommand( 'outdent' );
     445                                                        evt.cancel();
     446                                                }
     447                                        }
     448                                }
     449                        });
    428450                },
    429451
    430452                requires : [ 'domiterator', 'list' ]
© 2003 – 2022, CKSource sp. z o.o. sp.k. All rights reserved. | Terms of use | Privacy policy