TinyMCE PowerPaste plugin not always creates base64 string for images when copying

有些话、适合烂在心里 提交于 2019-12-13 08:26:36

问题


I am using TinyMCE PowerPaste plugin automatically to copy and paste content from Microsoft Word and other HTML sources. I am setting up to true powerpaste_allow_local_images in order to allow local images automatically been upload as Base64 encoded images and it works perfect if I copy and paste from Microsoft Office Suite such as Microsoft Word and outlook. However, if i copy and paste images from other html sources (e.g : Gmail, Google docs, etc), they are not uploaded as base64, instead tinymce creates a reference to the current online location of the image. I always need a base64 encoded images in order to save them in the db, I am wondering how can i force tinymce to create a base64 string for all images are being copied.

Appreciate any suggestion,


回答1:


PowerPaste brings images in from MS Word content because Word places a "local" image in the content (e.g. file:///path/to/image.png). When PowerPaste sees that local image it grabs an image binary from the RTF flavor in the clipboard - that is why you get a Base64 encoded image when you copy/paste from Word.

If you copy/paste from some online resource (e.g. something open in a browser) there is no "local" image - there is just a proper <img> tag in the HTML. As there is no image binary anywhere in the clipboard PowerPaste won't create a Base64 encoded image.

In this situation PowerPaste is working exactly as expected.

Please note that if you are a customer who has purchased PowerPaste you can get support from our support team (support.ephox.com).



来源:https://stackoverflow.com/questions/39842533/tinymce-powerpaste-plugin-not-always-creates-base64-string-for-images-when-copyi

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!