Opened 5 years ago

Closed 4 years ago

#13193 closed Bug (expired)

Dialog tab is disabled if has content elements of html type only

Reported by: Stevan Koprivica Owned by:
Priority: Normal Milestone:
Component: UI : Dialogs Version: 4.4.7
Keywords: Cc:

Description

In plugins/dialog/plugin.js, there's a bug in a show() method, evaluating if the tab shoud be disabled or not.

If the element has no input element, iteration never reaches evaluation if the element is required and can pass active content filter check.

If no element in the tab has input element, whole tab is disabled (and I'm sure it's unexpected when I have a tab with one html element in it).

Code excerpt

enableElements = 0;
for ( var j in this._.contents[ content.id ] ) {
    var elem = this._.contents[ content.id ][ j ];

    if ( elem.type == 'hbox' || elem.type == 'vbox' || !elem.getInputElement() )
        continue;

    // this code is never reached
    if ( elem.requiredContent && !this._.editor.activeFilter.check( elem.requiredContent ) )
	    elem.disable();
    else {
        elem.enable();
        enableElements++;
    }
}

// and enableElements remains 0, so the tab is disabled

if ( !enableElements || ( requiredContent && !this._.editor.activeFilter.check( requiredContent ) ) )
    tab[ 0 ].addClass( 'cke_dialog_tab_disabled' );
else
    tab[ 0 ].removeClass( 'cke_dialog_tab_disabled' );

Attachments (1)

mytest.zip (2.4 KB) - added by Jakub Ś 5 years ago.

Download all attachments as: .zip

Change History (3)

comment:1 Changed 5 years ago by Jakub Ś

Status: newpending

I can't reproduce that. I have tried few times with one tab, then with two tabs but everything works as expected.

I'm attaching sample test plugin. It can be enabled with below code:

CKEDITOR.replace( 'editor1', {extraPlugins : 'mytest'} );

@ctebah could you attach your sample plugin that demonstrates the problem or could you tell me what have I missed in mine?

Changed 5 years ago by Jakub Ś

Attachment: mytest.zip added

comment:2 Changed 4 years ago by Piotrek Koszuliński

Resolution: expired
Status: pendingclosed
Note: See TracTickets for help on using tickets.
© 2003 – 2019 CKSource – Frederico Knabben. All rights reserved. | Terms of use | Privacy policy