Trumbowyg icon indicating copy to clipboard operation
Trumbowyg copied to clipboard

Ability to set a success callback for Upload plugin without override insert image functionality

Open ozgurg opened this issue 3 years ago • 3 comments

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?

Screenshot at Apr 06 16-41-49

ozgurg avatar Apr 06 '21 13:04 ozgurg

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?

Alex-D avatar Jun 18 '21 18:06 Alex-D

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.

ozgurg avatar Jun 19 '21 21:06 ozgurg

@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.

justkidding96 avatar Jan 12 '22 13:01 justkidding96