[BUGFIX] Re-Init CKEditor after re-sorting of inline records 92/57392/2
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 12:47:28 +0000 (14:47 +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/57392
Tested-by: TYPO3com <no-reply@typo3.com>
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 1911975..ead261b 100644 (file)
@@ -566,6 +566,7 @@ var inline = {
         $(objectIdPrefix + records[current + 1 - cAdj] + '_div')
       );
       this.redrawSortingButtons(objectPrefix, records);
+      $(document).trigger('inline:sorting-changed');
     }
 
     return false;
index 9c99923..d1bf2b5 100644 (file)
@@ -194,6 +194,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) . ');
+                        });
                     });
                 });
         }';