1

I'm creating content in my pages with some javascript. I'm creating my divs and adding scripts. So, content is pulled into page via javascript.

I'm also using django-tinymce package in my admin site. I'm typing and saving my HTML code via HTML button on tinymce. Everything works fine in template. But, when i want to edit that content, my divs are replaced with an empty div in Tinymce HTML view.

Here is my original html code:

    <div site-widget="bulletin">
                        <bulletin-navigator></bulletin-navigator>
                        <bulletin-filter-container></bulletin-filter-container>
                        <bulletin-event-list-container></bulletin-event-list-container>
                    </div>
<script type="text/javascript" src="http://192.168.30.42:10000/assets/js/common.js"></script>
<script type="text/javascript" src="http://192.168.30.42:10000/assets/js/bulletin.js"></script>

After saving this html code, when i press HTML button on tinymce again i see the following html code:

<div>&nbsp;</div>
<script type="text/javascript" src="http://192.168.30.42:10000/assets/js/common.js"></script>
<script type="text/javascript" src="http://192.168.30.42:10000/assets/js/bulletin.js"></script>

my tincmce config is like this in settings.py file:

TINYMCE_DEFAULT_CONFIG = {
    'plugins': "table,paste,searchreplace",
    'theme': "advanced",
    'cleanup_on_startup': True,
    'custom_undo_redo_levels': 10,
    'skin' : "o2k7",
    'width' : "100%",
    'height' : "600px",
    'extended_valid_elements': 'div|bulletin-navigator|bulletin-filter-container|bulletin-event-list-container'
}
Sefa
  • 8,865
  • 10
  • 51
  • 82

1 Answers1

0

It looks like TinyMCE is kindly filtering out any tags it does not recognize. It is being overly helpful...

You may need to define 'custom_elements' in TinyMCE - http://www.tinymce.com/wiki.php/Configuration:custom_elements

Spend some time Here and configure it to fit your specific needs.

Sina Khelil
  • 2,001
  • 1
  • 18
  • 27