X-Git-Url: https://git.immae.eu/?p=perso%2FImmae%2FProjets%2Fpackagist%2Fludivine-ckeditor-component.git;a=blobdiff_plain;f=sources%2Fplugins%2Findentlist%2Fplugin.js;h=0ee30c05844fd3c49cc03834eb088b1c89e02f1a;hp=15c661f18bfa349c883463978caf540215c21756;hb=1794320dcfdfcd19572fb1676294f9853a6bbc20;hpb=7183f6a6a21ad9124e70c997e0168459f377a9f2 diff --git a/sources/plugins/indentlist/plugin.js b/sources/plugins/indentlist/plugin.js index 15c661f..0ee30c0 100644 --- a/sources/plugins/indentlist/plugin.js +++ b/sources/plugins/indentlist/plugin.js @@ -35,17 +35,24 @@ // Indent and outdent lists with TAB/SHIFT+TAB key. Indenting can // be done for any list item that isn't the first child of the parent. editor.on( 'key', function( evt ) { + var path = editor.elementPath(); + if ( editor.mode != 'wysiwyg' ) return; if ( evt.data.keyCode == this.indentKey ) { - var list = this.getContext( editor.elementPath() ); + // Prevent of getting context of empty path (#424)(https://dev.ckeditor.com/ticket/17028). + if ( !path ) { + return; + } + + var list = this.getContext( path ); if ( list ) { // Don't indent if in first list item of the parent. // Outdent, however, can always be done to collapse // the list into a paragraph (div). - if ( this.isIndent && CKEDITOR.plugins.indentList.firstItemInPath( this.context, editor.elementPath(), list ) ) + if ( this.isIndent && CKEDITOR.plugins.indentList.firstItemInPath( this.context, path, list ) ) return; // Exec related global indentation command. Global @@ -109,7 +116,8 @@ function indentList( editor ) { var that = this, database = this.database, - context = this.context; + context = this.context, + range; function indent( listNode ) { // Our starting and ending points of the range might be inside some blocks under a list item... @@ -164,7 +172,7 @@ for ( i = startItem.getCustomData( 'listarray_index' ); i <= lastItem.getCustomData( 'listarray_index' ); i++ ) { listArray[ i ].indent += indentOffset; - // Make sure the newly created sublist get a brand-new element of the same type. (#5372) + // Make sure the newly created sublist get a brand-new element of the same type. (http://dev.ckeditor.com/ticket/5372) if ( indentOffset > 0 ) { var listRoot = listArray[ i ].parent; listArray[ i ].parent = new CKEDITOR.dom.element( listRoot.getName(), listRoot.getDocument() ); @@ -179,7 +187,7 @@ var newList = CKEDITOR.plugins.list.arrayToList( listArray, database, null, editor.config.enterMode, listNode.getDirection() ); // Avoid nested
  • after outdent even they're visually same, - // recording them for later refactoring.(#3982) + // recording them for later refactoring.(http://dev.ckeditor.com/ticket/3982) if ( !that.isIndent ) { var parentLiElement; if ( ( parentLiElement = listNode.getParent() ) && parentLiElement.is( 'li' ) ) { @@ -207,7 +215,7 @@ // Nest preceding