File tree Expand file tree Collapse file tree 2 files changed +5
-2
lines changed
Expand file tree Collapse file tree 2 files changed +5
-2
lines changed Original file line number Diff line number Diff line change @@ -286,6 +286,7 @@ export class GridStack {
286286 } ,
287287 removableOptions : {
288288 accept : opts . itemClass ? '.' + opts . itemClass : gridDefaults . removableOptions . accept ,
289+ decline : gridDefaults . removableOptions . decline
289290 } ,
290291 } ;
291292 if ( el . getAttribute ( 'gs-animate' ) ) { // default to true, but if set to false use that instead
@@ -2038,7 +2039,7 @@ export class GridStack {
20382039 /** @internal mark item for removal */
20392040 private _itemRemoving ( el : GridItemHTMLElement , remove : boolean ) {
20402041 let node = el ? el . gridstackNode : undefined ;
2041- if ( ! node || ! node . grid ) return ;
2042+ if ( ! node || ! node . grid || el . classList . contains ( this . opts . removableOptions . decline ) ) return ;
20422043 remove ? node . _isAboutToRemove = true : delete node . _isAboutToRemove ;
20432044 remove ? el . classList . add ( 'grid-stack-item-removing' ) : el . classList . remove ( 'grid-stack-item-removing' ) ;
20442045 }
Original file line number Diff line number Diff line change @@ -25,7 +25,7 @@ export const gridDefaults: GridStackOptions = {
2525 oneColumnSize : 768 ,
2626 placeholderClass : 'grid-stack-placeholder' ,
2727 placeholderText : '' ,
28- removableOptions : { accept : '.grid-stack-item' } ,
28+ removableOptions : { accept : '.grid-stack-item' , decline : 'grid-stack-non-removable' } ,
2929 resizable : { handles : 'se' } ,
3030 rtl : 'auto' ,
3131
@@ -39,6 +39,7 @@ export const gridDefaults: GridStackOptions = {
3939 // removable: false,
4040 // staticGrid: false,
4141 // styleInHead: false,
42+ //removable
4243} ;
4344
4445/** default dragIn options */
@@ -334,6 +335,7 @@ export interface DDResizeOpt {
334335export interface DDRemoveOpt {
335336 /** class that can be removed (default?: '.' + opts.itemClass) */
336337 accept ?: string ;
338+ decline ?: string ;
337339}
338340
339341/** Drag&Drop dragging options */
You can’t perform that action at this time.
0 commit comments