IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
|
|
|
146 | 146 | if ( listNodeNames[ item.grandparent.getName() ] ) |
147 | 147 | currentListItem = item.element.clone( false, true ); |
148 | 148 | else |
| 149 | currentListItem = new CKEDITOR.dom.documentFragment( doc ); |
| 150 | |
| 151 | // Migrate all children to the new container, |
| 152 | // apply the proper text direction. |
| 153 | var newBlock, |
| 154 | dirLoose = item.grandparent.getDirection( 1 ) != orgDir, |
| 155 | enterBr = paragraphMode == CKEDITOR.ENTER_BR; |
| 156 | |
| 157 | for ( var i = 0, child, count = item.contents.length; i < count; i++ ) |
149 | 158 | { |
150 | | // Create completely new blocks here. |
151 | | if ( dir || item.element.hasAttributes() || paragraphMode != CKEDITOR.ENTER_BR ) |
| 159 | child = item.contents[ i ]; |
| 160 | if ( child.type == CKEDITOR.NODE_ELEMENT && child.isBlockBoundary() ) |
152 | 161 | { |
153 | | currentListItem = doc.createElement( paragraphName ); |
154 | | item.element.copyAttributes( currentListItem, { type:1, value:1 } ); |
| 162 | // Apply direction on content blocks. |
| 163 | if ( dirLoose && !child.getDirection() ) |
| 164 | child.setAttribute( 'dir', orgDir ); |
155 | 165 | |
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 ); |
| 166 | newBlock = null; |
161 | 167 | } |
162 | | else |
163 | | currentListItem = new CKEDITOR.dom.documentFragment( doc ); |
164 | | } |
| 168 | else if ( dirLoose || !enterBr ) |
| 169 | { |
| 170 | // Wrap inline contents with new block, just to remain item direction. |
| 171 | if ( !newBlock ) |
| 172 | { |
| 173 | newBlock = doc.createElement( paragraphName ); |
| 174 | dirLoose && newBlock.setAttribute( 'dir', orgDir ); |
| 175 | } |
165 | 176 | |
166 | | if ( currentListItem.type == CKEDITOR.NODE_ELEMENT ) |
167 | | { |
168 | | if ( item.grandparent.getDirection( 1 ) != orgDir ) |
169 | | currentListItem.setAttribute( 'dir', orgDir ); |
170 | | } |
| 177 | newBlock.append( child.clone( 1, 1 ) ); |
| 178 | } |
171 | 179 | |
172 | | for ( i = 0 ; i < item.contents.length ; i++ ) |
173 | | currentListItem.append( item.contents[i].clone( 1, 1 ) ); |
| 180 | currentListItem.append( newBlock || child.clone( 1, 1 ) ); |
| 181 | } |
174 | 182 | |
175 | 183 | if ( currentListItem.type == CKEDITOR.NODE_DOCUMENT_FRAGMENT |
176 | 184 | && currentIndex != listArray.length - 1 ) |
… |
… |
|
187 | 195 | && last.getName() in CKEDITOR.dtd.$block ) ) |
188 | 196 | { |
189 | 197 | currentListItem.append( doc.createElement( 'br' ) ); |
190 | | } |
191 | | } |
192 | | |
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 | 198 | } |
205 | 199 | } |
206 | 200 | |