From b014111d93cd18ff05c345a87e6481f45ec673c9 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Tim=20D=C3=BCsterhus?= Date: Mon, 15 Jun 2020 10:23:31 +0200 Subject: [PATCH] Preserve the scroll position in styleGlobalValues when saving Closes #3267 --- .../files/acp/templates/styleGlobalValues.tpl | 1 + .../lib/acp/form/StyleGlobalValuesForm.class.php | 12 +++++++++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/wcfsetup/install/files/acp/templates/styleGlobalValues.tpl b/wcfsetup/install/files/acp/templates/styleGlobalValues.tpl index 0408d87e34..51e53478cb 100644 --- a/wcfsetup/install/files/acp/templates/styleGlobalValues.tpl +++ b/wcfsetup/install/files/acp/templates/styleGlobalValues.tpl @@ -28,6 +28,7 @@
+
diff --git a/wcfsetup/install/files/lib/acp/form/StyleGlobalValuesForm.class.php b/wcfsetup/install/files/lib/acp/form/StyleGlobalValuesForm.class.php index 491d76b578..a86b2b551e 100644 --- a/wcfsetup/install/files/lib/acp/form/StyleGlobalValuesForm.class.php +++ b/wcfsetup/install/files/lib/acp/form/StyleGlobalValuesForm.class.php @@ -26,6 +26,12 @@ class StyleGlobalValuesForm extends AbstractForm { * @var string */ public $styles = ''; + + /** + * current scroll offset before submitting the form + * @var integer + */ + public $stylesScrollOffset = 0; /** * @inheritDoc @@ -36,6 +42,9 @@ class StyleGlobalValuesForm extends AbstractForm { if (isset($_POST['styles'])) { $this->styles = StringUtil::unifyNewlines(StringUtil::trim($_POST['styles'])); } + if (isset($_POST['stylesScrollOffset'])) { + $this->stylesScrollOffset = intval($_POST['stylesScrollOffset']); + } } /** @@ -84,7 +93,8 @@ class StyleGlobalValuesForm extends AbstractForm { parent::assignVariables(); WCF::getTPL()->assign([ - 'styles' => $this->styles + 'styles' => $this->styles, + 'stylesScrollOffset' => $this->stylesScrollOffset, ]); } } -- 2.20.1