Opened 13 years ago
Closed 11 years ago
#10422 closed Bug (fixed)
fillEmptyBlocks not working properly if a function is specified
| Reported by: | raz_atoth | Owned by: | Piotrek Koszuliński |
|---|---|---|---|
| Priority: | Normal | Milestone: | CKEditor 4.4.3 |
| Component: | General | Version: | 4.0 Beta |
| Keywords: | HasPatch | Cc: | shane@… |
Description (last modified by )
The function never fires,if config.fillEmptyBlocks is a function,although there are empty elements and a is placed instead just as if config.fillEmptyBlocks was true [<div class="block"> </div>] If config.fillEmptyBlocks=false it works as expected [<div class="block"></div>]
config.fillEmptyBlocks = function( element )
{
alert('fillEmptyBlocks!');
if ( element.attributes[ 'class' ].indexOf ( 'clear-both' ) != -1 )
return false;
}
Attachments (1)
Change History (6)
Changed 13 years ago by
comment:1 Changed 13 years ago by
| Description: | modified (diff) |
|---|---|
| Status: | new → confirmed |
| Version: | 4.1.1 → 4.0 Beta |
comment:2 Changed 12 years ago by
| Cc: | shane@… added |
|---|---|
| Keywords: | HasPatch added |
For CKEditor 4.3.1 in htmldataprocessor.js, it appears the fillEmptyBlock argument for blockFilter() will always be passed as a boolean true when config.fillEmptyBlocks is a function. So when building the list of text blocks, blockFilter() will never receive a function for the fillEmptyBlock argument. Propose changes:
From
for ( i in textBlockTags ) rules.elements[ i ] = blockFilter( isOutput, editor.config.fillEmptyBlocks !== false );
To
for ( i in textBlockTags ) rules.elements[ i ] = blockFilter( isOutput, editor.config.fillEmptyBlocks );
And From
( typeof fillEmptyBlock == 'function' ? fillEmptyBlock( block ) !== false : fillEmptyBlock ) )
To
( typeof fillEmptyBlock == 'function' ? fillEmptyBlock( block ) !== false : fillEmptyBlock !== false ) )
comment:3 Changed 11 years ago by
| Milestone: | → CKEditor 4.4.3 |
|---|---|
| Owner: | set to Piotrek Koszuliński |
| Status: | confirmed → assigned |
A duplicate was reported in #12129.
comment:5 Changed 11 years ago by
| Resolution: | → fixed |
|---|---|
| Status: | review → closed |
I've updated one comment and joined var statement. Fixed with git:ab195efbe1 (merged to master).

Problem can be reproduced from CKEditor 4 beta. In 3.x branch when you switched to source you could see alert being called. Nothing like this is happening in CKE 4.x.