Ticket #4898: 4898.patch
File 4898.patch, 2.5 KB (added by , 14 years ago) |
---|
-
_source/plugins/wysiwygarea/plugin.js
170 170 } 171 171 } 172 172 173 var isNotWhitespace = CKEDITOR.dom.walker.whitespaces( true ); 174 173 175 /** 174 176 * Auto-fixing block-less content by wrapping paragraph (#3190), prevent 175 177 * non-exitable-block by padding extra br.(#3189) … … 211 213 var previousElement = fixedBlock.getPrevious( isNotWhitespace ), 212 214 nextElement = fixedBlock.getNext( isNotWhitespace ); 213 215 214 215 216 if ( previousElement && previousElement.getName 216 217 && !( previousElement.getName() in nonExitableElementNames ) 217 218 && range.moveToElementEditStart( previousElement ) … … 222 223 fixedBlock.remove(); 223 224 } 224 225 } 225 226 range.select();227 // Notify non-IE that selection has changed.228 if ( !CKEDITOR.env.ie )229 editor.selectionChange();230 226 } 231 227 232 228 // All browsers are incapable to moving cursor out of certain non-exitable 233 229 // blocks (e.g. table, list, pre) at the end of document, make this happen by 234 230 // place a bogus node there, which would be later removed by dataprocessor. 235 var lastNode = body.getLast( CKEDITOR.dom.walker.whitespaces( true ) ); 236 if ( lastNode && lastNode.getName && ( lastNode.getName() in nonExitableElementNames ) ) 231 var walkerRange = new CKEDITOR.dom.range( editor.document ), 232 walker = new CKEDITOR.dom.walker( walkerRange ); 233 walkerRange.selectNodeContents( body ); 234 walker.evaluator = function( node ) 237 235 { 236 return node.type == CKEDITOR.NODE_ELEMENT && ( node.getName() in nonExitableElementNames ); 237 }; 238 walker.guard = function( node, isMoveout ) 239 { 240 return !( ( node.type == CKEDITOR.NODE_TEXT && isNotWhitespace( node ) ) || isMoveout ); 241 }; 242 243 if ( walker.previous() ) 244 { 238 245 restoreDirty( editor ); 239 246 CKEDITOR.env.ie && restoreSelection( selection ); 240 247 241 if ( !CKEDITOR.env.ie ) 242 body.appendBogus(); 248 var paddingBlock; 249 if ( enterMode != CKEDITOR.ENTER_BR ) 250 paddingBlock = body.append( new CKEDITOR.dom.element( enterMode == CKEDITOR.ENTER_P ? 'p' : 'div' ) ); 243 251 else 244 body.append( editor.document.createText( '\xa0' ) ); 252 paddingBlock = body; 253 254 if ( !CKEDITOR.env.ie ) 255 paddingBlock.appendBogus(); 245 256 } 257 258 range.select(); 259 editor.selectionChange(); 246 260 } 247 261 248 262 CKEDITOR.plugins.add( 'wysiwygarea',