Opened 7 years ago

Last modified 7 years ago

#9560 confirmed Bug

CKE 3.x and 4.x - Undefined table width gets reset to default

Reported by: Jakub Ś Owned by:
Priority: Normal Milestone:
Component: General Version: 3.6.1
Keywords: Cc:

Description (last modified by Jakub Ś)

This is the continuation of #9478.

To reproduce:

  1. Clear editor contents with CRTL+A Backspace
  2. Insert default table
  3. Open table properties dialog, clear width value and click OK
  4. Open table properties one more time.

Result: Default table width 500px is present in width field and once you click OK table gets default width.

You have to use below code to see the bug

CKEDITOR.on( 'dialogDefinition', function( ev )
            {
                var dialogName = ev.data.name;
                var dialogDefinition = ev.data.definition;

                // Set default table width during creation.
                if(dialogName == 'table')
                {
                    var infoTab = dialogDefinition.getContents( 'info' );
                    txtWidth = infoTab.get( 'txtWidth' );
                    txtWidth['default'] = '100%';
                }

                if ( dialogName == 'tableProperties' )
                {
                    var infoTab = dialogDefinition.getContents( 'info' );

                    var tab = dialogDefinition.getContents( 'advanced' );
                    tab.remove ('advLangDir');
                    tab.remove ('advStyles');
                    tab.remove ('advCSSClasses');
                }
            });

window.x  = CKEDITOR.editor.replace('editor1', {
    removePlugins : 'button,div,filebrowser,flash,format,forms,horizontalrule,indent,justify,liststyle,pagebreak,showborders,stylescombo,templates',
        toolbar :
            [
                ['Source', 'Table']
            ],
});

With this code bug can be reproduced in v4 but also in v3 from CKE 3.6.1 rev. [6979]

Change History (3)

comment:1 Changed 7 years ago by Jakub Ś

Status: newconfirmed

comment:2 Changed 7 years ago by Joel

I think I managed to narrow down even further. The line that actually causes the bug to appear is tab.remove('advStyles'). I updated a jsfiddle to v4 for this: http://jsfiddle.net/gz9b4/4/ - the code for replicating in 3.6.2 at least is as follows

 CKEDITOR.on(
    'dialogDefinition', 
    function( ev )
    {
        var dialogName = ev.data.name;
        var dialogDefinition = ev.data.definition;

        if ( dialogName == 'tableProperties' )
        {
            var tab = dialogDefinition.getContents( 'advanced' );
            tab.remove ('advStyles'); // This causes the bug to appear
            //tab.remove ('advLangDir'); // this does not
            //tab.remove ('advCSSClasses'); // nor this
        }
    }
);
window.x  = CKEDITOR.editor.replace('my-editor');

comment:3 Changed 7 years ago by Jakub Ś

Description: modified (diff)
Note: See TracTickets for help on using tickets.
© 2003 – 2019 CKSource – Frederico Knabben. All rights reserved. | Terms of use | Privacy policy