/*\r
-Copyright (c) 2003-2010, CKSource - Frederico Knabben. All rights reserved.\r
+Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved.\r
For licensing, see LICENSE.html or http://ckeditor.com/license\r
*/\r
\r
else if ( item.indent == Math.max( indentLevel, 0 ) + 1 )\r
{\r
var listData = CKEDITOR.plugins.list.arrayToList( listArray, null, currentIndex, paragraphMode );\r
+\r
+ // If the next block is an <li> with another list tree as the first\r
+ // child, we'll need to append a filler (<br>/NBSP) or the list item\r
+ // wouldn't be editable. (#6724)\r
+ if ( !currentListItem.getChildCount() && CKEDITOR.env.ie && !( doc.$.documentMode > 7 ))\r
+ currentListItem.append( doc.createText( '\xa0' ) );\r
currentListItem.append( listData.listNode );\r
currentIndex = listData.nextIndex;\r
}\r
else\r
{\r
// Create completely new blocks here.\r
- if ( dir || item.element.hasAttributes() ||\r
- ( paragraphMode != CKEDITOR.ENTER_BR && item.grandparent.getName() != 'td' ) )\r
+ if ( dir || item.element.hasAttributes() || paragraphMode != CKEDITOR.ENTER_BR )\r
{\r
currentListItem = doc.createElement( paragraphName );\r
item.element.copyAttributes( currentListItem, { type:1, value:1 } );\r
- dir && currentListItem.setAttribute( 'dir', dir );\r
+ var itemDir = item.element.getDirection() || dir;\r
+ itemDir &&\r
+ currentListItem.setAttribute( 'dir', itemDir );\r
\r
// There might be a case where there are no attributes in the element after all\r
// (i.e. when "type" or "value" are the only attributes set). In this case, if enterMode = BR,\r
}\r
};\r
\r
- function setState( editor, state )\r
- {\r
- editor.getCommand( this.name ).setState( state );\r
- }\r
-\r
function onSelectionChange( evt )\r
{\r
var path = evt.data.path,\r
blockLimit = path.blockLimit,\r
elements = path.elements,\r
- element;\r
+ element,\r
+ i;\r
\r
// Grouping should only happen under blockLimit.(#3940).\r
- for ( var i = 0 ; i < elements.length && ( element = elements[ i ] )\r
+ for ( i = 0 ; i < elements.length && ( element = elements[ i ] )\r
&& !element.equals( blockLimit ); i++ )\r
{\r
if ( listNodeNames[ elements[i].getName() ] )\r
- {\r
- return setState.call( this, evt.editor,\r
- this.type == elements[i].getName() ? CKEDITOR.TRISTATE_ON : CKEDITOR.TRISTATE_OFF );\r
- }\r
+ return this.setState( this.type == elements[i].getName() ? CKEDITOR.TRISTATE_ON : CKEDITOR.TRISTATE_OFF );\r
}\r
\r
- return setState.call( this, evt.editor, CKEDITOR.TRISTATE_OFF );\r
+ return this.setState( CKEDITOR.TRISTATE_OFF );\r
}\r
\r
function changeListType( editor, groupObj, database, listsCreated )\r
enclosedNode = range && range.getEnclosedNode();\r
if ( enclosedNode && enclosedNode.is\r
&& this.type == enclosedNode.getName() )\r
- setState.call( this, editor, CKEDITOR.TRISTATE_ON );\r
+ this.setState( CKEDITOR.TRISTATE_ON );\r
}\r
}\r
\r
init : function( editor )\r
{\r
// Register commands.\r
- var numberedListCommand = new listCommand( 'numberedlist', 'ol' ),\r
- bulletedListCommand = new listCommand( 'bulletedlist', 'ul' );\r
- editor.addCommand( 'numberedlist', numberedListCommand );\r
- editor.addCommand( 'bulletedlist', bulletedListCommand );\r
+ var numberedListCommand = editor.addCommand( 'numberedlist', new listCommand( 'numberedlist', 'ol' ) ),\r
+ bulletedListCommand = editor.addCommand( 'bulletedlist', new listCommand( 'bulletedlist', 'ul' ) );\r
\r
// Register the toolbar button.\r
editor.ui.addButton( 'NumberedList',\r