Issue Bug Closed

#81893ck_editor: Linefeeds added after each save

Michael Perlbach 07/17/17, 10:15 updated 10/15/24, 09:30

Description

Hi,

I already made the experience in TYPO3 7.6.x and now it is also happening in TYPO 8.7.2:

Whenever I save Text in ck_editor an additional line feed

 

is added after
each line. Also is every “
“-tag converted into a “

“-wrapper around the line.

In order to prevent this behaviour I added the following directive to my page tsconfig:

RTE.default {
proc {
dontConvBRtoParagraph = 1
preserveTables = 1
typolist = 0
}
}

which has no effect at all.

I am not in the mood nor do I have the time fiddling around with dozens of possible
ts-optioons and trying to find a solution by trial-and-error. This is so basic – there
should be a straightforward solution (which I did not find so far).

Reviews 2

History 3336

Show 11 earlier messages
  1. Wouter Wolters commented and changed status New Needs Feedback <span data-processor="relativetime" data-value="2017-07-20T23:00:20+00:00" > 07/20/17, 23:00 </span>

    Do you use Flux as extension?

  2. Michael Perlbach commented <span data-processor="relativetime" data-value="2017-07-21T01:31:32+00:00" > 07/21/17, 01:31 </span>

    Hi Wouter,

    I do not use Flux.

    I only use DCE (1.4.8) and included
    - Fluid Content Elements (fluid_styled_content)
    - Fluid Content Elements CSS (optional) (fluid_styled_content)

    Regards
    Michael

  3. Jasmina Ließmann commented <span data-processor="relativetime" data-value="2017-08-01T11:00:32+00:00" > 08/01/17, 11:00 </span>

    I can confirm the problem, but only for my special case. I have several custom elements (new CTypes) that can contain IRRE elements. The IRRE element itself has a text field, which should contain an RTE only on a particular CType.

    By using a configuration like this, I get duplicate p-tags each time I save the particular CType.

    $GLOBALS['TCA']['tt_content']['types']['ce_custom'] = [
        'columnsOverrides' => [
            'tx_domain_model_records' => [
                'config' => [
                    'overrideChildTca' => [
                        'columns' => [
                            'text' => [
                                'config' => [
                                    'enableRichtext' => true,
                                    'richtextConfiguration' => 'default',
                                ],
                            ],
                        ],
                    ],
                ],
            ],
        ],
    ],

    If I activate the RTE for the text field of the IRRE element in general (and not just for the specific CType), the problem does not occur.

    Tested with:
    • TYPO3 CMS 8.7.5-dev
    • rte_ckeditor (8.7.5)
    • fluid_styled_content (8.7.5)

    I don’t use Flux or DCE. In normal content elements like ‘text’ or ‘textmedia’ the problem does not occur as well.

  4. Ralf Zimmermann commented <span data-processor="relativetime" data-value="2017-08-30T16:26:45+00:00" > 08/30/17, 16:26 </span>

    I use the columnsOverrides and overrideChildTca TCA feature to enable the RTE on the “description” field of a sys_file_reference.

    Configuration/TCA/Overrides/tt_content.php:

        \TYPO3\CMS\Core\Utility\ArrayUtility::mergeRecursiveWithOverrule(
            $GLOBALS['TCA']['tt_content'],
            [
                'types' => [
                    'textmedia' => [
                        'columnsOverrides' => [
                            'assets' => [
                                'config' => [
                                    'overrideChildTca' => [
                                        'columns' => [
                                            'description' => [
                                                'config' => [
                                                    'enableRichtext' => true,
                                                    'richtextConfiguration' => 'default'
                                                ],
                                            ],
                                        ],
                                    ],
                                ],
                            ],
                        ],
                    ],
                ],
            ]
        );

    When saving, the DataHandler does not know what was overwritten by the parent element:
    https://github.com/TYPO3/TYPO3.CMS/blob/TYPO3_8-7-4/typo3/sysext/core/Classes/DataHandling/DataHandler.php#L1770

    The DataHandler takes the “default” configuration of “$GLOBALS[‘TCA’][‘sys_file_reference’][‘types’]2[‘columnsOverrides’][‘description’][‘config’]” and ignores the “overrideChildTca” configuration from the parent element.
    Therefore, “‘enableRichtext’ => true” is not set and the DataHandler does not execute the required RTE transformations.

  5. Kevin Quiatkowski commented <span data-processor="relativetime" data-value="2018-03-21T15:24:51+00:00" > 03/21/18, 15:24 </span>

    I have this Problem on TYPO3 8.7.9 with News 6.2.0
    If I add a Content element that has a ck_editor to a news entry, I get the new lines on every save.

  6. Riccardo De Contardi commented <span data-processor="relativetime" data-value="2019-04-02T21:44:05+00:00" > 04/02/19, 21:44 </span>

    Is this still an issue? I tried to use

    - TYPO3 9.5.5
    - Ext:news 7.1.0

    I followed the following steps:

    1) create a sysfolder
    2) create a news record
    3) tab “content elements” > create a “text” content element
    4) write some text in it
    5) Save

    So far, I’ve not experienced that each save adds a line. Is a different test required?

  1. Benni Mack commented and changed status New Needs Feedback <span data-processor="relativetime" data-value="2020-01-09T16:49:57+00:00" > 01/09/20, 16:49 </span>

    Should be fixed with https://review.typo3.org/c/Packages/TYPO3.CMS/+/60902 – right? (applied to 10, 9 and 8 in August 2019 release)

  2. Kevin Quiatkowski commented <span data-processor="relativetime" data-value="2020-01-09T20:10:23+00:00" > 01/09/20, 20:10 </span>

    I currently have this bug sometimes in a 9.5.13. Looks like there will be added a

     

    every time there is more than one line break between 2 p blocks. With each save there comes an additional line of empty p. Switching to the source view and delete every line break between the p’s is a workaround.
  3. Hugo Laporte commented and changed TYPO3 Version 8 9 PHP Version 7.0 7.2 <span data-processor="relativetime" data-value="2020-01-10T16:47:55+00:00" > 01/10/20, 16:47 </span>

    I also have this issue with tt_news and gridelements on the ckeditor content field. Every time I save it’s adding :

    <p>&nbsp;</p>

    between my paragraphs. Kind of annoying.

    My only solution so far was to remove all the empty paragraphs by javascript. The problem does’nt appear on a core content element like “Regular Text Element”.

    TYPO3 9.5.13
    tt_news 9.5.3
    gridelements 9.3.0

  4. Michael Sollmann commented <span data-processor="relativetime" data-value="2020-04-11T15:07:53+00:00" > 04/11/20, 15:07 </span>

    Can confirm this with

    TYPO3 9.5.13
    tt_news 9.5.3
    gridelements 9.3.0

    Gridelements are installed but not used here.

  5. Riccardo De Contardi commented and changed status Needs Feedback Closed <span data-processor="relativetime" data-value="2020-11-07T15:41:25+00:00" > 11/07/20, 15:41 </span>

    I think it is safe to close this issue for now (long time without feedback and seems related to a deprecated feature)

    If you think that this is the wrong decision, please reopen it or ping me and I’ll do

    Thank you.

  6. Daniel Ostmann commented <span data-processor="relativetime" data-value="2021-02-03T11:39:16+00:00" > 02/03/21, 11:39 </span>

    I can confirm this issue in TYPO3 9.5.24.

    I’ve configured the sys_file_reference.description to use the RTE (code above: #note-8). After saving the Editor adds <p>&nbsp;</p> at top and bottom and replaces every linebreak with <p>&nbsp;</p> as well.

    If activate the RTE in the TCA of sys_file_reference directly (no columnsOverrides), it works.

  7. Benjamin Robinson commented <span data-processor="relativetime" data-value="2021-06-03T11:55:42+00:00" > 06/03/21, 11:55 </span>

    I can also confirm this issue in TYPO3 9.5.27, same conditions as described by Daniel. Can someone reopen this who has permissions to do so?

  8. Benjamin Robinson commented <span data-processor="relativetime" data-value="2021-06-15T10:30:34+00:00" > 06/15/21, 10:30 </span>

    Addendum: I had tried to activate the RTE for selected content elements in the description field of sys_file_reference and encountered the same problem as Ralf Zimmermann, that after saving new paragraphs were created in the RTE.

    Afterwards I manually extended sys_file_reference with a new field “bodytext” …

    CREATE TABLE sys_file_reference (
        bodytext mediumtext,
    );
        // Configure new fields:
        $newfields = array(
            'bodytext' => array(
                'exclude' => 1,
                'label' => 'LLL:EXT:core/Resources/Private/Language/locallang_general.xlf:LGL.text',
                'config' => array(
                    'type' => 'text',
                    'cols' => '80',
                    'rows' => '15',
                    'wrap' => 'off',
                    'softref' => 'typolink_tag,images,email[subst],url',
                    'format' => 'html',
                    'enableRichtext' => true,
                    'richtextConfiguration' => 'default'
                )
            )
        );
        // Add new fields:
        \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addTCAcolumns('sys_file_reference', $newfields);

    … and assigned this field to my content element:

        $GLOBALS['TCA']['tt_content']['types']['mycontentelement'] = array(
            'showitem' => '
                --div--;LLL:EXT:core/Resources/Private/Language/Form/locallang_tabs.xlf:general,
                --palette--;;general,
                --palette--;;headers,
                image,
            ',
            'columnsOverrides' => [
                'image' => [
                    'config' => [
                        'overrideChildTca' => [
                            'types' => [
                                2 => [
                                    'showitem' => '
                                        bodytext,
                                        --palette--;;basicoverlayPalette,--palette--;;filePalette
                                    ',
                                    'columnsOverrides' => [
                                        'description' => [
                                            'config' => [
                                                'placeholder' => '',
                                                'mode' => '',
                                                'enableRichtext' => 1,
                                                'richtextConfiguration' => 'default',
                                            ],
                                        ],
                                    ],
                                ],
                            ],
                        ],
                    ],
                ],
            ],
        );

    This worked now. The above TCA example contains both cases:
    1. the working new field “bodytext” with RTE
    2. the problematic “description” field with RTE, which creates empty lines when saving.

  9. Sascha Egerer commented <span data-processor="relativetime" data-value="2021-11-03T07:16:46+00:00" > 11/03/21, 07:16 </span>

    The problem, where the linefeed are added, happens at this place: https://github.com/TYPO3/typo3/blob/946825899102f8a603bc487f60ae87ca9859d31a/typo3/sysext/core/Classes/DataHandling/DataHandler.php#L1650-L1656

    This is because a wrong field config is used. The TCA columnOverrides are respected but overrideChildTca settings are not respected:
    https://github.com/TYPO3/typo3/blob/946825899102f8a603bc487f60ae87ca9859d31a/typo3/sysext/core/Classes/DataHandling/DataHandler.php#L1457

    So enabling the RTE via overrideChildTca does still produce the problem.

  10. Miron Ogrodowicz commented <span data-processor="relativetime" data-value="2022-09-06T09:02:37+00:00" > 09/06/22, 09:02 </span>

    I created a ddev project where this issue can bea easily reproduced to help track the bug down :)

    It demonstrates exactly the issue from https://forge.typo3.org/issues/81893#note-8 and https://forge.typo3.org/issues/81893#note-24

    Attached I am sending you the repository: https://github.com/micron/typo3-81893

    All instructions can be found in the README.md.

  11. Jasmina Ließmann commented <span data-processor="relativetime" data-value="2023-07-24T14:24:53+00:00" > 07/24/23, 14:24 </span>

    Just to update: The problem still occurs in v11.5 (had it just today). Neither “columnsOverrides” nor “columns” worked for me when placed in “overrideChildTca” (see reduced example configuration):

    $tcaCustomField = [
        'columns' => [
            'custom_field' => [
                'config' => [
                    'type' => 'inline',
                    'overrideChildTca' => [
                        'types' => [
                            '0' => [
                                'showitem' => 'bodytext,',
                                'columnsOverrides' => [
                                    'bodytext' => [
                                        'config' => [
                                            'enableRichtext' => true,
                                            'richtextConfiguration' => 'default',
                                        ],
                                    ],
                                ],
                            ],
                        ],
                    ],
                ],
            ],
        ],
    ];
    $GLOBALS['TCA']['pages'] = array_replace_recursive(
        $GLOBALS['TCA']['pages'],
        $tcaCustomField
    );
    $tcaCustomField = [
        'columns' => [
            'custom_field' => [
                'config' => [
                    'type' => 'inline',
                    'overrideChildTca' => [
                        'types' => [...],
                        'columns' => [
                            'bodytext' => [
                                'config' => [
                                    'enableRichtext' => true,
                                    'richtextConfiguration' => 'default',
                                ],
                            ],
                        ]
                    ],
                ],
            ],
        ],
    ];
    $GLOBALS['TCA']['pages'] = array_replace_recursive(
        $GLOBALS['TCA']['pages'],
        $tcaCustomField
    );

    Tested with v11.5.28 and PHP 8.1. Haven’t tested it with v12.

  12. Garvin Hicking commented <span data-processor="relativetime" data-value="2024-07-08T09:25:15+00:00" > 07/08/24, 09:25 </span>

    I have added an EXT:styleguide case for this in v13/main. I could not reproduce this case there, I believe it got properly addressed with the TCA SchemaFactory implementation of v13, which now properly evaluates overrides so that DataHandler uses the final configuration.

    I tested it with both a custom IRRE relation as well as with the “file” metadata one.

    I also backported this to v12 where I could not reproduce it either.

  13. Garvin Hicking commented <span data-processor="relativetime" data-value="2024-07-08T11:52:40+00:00" > 07/08/24, 11:52 </span>

    (Note: I could reproduce it in 11.5 – so I do think this got fixed with v12, probably due to the CKEditor5 upgrade?

  14. Garvin Hicking commented and changed status Under Review Resolved done 0 % 100 % <span data-processor="relativetime" data-value="2024-08-09T16:10:10+00:00" > 08/09/24, 16:10 </span>

    Applied in changeset commit:dcd57dff3316fa0214c11381aadfbe9ea8891729.