Reload content after save (#5737)
authorOlaf Braun <olaf_schmitz_1@t-online.de>
Fri, 22 Dec 2023 13:20:54 +0000 (14:20 +0100)
committerGitHub <noreply@github.com>
Fri, 22 Dec 2023 13:20:54 +0000 (14:20 +0100)
* Reload content after save

* Insert null check

* Reload content in pages after save

* Reload content in box after save

* Fix comment message

* Correct check if input processor exists

wcfsetup/install/files/lib/acp/form/ArticleEditForm.class.php
wcfsetup/install/files/lib/acp/form/BoxEditForm.class.php
wcfsetup/install/files/lib/acp/form/PageEditForm.class.php

index 417e0f07e325f8305add4cf4a9636d7d98ff0a2d..636f9a7644bf6f33f5339a93036f18c9aa9d29e3 100644 (file)
@@ -144,6 +144,16 @@ class ArticleEditForm extends ArticleAddForm
         // call saved event
         $this->saved();
 
+        // Ensure that the CKEditor has the correct content after save.
+        if ($this->isMultilingual) {
+            foreach (LanguageFactory::getInstance()->getLanguages() as $language) {
+                $this->content[$language->languageID] = isset($this->htmlInputProcessors[$language->languageID]) ?
+                    $this->htmlInputProcessors[$language->languageID]->getHtml() : '';
+            }
+        } else {
+            $this->content[0] = isset($this->htmlInputProcessors[0]) ? $this->htmlInputProcessors[0]->getHtml() : '';
+        }
+
         // show success message
         WCF::getTPL()->assign('success', true);
     }
index 020b2670d9254acad3d180829d64c3aa3dc8b927..28f238440fc814a58b3f8420db2a490ac269c27a 100644 (file)
@@ -174,6 +174,16 @@ class BoxEditForm extends BoxAddForm
         // call saved event
         $this->saved();
 
+        // Ensure that the CKEditor has the correct content after save.
+        if ($this->isMultilingual) {
+            foreach (LanguageFactory::getInstance()->getLanguages() as $language) {
+                $this->content[$language->languageID] = isset($this->htmlInputProcessors[$language->languageID]) ?
+                    $this->htmlInputProcessors[$language->languageID]->getHtml() : '';
+            }
+        } else {
+            $this->content[0] = isset($this->htmlInputProcessors[0]) ? $this->htmlInputProcessors[0]->getHtml() : '';
+        }
+
         // show success message
         WCF::getTPL()->assign('success', true);
     }
index 86919420738c2d638779fc913051eb47495702bb..adaaeddb35e7a4e43ca5b994ee4c16036e85788c 100644 (file)
@@ -259,6 +259,16 @@ class PageEditForm extends PageAddForm
         // call saved event
         $this->saved();
 
+        // Ensure that the CKEditor has the correct content after save.
+        if ($this->isMultilingual) {
+            foreach (LanguageFactory::getInstance()->getLanguages() as $language) {
+                $this->content[$language->languageID] = isset($this->htmlInputProcessors[$language->languageID]) ?
+                    $this->htmlInputProcessors[$language->languageID]->getHtml() : '';
+            }
+        } else {
+            $this->content[0] = isset($this->htmlInputProcessors[0]) ? $this->htmlInputProcessors[0]->getHtml() : '';
+        }
+
         // show success message
         WCF::getTPL()->assign('success', true);
     }