Changeset 6138
- Timestamp:
- 11/30/10 09:19:10 (2 years ago)
- Location:
- CKEditor/branches/versions/3.5.x
- Files:
-
- 2 edited
-
CHANGES.html (modified) (1 diff)
-
_source/plugins/htmldataprocessor/plugin.js (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
CKEditor/branches/versions/3.5.x/CHANGES.html
r6128 r6138 46 46 <li><a href="http://dev.ckeditor.com/ticket/6334">#6334</a> : CKEditor now uses <a href="http://www.w3.org/TR/2010/WD-html5-20101019/elements.html#embedding-custom-non-visible-data-with-the-data-attributes">HTML5's data-* attributes</a> for its internal attributes.</li> 47 47 <li><a href="http://dev.ckeditor.com/ticket/6103">#6103</a> : It's now possible to control the styling of inline read-only elements with the disableReadonlyStyling setting. It's also possible to avoid inline-styling any element by setting its data-cke-nostyle attribute to "1".</li> 48 <li><a href="http://dev.ckeditor.com/ticket/5404">#5404</a> : "fillEmptyBlocks" configuration option of v2 is now available.</li> 48 49 </ul> 49 50 <p> -
CKEditor/branches/versions/3.5.x/_source/plugins/htmldataprocessor/plugin.js
r6126 r6138 39 39 } 40 40 41 function blockNeedsExtension( block, fromSource ) 42 { 41 function blockNeedsExtension( block, fromSource, extendEmptyBlock ) 42 { 43 if( !extendEmptyBlock || 44 typeof extendEmptyBlock == 'function' && ( extendEmptyBlock( block ) == false ) ) 45 return false; 46 43 47 // 1. For IE version >=8, empty blocks are displayed correctly themself in wysiwiyg; 44 48 // 2. For the rest, at least table cell and list item need no filler space. … … 52 56 var lastChild = lastNoneSpaceChild( block ); 53 57 54 return !lastChild 55 || lastChild.type == CKEDITOR.NODE_ELEMENT && lastChild.name == 'br' 56 // Some of the controls in form needs extension too, 57 // to move cursor at the end of the form. (#4791) 58 || block.name == 'form' && lastChild.name == 'input'; 59 } 60 61 function extendBlockForDisplay( block ) 62 { 63 trimFillers( block, true ); 64 65 if ( blockNeedsExtension( block, true ) ) 66 { 67 if ( CKEDITOR.env.ie ) 68 block.add( new CKEDITOR.htmlParser.text( '\xa0' ) ); 69 else 70 block.add( new CKEDITOR.htmlParser.element( 'br', {} ) ); 58 return !lastChild || lastChild && 59 ( lastChild.type == CKEDITOR.NODE_ELEMENT && lastChild.name == 'br' 60 // Some of the controls in form needs extension too, 61 // to move cursor at the end of the form. (#4791) 62 || block.name == 'form' && lastChild.name == 'input' ); 63 } 64 65 function getBlockExtension( isOutput, emptyBlockFiller ) 66 { 67 return function( node ) 68 { 69 trimFillers( node, !isOutput ); 70 71 if ( blockNeedsExtension( node, !isOutput, emptyBlockFiller ) ) 72 { 73 if ( isOutput || CKEDITOR.env.ie ) 74 node.add( new CKEDITOR.htmlParser.text( '\xa0' ) ); 75 else 76 node.add( new CKEDITOR.htmlParser.element( 'br', {} ) ); 77 } 71 78 } 72 }73 74 function extendBlockForOutput( block )75 {76 trimFillers( block );77 78 if ( blockNeedsExtension( block ) )79 block.add( new CKEDITOR.htmlParser.text( '\xa0' ) );80 79 } 81 80 … … 106 105 107 106 for ( i in blockLikeTags ) 108 defaultDataBlockFilterRules.elements[ i ] = extendBlockForDisplay;107 defaultDataBlockFilterRules.elements[ i ] = getBlockExtension(); 109 108 110 109 var defaultHtmlFilterRules = … … 242 241 } 243 242 }; 244 245 var defaultHtmlBlockFilterRules = { elements : {} };246 247 for ( i in blockLikeTags )248 defaultHtmlBlockFilterRules.elements[ i ] = extendBlockForOutput;249 243 250 244 if ( CKEDITOR.env.ie ) … … 413 407 dataProcessor.dataFilter.addRules( defaultDataBlockFilterRules ); 414 408 dataProcessor.htmlFilter.addRules( defaultHtmlFilterRules ); 409 410 var defaultHtmlBlockFilterRules = { elements : {} }; 411 for ( i in blockLikeTags ) 412 defaultHtmlBlockFilterRules.elements[ i ] = getBlockExtension( true, editor.config.fillEmptyBlocks ); 413 415 414 dataProcessor.htmlFilter.addRules( defaultHtmlBlockFilterRules ); 415 }, 416 417 onLoad : function() 418 { 419 ! ( 'fillEmptyBlocks' in CKEDITOR.config ) && ( CKEDITOR.config.fillEmptyBlocks = 1 ); 416 420 } 417 421 }); … … 511 515 * config.forceSimpleAmpersand = false; 512 516 */ 517 518 /** 519 * Whether a filler text (non-breaking space entity - ) will be inserted into empty block elements in HTML output, 520 * this is used to render block elements properly with line-height; When a function is instead specified, 521 * it'll be passed a {@link CKEDITOR.htmlParser.element} to decide whether adding the filler text 522 * by expecting a boolean return value. 523 * @name CKEDITOR.config.fillEmptyBlocks; 524 * @since 3.5 525 * @type Boolean 526 * @default true 527 * @example 528 * config.fillEmptyBlocks = false; // Prevent filler nodes in all empty blocks. 529 * 530 * // Prevent filler node only in float cleaners. 531 * config.fillEmptyBlocks = function( element ) 532 * { 533 * if ( element.attributes[ 'class' ].indexOf ( 'clear-both' ) != -1 ) 534 * return false; 535 * } 536 */ 537
Note: See TracChangeset
for help on using the changeset viewer.
