Opened 6 years ago

Closed 6 years ago

Last modified 6 years ago

#11640 closed Bug (invalid)

onClick event of "send to server" button not firing in image plugin

Reported by: Mandeep Owned by:
Priority: Normal Milestone:
Component: General Version:
Keywords: Cc:

Description

What I need to do is show an "uploading" text somewhere when the file is being sent to the server. Currently what I was trying to do is on the click of "Send it to server" button in the upload tab, I want to change the text of that button to "Uploading" so as the user will atleast know that the file is being uploaded. I consoled that button and found that i was getting an onClick event handler. I used it but it just wouldnt fire.

Here is my code.

CKEDITOR.replace('textarea1', {

filebrowserImageUploadUrl: '/upload'

});

CKEDITOR.on('dialogDefinition', function(ev) {

var dialogName = ev.data.name;

var dialogDefinition = ev.data.definition;

if (dialogName == 'image') {

dialogDefinition.onLoad = function() {

var dialog = CKEDITOR.dialog.getCurrent();

var uploadTab = dialogDefinition.getContents('Upload'); var uploadButton = uploadTab.get('uploadButton'); console.log('uploadButton', uploadButton);

uploadButtononClick? = function(evt){

console.log('fire in the hole', evt);

}

uploadButtonfilebrowser?onSelect? = function(fileUrl, errorMessage) {

console.log('working');

}

};

}

});

Notice that the onSelect handler successfully fires after the image has been uploaded to the server, but the onClick event wouldnt fire. I hope you look into this matter. And if you have a more better way of indicating the user that the file is being uploaded, I would really like to know.

I am using CKEditor: version 4.3.3(I tried both with minified and unminified code) Browser: Chrome 33.0

Let me know if you want any other details. Thank you.

Change History (4)

comment:1 Changed 6 years ago by Mandeep

Putting my code in code blocks, since the braces are not showing up properly in description.


	CKEDITOR.replace('textarea1', {
		filebrowserImageUploadUrl: '/upload'
	});

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

		if (dialogName == 'image') {
			dialogDefinition.onLoad = function() {
				var dialog = CKEDITOR.dialog.getCurrent();

				var uploadTab = dialogDefinition.getContents('Upload');
				var uploadButton = uploadTab.get('uploadButton');
				console.log('uploadButton', uploadButton);

				uploadButton['onClick'] = function(evt){
					console.log('fire in the hole', evt);
				}

				uploadButton['filebrowser']['onSelect'] = function(fileUrl, errorMessage) {
					console.log('working');
				}
			};

		}

	});


comment:2 Changed 6 years ago by Jakub Ś

Resolution: invalid
Status: newclosed

I'm sorry but this is bug tracker and not place for asking implementation questions.

If you have valid license pleaaase report this issue to our support channel. You can also try using the forum http://ckeditor.com/Forums/CKEditor-0

comment:3 Changed 6 years ago by Jakub Ś

NOTE: you code will work once you click on button but you need to have image to upload selected.

comment:4 Changed 6 years ago by Mandeep

I presume that this is a bug since I get the event but it is not getting fired. And I am clicking the button after selecting the image via "Choose File" button. Even the file is getting successfully uploaded to the server. Its just that the code I am writing on the 'onClick' event handler does not run.

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