Closed hmftw closed 10 years ago
Hi hmftw,
If i understand the question correctly then you need the following functionality:
uploadFile
) you want to have a reference to the instance (textarea) on which the event was fired?onReceivedFile
and onUploadedFile
hook you want to be able to reference the e.originalEvent?Both references are, as you mentioned, not available right now, this would require a modification in the current hooks.
Hereby my proposal to fix the issue, all events will have additional parameters which contain the instance, and where applicable the originalEvent
{
/**
* When a file is received by drag-drop or paste
*
* @param {Blob} file
* @param {Textarea}
* @param {Event}
*/
onReceivedFile: function(file, instance, originalEvent) {},
/**
* When a file has succesfully been uploaded
*
* @param {Object} json JSON data returned from the server
* @param {Textarea}
*/
onUploadedFile: function(json, instance) {},
/**
* Custom error handler. Runs after removing the placeholder text and before the alert().
* Return false from this function to prevent the alert dialog.
*
* @Param {Textarea}
* @return {Boolean} when false is returned it will prevent default error behavior
*/
customErrorHandler: function(instance) { return true; }
}
If you are willing to create a Pull Request then i'll glady accept it. Or i will add this later when i got the time.
Continuing in #27
Hello,
first of all, i would like to thank you for that very good project. That project could take many work off hand :)
I have a special question.
I have a big problem with your lib in combination with the jQ Sortable.
Especially, I have a two layered..
@Attach "One" you can see an overview about the project.
It is a collection of looks.
The unique Looks have a lookposition starting by 1 to N-Numbers of Looks. A new Look can be added by Click to "First" or "Last".
One Look Container will be added by using this function:
The variable "gl_countLookArticles" is a global Variable which contains all existing Looks and the count of articles to each look.
The function attachInlineUploadByLookPos:
The Library works, with an own modification like this:
With my solution, the internal reference to the object is given by itself. I can get the instance @the method: uploadFile using editor.targetElement() ...
The current version depends on the Lookposition... If I click to "First" the position 1 will be overgiven to the function "attachInlineUploadByLookPos" and the next click too... :P In my perception, i have no way to get the "only" correct container which is been affected by using the dropfunction.. or?
I'd like to have a clear and simple solution.. Could I get a advice from you, please?
Is there a way to get the e.originalEvent? :P