From: Tim Düsterhus Date: Mon, 15 Jun 2020 08:32:35 +0000 (+0200) Subject: Preserve the scroll position in styleAdd when saving X-Git-Tag: 5.3.0_Alpha_1~212^2 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=e3cec212520a0686e4cb63979a2d40674e4d53fc;p=GitHub%2FWoltLab%2FWCF.git Preserve the scroll position in styleAdd when saving Closes #3266 --- diff --git a/wcfsetup/install/files/acp/templates/styleAdd.tpl b/wcfsetup/install/files/acp/templates/styleAdd.tpl index 93b8f8b8ee..a80ad128d5 100644 --- a/wcfsetup/install/files/acp/templates/styleAdd.tpl +++ b/wcfsetup/install/files/acp/templates/styleAdd.tpl @@ -1018,6 +1018,7 @@
+
{lang}wcf.acp.style.advanced.individualScss.description{/lang}
@@ -1032,6 +1033,7 @@
+
{if $errorField == 'overrideScssCustom'} @@ -1060,6 +1062,7 @@
+
{lang}wcf.acp.style.advanced.individualScss.description{/lang}
@@ -1074,6 +1077,7 @@
+
{if $errorField == 'overrideScss'} diff --git a/wcfsetup/install/files/lib/acp/form/StyleAddForm.class.php b/wcfsetup/install/files/lib/acp/form/StyleAddForm.class.php index 15ffa0d049..b26656fb43 100644 --- a/wcfsetup/install/files/lib/acp/form/StyleAddForm.class.php +++ b/wcfsetup/install/files/lib/acp/form/StyleAddForm.class.php @@ -12,6 +12,7 @@ use wcf\system\exception\UserInputException; use wcf\system\language\I18nHandler; use wcf\system\Regex; use wcf\system\WCF; +use wcf\util\ArrayUtil; use wcf\util\DateUtil; use wcf\util\FileUtil; use wcf\util\StringUtil; @@ -199,6 +200,12 @@ class StyleAddForm extends AbstractForm { */ public $specialVariables = []; + /** + * current scroll offsets before submitting the form + * @var integer[] + */ + public $scrollOffsets = []; + /** * @inheritDoc */ @@ -281,6 +288,9 @@ class StyleAddForm extends AbstractForm { if (isset($_POST['styleVersion'])) $this->styleVersion = StringUtil::trim($_POST['styleVersion']); if (isset($_POST['templateGroupID'])) $this->templateGroupID = intval($_POST['templateGroupID']); if (isset($_POST['apiVersion']) && in_array($_POST['apiVersion'], Style::$supportedApiVersions)) $this->apiVersion = $_POST['apiVersion']; + + // codemirror scroll offset + if (isset($_POST['scrollOffsets']) && is_array($_POST['scrollOffsets'])) $this->scrollOffsets = ArrayUtil::toIntegerArray($_POST['scrollOffsets']); } /** @@ -652,7 +662,8 @@ class StyleAddForm extends AbstractForm { 'tmpHash' => $this->tmpHash, 'variables' => $this->variables, 'supportedApiVersions' => Style::$supportedApiVersions, - 'newVariables' => $this->newVariables + 'newVariables' => $this->newVariables, + 'scrollOffsets' => $this->scrollOffsets, ]); }