Opened 8 years ago

Closed 8 years ago

#4773 closed Bug (fixed)

fileBrowser plugin overwrites any onClick function for a fileButton element

Reported by: Alfonso Martínez de Lizarrondo Owned by: Alfonso Martínez de Lizarrondo
Priority: Normal Milestone: CKEditor 3.2
Component: UI : Dialogs Version: 3.0.1
Keywords: Confirmed Review+ Cc:

Description

The fileBrowser plugin applies its own "fileUpload" function to the onClick handler of the fileButtons, without any regards to any such handler specified in the definition of the object.

Unfortunately, the big anonymous function makes quite hard to workaround this or other improvements from a plugin.

The solution here is to change

if ( url )
{					
	element.onClick = uploadFile ;
	element.filebrowser.url = url;
...

to a wrapper that includes the previous handler:

if ( url )
{					
	var onClick = element.onClick;
	element.onClick = function( evt )
	{
		// "element" here means the definition object, so we need to find the correct
		// button to scope the event call
		var sender = evt.sender
		if ( onClick && onClick.call( sender, evt ) === false )
			return false;
		return uploadFile.call( sender, evt );
	};

	element.filebrowser.url = url;
...

Attachments (1)

4773.patch (992 bytes) - added by Alfonso Martínez de Lizarrondo 8 years ago.
Proposed patch

Download all attachments as: .zip

Change History (5)

comment:1 Changed 8 years ago by Garry Yao

Component: GeneralUI : Dialogs
Keywords: Confirmed added
Milestone: CKEditor 3.2

Changed 8 years ago by Alfonso Martínez de Lizarrondo

Attachment: 4773.patch added

Proposed patch

comment:2 Changed 8 years ago by Alfonso Martínez de Lizarrondo

Keywords: Review? added; HasPatch removed
Owner: set to Alfonso Martínez de Lizarrondo
Status: newassigned

comment:3 Changed 8 years ago by Garry Yao

Keywords: Review+ added; Review? removed

Please compensate the missing semicolon after L286 before commit.

comment:4 Changed 8 years ago by Alfonso Martínez de Lizarrondo

Resolution: fixed
Status: assignedclosed

Thanks for the tip
Fixed with [4923]

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