From 0d2d8d924a330c28e41b858c324588f86d5bf10a Mon Sep 17 00:00:00 2001 From: Andreas Kienast <a.fernandez@scripting-base.de> Date: Thu, 13 Jun 2024 11:58:12 +0200 Subject: [PATCH] [BUGFIX] Merge code editor settings properly The settings for the `typo3-t3editor-codemirror` element were passed in an `options` attribute, which is unknown. This leads to the issue that e.g. the `readOnly` flag set in TCA is ignored. The composed settings are now properly merged. Resolves: #104084 Releases: main, 12.4 Change-Id: I7e34a8230764c33b7924128176088ab32cb35a58 Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/84699 Tested-by: core-ci <typo3@b13.com> Reviewed-by: Andreas Kienast <a.fernandez@scripting-base.de> Tested-by: Andreas Kienast <a.fernandez@scripting-base.de> --- .../t3editor/Classes/Form/Element/T3editorElement.php | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/typo3/sysext/t3editor/Classes/Form/Element/T3editorElement.php b/typo3/sysext/t3editor/Classes/Form/Element/T3editorElement.php index 9d28e6212fc9..55426fd205c8 100644 --- a/typo3/sysext/t3editor/Classes/Form/Element/T3editorElement.php +++ b/typo3/sysext/t3editor/Classes/Form/Element/T3editorElement.php @@ -115,7 +115,7 @@ class T3editorElement extends AbstractFormElement $settings = []; if ($parameterArray['fieldConf']['config']['readOnly'] ?? false) { - $settings['readOnly'] = true; + $settings['readonly'] = true; } $editorHtml = $this->getHTMLCodeForEditor( @@ -213,13 +213,12 @@ class T3editorElement extends AbstractFormElement $keymaps[] = $keymap; } } - $codeMirrorConfig = [ + $codeMirrorConfig = array_merge($settings, [ 'name' => $name, 'mode' => GeneralUtility::jsonEncodeForHtmlAttribute($mode->getModule(), false), 'addons' => GeneralUtility::jsonEncodeForHtmlAttribute($addons, false), 'keymaps' => GeneralUtility::jsonEncodeForHtmlAttribute($keymaps, false), - 'options' => GeneralUtility::jsonEncodeForHtmlAttribute($settings, false), - ]; + ]); $code[] = '<typo3-t3editor-codemirror ' . GeneralUtility::implodeAttributes($codeMirrorConfig, true) . '>'; $code[] = '<textarea ' . GeneralUtility::implodeAttributes($attributes, true) . '>' . htmlspecialchars($content) . '</textarea>'; -- GitLab