From 46e9d3a34658ad54eef10e5ca07754cb87a0fe37 Mon Sep 17 00:00:00 2001 From: Achim Fritz Date: Wed, 19 Feb 2025 16:18:37 +0100 Subject: [PATCH] [BUGFIX] autoParagraph and enterMode both configurations autoParagraph: 1 and enterMode: 2 are dropped with CKEditor 5 we introduced an event listener for replace paragraphs for TYPO3 v13 --- .../AfterTransformTextForPersistence.php | 33 +++++++++++++++++++ Configuration/RTE/Richtextinputfields.yaml | 2 ++ 2 files changed, 35 insertions(+) create mode 100644 Classes/EventListener/AfterTransformTextForPersistence.php diff --git a/Classes/EventListener/AfterTransformTextForPersistence.php b/Classes/EventListener/AfterTransformTextForPersistence.php new file mode 100644 index 0000000..33e9043 --- /dev/null +++ b/Classes/EventListener/AfterTransformTextForPersistence.php @@ -0,0 +1,33 @@ + instead of

+ // autoParagraph: false + $config = $event->getProcessingConfiguration(); + if ((bool)($config['plainRichText'] ?? false) === false) { + return; + } + $content = $event->getHtmlContent(); + $pattern = '/((.*?)+)\<\/p>/'; + $matches = []; + $cnt = preg_match_all($pattern, $content, $matches); + if ($cnt > 0) { + $event->setHtmlContent(implode('
', $matches[2])); + } + } + +} diff --git a/Configuration/RTE/Richtextinputfields.yaml b/Configuration/RTE/Richtextinputfields.yaml index 9117a9b..d52f058 100644 --- a/Configuration/RTE/Richtextinputfields.yaml +++ b/Configuration/RTE/Richtextinputfields.yaml @@ -35,6 +35,8 @@ editor: processing: overruleMode: nothing + # v13: autoParagraph: false and enterMode: 2 + plainRichText: true allowTags: - sub - sup