Browse Source

#120: pull 'clone'

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

14
Sortable.js

@ -247,9 +247,11 @@
_dispatchEvent(dragEl, 'start'); _dispatchEvent(dragEl, 'start');
cloneEl = dragEl.cloneNode(true); if (activeGroup.pull == 'clone') {
_css(cloneEl, 'display', 'none'); cloneEl = dragEl.cloneNode(true);
rootEl.insertBefore(cloneEl, dragEl); _css(cloneEl, 'display', 'none');
rootEl.insertBefore(cloneEl, dragEl);
}
} }
}, },
@ -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