Opened 11 years ago
Last modified 11 years ago
#12568 confirmed Bug
Docprops dialog color "choose" buttons behave strangely if colorpicker dialog is cancelled
| Reported by: | jhub | Owned by: | |
|---|---|---|---|
| Priority: | Normal | Milestone: | |
| Component: | General | Version: | 3.6 |
| Keywords: | Cc: |
Description
This is the same as #8771 which was closed as "expired - can't reproduce" a while back. This bug is still present in 4.4.5 and is actually very easy to reproduce even with the demo at http://ckeditor.com/demo#full-page:
Click the document properties button to open the docprops dialog.
Go to "Design" page.
Click on "Choose" button of "Text color" field.
Do *not* pick a color in the colorpicker but close the colorpicker with "Cancel".
Click on "Choose" button of Background color".
Now *do* pick a color in the colorpicker and close it with "OK":
The selected color is set into the "Background color" field (as expected) but is incorrectly *also* set into the "text color" field.
As already described in #8771, the problem is in ckeditor/plguins/docprops/dialogs/docprops.js, in the "getDialogValue" function:
Buggy code:
var onOk = function() {
releaseHandlers( this );
callback( this, this._.parentDialog );
};
var releaseHandlers = function( dialog ) {
dialog.removeListener( 'ok', onOk );
dialog.removeListener( 'cancel', releaseHandlers );
};
var bindToDialog = function( dialog ) {
dialog.on( 'ok', onOk );
dialog.on( 'cancel', releaseHandlers );
};
The problem with the above is that "releaseHandlers" is set directly as the "cancel" listener.
Suggested change:
var onOk = function() {
releaseHandlers( this );
callback( this, this._.parentDialog );
};
var onCancel = function() {
releaseHandlers( this );
};
var releaseHandlers = function( dialog ) {
dialog.removeListener( 'ok', onOk );
dialog.removeListener( 'cancel', onCancel );
};
var bindToDialog = function( dialog ) {
dialog.on( 'ok', onOk );
dialog.on( 'cancel', onCancel );
};
Change History (2)
comment:1 Changed 11 years ago by
comment:2 Changed 11 years ago by
| Status: | new → confirmed |
|---|---|
| Version: | 4.4.5 → 3.6 |
Problem can be reproduced from CKEditor 3.6 in all browsers.

cc