[BUGFIX] rte_ckeditor triggers has-change on change 68/52968/4
authorRalf Hettinger <ralf.hettinger@brain-appeal.com>
Mon, 29 May 2017 20:38:43 +0000 (22:38 +0200)
committerBenni Mack <benni@typo3.org>
Sat, 17 Jun 2017 20:25:39 +0000 (22:25 +0200)
CKEditor fields now triggers FormEngine.Validation.markFieldAsChanged
therefore a warning of unsaved changes on closing the form is raised
based on changes within these CKEditor fields.

Resolves: #68955
Releases: master, 8.7
Change-Id: I0da98c2204b20b0f6cd27a53b66f2df3d369a145
Reviewed-on: https://review.typo3.org/52968
Tested-by: TYPO3com <no-reply@typo3.com>
Reviewed-by: Frank Naegler <frank.naegler@typo3.org>
Tested-by: Mona Muzaffar <mona.muzaffar@gmx.de>
Reviewed-by: Benni Mack <benni@typo3.org>
Tested-by: Benni Mack <benni@typo3.org>
typo3/sysext/rte_ckeditor/Classes/Form/Element/RichTextElement.php

index b45dcf2..0d7a720 100644 (file)
@@ -180,10 +180,11 @@ class RichTextElement extends AbstractFormElement
         return 'function(CKEDITOR) {
                 ' . $externalPlugins . '
                 CKEDITOR.replace("' . $fieldId . '", ' . json_encode($configuration) . ');
         return 'function(CKEDITOR) {
                 ' . $externalPlugins . '
                 CKEDITOR.replace("' . $fieldId . '", ' . json_encode($configuration) . ');
-                require([\'TYPO3/CMS/Backend/FormEngine\'], function(FormEngine) {
+                require([\'jquery\', \'TYPO3/CMS/Backend/FormEngine\'], function($, FormEngine) {
                     CKEDITOR.instances.' . $fieldId . '.on(\'change\', function() {
                         CKEDITOR.instances.' . $fieldId . '.updateElement();
                         FormEngine.Validation.validate();
                     CKEDITOR.instances.' . $fieldId . '.on(\'change\', function() {
                         CKEDITOR.instances.' . $fieldId . '.updateElement();
                         FormEngine.Validation.validate();
+                        FormEngine.Validation.markFieldAsChanged($(\'#' . $fieldId . '\'));
                     });
                 });
         }';
                     });
                 });
         }';