TinyMCE stripping my code

For questions and problems with the CMS core. This board is NOT for any 3rd party modules, addons, PHP scripts or anything NOT distributed with the CMS made simple package itself.
Post Reply
jasnick
Power Poster
Power Poster
Posts: 695
Joined: Sat Jan 15, 2011 8:36 am

TinyMCE stripping my code

Post by jasnick »

Using latest version CMSMS.

I notice that others have run into the problem of the WYSIWYG text editor stripping out some of the added code. Is there a solution - perhaps another text editor that lets me enter my own code and retains it?
Is there someway the settings can be altered in TinyMCE? I have not gone there yet - will wait and see if anyone knows what to do.

Thanks.
User avatar
Dr.CSS
Moderator
Moderator
Posts: 12711
Joined: Thu Mar 09, 2006 5:32 am

Re: TinyMCE stripping my code

Post by Dr.CSS »

Mind sharing what code it is that gets stripped?...
Wishbone
Power Poster
Power Poster
Posts: 1368
Joined: Tue Dec 23, 2008 8:39 pm

Re: TinyMCE stripping my code

Post by Wishbone »

In TinyMCE->Advanced->Extra Configuration, you can place TinyMCE directives to decide which tags are kept. The issue is that this replaces the default list. I'm not sure if it's using Tiny's default, or if CMSMS sets this default. If you put your favorite tag in this list, these will be the only tags accepted, and <p>, <h1>, etc will be deleted. Check the Tiny Wiki for the syntax of this directive.

I think it would be nice for future Tiny module releases to provide a field that indicates all accepted html tags (and attributes of those tags) that are accepted, where admins can add or delete at will.
jasnick
Power Poster
Power Poster
Posts: 695
Joined: Sat Jan 15, 2011 8:36 am

Re: TinyMCE stripping my code

Post by jasnick »

This is the code I used - it is for a rounded corner box and I have used it on countless websites as is.

<div class="rcbox">
<div class="rctop"><div></div></div>
<div class="rccontent">
<p>Lorem ipsum dolor sit amet, consectetur
adipisicing elit, sed do eiusmod tempor incididunt
ut labore et dolore magna aliqua.</p>
</div>
<div class="rcbottom"><div></div></div>
</div>

I tried putting each <div></div> on a separate line - made no difference. I am left with:

<div class="rcbox">
<div class="rccontent">
<p>Lorem ipsum dolor sit amet, consectetur
adipisicing elit, sed do eiusmod tempor incididunt
ut labore et dolore magna aliqua.</p>
</div
</div>

It takes me back a few years to when I first started designing and used a WYSIWYG editor (not knowing any better at the time) and got so annoyed at the way it didn't want to do things my way that I ditched it and started learning HTML and CSS.
User avatar
Dr.CSS
Moderator
Moderator
Posts: 12711
Joined: Thu Mar 09, 2006 5:32 am

Re: TinyMCE stripping my code

Post by Dr.CSS »

Yes tiny auto strips empty tags like div, maybe put it in the template and use a {content block='secondblock'} tag in them...
Wishbone
Power Poster
Power Poster
Posts: 1368
Joined: Tue Dec 23, 2008 8:39 pm

Re: TinyMCE stripping my code

Post by Wishbone »

Tiny won't strip out an empty div if it has an HTML comment in it: <div><!-- --></div>
User avatar
Dr.CSS
Moderator
Moderator
Posts: 12711
Joined: Thu Mar 09, 2006 5:32 am

Re: TinyMCE stripping my code

Post by Dr.CSS »

Then it's not empty...
Wishbone
Power Poster
Power Poster
Posts: 1368
Joined: Tue Dec 23, 2008 8:39 pm

Re: TinyMCE stripping my code

Post by Wishbone »

Dr.CSS wrote:Then it's not empty...
It's effectively empty, and It accomplishes what he needs to do.
jasnick
Power Poster
Power Poster
Posts: 695
Joined: Sat Jan 15, 2011 8:36 am

Re: TinyMCE stripping my code

Post by jasnick »

What a great idea! Thanks Wishbone and Dr.CSS - will try that.
Post Reply

Return to “CMSMS Core”