From 5321400b73f23b746581bb0b5e57f89fcfefa684 Mon Sep 17 00:00:00 2001 From: Alain Dumesny Date: Sun, 16 Mar 2025 16:39:55 -0700 Subject: [PATCH] Locked not working as expected * fix #2981 --- doc/CHANGES.md | 1 + src/gridstack.ts | 8 +++++--- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/doc/CHANGES.md b/doc/CHANGES.md index 147fa68b1..26e3e8c31 100644 --- a/doc/CHANGES.md +++ b/doc/CHANGES.md @@ -128,6 +128,7 @@ Change log * fix: [#2980](https://github.com/gridstack/gridstack.js/issues/2980) dd-touch circular dependency * fix: [#2667](https://github.com/gridstack/gridstack.js/issues/2667) sidebar items not honoring gs-w (enter-leave-re-enter) * fix: [#2987](https://github.com/gridstack/gridstack.js/issues/2987) gs-size-to-content to support numbers +* fix: [#2981](https://github.com/gridstack/gridstack.js/issues/2981) Locked not working as expected ## 11.4.0 (2025-02-27) * fix: [#2921](https://github.com/gridstack/gridstack.js/pull/2921) replace initMouseEvent with MouseEvent constructor and added composed: true diff --git a/src/gridstack.ts b/src/gridstack.ts index 114fbae07..778ac174a 100644 --- a/src/gridstack.ts +++ b/src/gridstack.ts @@ -2459,14 +2459,16 @@ export class GridStack { const noResize = node.noResize || this.opts.disableResize; // check for disabled grid first - const disable = this.opts.staticGrid || (noMove && noResize); + const disable = node.locked || this.opts.staticGrid || (noMove && noResize); if (force || disable) { if (node._initDD) { this._removeDD(el); // nukes everything instead of just disable, will add some styles back next delete node._initDD; } - if (disable) el.classList.add('ui-draggable-disabled', 'ui-resizable-disabled'); // add styles one might depend on #1435 - if (!force) return this; + if (disable) { + el.classList.add('ui-draggable-disabled', 'ui-resizable-disabled'); // add styles one might depend on #1435 + return this; + } } if (!node._initDD) {