User cannot paste google charts into cms pages even when set to 'no filtering'

28 views
Skip to first unread message

Paul Whipp

unread,
Sep 7, 2015, 3:40:35 PM9/7/15
to Mezzanine Users

I have a user working with Mezzanine 4.0.0/Django 1.8.3

They are using simple google charts to illustrate various things (all the data is included with the chart on the page like the standard google chart examples).

The charts do not present correctly even though they work fine in plain html files tested locally.

I believe the reason for the incorrect presentation is that when the user pastes the code into the html source, ' ' gets added into the empty divs placed for the charts. This reproduces the same error on a local test file.

I'm not sure why this padding is added by the admin page editor and I can't remove it without it adding it straight back. If I edit '<>' remove the '&nbsp;' from the div content and then click OK. Opening the editor again shows the '&nbsp;' added right back again (and a paragraph wrapped around the javascript which is strange but does not seem to be causing a problem).

'no filtering' is set.

Is there any way that I can get the 'source' edit to simply allow a source edit with no interference from probably well meaning but (in this case) bugged interference?

Cheers,
Paul Whipp

Ryne Everett

unread,
Sep 10, 2015, 2:32:11 PM9/10/15
to Mezzanine Users
Did you make any progress on this? It sounds like a bug but I let it go a few days because I was hoping somebody would have some more specific insight.

The first thing I'd probably do is drop a debugger in RichtextField.clean (in mezzanine/core/fields.py) and make sure `settings.RICHTEXT_FILTER_LEVEL == RICHTEXT_FILTER_LEVEL_NONE` is true and that the `value` is still correct at that point.



--
You received this message because you are subscribed to the Google Groups "Mezzanine Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mezzanine-use...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Paul Whipp

unread,
Sep 10, 2015, 2:50:28 PM9/10/15
to Mezzanine Users
No progress. I don't believe hat debug point is not relevant; this issue is deep in the editor itself because you can reproduce it by typing an empty div into the html field in the editor ('<>') and then switching back to the normal source - the '&nbsp;' and extraneous <p>....</p> elements are inserted then... long before you start cleaning stuff up in mezzanine.

Cheers,
Paaul

You received this message because you are subscribed to a topic in the Google Groups "Mezzanine Users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/mezzanine-users/j4Mhu42hHlw/unsubscribe.
To unsubscribe from this group and all its topics, send an email to mezzanine-use...@googlegroups.com.

Paul Whipp

unread,
Sep 10, 2015, 2:51:02 PM9/10/15
to Mezzanine Users
sorry about the double negative there (ignore the 'is not').

Eduardo Rivas

unread,
Sep 10, 2015, 2:52:21 PM9/10/15
to mezzani...@googlegroups.com
Have you peeked into the TinyMCE docs? I'm sure there must be something
you can do to change this behavior in tinymce_setup.js.

Ryne Everett

unread,
Sep 10, 2015, 2:52:42 PM9/10/15
to Mezzanine Users
Oh gotcha, definitely a tinymce bug.

On Thu, Sep 10, 2015 at 1:52 PM, Eduardo Rivas <jeriva...@gmail.com> wrote:
Have you peeked into the TinyMCE docs? I'm sure there must be something you can do to change this behavior in tinymce_setup.js.

Paul Whipp

unread,
Sep 10, 2015, 3:34:33 PM9/10/15
to Mezzanine Users
Googling deeper got me to this - http://www.phoca.cz/documents/16-joomla/769-joomla-3-tinymce-stop-removing-empty-tags - from which I infer that it is possible to suppress the behaviour in tinymce and I guess there is something I could do by shadowing the tinymce_setup.js with one that hacks the div rule to allow empty divs (although in mezz terms I think this should be linked to the 'no filter' setting somehow - perhaps with more sophisticated control over tinyMCE like that offered in Joomla (above).

This could probably also address its adding '<p>' tags around <script></script> entries too (these entries are for the pasted in google charts).


You received this message because you are subscribed to a topic in the Google Groups "Mezzanine Users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/mezzanine-users/j4Mhu42hHlw/unsubscribe.
To unsubscribe from this group and all its topics, send an email to mezzanine-use...@googlegroups.com.

Ryne Everett

unread,
Sep 10, 2015, 3:45:44 PM9/10/15
to Mezzanine Users

Ryne Everett

unread,
Sep 10, 2015, 3:47:27 PM9/10/15
to Mezzanine Users
I wonder if allowing everything in tinymce shouldn't be the default since we're already cleaning html in python.

Paul Whipp

unread,
Sep 10, 2015, 6:07:34 PM9/10/15
to Mezzanine Users
That seems the right approach to me. If I say 'no filtering' I mean don't mess with my html dammit :)

Ryne Everett

unread,
Nov 5, 2015, 11:51:38 PM11/5/15
to Mezzanine Users
Reply all
Reply to author
Forward
0 new messages