Bug #30431
closed
RTE removes <span> tags though allowTags and rmTagIfNoAttrib are set correctly
Added by Lars Zimmermann about 13 years ago.
Updated about 13 years ago.
Category:
RTE (rtehtmlarea + ckeditor)
Description
I tried to enter <p><a href="#">Foo <span>bar</span></a></p> in the source code mode in the RTE.
After saving the RTE removes the <span></span> tag completely. The TSConfig field of the root page only contains the line
RTE.default.proc.entryHTMLparser_db.rmTagIfNoAttrib = font
<span> is allowed by default in the "allowTags" section.
Could someone please have a look if something's wrong there?
Cheers and thanks alot in advance
Lars
I tried to help Lars a bit with this, but I also don't know, where the problem comes from.
A simpler string to reproduce is <p><span>foo</span></p>
.
In t3lib_parsehtml_proc::RTE_transform()
the function TS_transform_db($value, $cmd == 'css_transform');
is called with the correct $value
and returns it with stripped span
.
One thing, which I think is weird is that in t3lib_parsehtml::HTMLcleaner
value of $tags['span']['rmTagIfNoAttrib']
is again 1, but not 0 as I would expect (and I think therefore it is removed).
Steffen
- Target version deleted (
4.5.7)
- Status changed from New to Accepted
- Complexity set to medium
rmTagIfNoAttrib is set to 1 inside that class in getKeepTags() for some (not obvious) reason.
- Status changed from Accepted to Needs Feedback
- Assignee set to Peter Niederlag
Hello,
the default HTMLparser process has an internal default rmTagIfNoAttrib = 1 fro the span tag. However you can override this via the HTMLparser_db config in TSconfig. The following snippet will allow for <p><span>test</span></p> (unless some other configured options remove it).
RTE {
default {
proc {
HTMLparser_db {
tags {
span {
rmTagIfNoAttrib = 0
}
}
}
}
}
}
Please cheack and report if this solves your issue.
Indeed! I thought I checked this, but I had entryHTMLparser_db
instead of HTMLparser_db
.
Lars, can you give it a try, again?
So removing span
from RTE.default.proc.entryHTMLparser_db.rmTagIfNoAttrib
isn't needed, instead, only what Peter posted has to be set.
Hi Peter,
thanks for your help!
Unfortunately neither of the lines has helped to solve the issue
RTE.default.proc.HTMLparser_db.tags.span.rmTagIfNoAttrib = 1
RTE.default.proc.entryHTMLparser_db.rmTagIfNoAttrib = font
Just your line, both together or just the other didn't solve the problem. Today I've worked with a not-so-recent 4.6-dev version, where the RTE keeps the <span>foobar</span> tags... Maybe that's a hint?
Ok, I have something in my eye or my brain is not working. In the mail I got from the answer to this issue the line said
RTE.default.proc.HTMLparser_db.tags.span.rmTagIfNoAttrib = 1
but just copying it seems not to work. When I started reading the issues here I noticed, that it should not remove the attrib so it has to be 0, as mentioned 3 entries above.
RTE.default.proc.HTMLparser_db.tags.span.rmTagIfNoAttrib = 0
It obviously works to solve the issue!
Thank you Peter!
- Status changed from Needs Feedback to Rejected
well, I was confirming the setting while toggling it on and off. Then I copied it wrong, and updated the comment after I noticed it was wrong. =0 is of course the correct setting and your eyes and brain are just fine.
Also available in: Atom
PDF