File tree Expand file tree Collapse file tree 4 files changed +48
-5
lines changed
Expand file tree Collapse file tree 4 files changed +48
-5
lines changed Original file line number Diff line number Diff line change @@ -26,6 +26,7 @@ <h1>Demos</h1>
2626 < li > < a href ="right-to-left(rtl).html "> Right-To-Left (RTL)</ a > </ li >
2727 < li > < a href ="serialization.html "> Serialization</ a > </ li >
2828 < li > < a href ="static.html "> Static</ a > </ li >
29+ < li > < a href ="title_drag.html "> Title drag</ a > </ li >
2930 < li > < a href ="two.html "> Two grids</ a > </ li >
3031 < li > < a href ="two_vertical.html "> Two grids Vertical</ a > </ li >
3132 < li > < a href ="vue2js.html "> Vue2.js</ a > </ li >
Original file line number Diff line number Diff line change 1+ <!DOCTYPE html>
2+ < html lang ="en ">
3+ < head >
4+ < meta charset ="utf-8 ">
5+ < meta http-equiv ="X-UA-Compatible " content ="IE=edge ">
6+ < meta name ="viewport " content ="width=device-width, initial-scale=1 ">
7+ < title > Title area drag</ title >
8+
9+ < link rel ="stylesheet " href ="demo.css "/>
10+ < script src ="../dist/gridstack-all.js "> </ script >
11+ < style type ="text/css ">
12+ .card-header {
13+ cursor : move;
14+ min-height : 25px ;
15+ }
16+ .card-header : hover {
17+ background-color : rgba (0 , 0 , 0 , 0.1 );
18+ }
19+ .card {
20+ text-align : left;
21+ }
22+ </ style >
23+
24+ </ head >
25+ < body >
26+ < div class ="container-fluid ">
27+ < h1 > Title area drag</ h1 >
28+ < br > < br >
29+ < div class ="grid-stack ">
30+ < div class ="grid-stack-item " gs-w ="3 " gs-h ="3 "> < div class ="grid-stack-item-content ">
31+ < div class ="card-header "> - Drag here -</ div >
32+ < div class ="card "> the rest of the panel content doesn't drag</ div >
33+ </ div > </ div >
34+ </ div >
35+ </ div >
36+ < script src ="events.js "> </ script >
37+ < script type ="text/javascript ">
38+ let grid = GridStack . init ( { handle : '.card-header' } ) ; // drag by the header only
39+ addEvents ( grid ) ;
40+ </ script >
41+ </ body >
42+ </ html >
Original file line number Diff line number Diff line change @@ -84,7 +84,6 @@ Change log
8484
8585## 7.2.3-dev (TBD)
8686* fix [ #2206 ] ( https://github.com/gridstack/gridstack.js/issues/2206 ) ` load() ` with collision fix
87- * fix [ #2210 ] ( https://github.com/gridstack/gridstack.js/pull/2210 ) restored checking for grid option.handle draggable area
8887
8988## 7.2.3 (2023-02-02)
9089* fix ` addWidget() ` to handle passing just {el} which was needed for Angular HMTL template demo
Original file line number Diff line number Diff line change @@ -136,12 +136,13 @@ export class DDDraggable extends DDBaseImplement implements HTMLElementExtendOpt
136136 // also check for content editable
137137 if ( ( e . target as HTMLElement ) . closest ( '[contenteditable="true"]' ) ) return true ;
138138
139+ // REMOVE: why would we get the event if it wasn't for us or child ?
139140 // make sure we are clicking on a drag handle or child of it...
140141 // 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)
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 ;
142+ // let className = this.option.handle.substring(1);
143+ // let el = e.target as HTMLElement;
144+ // while (el && !el.classList.contains(className)) { el = el.parentElement; }
145+ // if (!el) return;
145146
146147 this . mouseDownEvent = e ;
147148 delete this . dragging ;
You can’t perform that action at this time.
0 commit comments