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 {
286
286
} ,
287
287
removableOptions : {
288
288
accept : opts . itemClass ? '.' + opts . itemClass : gridDefaults . removableOptions . accept ,
289
+ decline : gridDefaults . removableOptions . decline
289
290
} ,
290
291
} ;
291
292
if ( el . getAttribute ( 'gs-animate' ) ) { // default to true, but if set to false use that instead
@@ -2038,7 +2039,7 @@ export class GridStack {
2038
2039
/** @internal mark item for removal */
2039
2040
private _itemRemoving ( el : GridItemHTMLElement , remove : boolean ) {
2040
2041
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 ;
2042
2043
remove ? node . _isAboutToRemove = true : delete node . _isAboutToRemove ;
2043
2044
remove ? el . classList . add ( 'grid-stack-item-removing' ) : el . classList . remove ( 'grid-stack-item-removing' ) ;
2044
2045
}
Original file line number Diff line number Diff line change @@ -25,7 +25,7 @@ export const gridDefaults: GridStackOptions = {
25
25
oneColumnSize : 768 ,
26
26
placeholderClass : 'grid-stack-placeholder' ,
27
27
placeholderText : '' ,
28
- removableOptions : { accept : '.grid-stack-item' } ,
28
+ removableOptions : { accept : '.grid-stack-item' , decline : 'grid-stack-non-removable' } ,
29
29
resizable : { handles : 'se' } ,
30
30
rtl : 'auto' ,
31
31
@@ -39,6 +39,7 @@ export const gridDefaults: GridStackOptions = {
39
39
// removable: false,
40
40
// staticGrid: false,
41
41
// styleInHead: false,
42
+ //removable
42
43
} ;
43
44
44
45
/** default dragIn options */
@@ -334,6 +335,7 @@ export interface DDResizeOpt {
334
335
export interface DDRemoveOpt {
335
336
/** class that can be removed (default?: '.' + opts.itemClass) */
336
337
accept ?: string ;
338
+ decline ?: string ;
337
339
}
338
340
339
341
/** Drag&Drop dragging options */
You can’t perform that action at this time.
0 commit comments