Trumbowyg
Trumbowyg copied to clipboard
Ability to set a success callback for Upload plugin without override insert image functionality
When we set a success callback for Upload plugin, insert image functionality of Trumbowyg is ignored. I think this functionality should not be overridden. What do you think?
The whole goal of this function is to be overridden, to make some custom things.
What did you need in that? An event to know when an upload has succeeded? Or modify/transform the server response here? Or whatever?
The whole goal of this function is to be overridden, to make some custom things.
What did you need in that? An event to know when an upload has succeeded? Or modify/transform the server response here? Or whatever?
Trumbowyg doing some things. In example, showing a modal, inserting the image, etc. But when we override the success callback, the whole default behaviour ignores. So, when I want to add just one functionality, I can't use default behaivor. As the user of the library, I shouldn't need to rewrite the default functionality again.
In summary, I think we should extend the callback instead overriding it. Even if we pass a custom callback, the else block should be run.
@Alex-D I agree with @ozgurg the callback is to allow the user change output like adding an access token to the image for example. After the modification the plugin needs to execute the code for adding the image to the editor.