From b06cc92a28ba4f98b69dea452865d23b70570067 Mon Sep 17 00:00:00 2001 From: Georg Ringer <georg.ringer@gmail.com> Date: Fri, 25 Sep 2020 22:46:35 +0200 Subject: [PATCH] [FEATURE] Use the ckeditor plugin editorplaceholder Enable the ckeditor plugin editorplaceholder which is available since the update of ckeditor to version 4.15.0 with #92412 and fill it with the placeholder information provided by the TCA. Resolves: #92423 Releases: master Change-Id: Ie392073d200a193b2be5f245042f0914f7665cdd Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/65899 Tested-by: Torben Hansen <derhansen@gmail.com> Tested-by: TYPO3com <noreply@typo3.com> Tested-by: Oliver Bartsch <bo@cedev.de> Tested-by: Andreas Fernandez <a.fernandez@scripting-base.de> Reviewed-by: Torben Hansen <derhansen@gmail.com> Reviewed-by: Oliver Bartsch <bo@cedev.de> Reviewed-by: Andreas Fernandez <a.fernandez@scripting-base.de> --- ...423-EnablePlaceholderConfigForCkeditor.rst | 37 +++++++++++++++++++ .../Classes/Form/Element/RichTextElement.php | 3 ++ .../Configuration/RTE/Default.yaml | 1 + .../rte_ckeditor/Configuration/RTE/Full.yaml | 1 + 4 files changed, 42 insertions(+) create mode 100644 typo3/sysext/core/Documentation/Changelog/master/Feature-92423-EnablePlaceholderConfigForCkeditor.rst diff --git a/typo3/sysext/core/Documentation/Changelog/master/Feature-92423-EnablePlaceholderConfigForCkeditor.rst b/typo3/sysext/core/Documentation/Changelog/master/Feature-92423-EnablePlaceholderConfigForCkeditor.rst new file mode 100644 index 000000000000..2c468b0809bd --- /dev/null +++ b/typo3/sysext/core/Documentation/Changelog/master/Feature-92423-EnablePlaceholderConfigForCkeditor.rst @@ -0,0 +1,37 @@ +.. include:: ../../Includes.txt + +======================================================== +Feature: #92423 - Enable placeholder config for ckeditor +======================================================== + +See :issue:`92423` + +Description +=========== + +After the update of ckeditor to version 4.15.0, a new ckeditor plugin, called +**Editor Placeholder**, is now available. More information along with an example +can be found in the official documentation_. + +The placeholder configuration of TCA type `text` is now fed into the ckeditor plugin: + +.. code-block:: php + + 'bodytext' => [ + 'label' => 'LLL:EXT:core/Resources/Private/Language/locallang_general.xlf:LGL.text', + 'config' => [ + 'placeholder' => 'This is a placeholder', + 'type' => 'text', + 'enableRichtext' => true, + ] + ] + + +Impact +====== + +Editors can now be supported by providing a placeholder text also for the ckeditor. + +.. _documentation: https://ckeditor.com/docs/ckeditor4/latest/examples/editorplaceholder.html + +.. index:: Backend, ext:rte_ckeditor diff --git a/typo3/sysext/rte_ckeditor/Classes/Form/Element/RichTextElement.php b/typo3/sysext/rte_ckeditor/Classes/Form/Element/RichTextElement.php index 8295596960f0..ba7372ffc917 100644 --- a/typo3/sysext/rte_ckeditor/Classes/Form/Element/RichTextElement.php +++ b/typo3/sysext/rte_ckeditor/Classes/Form/Element/RichTextElement.php @@ -218,6 +218,9 @@ class RichTextElement extends AbstractFormElement } } $configuration['extraPlugins'] .= ',' . $extraPluginName; + if (isset($this->data['parameterArray']['fieldConf']['config']['placeholder'])) { + $configuration['editorplaceholder'] = (string)$this->data['parameterArray']['fieldConf']['config']['placeholder']; + } $externalPlugins .= 'CKEDITOR.plugins.addExternal('; $externalPlugins .= GeneralUtility::quoteJSvalue($extraPluginName) . ','; diff --git a/typo3/sysext/rte_ckeditor/Configuration/RTE/Default.yaml b/typo3/sysext/rte_ckeditor/Configuration/RTE/Default.yaml index 45e3253e4fac..0faf80b09ec6 100644 --- a/typo3/sysext/rte_ckeditor/Configuration/RTE/Default.yaml +++ b/typo3/sysext/rte_ckeditor/Configuration/RTE/Default.yaml @@ -31,6 +31,7 @@ editor: extraPlugins: - justify - autolink + - editorplaceholder removePlugins: - image diff --git a/typo3/sysext/rte_ckeditor/Configuration/RTE/Full.yaml b/typo3/sysext/rte_ckeditor/Configuration/RTE/Full.yaml index a03d21ff4d5f..e4586c0884f5 100644 --- a/typo3/sysext/rte_ckeditor/Configuration/RTE/Full.yaml +++ b/typo3/sysext/rte_ckeditor/Configuration/RTE/Full.yaml @@ -55,6 +55,7 @@ editor: - selectall - autolink - wordcount + - editorplaceholder removePlugins: - image -- GitLab