Div tags removed from HTML dialog in WYSIWYG Editor

Topics: Developer Forum, Project Management Forum, User Forum
Nov 20, 2008 at 3:28 PM
Hello,

For some reason when I add div tags to the HTML dialog in the WYSIWYG the div tag is replaced with a paragraph tag <p>

Has anyone run into this? Why would this be happening?

Thanks
Daniel
Nov 20, 2008 at 3:35 PM
Hello, here is some more information

Here is the code that I type in the HTML dialog

<div id="cse-search-results"></div>
<script type="text/javascript">
  var googleSearchIframeName = "cse-search-results";
  var googleSearchFormName = "cse-search-box";
  var googleSearchFrameWidth = 600;
  var googleSearchDomain = "www.google.com";
  var googleSearchPath = "/cse";
</script>
<script type="text/javascript" src="http://www.google.com/afsonline/show_afs_search.js"></script>

This is what it gets replaced with, ie the next time I open the HTML dialog this is what I see

<p>
<script type="text/javascript"><!--
  var googleSearchIframeName = "cse-search-results";
  var googleSearchFormName = "cse-search-box";
  var googleSearchFrameWidth = 600;
  var googleSearchDomain = "www.google.com";
  var googleSearchPath = "/cse";
// --></script>
<script src="http://www.google.com/afsonline/show_afs_search.js" type="text/javascript"></script>
</p>

Why would this be the case? How can this be fixed?

Thanks
Daniel


Coordinator
Nov 20, 2008 at 6:55 PM
While I managed to keep the div the class still gets stripped and the p is inserted. This is how you can modify tinymce settings:

    <edit>
        <tinyMCE>
            <settings>
                <add key="extended_valid_elements" value="hr[class|width|size|noshade],span[class|align|style],pre[class],code[class],iframe[src|width|height|name|align],div[class|style]"/>
            </settings>
        </tinyMCE>
    </edit>

I'm far from a tinymce wiz, you could look around the tinymce forum for a solution. It's a resonable default so I'll look some more and post back here if I find something useful.
Coordinator
Nov 20, 2008 at 6:59 PM
Oh, and by the way. You might want to create a droppable part that encapsulates those codes. Or define a textarea without wysiwyg.
Nov 20, 2008 at 7:03 PM
> Or define a textarea without wysiwyg.

Is it possible to allow the user to select the editor? E.g. most users will want to use WYSIWYG, however some users will need to edit the HTML without TinyMCE modifying it.