Browse Source

#120: pull 'clone'

pull/126/merge
RubaXa 10 years ago
parent
commit
3f1cd3f155
  1. 8
      Sortable.js
  2. 2
      Sortable.min.js

8
Sortable.js

@ -247,10 +247,12 @@
_dispatchEvent(dragEl, 'start'); _dispatchEvent(dragEl, 'start');
if (activeGroup.pull == 'clone') {
cloneEl = dragEl.cloneNode(true); cloneEl = dragEl.cloneNode(true);
_css(cloneEl, 'display', 'none'); _css(cloneEl, 'display', 'none');
rootEl.insertBefore(cloneEl, dragEl); rootEl.insertBefore(cloneEl, dragEl);
} }
}
}, },
_emulateDragOver: function (){ _emulateDragOver: function (){
@ -375,13 +377,13 @@
target = _closest(evt.target, this.options.draggable, el); target = _closest(evt.target, this.options.draggable, el);
dragRect = dragEl.getBoundingClientRect(); dragRect = dragEl.getBoundingClientRect();
if ((activeGroup.pull == 'clone') && (cloneEl.state !== isOwner)) { if (cloneEl && (cloneEl.state !== isOwner)) {
_css(cloneEl, 'display', isOwner ? 'none' : ''); _css(cloneEl, 'display', isOwner ? 'none' : '');
!isOwner && cloneEl.state && rootEl.insertBefore(cloneEl, dragEl); !isOwner && cloneEl.state && rootEl.insertBefore(cloneEl, dragEl);
cloneEl.state = isOwner; cloneEl.state = isOwner;
} }
if (revert) { if (revert && cloneEl) {
rootEl.insertBefore(dragEl, cloneEl); rootEl.insertBefore(dragEl, cloneEl);
return; return;
} }
@ -504,7 +506,7 @@
_dispatchEvent(dragEl, 'update'); _dispatchEvent(dragEl, 'update');
_dispatchEvent(dragEl, 'sort'); _dispatchEvent(dragEl, 'sort');
cloneEl.parentNode.removeChild(cloneEl); cloneEl && cloneEl.parentNode.removeChild(cloneEl);
} }
_dispatchEvent(rootEl, 'end'); _dispatchEvent(rootEl, 'end');

2
Sortable.min.js vendored

File diff suppressed because one or more lines are too long
Loading…
Cancel
Save