🐛 (#252) Ignore local storage collapse state, if set by user

This commit is contained in:
Alicia Sykes 2021-10-09 12:45:49 +01:00
parent 009a8354a5
commit 2d778bee98
1 changed files with 3 additions and 1 deletions

View File

@ -45,7 +45,7 @@ export default {
methods: {
/* Check that row & column span is valid, and not over the max */
checkSpanNum(span, classPrefix) {
const maxSpan = 4;
const maxSpan = 8;
let numSpan = /^\d*$/.test(span) ? parseInt(span, 10) : 1;
numSpan = (numSpan > maxSpan) ? maxSpan : numSpan;
return `${classPrefix}-${numSpan}`;
@ -68,7 +68,9 @@ export default {
}
return JSON.parse(localStorage[localStorageKeys.COLLAPSE_STATE]);
},
/* If not specified by user, get last state from local storage */
getCollapseState() {
if (this.collapsed !== undefined) return !this.collapsed;
const collapseStateObject = this.initialiseStorage();
let collapseState = !this.collapsed;
if (collapseStateObject[this.uniqueKey] !== undefined) {