Skip to content

Commit 0cc9e5e

Browse files
authored
Merge pull request #2065 from adumesny/master
v6.0.3 branch fixes
2 parents e64b0c4 + 8cc95c1 commit 0cc9e5e

18 files changed

+45
-32
lines changed

demo/serialization.html

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,14 +30,15 @@ <h1>Serialization demo</h1>
3030
});
3131

3232
grid.on('added removed change', function(e, items) {
33+
if (!items) return;
3334
let str = '';
3435
items.forEach(function(item) { str += ' (x,y)=' + item.x + ',' + item.y; });
3536
console.log(e.type + ' ' + items.length + ' items:' + str );
3637
});
3738

3839
let serializedData = [
3940
{x: 0, y: 0, w: 2, h: 2, id: '0'},
40-
{x: 3, y: 1, h: 2, id: '1', content: "<button onclick=\"alert('clicked!')\">Press me</button>"},
41+
{x: 3, y: 1, h: 2, id: '1', content: "<button onclick=\"alert('clicked!')\">Press me</button><div>text area</div><div><textarea></textarea></div><div>Input Field</div><input type='text'>"},
4142
{x: 4, y: 1, id: '2'},
4243
{x: 2, y: 3, w: 3, id: '3'},
4344
{x: 1, y: 3, id: '4'}

doc/CHANGES.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ Change log
66
**Table of Contents** *generated with [DocToc](http://doctoc.herokuapp.com/)*
77

88
- [7-dev (TBD)](#7-dev-tbd)
9+
- [6.0.3-dev (2022-10-08)](#603-2022-10-08)
910
- [6.0.2 (2022-09-23)](#602-2022-09-23)
1011
- [6.0.1 (2022-08-27)](#601-2022-08-27)
1112
- [6.0.0 (2022-08-21)](#600-2022-08-21)
@@ -79,6 +80,10 @@ Thank you [StephanP] for sponsoring it.<br>
7980
See [advance Nested](https://github.com/gridstack/gridstack.js/blob/master/demo/nested_advanced.html)
8081
* add - ability to pause drag&drop collision until the user stops moving - see `DDDragOpt.pause` (used for creating nested grids on the fly based on gesture).
8182

83+
## 6.0.3-dev (2022-10-08)
84+
* fixed [#2055](https://github.com/gridstack/gridstack.js/issues/2055) maxRow=1 resize outside (broke in 6.0.1)
85+
* fixed [#2054](https://github.com/gridstack/gridstack.js/issues/2054) Can't enter text in textarea/input (broke in v6)
86+
8287
## 6.0.2 (2022-09-23)
8388
* fixed [#2034](https://github.com/gridstack/gridstack.js/issues/2034) `removeWidget()` breaking resize handle feedback
8489
* fixed [#2043](https://github.com/gridstack/gridstack.js/issues/2043) when swapping shapes in maxRow grid, make sure we still check for 50% coverage

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "gridstack",
3-
"version": "6.0.2-dev",
3+
"version": "6.0.3-dev",
44
"description": "TypeScript/JS lib for dashboard layout and creation, no external dependencies, with many wrappers (React, Angular, Vue, Ember, knockout...)",
55
"main": "./dist/gridstack.js",
66
"types": "./dist/gridstack.d.ts",

src/dd-base-impl.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**
2-
* dd-base-impl.ts 6.0.2-dev
2+
* dd-base-impl.ts 6.0.3-dev
33
* Copyright (c) 2021-2022 Alain Dumesny - see GridStack root license
44
*/
55

src/dd-draggable.ts

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**
2-
* dd-draggable.ts 6.0.2-dev
2+
* dd-draggable.ts 6.0.3-dev
33
* Copyright (c) 2021-2022 Alain Dumesny - see GridStack root license
44
*/
55

@@ -129,12 +129,19 @@ export class DDDraggable extends DDBaseImplement implements HTMLElementExtendOpt
129129
if (DDManager.mouseHandled) return;
130130
if (e.button !== 0) return true; // only left click
131131

132+
// make sure we are not clicking on known object that handles mouseDown (TODO: make this extensible ?) #2054
133+
const skipMouseDown = ['input', 'textarea', 'button', 'select', 'option'];
134+
const name = (e.target as HTMLElement).nodeName.toLowerCase();
135+
if (skipMouseDown.find(skip => skip === name)) return true;
136+
132137
// make sure we are clicking on a drag handle or child of it...
133138
// Note: we don't need to check that's handle is an immediate child, as mouseHandled will prevent parents from also handling it (lowest wins)
134-
let className = this.option.handle.substring(1);
135-
let el = e.target as HTMLElement;
136-
while (el && !el.classList.contains(className)) { el = el.parentElement; }
137-
if (!el) return;
139+
//
140+
// REMOVE: why would we get the event if it wasn't for us or child ?
141+
// let className = this.option.handle.substring(1);
142+
// let el = e.target as HTMLElement;
143+
// while (el && !el.classList.contains(className)) { el = el.parentElement; }
144+
// if (!el) return;
138145
this.mouseDownEvent = e;
139146
delete this.dragging;
140147
delete DDManager.dragElement;
@@ -201,7 +208,7 @@ export class DDDraggable extends DDBaseImplement implements HTMLElementExtendOpt
201208
}
202209
this.triggerEvent('dragstart', ev);
203210
}
204-
e.preventDefault();
211+
e.preventDefault(); // needed otherwise we get text sweep text selection as we drag around
205212
return true;
206213
}
207214

src/dd-droppable.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**
2-
* dd-droppable.ts 6.0.2-dev
2+
* dd-droppable.ts 6.0.3-dev
33
* Copyright (c) 2021-2022 Alain Dumesny - see GridStack root license
44
*/
55

src/dd-element.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**
2-
* dd-elements.ts 6.0.2-dev
2+
* dd-elements.ts 6.0.3-dev
33
* Copyright (c) 2021 Alain Dumesny - see GridStack root license
44
*/
55

src/dd-gridstack.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/**
2-
* dd-gridstack.ts 6.0.2-dev
3-
* Copyright (c) 2021-2022 Alain Dumesny - see GridStack root license
2+
* dd-gridstack.ts 6.0.3-dev
3+
* Copyright (c) 2021 Alain Dumesny - see GridStack root license
44
*/
55

66
/* eslint-disable @typescript-eslint/no-unused-vars */

src/dd-manager.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/**
2-
* dd-manager.ts 6.0.2-dev
3-
* Copyright (c) 2021-2022 Alain Dumesny - see GridStack root license
2+
* dd-manager.ts 6.0.3-dev
3+
* Copyright (c) 2021 Alain Dumesny - see GridStack root license
44
*/
55

66
import { DDDraggable } from './dd-draggable';

src/dd-resizable-handle.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**
2-
* dd-resizable-handle.ts 6.0.2-dev
2+
* dd-resizable-handle.ts 6.0.3-dev
33
* Copyright (c) 2021-2022 Alain Dumesny - see GridStack root license
44
*/
55

0 commit comments

Comments
 (0)