Commit 1fbf9afb authored by radiolips's avatar radiolips Committed by GitHub
Browse files

Merge pull request #664 from radiolips/feature/661

Allow cloning sidebar items 661, 396, 499
parents a4a00163 83719340
......@@ -43,7 +43,7 @@ gridstack.js News
=====
Version 1.0 is coming! Check out the blog post here for more information:
[https://dylandreams.com/2017/04/26/gridstack-10-coming-soon/](https://dylandreams.com/2017/04/26/gridstack-10-coming-soon/)
[https://dylandreams.com/2017/04/26/gridstack-10-coming-soon/](https://dylandreams.com/2017/04/26/gridstack-10-coming-soon/) and [https://dylandreams.com](subscribe to the blog) for more gridstack news and tutorials.
Demo and examples
......
This diff is collapsed.
......@@ -844,6 +844,9 @@
})
.on(self.container, 'dropout', function(event, ui) {
var el = $(ui.draggable);
if (!el.data('_gridstack_node')) {
return;
}
el.unbind('drag', onDrag);
var node = el.data('_gridstack_node');
node.el = null;
......@@ -860,10 +863,10 @@
var el = $(ui.draggable).clone(false);
el.data('_gridstack_node', node);
var originalNode = $(ui.draggable).data('_gridstack_node_orig');
if (typeof originalNode !== 'undefined') {
if (typeof originalNode !== 'undefined' && typeof originalNode._grid !== 'undefined') {
originalNode._grid._triggerRemoveEvent();
}
$(ui.draggable).remove();
$(ui.helper).remove();
node.el = el;
self.placeholder.hide();
el
......@@ -885,6 +888,9 @@
self._triggerChangeEvent();
self.grid.endUpdate();
$(ui.draggable).unbind('drag', onDrag);
$(ui.draggable).removeData('_gridstack_node');
$(ui.draggable).removeData('_gridstack_node_orig');
});
}
};
......
This diff is collapsed.
This diff is collapsed.
......@@ -5,6 +5,7 @@ Change log
<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
**Table of Contents** *generated with [DocToc](http://doctoc.herokuapp.com/)*
- [v1.0.0 (development)](#v100-development)
- [v0.3.0 (2017-04-21)](#v030-2017-04-21)
- [v0.2.6 (2016-08-17)](#v026-2016-08-17)
- [v0.2.5 (2016-03-02)](#v025-2016-03-02)
......@@ -17,6 +18,10 @@ Change log
<!-- END doctoc generated TOC please keep comment here to allow auto update -->
## v1.0.0 (development)
- enable sidebar items to be duplicated properly. Pass `helper: 'clone'` in `draggable` options. ([#661](https://github.com/troolee/gridstack.js/issues/661), ([#396](https://github.com/troolee/gridstack.js/issues/396), ([#499](https://github.com/troolee/gridstack.js/issues/499).
## v0.3.0 (2017-04-21)
- remove placeholder when dragging widget below grid (already worked when dragging left, above, and to the right of grid).
......
......@@ -844,6 +844,9 @@
})
.on(self.container, 'dropout', function(event, ui) {
var el = $(ui.draggable);
if (!el.data('_gridstack_node')) {
return;
}
el.unbind('drag', onDrag);
var node = el.data('_gridstack_node');
node.el = null;
......@@ -860,10 +863,10 @@
var el = $(ui.draggable).clone(false);
el.data('_gridstack_node', node);
var originalNode = $(ui.draggable).data('_gridstack_node_orig');
if (typeof originalNode !== 'undefined') {
if (typeof originalNode !== 'undefined' && typeof originalNode._grid !== 'undefined') {
originalNode._grid._triggerRemoveEvent();
}
$(ui.draggable).remove();
$(ui.helper).remove();
node.el = el;
self.placeholder.hide();
el
......@@ -885,6 +888,9 @@
self._triggerChangeEvent();
self.grid.endUpdate();
$(ui.draggable).unbind('drag', onDrag);
$(ui.draggable).removeData('_gridstack_node');
$(ui.draggable).removeData('_gridstack_node_orig');
});
}
};
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment