IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
|
|
|
102 | 102 | indentLevel = Math.max( listArray[ baseIndex ].indent, 0 ), |
103 | 103 | currentListItem = null, |
104 | 104 | orgDir, |
| 105 | block, |
105 | 106 | paragraphName = ( paragraphMode == CKEDITOR.ENTER_P ? 'p' : 'div' ); |
106 | 107 | while ( 1 ) |
107 | 108 | { |
… |
… |
|
146 | 147 | if ( listNodeNames[ item.grandparent.getName() ] ) |
147 | 148 | currentListItem = item.element.clone( false, true ); |
148 | 149 | else |
| 150 | currentListItem = new CKEDITOR.dom.documentFragment( doc ); |
| 151 | |
| 152 | // Migrate all children to the new container, |
| 153 | // apply the proper text direction. |
| 154 | var dirLoose = item.grandparent.getDirection( 1 ) != orgDir, |
| 155 | enterBr = paragraphMode == CKEDITOR.ENTER_BR, |
| 156 | li = item.element, |
| 157 | className = li.getAttribute( 'class' ), |
| 158 | style = li.getAttribute( 'style' ); |
| 159 | |
| 160 | for ( var i = 0, child, count = item.contents.length; i < count; i++ ) |
149 | 161 | { |
150 | | // Create completely new blocks here. |
151 | | if ( dir || item.element.hasAttributes() || paragraphMode != CKEDITOR.ENTER_BR ) |
| 162 | child = item.contents[ i ]; |
| 163 | |
| 164 | if ( child.type == CKEDITOR.NODE_ELEMENT && child.isBlockBoundary() ) |
152 | 165 | { |
153 | | currentListItem = doc.createElement( paragraphName ); |
154 | | item.element.copyAttributes( currentListItem, { type:1, value:1 } ); |
| 166 | // Apply direction on content blocks. |
| 167 | if ( dirLoose && !child.getDirection() ) |
| 168 | child.setAttribute( 'dir', orgDir ); |
155 | 169 | |
156 | | // There might be a case where there are no attributes in the element after all |
157 | | // (i.e. when "type" or "value" are the only attributes set). In this case, if enterMode = BR, |
158 | | // the current item should be a fragment. |
159 | | if ( !dir && paragraphMode == CKEDITOR.ENTER_BR && !currentListItem.hasAttributes() ) |
160 | | currentListItem = new CKEDITOR.dom.documentFragment( doc ); |
| 170 | // Merge into child styles. |
| 171 | style && child.setAttribute( 'style', style + child.getAttribute( 'style' ) || '' ); |
| 172 | className && child.addClass( className ); |
161 | 173 | } |
162 | | else |
163 | | currentListItem = new CKEDITOR.dom.documentFragment( doc ); |
164 | | } |
| 174 | else if ( dirLoose || !enterBr || style || className ) |
| 175 | { |
| 176 | // Establish new block to hold text direction and styles. |
| 177 | if ( !block ) |
| 178 | { |
| 179 | block = doc.createElement( paragraphName ); |
| 180 | dirLoose && block.setAttribute( 'dir', orgDir ); |
| 181 | } |
165 | 182 | |
166 | | if ( currentListItem.type == CKEDITOR.NODE_ELEMENT ) |
167 | | { |
168 | | if ( item.grandparent.getDirection( 1 ) != orgDir ) |
169 | | currentListItem.setAttribute( 'dir', orgDir ); |
170 | | } |
| 183 | // Copy over styles to new block; |
| 184 | style && block.setAttribute( 'style', style ); |
| 185 | className && block.setAttribute( 'class', className ); |
| 186 | |
| 187 | block.append( child.clone( 1, 1 ) ); |
| 188 | } |
171 | 189 | |
172 | | for ( i = 0 ; i < item.contents.length ; i++ ) |
173 | | currentListItem.append( item.contents[i].clone( 1, 1 ) ); |
| 190 | currentListItem.append( block || child.clone( 1, 1 ) ); |
| 191 | } |
174 | 192 | |
175 | 193 | if ( currentListItem.type == CKEDITOR.NODE_DOCUMENT_FRAGMENT |
176 | 194 | && currentIndex != listArray.length - 1 ) |
… |
… |
|
190 | 208 | } |
191 | 209 | } |
192 | 210 | |
193 | | if ( currentListItem.type == CKEDITOR.NODE_ELEMENT && |
194 | | currentListItem.getName() == paragraphName && |
195 | | currentListItem.$.firstChild ) |
196 | | { |
197 | | currentListItem.trim(); |
198 | | var firstChild = currentListItem.getFirst(); |
199 | | if ( firstChild.type == CKEDITOR.NODE_ELEMENT && firstChild.isBlockBoundary() ) |
200 | | { |
201 | | var tmp = new CKEDITOR.dom.documentFragment( doc ); |
202 | | currentListItem.moveChildren( tmp ); |
203 | | currentListItem = tmp; |
204 | | } |
205 | | } |
206 | | |
207 | 211 | var currentListItemName = currentListItem.$.nodeName.toLowerCase(); |
208 | 212 | if ( !CKEDITOR.env.ie && ( currentListItemName == 'div' || currentListItemName == 'p' ) ) |
209 | 213 | currentListItem.appendBogus(); |
… |
… |
|
213 | 217 | } |
214 | 218 | else |
215 | 219 | return null; |
| 220 | |
| 221 | block = null; |
216 | 222 | |
217 | 223 | if ( listArray.length <= currentIndex || Math.max( listArray[ currentIndex ].indent, 0 ) < indentLevel ) |
218 | 224 | break; |