Project

General

Profile

Actions

Bug #30431

closed

RTE removes <span> tags though allowTags and rmTagIfNoAttrib are set correctly

Added by Lars Zimmermann over 12 years ago. Updated over 12 years ago.

Status:
Rejected
Priority:
Should have
Category:
RTE (rtehtmlarea + ckeditor)
Target version:
-
Start date:
2011-09-29
Due date:
% Done:

0%

Estimated time:
TYPO3 Version:
4.5
PHP Version:
Tags:
Complexity:
medium
Is Regression:
Sprint Focus:

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

Actions #1

Updated by Steffen Gebert over 12 years ago

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

Actions #2

Updated by Steffen Gebert over 12 years ago

  • Target version deleted (4.5.7)
Actions #3

Updated by Peter Niederlag over 12 years ago

  • 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.

Actions #4

Updated by Peter Niederlag over 12 years ago

  • 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.

Actions #5

Updated by Steffen Gebert over 12 years ago

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.

Actions #6

Updated by Lars Zimmermann over 12 years ago

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?

Actions #7

Updated by Lars Zimmermann over 12 years ago

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!

Actions #8

Updated by Peter Niederlag over 12 years ago

  • 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.

Actions

Also available in: Atom PDF