Tinymce accept pasting images

I've recently received some questions from users who are copying and pasting images into the text editor (tinymce).

And it does work, however, only in the editing form. In the view, the image is broken.

I believe this happened when TinyMCE was updated to version 7.

In version 5, the default option for paste_data_images was false, but this changed in version 7.

Version 7

Version 5

It might be better to set this to false when integrating Plone with TinyMCE to avoid these issues.

Please open an issue in mockup.

Unfortunately the paste plugin code has moved to the "premium plugins" which have to be paid for.

It would be great if you file an issue here GitHub · Where software is built for changing the default options.

Here is the issue: pat-tinymce allows pasting images as data URLs, resulting in broken images on view · Issue #1483 · plone/mockup · GitHub

For a client project I grabbed code from

as suggested in the post Extracting base64 encoded images from HTML - #2 by fredvd

On ObjectModifiedEvent my hacked monstrosity creates an image in the content item (it must be folderish) then changes the img tag src to be the newly created image, prepends the parent item ID to the path of the image, and uses a scaled version of the image.

I’m sure my code can be improved on, but at least now my users can quickly paste an image into what they’re writing and have Plone just do its expected thing.

I’ll see if I can pull out just that feature…