Opened 6 years ago

Last modified 6 years ago

#10052 confirmed Bug

Image dialog - preview do not refresh when field is cleared

Reported by: Gael Owned by:
Priority: Normal Milestone:
Component: UI : Dialogs Version: 3.0.2
Keywords: Cc:

Description

The preview window in the image dialog do not clear the CSS attribute when the value is cleared:

  1. Insert an image in CKEditor.
  2. Right click on the image and open the image dialiog.
  3. Enter a border of 9. The preview image show a border of 9px.
  4. Clear the border field (erase the number 9 from the field). The preview image still show a border of 9px.

Affect: Border, HSpace VSpace, etc.

I notice the following in the code:
File: _source/plugins/image/dialogs/image.js
Line: 848

if ( !isNaN( value ) )
{
	element.setStyle( 'border-width', CKEDITOR.tools.cssLength( value ) );
	element.setStyle( 'border-style', 'solid' );
}
else if ( !value && this.isChanged() )
	element.removeStyle( 'border' );

I don't understand why it check if the field has been changed before removing the style, but if I remove that check, it works as expected:

if ( !isNaN( value ) )
{
	element.setStyle( 'border-width', CKEDITOR.tools.cssLength( value ) );
	element.setStyle( 'border-style', 'solid' );
}
else if ( !value )
	element.removeStyle( 'border' );

Change History (1)

comment:1 Changed 6 years ago by Jakub Ś

Status: newconfirmed
Version: 4.0.2 (GitHub - master)3.0.2

Problem can be reproduced in all browsers from CKEditor 3.0.2.

  1. Seems if you enter one digit value 1-9 border Hspace and vSpace doesn't get refreshed.
  2. If you enter two digit value then there is no problem
  3. There is also a way to break border insertion
    • Open image dialog, enter URL and size you want
    • Click inside border field and enter 9
    • Click inside HSpace field
    • Click again inside Border field and enter =. Now you should have 9=
    • Press backspace two times to remove the border.
    • Click OK.
    • Result: Image is inserted with border.
Note: See TracTickets for help on using tickets.
© 2003 – 2019 CKSource – Frederico Knabben. All rights reserved. | Terms of use | Privacy policy