Skip to content

Commit f157979

Browse files
authored
1.8.0-rc1
1 parent 84d6358 commit f157979

File tree

8 files changed

+553
-218
lines changed

8 files changed

+553
-218
lines changed

CONTRIBUTING.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,15 @@
22

33
### Issue
44

5-
1. Try [master](https://github.com/RubaXa/Sortable/tree/master/)-branch, perhaps the problem has been solved;
6-
2. [Use the search](https://github.com/RubaXa/Sortable/search?type=Issues&q=problem), maybe already have an answer;
5+
1. Try [master](https://github.com/SortableJS/Sortable/tree/master/)-branch, perhaps the problem has been solved;
6+
2. [Use the search](https://github.com/SortableJS/Sortable/search?type=Issues&q=problem), maybe already have an answer;
77
3. If not found, create example on [jsbin.com (draft)](http://jsbin.com/zunibaxada/1/edit?html,js,output) and describe the problem.
88

99
---
1010

1111
### Pull Request
1212

13-
1. Only into [master](https://github.com/RubaXa/Sortable/tree/master/)-branch.
13+
1. Only into [master](https://github.com/SortableJS/Sortable/tree/master/)-branch.
1414
2. Do not modify `Sortable.min.js`, this will be compiled before each release.
1515

1616
### Setup

ISSUE_TEMPLATE.md

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,15 @@
1-
## Hi, this project very much requires the maintainer, if you have a chewing and appropriate skills, please [contact me](mailto:ibn@rubaxa.org?subject=Sortable%20vs.%20Maintainer)!
1+
#### Problem:
22

33

4-
---
54

5+
#### JSBin/JSFiddle demonstrating the problem:
6+
7+
8+
---
69
Before you create an issue, check it:
710

8-
1. Try [master](https://github.com/RubaXa/Sortable/tree/master/)-branch, perhaps the problem has been solved;
9-
2. [Use the search](https://github.com/RubaXa/Sortable/search?q=problem), maybe already have an answer;
11+
1. Try [master](https://github.com/SortableJS/Sortable/tree/master/)-branch, perhaps the problem has been solved;
12+
2. [Use the search](https://github.com/SortableJS/Sortable/search?q=problem), maybe we already have an answer;
1013
3. If not found, create an example on [jsbin.com (draft)](http://jsbin.com/vojixek/edit?html,js,output) and describe the problem.
1114

1215
Bindings:

README.md

Lines changed: 66 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,10 @@ Demo: http://sortablejs.github.io/Sortable/
3434

3535
### Articles
3636

37+
* [Swap Thresholds and Direction](https://github.com/SortableJS/Sortable/wiki/Swap-Thresholds-and-Direction) (December 2, 2018)
3738
* [Sortable v1.0 — New capabilities](https://github.com/SortableJS/Sortable/wiki/Sortable-v1.0-—-New-capabilities/) (December 22, 2014)
3839
* [Sorting with the help of HTML5 Drag'n'Drop API](https://github.com/SortableJS/Sortable/wiki/Sorting-with-the-help-of-HTML5-Drag'n'Drop-API/) (December 23, 2013)
3940

40-
4141
<br/>
4242

4343
### Install
@@ -79,7 +79,7 @@ You can use any element for the list and its elements, not just `ul`/`li`. Here
7979
### Options
8080
```js
8181
var sortable = new Sortable(el, {
82-
group: "name", // or { name: "...", pull: [true, false, clone], put: [true, false, array] }
82+
group: "name", // or { name: "...", pull: [true, false, 'clone', array], put: [true, false, array] }
8383
sort: true, // sorting inside list
8484
delay: 0, // time in milliseconds to define when the sorting should start
8585
touchStartThreshold: 0, // px, how many pixels the point should move before cancelling a delayed drag event
@@ -95,6 +95,11 @@ var sortable = new Sortable(el, {
9595
dragClass: "sortable-drag", // Class name for the dragging item
9696
dataIdAttr: 'data-id',
9797

98+
swapThreshold: 1, // Threshold of the swap zone
99+
invertSwap: false, // Will always use inverted swap zone if set to true
100+
invertedSwapThreshold: 1, // Threshold of the inverted swap zone (will be set to swapThreshold value by default)
101+
direction: 'horizontal', // Direction of Sortable (will be detected automatically if not given)
102+
98103
forceFallback: false, // ignore the HTML5 DnD behaviour and force the fallback to kick in
99104

100105
fallbackClass: "sortable-fallback", // Class name for the cloned DOM Element when using forceFallback
@@ -107,6 +112,8 @@ var sortable = new Sortable(el, {
107112
scrollSpeed: 10, // px
108113
bubbleScroll: true, // apply autoscroll to all parent elements, allowing for easier movement
109114

115+
dragoverBubble: false,
116+
110117
setData: function (/** DataTransfer */dataTransfer, /** HTMLElement*/dragEl) {
111118
dataTransfer.setData('Text', dragEl.textContent); // `dataTransfer` object of HTML5 DragEvent
112119
},
@@ -183,7 +190,7 @@ To drag elements from one list into another, both lists must have the same `grou
183190
You can also define whether lists can give away, give and keep a copy (`clone`), and receive elements.
184191

185192
* name: `String` — group name
186-
* pull: `true|false|["foo", "bar"]|'clone'|function` — ability to move from the list. `clone` — copy the item, rather than move. Or an array of group names which the elements may be put in.
193+
* pull: `true|false|["foo", "bar"]|'clone'|function` — ability to move from the list. `clone` — copy the item, rather than move. Or an array of group names which the elements may be put in. Defaults to `true`.
187194
* put: `true|false|["baz", "qux"]|function` — whether elements can be added from other lists, or an array of group names from which elements can be taken.
188195
* revertClone: `boolean` — revert cloned element to initial position after moving to a another list.
189196

@@ -215,6 +222,53 @@ Demo: https://jsbin.com/zosiwah/edit?js,output
215222
---
216223

217224

225+
#### `swapThreshold` option
226+
Percentage of the target that the swap zone will take up, as a float between `0` and `1`.
227+
228+
Read more: https://github.com/SortableJS/Sortable/wiki/Swap-Thresholds-and-Direction#swap-threshold
229+
230+
231+
---
232+
233+
234+
#### `invertSwap` option
235+
Set to `true` to set the swap zone to the sides of the target, for the effect of sorting "in between" items.
236+
237+
Read more: https://github.com/SortableJS/Sortable/wiki/Swap-Thresholds-and-Direction#forcing-inverted-swap-zone
238+
239+
240+
---
241+
242+
243+
#### `invertedSwapThreshold` option
244+
Percentage of the target that the inverted swap zone will take up, as a float between `0` and `1`. If not given, will default to `swapThreshold`.
245+
246+
Read more: https://github.com/SortableJS/Sortable/wiki/Swap-Thresholds-and-Direction#dealing-with-swap-glitching
247+
248+
249+
---
250+
251+
252+
#### `direction` option
253+
Direction that the Sortable should sort in. Can be set to `'vertical'`, `'horizontal'`, or a function, which will be called whenever a target is dragged over. Must return `'vertical'` or `'horizontal'`.
254+
255+
Read more: https://github.com/SortableJS/Sortable/wiki/Swap-Thresholds-and-Direction#direction
256+
257+
258+
Example of dynamic direction detection:
259+
260+
```js
261+
Sortable.create(el, {
262+
direction: function(evt, target, dragEl) {
263+
return Sortable.utils.detectDirection(el);
264+
}
265+
});
266+
```
267+
268+
269+
---
270+
271+
218272
#### `touchStartThreshold` option
219273
This option is similar to `fallbackTolerance` option.
220274

@@ -413,6 +467,14 @@ Demo: https://jsbin.com/kesewor/edit?html,js,output
413467

414468
---
415469

470+
471+
#### `dragoverBubble` option
472+
If set to `true`, the dragover event will bubble to parent Sortables. Useful for nested Sortables. Works on both fallback and native dragover event.
473+
474+
475+
---
476+
477+
416478
### Event object ([demo](https://jsbin.com/fogujiv/edit?js,output))
417479

418480
- to:`HTMLElement` — list, in which moved element.
@@ -576,6 +638,7 @@ Link to the active instance.
576638
* closest(el`:HTMLElement`, selector`:String`[, ctx`:HTMLElement`])`:HTMLElement|Null` — for each element in the set, get the first element that matches the selector by testing the element itself and traversing up through its ancestors in the DOM tree
577639
* clone(el`:HTMLElement`)`:HTMLElement` — create a deep copy of the set of matched elements
578640
* toggleClass(el`:HTMLElement`, name`:String`, state`:Boolean`) — add or remove one classes from each element
641+
* detectDirection(el`:HTMLElement`)`:String` — automatically detect the direction of the element as either `'vertical'` or `'horizontal'`
579642

580643

581644
---
@@ -636,9 +699,6 @@ Please, [read this](CONTRIBUTING.md).
636699

637700

638701
## MIT LICENSE
639-
Copyright 2013-2017 Lebedev Konstantin <ibnRubaXa@gmail.com>
640-
http://SortableJS.github.io/Sortable/
641-
642702
Permission is hereby granted, free of charge, to any person obtaining
643703
a copy of this software and associated documentation files (the
644704
"Software"), to deal in the Software without restriction, including

0 commit comments

Comments
 (0)