Tui.editor: How can I remove base64 content when I upload image?

Created on 4 Apr 2018  ·  8Comments  ·  Source: nhn/tui.editor


First, thanks for your job!

Version


1.0.5

Test Environment


Mac Chrome

Current Behavior


I have use addImageBlobHook callback to upload image, but Base64 also insert into textarea

addImageBlobHook: function (blob, callback) {
                            var uploadedImageURL = that.imageUpload(blob);
                            callback(uploadedImageURL, 'alt text');
                            return false;
                        }

content like this, appear twice

![alt text](image url)![ie.png](data:image/png;base64,iVBORw0KGgoAA......

Expected Behavior


only my code here

![alt text](image url)

so, how can I remove base64 code when I upload a image?

Question

Most helpful comment

image

@horan-geeker You wrote the addImageBlobHook in the events, but it is a hooks, dude.

image

@kyuwoo-choi This issue should be closed.

All 8 comments

oh well.
The code snippet you wrote should work fine.
the base64 image string should be replaced with uploaded URL.

I have tested it now and I can't reproduce.
will you post your example on codepen or somewhere?

Sorry to tell that I can't upload tui-editor.js and other files on codeopen, so I post them on my own server where you can see the source code from the follow page.

this is my server address http://115.28.82.133/example00-demo.html you can drop a file into content block and do a test. the truth is that it appeared twice, I don't know if I use it in a wrong case.

I have downloaded project zip file, there are three file in dist/ directory tui-editor-Editor-all.js, tui-editor.css and tui-editor-contents.css I have include them in my demo, as for other js and css files I copied urls from your example page example00-demo.html

image

@horan-geeker You wrote the addImageBlobHook in the events, but it is a hooks, dude.

image

@kyuwoo-choi This issue should be closed.

Sorry, It's my fault, thank u @toby1991

I think we can close this issue.

@horan-geeker hi, I found if I remove the base64 content the preview of the picture will disappear. So how should I replace the base64 code?

@wangchongchong1007 you need use addImageBlobHook in hooks section, and the page will only has a href without any base64 code.

@horan-geeker I know it's been 3 years, but can you share your upload script if you still have it please ? It would really help me
I can't seem to manage upload and the blob variable returns metadata and not an actual image file

Was this page helpful?
0 / 5 - 0 ratings