[BUGFIX] Wait with replacing CKEditor until DOM is ready 55/53455/2
authorFrans Saris <franssaris@gmail.com>
Wed, 12 Jul 2017 13:17:01 +0000 (15:17 +0200)
committerGeorg Ringer <georg.ringer@gmail.com>
Wed, 12 Jul 2017 13:42:51 +0000 (15:42 +0200)
Resolves: #81243
Releases: master, 8.7
Change-Id: I31ce2b3b97b47c557b93341b17839174e5097e38
Reviewed-on: https://review.typo3.org/53455
Reviewed-by: Georg Ringer <georg.ringer@gmail.com>
Tested-by: Georg Ringer <georg.ringer@gmail.com>
typo3/sysext/rte_ckeditor/Classes/Form/Element/RichTextElement.php

index 17c1078..da7cbe7 100644 (file)
@@ -183,12 +183,14 @@ class RichTextElement extends AbstractFormElement
 
         return 'function(CKEDITOR) {
                 ' . $externalPlugins . '
-                CKEDITOR.replace("' . $fieldId . '", ' . json_encode($configuration) . ');
-                require([\'jquery\', \'TYPO3/CMS/Backend/FormEngine\'], function($, FormEngine) {
-                    CKEDITOR.instances.' . $fieldId . '.on(\'change\', function() {
-                        CKEDITOR.instances.' . $fieldId . '.updateElement();
-                        FormEngine.Validation.validate();
-                        FormEngine.Validation.markFieldAsChanged($(\'#' . $fieldId . '\'));
+                $(function(){
+                    CKEDITOR.replace("' . $fieldId . '", ' . json_encode($configuration) . ');
+                    require([\'jquery\', \'TYPO3/CMS/Backend/FormEngine\'], function($, FormEngine) {
+                        CKEDITOR.instances.' . $fieldId . '.on(\'change\', function() {
+                            CKEDITOR.instances.' . $fieldId . '.updateElement();
+                            FormEngine.Validation.validate();
+                            FormEngine.Validation.markFieldAsChanged($(\'#' . $fieldId . '\'));
+                        });
                     });
                 });
         }';