TinyMCE stripping out img id attributes Options
cnatale
Posted: Wednesday, April 02, 2008 11:21:11 PM
Rank: Newbie

Joined: 3/13/2008
Posts: 10
Hello,

When I give an image tag an id attribute, either through tinyMCE's right-click menu, or directly through the html textbox, as soon as i publish it the id is stripped out. I've looked at the tinyMceConfig.config, and it appears to be set to allow for this. Here is relevant section of the config:



Quote:

<validElements>
<![CDATA[+a[id|style|rel|rev|charset|hreflang|dir|lang|tabindex|accesskey|type|name|href|target|title|class|onfocus|onblur|onclick|
ondblclick|onmousedown|onmouseup|onmouseover|onmousemove|onmouseout|onkeypress|onkeydown|onkeyup],-strong/-b[class|style],-em/-i[class|style],
-strike[class|style],-u[class|style],#p[id|style|dir|class|align],-ol[class|style],-ul[class|style],-li[class|style],br,
img[id|dir|lang|longdesc|usemap|style|class|src|onmouseover|onmouseout|border|alt=|title|hspace|vspace|width|height|align|umbracoorgwidth|umbracoorgheight|onresize|onresizestart|onresizeend|rel],
-sub[style|class],-sup[style|class],-blockquote[dir|style],-table[border=0|cellspacing|cellpadding|width|height|class|align|summary|style|dir|id|lang|bgcolor|background|bordercolor],
-tr[id|lang|dir|class|rowspan|width|height|align|valign|style|bgcolor|background|bordercolor],tbody[id|class],
thead[id|class],tfoot[id|class],-td[id|lang|dir|class|colspan|rowspan|width|height|align|valign|style|bgcolor|background|bordercolor|scope],
-th[id|lang|dir|class|colspan|rowspan|width|height|align|valign|style|scope],caption[id|lang|dir|class|style],-div[id|dir|class|align|style],
-span[class|align],-pre[class|align|style],address[class|align|style],-h1[id|dir|class|align],-h2[id|dir|class|align],
-h3[id|dir|class|align],-h4[id|dir|class|align],-h5[id|dir|class|align],-h6[id|style|dir|class|align],hr[class|style],
dd[id|class|title|style|dir|lang],dl[id|class|title|style|dir|lang],dt[id|class|title|style|dir|lang]]]></validElements>



Any ideas on what the problem is?

Thanks
tommyp
Posted: Thursday, April 03, 2008 11:26:38 PM
Rank: Enthusiast

Joined: 10/14/2007
Posts: 46
Location: Allerød, Denmark
Hi, I have a similar problem.
When adding
align="left"
to a img tag (directly in html or via the Image Property form) it shows correctly in the tinyMCE WYSIWYG editor - until I click save or savne-and-publish - then the align is removed again.

Any ideas?

>Tommy
sonicvibe
Posted: Friday, April 04, 2008 1:32:22 AM
Rank: Newbie

Joined: 4/4/2008
Posts: 2
Location: CLT
tommyp wrote:
When adding
align="left"
to a img tag (directly in html or via the Image Property form) it shows correctly in the tinyMCE WYSIWYG editor - until I click save or savne-and-publish - then the align is removed again.


I'm having the exact same problem.. I'm just getting into umbraco and this is really frustrating. Any help would be most appreciated.

Thanks
rorythecheese
Posted: Friday, April 04, 2008 11:23:01 AM

Rank: Newbie

Joined: 2/15/2008
Posts: 20
Location: London, England
Im cant remeber exactly, there is another post or two on this somewhere, but umbraco strips out the align tags unless you add a rel attribute to the img. So put align="left" rel="0" and it should work.

Either that or in developer->data types - change the richtext editor from TINYMCE to ultrasimpleeditor, in which you can just add straight html.
drobar
Posted: Friday, April 04, 2008 3:28:09 PM

Rank: Umbracoholic

Joined: 9/8/2006
Posts: 1,410
Location: KY, USA
Perhaps the problem isn't with TinyMCE, but with Tidy and its attempts to clean up the code? Here's an post that talks about that.

http://forum.umbraco.org/yaf_postst3972_How-to-configure-Tidy-html-output.aspx

cheers,
doug.


MVP 2007-2009 - Official Umbraco Trainer for North America - Percipient Studios
hartvig
Posted: Monday, April 07, 2008 1:36:20 PM

Rank: Addict

Joined: 3/17/2008
Posts: 812
Location: Nyborg, Denmark
umbraco is setup to output xhtml strict by default.

The align attribute is not allowed in xhtml strict, which is why it's by default has been removed from the ValidElements element in the tiny config file. If you're not doing xhtml, then you can consider adding it. However, the proper way to do it is via css which is the recommended approach.

Hope this helps!

/n

Jeeeez, did I really start this :-)
Pierre
Posted: Tuesday, April 08, 2008 9:21:51 AM
Rank: Newbie

Joined: 10/2/2007
Posts: 6
But an id shouldn't be stripped out, should it? It's part of the XHTML.
hartvig
Posted: Tuesday, April 08, 2008 11:00:23 AM

Rank: Addict

Joined: 3/17/2008
Posts: 812
Location: Nyborg, Denmark
@Pierre: No, that's correct. I'll add it as a bug in cp

Jeeeez, did I really start this :-)
sonicvibe
Posted: Wednesday, April 09, 2008 5:27:11 PM
Rank: Newbie

Joined: 4/4/2008
Posts: 2
Location: CLT
It's also stripping out class in the img tag, is it suppose to do that?
mgrdcm
Posted: Thursday, May 01, 2008 3:38:23 PM
Rank: Newbie

Joined: 4/15/2008
Posts: 17
Location: Indianapolis, IN
This is hitting me too now - For some reason it has started stripping out several attributes such as 'style' and just about everything from the 'img' element. Any new news on this?
kevinperrott
Posted: Wednesday, May 07, 2008 5:43:13 PM
Rank: Newbie

Joined: 5/7/2008
Posts: 2
Just was fighting with this as well.. had to disable Moxie editor to get it to work right. Another question I have is how to prevent <p> tags from automatically being inserted.
Dirk
Posted: Wednesday, May 07, 2008 8:46:10 PM

Rank: Fanatic

Joined: 9/27/2007
Posts: 411
Location: Belgium
<p> tags get inserted when hitting <ENTER> key in the rte. Use <SHIFT>+<ENTER> instead.

level 1 certified - umbraco blog at netaddicts.be
kevinperrott
Posted: Thursday, May 08, 2008 12:04:14 AM
Rank: Newbie

Joined: 5/7/2008
Posts: 2
Dirk wrote:
<p> tags get inserted when hitting <ENTER> key in the rte. Use <SHIFT>+<ENTER> instead.

Thanks but I'm not pressing <ENTER>.. I'm editing in HTML mode and even after I delete the <p> </p> tags.. after updating the editor.. they reappear.. annoying.. there's only the <img ... /> tag in the HTML window enclosed in <a></a> .. and they still appeare.. maybe there's a setting..

KP
cato
Posted: Tuesday, May 27, 2008 5:41:55 AM
Rank: Newbie

Joined: 6/11/2007
Posts: 5
Location: Auckland, NZ
You can set tinymce to set rel to 0 by default so this never happens

Open the file /config/tinyMceConfig.config
Under <validElements> locate the img tag and its attributes. Find the rel attribute and make it rel=0

http://www.codeplex.com/umbraco/WorkItem/View.aspx?WorkItemId=11808
echidna
Posted: Wednesday, June 11, 2008 3:01:12 AM
Rank: Newbie

Joined: 6/11/2008
Posts: 7
Location: uranus
is there no cleaner way to stop umbr4ko from nuking my alt tags?

rel="0" seems like some pretty pointless junk to be adding to fix what should be a simple problem.
echidna
Posted: Wednesday, June 11, 2008 3:45:47 AM
Rank: Newbie

Joined: 6/11/2008
Posts: 7
Location: uranus
for me the rel=0 hack only works on the first publish.

subsequent publishes will remove rel and alt.

why does umbraco give a fsck about my img tags?

it would be nice if bugs like these where fixed b4 we started talking about v4. its crap like this that makes switching to drupal, plone, joomla or whatever so appealing.
echidna
Posted: Wednesday, June 11, 2008 6:38:33 AM
Rank: Newbie

Joined: 6/11/2008
Posts: 7
Location: uranus
if you can avoid the no macros in firefox bug then insert images via a usercontrol and umbraco will not butcher your image tags.

there goes 4 hours of my life im never getting back.
CMOLO
Posted: Friday, June 20, 2008 3:30:02 AM
Rank: Newbie

Joined: 6/20/2008
Posts: 1
Location: Australia
Howdy Folks,

I'm actually from the Joomla CMS camp but Joomla also uses TinyMCE and after unsuccessfully looking for a solution to this problem, I decided to do my own digging and have come up with a solution.

Obviously, Umbraco will be set up with TinyMCE quite differently to Joomla but you need to look for a JavaScript property somewhere in your TinyMCE codebase called 'extended_valid_elements'.

You will find that this is a list of elements and their allowable attributes separated with pipes. Simply add any elements and attributes to this list and save the file. Eg you can add 'id|' and TinyMCE will preserve your id atts in images.

I am using TinyMCE 2.0 and Joomla 1.5

Hope this helps.
derrick
Posted: Wednesday, July 02, 2008 11:17:47 AM
Rank: Newbie

Joined: 7/2/2008
Posts: 1
Location: London
Hi CMOLO,

I'm also plagued by this issue of stripped attributes. Also using Joomla1.5 & TinyMCE. I've tried what you suggested but its having no effect. Are there any other relevant config settings that need to be considered?

TIA
robl
Posted: Monday, July 14, 2008 3:35:42 PM
Rank: Newbie

Joined: 7/14/2008
Posts: 1
Hi

I am also finding Umbraco pretty useless with this issue stopping my progress - can anyone offer a solution? Is this an Umbraco or TinyMCE issue?

Rob
Users browsing this topic
Guest


You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.