Skip to content

Commit

Permalink
fixed #713 (#761)
Browse files Browse the repository at this point in the history
  • Loading branch information
lukasoppermann committed Jun 15, 2021
1 parent 2b9ec88 commit dbd417c
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
2 changes: 1 addition & 1 deletion docs/html5sortable.js
Original file line number Diff line number Diff line change
Expand Up @@ -1269,7 +1269,7 @@ var sortable = (function () {
return;
}
var options = addData(sortableElement, 'opts');
if (parseInt(options.maxItems) && filter(sortableElement.children, addData(sortableElement, 'items')).length >= parseInt(options.maxItems) && dragging.parentElement !== sortableElement) {
if (parseInt(options.maxItems) && filter(sortableElement.children, addData(sortableElement, 'items')).length > parseInt(options.maxItems) && dragging.parentElement !== sortableElement) {
return;
}
e.preventDefault();
Expand Down
9 changes: 5 additions & 4 deletions docs/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ <h2 class="h3 m0">
<div class="px2 muted">
forcePlaceholderSize: true,<br />
placeholderClass: 'ph-class', <br />
hoverClass: 'bg-maroon yellow' <br />
hoverClass: 'bg-maroon yellow', <br />
</div>
<div>});</div>
</code>
Expand All @@ -63,7 +63,6 @@ <h2 class="h3 m0">
<li class="p1 mb1 navy bg-yellow" style="position: relative; z-index: 10">Item 3</li>
<li class="p1 mb1 navy bg-yellow" style="position: relative; z-index: 10">Item 4</li>
<li class="p1 mb1 navy bg-yellow" style="position: relative; z-index: 10">Item 5</li>
<li class="p1 mb1 navy bg-yellow" style="position: relative; z-index: 10">Item 6</li>
</ul>
<button class="ml4 js-serialize-button button navy bg-yellow">Serialize</button>
<script type="text/javascript">
Expand Down Expand Up @@ -424,6 +423,7 @@ <h2 class="h3 m0">Sortable Copy</h2>
<code class="mb0">
<div>sortable('.o-sortable', {</div>
<div class="px2 muted">copy:true // default to false</div>
<div class="px2 muted">maxItems: 2</div>
<div>});</div>
</code>
</div>
Expand Down Expand Up @@ -452,9 +452,10 @@ <h2 class="h4 mt1">Copy items here</h2>
placeholderClass: 'mb1 bg-navy border border-yellow',
});
sortable('.js-sortable-copy-target', {
forcePlaceholderSize: true,
forcePlaceholderSize: true,
acceptFrom: '.js-sortable-copy,.js-sortable-copy-target',
placeholderClass: 'mb1 border border-maroon',
placeholderClass: 'mb1 border border-maroon',
maxItems: 2
});
sortable('.js-grid', {
forcePlaceholderSize: true,
Expand Down
2 changes: 1 addition & 1 deletion src/html5sortable.ts
Original file line number Diff line number Diff line change
Expand Up @@ -634,7 +634,7 @@ export default function sortable (sortableElements, options: configuration|objec
return
}
const options = data(sortableElement, 'opts')
if (parseInt(options.maxItems) && filter(sortableElement.children, data(sortableElement, 'items')).length >= parseInt(options.maxItems) && dragging.parentElement !== sortableElement) {
if (parseInt(options.maxItems) && filter(sortableElement.children, data(sortableElement, 'items')).length > parseInt(options.maxItems) && dragging.parentElement !== sortableElement) {
return
}
e.preventDefault()
Expand Down

0 comments on commit dbd417c

Please sign in to comment.