These answers were very helpful, thanks.

In our richtexteditor.js, we now added this setup parameter:

    params = $.extend(
      {
        // ...
        setup : function(ed) {
           ed.onSaveContent.add(function(ed, o) {
               // find all img's with src=data:image
               var pattern=/\<img[^>]*src=[^>]*data:image[^>]*\/\>/g;
               var filtered=o.content.replace(pattern, '');
               o.content=filtered;
           });
        },
        // ...
      },

That's all we need for now to prevent normal users doing this.

The suggestions for p.a.textfield look very good as well, because we also want to keep the more technically oriented crowd from inserting data URIs and other stuff.

As another thought, we might also use an event handler to remove data images after saving.

Kees

On 09/26/2012 10:30 AM, Yuri wrote:
Il 26/09/2012 10:14, Kees Hink ha scritto:

Is there a way to apply a transform before saving?

Only TinyMCE javascript can do this, and it has his own xhtml filter.

I've found this:

http://stackoverflow.com/questions/7573474/how-can-i-set-up-tinymce-so-that-it-wont-allow-inline-data-images


maybe can help.

_______________________________________________
Product-Developers mailing list
[email protected]
https://lists.plone.org/mailman/listinfo/plone-product-developers

Reply via email to