Skip to content

Commit d811c66

Browse files
author
Alain Dumesny
authored
Merge pull request gridstack#2521 from adumesny/master
fix column(1) to not restore if disableOneColumnMode
2 parents 512ee08 + edf91cc commit d811c66

File tree

3 files changed

+6
-5
lines changed

3 files changed

+6
-5
lines changed

doc/CHANGES.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,9 +104,10 @@ Change log
104104
<!-- END doctoc generated TOC please keep comment here to allow auto update -->
105105

106106
## 9.4.0-dev (TBD)
107-
* fix [#1275](https://github.com/gridstack/gridstack.js/issues/1275) div scale support - Thank you [elmehdiamlou](https://github.com/elmehdiamlou) for implementing this teh right way (add scale to current code)
107+
* feat [#1275](https://github.com/gridstack/gridstack.js/issues/1275) div scale support - Thank you [elmehdiamlou](https://github.com/elmehdiamlou) for implementing this teh right way (add scale to current code)
108108
* fix [#2489](https://github.com/gridstack/gridstack.js/commit/2489) moved the dropped event handler to after doing everything (no more setTimeout) - Thanks [arnoudb](https://github.com/arnoudb) for suggesting a fix.
109109
* fix [#2497](https://github.com/gridstack/gridstack.js/issues/2497) Utils.parseHeight() fix
110+
* fix column(1) to not restore if disableOneColumnMode on size change
110111

111112
## 9.4.0 (2023-10-15)
112113
* revert [#2263](https://github.com/gridstack/gridstack.js/issues/2263) div scale support - causing too many issues for now (#2498 #2491)

src/gridstack.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -863,9 +863,9 @@ export class GridStack {
863863
if (!column || column < 1 || this.opts.column === column) return this;
864864
let oldColumn = this.getColumn();
865865

866-
// if we go into 1 column mode (which happens if we're sized less than minW unless disableOneColumnMode is on)
866+
// if we go into 1 column mode due to size change (disableOneColumnMode is off and we hit min width)
867867
// then remember the original columns so we can restore.
868-
if (column === 1) {
868+
if (column === 1 && !this.opts.disableOneColumnMode) {
869869
this._prevColumn = oldColumn;
870870
} else {
871871
delete this._prevColumn;

src/utils.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -215,8 +215,8 @@ export class Utils {
215215
static parseHeight(val: numberOrString): HeightData {
216216
let h: number;
217217
let unit = 'px';
218-
if (val && typeof val === 'string') {
219-
if (val === 'auto') h = 0;
218+
if (typeof val === 'string') {
219+
if (val === 'auto' || val === '') h = 0;
220220
else {
221221
let match = val.match(/^(-[0-9]+\.[0-9]+|[0-9]*\.[0-9]+|-[0-9]+|[0-9]+)(px|em|rem|vh|vw|%)?$/);
222222
if (!match) {

0 commit comments

Comments
 (0)