Issue Bug Closed

#88556One line break in DB field causes 3 rendered p-tags in CKEditor

Alex Nostadt 06/13/19, 13:35 updated 08/11/26, 08:46

Description

<p>Hello World
</p><ul><li>foo bar</li></ul>

When writing this into a DB field with enabled RTE it causes 3 additional empty p-tags in CKEditor. These can be saved too. See attachment for a sample.

Not sure whether this is a CKEditor or TYPO3 related issue.

Reviews 3

Files 7

History 1720

  1. Benni Mack commented and changed status New Needs Feedback <span data-processor="relativetime" data-value="2019-06-13T13:37:33+00:00" > 06/13/19, 13:37 </span>

    Are you using the RTE in a FlexForm?

  2. Alex Nostadt commented <span data-processor="relativetime" data-value="2019-06-13T13:40:26+00:00" > 06/13/19, 13:40 </span>

    Benni Mack wrote:
    > Are you using the RTE in a FlexForm?

    No, I use it in a TCA.

    When removing the single existing line break between “World” and closing p-tag no additional line breaks are created. I have switched temporary to T3’s default preset but the behaviour was the same.

    That’s my TCA field config:

    <?php
            'myField' => [
                'exclude' => 1,
                'label' => $ll . 'myField',
                'config' => [
                    'type' => 'text',
                    'cols' => 40,
                    'rows' => 15,
                    'eval' => 'trim',
                    'enableRichtext' => true,
                ],
            ],
  3. Riccardo De Contardi commented and changed status Needs Feedback New <span data-processor="relativetime" data-value="2019-06-29T21:50:09+00:00" > 06/29/19, 21:50 </span>

    Is this somehow related? #88655

  4. Alex Nostadt commented <span data-processor="relativetime" data-value="2019-07-02T12:07:18+00:00" > 07/02/19, 12:07 </span>

    Riccardo De Contardi wrote:
    > Is this somehow related? #88655

    I will check within this week.

  5. Alex Nostadt commented <span data-processor="relativetime" data-value="2019-07-08T18:57:16+00:00" > 07/08/19, 18:57 </span>

    I don’t think this is related as #88655 is about ignored RTE config. whereas this issue is rather related to DB=>CKEditor parse-process.

  6. Benni Mack commented <span data-processor="relativetime" data-value="2019-08-16T12:46:29+00:00" > 08/16/19, 12:46 </span>

    Alex Nostadt wrote:
    > I don’t think this is related as #88655 is about ignored RTE config. whereas this issue is rather related to DB=>CKEditor parse-process.

    Can you share your CKEditor config? (if you have a manually configured RTE configuration) just to be sure.

  7. Alex Nostadt commented <span data-processor="relativetime" data-value="2019-08-17T09:05:59+00:00" > 08/17/19, 09:05 </span>

    Benni Mack wrote:
    > Alex Nostadt wrote:
    > > I don’t think this is related as #88655 is about ignored RTE config. whereas this issue is rather related to DB=>CKEditor parse-process.
    >
    > Can you share your CKEditor config? (if you have a manually configured RTE configuration) just to be sure.

    I could reproduce it with the default T3 config as well but can provide it as well within the next days.

  8. Alex Nostadt commented <span data-processor="relativetime" data-value="2019-08-26T15:38:15+00:00" > 08/26/19, 15:38 </span>

    Alex Nostadt wrote:
    > Benni Mack wrote:
    > > Alex Nostadt wrote:
    > > > I don’t think this is related as #88655 is about ignored RTE config. whereas this issue is rather related to DB=>CKEditor parse-process.
    > >
    > > Can you share your CKEditor config? (if you have a manually configured RTE configuration) just to be sure.
    >
    > I could reproduce it with the default T3 config as well but can provide it as well within the next days.

    Sorry, forgot this ticket. Add this to my priority list now.

  9. Alex Nostadt commented <span data-processor="relativetime" data-value="2019-08-30T08:42:51+00:00" > 08/30/19, 08:42 </span>

    That’s the RTE configuration:
    (I include Specific.yaml. We have multiple “Specific.yaml” files and our Default.yaml is our common denominator)
    *Default.yaml*

    imports:
        - { resource: "EXT:rte_ckeditor/Configuration/RTE/Processing.yaml" }
        - { resource: "EXT:rte_ckeditor/Configuration/RTE/Editor/Base.yaml" }
        - { resource: "EXT:rte_ckeditor/Configuration/RTE/Editor/Plugins.yaml" }
        - { resource: "EXT:rte_ckeditor_image/Configuration/RTE/Plugin.yaml" }
    
    processing:
        ## allowed default attributes (added by us is..: "style")
        allowAttributes: [class, id, title, dir, lang, xml:lang, itemscope, itemtype, itemprop, style]
    
    editor:
        externalPlugins:
            find:
                resource: "EXT:provider/Resources/Public/CKEditor/Plugins/find/"
    
        config:
            # can be "default", but a custom stylesSet can be defined here, which fits TYPO3 best
            stylesSet:
                - { name: "LLL:EXT:provider/Resources/Private/Language/rte.xlf:align-center", element: "p", styles: { text-align: "center"} }
                - { name: "LLL:EXT:provider/Resources/Private/Language/rte.xlf:justify", element: "p", styles: { text-align: "justify"} }
                - { name: "LLL:EXT:provider/Resources/Private/Language/rte.xlf:author", element: "p", attributes: { class: 'author' } }
                - { name: "LLL:EXT:provider/Resources/Private/Language/rte.xlf:citation", element: "p", attributes: { class: 'citation' } }
                - { name: "LLL:EXT:provider/Resources/Private/Language/rte.xlf:check", element: ["ul"], attributes: { class: 'check' } }
    
            toolbarGroups:
                - { name: styles, groups: [ styles ] }
                - "/"
                - { name: editing, groups: [ find, selection, spellchecker, editing ] }
                - { name: forms, groups: [ forms ] }
                - { name: basicstyles, groups: [ basicstyles, cleanup ] }
                - { name: paragraph, groups: [ list, indent, blocks, align, bidi, paragraph ] }
                - { name: links, groups: [ links ] }
                - { name: insert, groups: [ insert ] }
                - { name: colors, groups: [ colors ] }
                - { name: others, groups: [ others ] }
                - "/"
                - { name: clipboard, groups: [ clipboard, undo ] }
                - { name: document, groups: [ mode, document, doctools ] }
                - { name: tools, groups: [ tools ] }
                - { name: about, groups: [ about ] }
    
            format_tags: "p;h1;h2;h3;h4"
    
            justifyClasses:
                - text-left
                - text-center
                - text-right
                - text-justify
    
            buttons:
                link:
                    url:
                        properties:
                            class:
                                default: 'external-link'
                    properties:
                        class:
                            allowedClasses: 'external-link'
    
            classes:
                external-link:
                    name: 'External Link'
    
            classesAnchor:
                externalLink:
                    class: 'external-link'
                    type: 'url'
                    target: '_blank'
    
            removeButtons:
                - Save
                - NewPage
                - Preview
                - Print
                - Templates
                - Cut
                - Copy
                - Paste
                - PasteFromWord
                - Form
                - Checkbox
                - Radio,
                - TextField
                - Textarea
                - Select
                - Button
                - ImageButton
                - HiddenField
                - Outdent
                - Indent
                - Flash
                - HorizontalRule
                - Smiley
                - PageBreak
                - Iframe
                - Font
                - FontSize
                - TextColor
                - BGColor
                - ShowBlocks
                - Blockquote
                - About

    Specific.yaml

    imports:
        - { resource: "EXT:provider/Configuration/RTE/Default.yaml" }
    
    editor:
        externalPlugins:
            placeholder_select:
                resource: "EXT:provider/Resources/Public/CKEditor/Plugins/placeholder_select/"
    
        config:
            contentsCss: ["EXT:rte_ckeditor/Resources/Public/Css/contents.css", "EXT:provider/Resources/Public/Css/editor.css"]
            # can be "default", but a custom stylesSet can be defined here, which fits TYPO3 best
            stylesSet:
                - { name: "LLL:EXT:provider/Resources/Private/Language/rte.xlf:large", element:  ["p", "ul", "ol", "h1", "h2", "h3"], attributes: { class: 'large' } }
                - { name: "LLL:EXT:provider/Resources/Private/Language/rte.xlf:teaser-text", element: "p", attributes: { class: 'teaser-text' } }
                - { name: "LLL:EXT:provider/Resources/Private/Language/rte.xlf:light-gray", element: ["p", "ul", "ol"], attributes: { class: 'light-gray' } }
                - { name: "LLL:EXT:provider/Resources/Private/Language/rte.xlf:all-borders", element: "table", attributes: { class: 'all-borders' } }
                - { name: "LLL:EXT:provider/Resources/Private/Language/rte.xlf:horizontal-borders", element: "table", attributes: { class: 'horizontal-borders' } }
                - { name: "LLL:EXT:provider/Resources/Private/Language/rte.xlf:vertical-borders", element: "table", attributes: { class: 'vertical-borders' } }
  10. David Menzel commented and changed attached db_field_value.jpg attached rte_view.jpg attached rte_view_sourcecode.jpg attached fe_output.jpg attached fe_output_sourcecode.jpg attached db_field_value_wo_linebreak.jpg TYPO3 Version 8 11 PHP Version 7.2 7.4 <span data-processor="relativetime" data-value="2023-08-07T18:58:28+00:00" > 08/07/23, 18:58 </span>

    We have the same problem since (at least) TYPO3 10. Now using TYPO3 11.

    A bodytext database field has the following text:

    db_field_value.jpg

    The RTE ckeditor looks like this:

    rte_view.jpg

    RTE ckeditor Source code view:

    rte_view_sourcecode.jpg

    Output in FE:

    fe_output.jpg

    FE source code:

    fe_output_sourcecode.jpg

    You notice the additional empty p-Tags before/after the pre-tag?

    However, when I remove the linebreaks in the database field:
    db_field_value_wo_linebreak.jpg

    the FE works and there are no additional empty p-tags.
    When I save the RTE field again, the empty p-tags are back again because the linebreaks are back in the db field.

    Not sure why it only happens before/after the pre-tag.

    TYPO3 11.5.30 and PHP 7.4

  11. David Menzel commented and changed TYPO3 Version 11 12 PHP Version 7.4 8.2 <span data-processor="relativetime" data-value="2025-03-06T05:47:19+00:00" > 03/06/25, 05:47 </span>

    Problem still exists in TYPO3 12.4.27 and CKEditor 5.

    There’s an additional empty

    -Tag before and after the codeblock.

  12. Benjamin Kott commented and changed status Under Review Resolved done 0 % 100 % <span data-processor="relativetime" data-value="2026-08-06T20:15:08+00:00" > 08/06/26, 20:15 </span>

    Applied in changeset commit:b406a9416431d1945756ce418d9c3726844f5325.