From 3291845ac474cc8aa60a47c1b0ce1c4a15b068e7 Mon Sep 17 00:00:00 2001
From: Gaus Surahman <gausarts@gmail.com>
Date: Wed, 27 Sep 2023 15:32:49 +0700
Subject: [PATCH] Issue #3390007 by gausarts, DenisVS: Captions are squashed
 into one in mobile view

---
 css/gridstack.css                        |  2 ++
 css/gridstack.library.css                |  6 ++++++
 src/Engine/GridStackEnginePluginBase.php | 15 ++++++++-------
 src/GridStackManager.php                 |  1 +
 templates/gridstack.theme.inc            |  2 +-
 5 files changed, 18 insertions(+), 8 deletions(-)

diff --git a/css/gridstack.css b/css/gridstack.css
index 2cc26b7..6fe4026 100644
--- a/css/gridstack.css
+++ b/css/gridstack.css
@@ -69,6 +69,7 @@
 .gridstack--js .box,
 /* Prevents overlapping bg when edge to edge (EtE) is not enabled. */
 .gridstack .box__content {
+  position: relative;
   overflow: hidden;
 }
 
@@ -118,6 +119,7 @@
 .gridstack .b-gs,
 .gridstack .box__animated,
 .gridstack--js .b-noratio,
+.gridstack--js .box__content,
 .gridstack--js .box__content > a,
 .gridstack--js .box > .litebox {
   display: block;
diff --git a/css/gridstack.library.css b/css/gridstack.library.css
index ac0d75b..3c0a288 100644
--- a/css/gridstack.library.css
+++ b/css/gridstack.library.css
@@ -220,6 +220,12 @@
   float: left;
 }
 
+/* stylelint-disable declaration-no-important */
+.gridstack--js.is-gs-disabled .gridstack__box {
+  position: relative;
+  top: auto !important;
+}
+
 .is-gs-destroyed > .box > .box__content,
 .gridstack--gs.is-gs-disabled .box__content {
   position: relative;
diff --git a/src/Engine/GridStackEnginePluginBase.php b/src/Engine/GridStackEnginePluginBase.php
index 4dc9a4d..995703a 100644
--- a/src/Engine/GridStackEnginePluginBase.php
+++ b/src/Engine/GridStackEnginePluginBase.php
@@ -315,7 +315,8 @@ abstract class GridStackEnginePluginBase extends GridStackPluginBase implements
 
       $rid     = Defaults::regionId($delta);
       $region  = $regions[$rid] ?? [];
-      $subsets = $this->manager->toHashtag($item) + $settings;
+      $subsets = $this->manager->toHashtag($item);
+      $subsets = $this->manager->mergeSettings(['blazies', 'gridstacks'], $settings, $subsets);
       $config  = $this->manager->reset($subsets, TRUE);
 
       $config->set('region', $region)
@@ -347,12 +348,12 @@ abstract class GridStackEnginePluginBase extends GridStackPluginBase implements
     $gridstack = $settings['gridstacks'];
 
     foreach (array_keys($grids) as $gid) {
-      $rid      = Defaults::regionId($delta . '_' . $gid);
-      $region   = $regions[$rid] ?? [];
-      $nested   = $item[$gid] ?? [];
-      $subsets  = $this->manager->toHashtag($nested);
-      $subsets += $settings;
-      $config   = $this->manager->reset($subsets, TRUE);
+      $rid     = Defaults::regionId($delta . '_' . $gid);
+      $region  = $regions[$rid] ?? [];
+      $nested  = $item[$gid] ?? [];
+      $subsets = $this->manager->toHashtag($nested);
+      $subsets = $this->manager->mergeSettings(['blazies', 'gridstacks'], $settings, $subsets);
+      $config  = $this->manager->reset($subsets, TRUE);
 
       $config->set('region', $region)
         ->set('rid', $rid)
diff --git a/src/GridStackManager.php b/src/GridStackManager.php
index 87bcf1f..0111466 100644
--- a/src/GridStackManager.php
+++ b/src/GridStackManager.php
@@ -261,6 +261,7 @@ class GridStackManager extends BlazyManagerBase implements GridStackManagerInter
       // @fixme v5.1.1 ->set('use.gridstatic', $gridstacks->ui('gridstatic'))
       ->set('use.gridstatic', FALSE)
       ->set('use.js', $use_js)
+      ->set('use.inner', $use_js)
       ->set('use.nested', $use_framework)
       ->set('was.settings', TRUE);
 
diff --git a/templates/gridstack.theme.inc b/templates/gridstack.theme.inc
index 6cd7b71..f279ef7 100644
--- a/templates/gridstack.theme.inc
+++ b/templates/gridstack.theme.inc
@@ -80,7 +80,7 @@ function template_preprocess_gridstack_box(&$variables) {
   // Provides inner DIV if so required (.row.gridstack--nested > DIV).
   // When using CSS frameworks to have row + inner divities display correctly.
   // Not needed by JS engines, just CSS engines.
-  $check = $use_inner && $use_fw && $has_content;
+  $check = $use_fw ? $use_inner && $has_content : $use_inner;
   $config->set('use.inner', $check);
 
   // Provides optional classes if so configured.
-- 
GitLab