diff --git a/plugins/indentlist/plugin.js b/plugins/indentlist/plugin.js index 81f212c323f..40eaec9e5f7 100644 --- a/plugins/indentlist/plugin.js +++ b/plugins/indentlist/plugin.js @@ -174,7 +174,19 @@ listArray[ i ].indent += indentOffset; // 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; + var listRoot; + + for ( var j = i - 1; j >= 0; j-- ) { + if ( listArray[ j ].indent === indentOffset ) { + listRoot = listArray[ j ].parent; + break; + } + } + + if ( listRoot === undefined ) { + listRoot = listArray[ i ].parent; + } + listArray[ i ].parent = new CKEDITOR.dom.element( listRoot.getName(), listRoot.getDocument() ); } }