question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Double image after replacing result in onImageUploadBefore

See original GitHub issue

When I use onImageUploadBefore to upload an image and return new result object, I get two images in the editor, one with the updated image URL from the upload function and one that is base64.

How do I prevent the second, base64 image from showing?

Here’s a rough code example of what I am doing

onImageUploadBefore: async (files: File[], info: object, uploadHandler: Function) => {
let fileName = await helpers.ddddd(files[0]);
let res = {
"result": [{ "url": fileName, "name": files[0].name, "size": files[0].size },]
};
uploadHandler(res);
}

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

4reactions
svermaakcommented, Sep 29, 2020

Thank you

I have done this to solve my issue.

I removed imageUploadUrl and change onImageUploadBefore to synchronize with async function

Thank you for all your help and time

onImageUploadBefore: (files: File[], info: object, uploadHandler: Function) => {
(async () => {
let fileName = await helpers.uploadFile(files[0]);
let res = {
"result": [{ "url": fileName, "name": files[0].name, "size": files[0].size },]
};
uploadHandler(res);
})();
uploadHandler();
}
1reaction
JiHong88commented, Sep 29, 2020

@svermaak @quanlatoi If undefined is returned, it waits until uploadHandler is executed. Dont’t using async function. If used async function that the promise object is returned and the basic functions of the editor are executed.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Double image after replacing result in onImageUploadBefore
When I use onImageUploadBefore to upload an image and return new result object, I get two images in the editor, one with the...
Read more >
SOLVED: How to fix double image - Vizio Television - iFixit
Redjude Cadornigara most double images are caused by a GATE TAB bond failure. For that, you will have to check the thin orange...
Read more >
suneditor/README.md - UNPKG
97, When you display a document created by suneditor ... 113, import image from 'suneditor/src/plugins/dialog/link' ... 453, {text: 'Double', value: 2}.
Read more >
Suneditor - npm.io
The Suneditor is a lightweight, flexible, customizable WYSIWYG text editor for your web applications. Pasting from Microsoft Word and Excel.
Read more >
suneditor - npm
When you display a document created by suneditor You need to ... import image from 'suneditor/src/plugins/dialog/link' import list from ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found