ckeditortypo3typoscriptrtetypo3-10.x

TYPO3 v10: Remove <p> tags around paragraphs in custom RTE field (CKeditor)


I have a RTE field in my custom extension for TYPO3 10.4 with Fluid Styled Content. The RTE CKEditor automatically wraps each paragraph with a p tag. I'd like to get rid of this p tag. It's just a teaser field where I don't need line breaks or paragraphs.

What I tried so far is to create my own parseFunc via TypoScript to solve the problem during frontend output:

lib.parseFunc_my_teaser < lib.parseFunc_RTE
lib.parseFunc_my_teaser.nonTypoTagStdWrap.encapsLines >
lib.parseFunc_my_teaser.nonTypoTagStdWrap.encapsLines {
  encapsTagList = p
  remapTag.P =
}

In my Fluid template I use the parsefunc like this:

{article.data.teaser -> f:format.html(parseFuncTSPath: 'lib.parseFunc_my_teaser')}

This works and p tags are gone.

But I wonder if there is no nicer solution. I think I need to find a solution to tackle this problem either within the CKEditor configuration or via Page TSconfig. Unfortunately I wasn't able to find a proper approach.

By the way, another problem is, that in the "Info" Backend module of TYPO3 in my installation the view for Page TSconfig filtered by RTE. is empty. Any ideas on this?

TPYO3 v10 Backend Module "Info" with empty Page TSconfig view


Solution

  • I actually do that directly within an own RTE preset for CKE4 (tested in TYPO3 8, 9, 10 LTS):

    editor.config.format_tags: "p"
    editor.config.enterMode: 2
    editor.config.shiftEnterMode: 2
    

    With that an editor can't write P-tags. Even not in Source-Mode of CKE4.