[BUGFIX] Re-Init CKEditor after re-sorting of inline records 82/57382/4
authorFrank Naegler <frank.naegler@typo3.org>
Tue, 26 Jun 2018 20:01:22 +0000 (22:01 +0200)
committerChristian Kuhn <lolli@schwarzbu.ch>
Wed, 27 Jun 2018 08:58:05 +0000 (10:58 +0200)
This patch triggers an event and uses this event to re-init the
CKEditor after re-sorting inline records.

Resolves: #79468
Releases: master, 8.7
Change-Id: Ib7d0ad6c1b0cb6b292b3dfa8488a6528ff74ceee
Reviewed-on: https://review.typo3.org/57382
Tested-by: TYPO3com <no-reply@typo3.com>
Reviewed-by: Benni Mack <benni@typo3.org>
Tested-by: Benni Mack <benni@typo3.org>
Reviewed-by: Wouter Wolters <typo3@wouterwolters.nl>
Reviewed-by: Christian Kuhn <lolli@schwarzbu.ch>
Tested-by: Christian Kuhn <lolli@schwarzbu.ch>
typo3/sysext/backend/Resources/Public/JavaScript/FormEngineFlexForm.js
typo3/sysext/backend/Resources/Public/JavaScript/jsfunc.inline.js
typo3/sysext/rte_ckeditor/Classes/Form/Element/RichTextElement.php

index 30fceb6..5cd9abf 100644 (file)
@@ -155,6 +155,7 @@ define(['jquery',
         tolerance: 'pointer',
         stop: function() {
           me.setActionStatus();
+          $(document).trigger('flexform:sorting-changed');
         }
       });
     });
index a183346..394a923 100644 (file)
@@ -575,6 +575,7 @@ var inline = {
       );
       this.redrawSortingButtons(objectPrefix, records);
       $(formObj).addClass('has-change');
+      $(document).trigger('inline:sorting-changed');
       $(document).trigger('change');
     }
 
index 0695b77..c60afd4 100644 (file)
@@ -190,6 +190,14 @@ class RichTextElement extends AbstractFormElement
                             FormEngine.Validation.validate();
                             FormEngine.Validation.markFieldAsChanged($(\'#' . $fieldId . '\'));
                         });
+                        $(document).on(\'inline:sorting-changed\', function() {
+                            CKEDITOR.instances["' . $fieldId . '"].destroy();
+                            CKEDITOR.replace("' . $fieldId . '", ' . json_encode($configuration) . ');
+                        });
+                        $(document).on(\'flexform:sorting-changed\', function() {
+                            CKEDITOR.instances["' . $fieldId . '"].destroy();
+                            CKEDITOR.replace("' . $fieldId . '", ' . json_encode($configuration) . ');
+                        });
                     });
                 });
         }';