Ticket #5404: 5404.patch
File 5404.patch, 3.4 KB (added by , 14 years ago) |
---|
-
_source/plugins/htmldataprocessor/plugin.js
38 38 } 39 39 } 40 40 41 function blockNeedsExtension( block )41 function blockNeedsExtension( block, extendEmptyBlock ) 42 42 { 43 43 var lastChild = lastNoneSpaceChild( block ); 44 44 45 return !lastChild 46 || lastChild.type == CKEDITOR.NODE_ELEMENT && lastChild.name == 'br' 47 // Some of the controls in form needs extension too, 48 // to move cursor at the end of the form. (#4791) 49 || block.name == 'form' && lastChild.name == 'input'; 45 return extendEmptyBlock && !lastChild 46 || lastChild && 47 ( lastChild.type == CKEDITOR.NODE_ELEMENT && lastChild.name == 'br' 48 // Some of the controls in form needs extension too, 49 // to move cursor at the end of the form. (#4791) 50 || block.name == 'form' && lastChild.name == 'input' ); 50 51 } 51 52 52 function extendBlockForDisplay( block)53 function getBlockExtension( isOutput, emptyBlockFiller ) 53 54 { 54 trimFillers( block, true ); 55 56 if ( blockNeedsExtension( block ) ) 55 return function( node ) 57 56 { 58 if ( CKEDITOR.env.ie ) 59 block.add( new CKEDITOR.htmlParser.text( '\xa0' ) ); 60 else 61 block.add( new CKEDITOR.htmlParser.element( 'br', {} ) ); 62 } 63 } 64 65 function extendBlockForOutput( block ) 66 { 67 trimFillers( block ); 68 69 if ( blockNeedsExtension( block ) ) 70 block.add( new CKEDITOR.htmlParser.text( '\xa0' ) ); 57 trimFillers( node, !isOutput ); 58 if ( blockNeedsExtension( node, !isOutput || emptyBlockFiller ) ) 59 { 60 if ( isOutput || CKEDITOR.env.ie ) 61 node.add( new CKEDITOR.htmlParser.text( '\xa0' ) ); 62 else 63 node.add( new CKEDITOR.htmlParser.element( 'br', {} ) ); 64 } 65 } 71 66 } 72 67 73 68 var dtd = CKEDITOR.dtd; … … 95 90 var defaultDataBlockFilterRules = { elements : {} }; 96 91 97 92 for ( i in blockLikeTags ) 98 defaultDataBlockFilterRules.elements[ i ] = extendBlockForDisplay;93 defaultDataBlockFilterRules.elements[ i ] = getBlockExtension(); 99 94 100 95 var defaultHtmlFilterRules = 101 96 { … … 225 220 } 226 221 }; 227 222 228 var defaultHtmlBlockFilterRules = { elements : {} };229 230 for ( i in blockLikeTags )231 defaultHtmlBlockFilterRules.elements[ i ] = extendBlockForOutput;232 233 223 if ( CKEDITOR.env.ie ) 234 224 { 235 225 // IE outputs style attribute in capital letters. We should convert … … 367 357 dataProcessor.dataFilter.addRules( defaultDataFilterRules ); 368 358 dataProcessor.dataFilter.addRules( defaultDataBlockFilterRules ); 369 359 dataProcessor.htmlFilter.addRules( defaultHtmlFilterRules ); 360 361 var defaultHtmlBlockFilterRules = { elements : {} }; 362 for ( i in blockLikeTags ) 363 defaultHtmlBlockFilterRules.elements[ i ] = getBlockExtension( true, editor.config.fillEmptyBlocks !== false ); 364 370 365 dataProcessor.htmlFilter.addRules( defaultHtmlBlockFilterRules ); 371 366 } 372 367 }); … … 461 459 * config.forceSimpleAmpersand = false; 462 460 */ 463 461 CKEDITOR.config.forceSimpleAmpersand = false; 462 463 /** 464 * Whether editor output will insert the non-breaking space entity ( ) into empty block elements. 465 * @name CKEDITOR.config.fillEmptyBlocks; 466 * @type Boolean 467 * @default true 468 * @example 469 * config.fillEmptyBlocks = false; 470 */ 471