Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Allow cloning sidebar items 661, 396, 499 #664

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 15, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions dist/gridstack.all.js

Large diffs are not rendered by default.

10 changes: 8 additions & 2 deletions dist/gridstack.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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
Expand All @@ -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');
});
}
};
Expand Down
4 changes: 2 additions & 2 deletions dist/gridstack.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/gridstack.min.map

Large diffs are not rendered by default.

5 changes: 5 additions & 0 deletions doc/CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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).
Expand Down
10 changes: 8 additions & 2 deletions src/gridstack.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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
Expand All @@ -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');
});
}
};
Expand Down