The editor automatically uploads pictures from the pasted web page

ask a passer-by to see how the pictures in this editor are obtained and sent to the background:

(forget to mention, it"s a mixture of picture and text)

when I found this function when using Wechat"s public platform, I pasted the content I copied from other web pages into the editor of Wechat"s public platform. At this time, the address of the picture changed, and it was also marked with a watermark.


Mar.05,2021

when you paste an image into the editor, the image is uploaded to the Tencent backend for processing (cropping, watermark, etc.) and saved (renamed, etc.). After success, the server returns the address of the image and displays it in the text editor.


tried several methods
ps: copy and paste content is text and picture mixing
1. The method of listening to onpaste: is to get the contents of clipboardData. If you only copy and paste pictures, you can get file information. However, when pasting text and picture mixed content, you can only get text/html, that is, clipboardData.items, and there is no file information in it. (I don't know if it's the wrong posture, so I gave up this method)
2. The step to using canvas: is to insert img into canvas, and then convert canvas to base64's picture format. As a result, the plug-in succeeded and canvas replaced img, and when I tried to get base64 with toDataURL, I failed again because of cross-domain problems.

ask the bosses passing by to give me some advice. I just want to solve the problem:
1. In the case of mixed picture and text, can you get file information in clipboardData
2. Is there any other way to solve the cross-domain problem besides setting up nginx?

Menu