Skip to content

Commit 43fd373

Browse files
committed
Merge branch 'dev'
2 parents 591b311 + f3e090c commit 43fd373

4 files changed

Lines changed: 19 additions & 6 deletions

File tree

Sortable.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -655,8 +655,7 @@
655655

656656
clearInterval(this._loopId);
657657
clearInterval(autoScroll.pid);
658-
659-
clearTimeout(this.dragStartTimer);
658+
clearTimeout(this._dragStartTimer);
660659

661660
// Unbind events
662661
_off(document, 'drop', this);
@@ -885,7 +884,7 @@
885884
selector = selector.split('.');
886885

887886
var tag = selector.shift().toUpperCase(),
888-
re = new RegExp('\\s(' + selector.join('|') + ')\\s', 'g');
887+
re = new RegExp('\\s(' + selector.join('|') + ')(?=\\s)', 'g');
889888

890889
do {
891890
if (

ng-sortable.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,9 @@
2525

2626

2727
angular.module('ng-sortable', [])
28-
.constant('version', '0.3.7')
29-
.directive('ngSortable', ['$parse', function ($parse) {
28+
.constant('ngSortableVersion', '0.3.7')
29+
.constant('ngSortableConfig', {})
30+
.directive('ngSortable', ['$parse', 'ngSortableConfig', function ($parse, ngSortableConfig) {
3031
var removed,
3132
nextSibling;
3233

@@ -67,7 +68,7 @@
6768
scope: { ngSortable: "=?" },
6869
link: function (scope, $el, attrs) {
6970
var el = $el[0],
70-
options = scope.ngSortable || {},
71+
options = angular.extend(scope.ngSortable || {}, ngSortableConfig),
7172
source = getSource(el),
7273
watchers = [],
7374
sortable

react-sortable-mixin.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,16 @@
134134
this._sortableInstance = Sortable.create((this.refs[options.ref] || this).getDOMNode(), copyOptions);
135135
},
136136

137+
componentWillReceiveProps: function (nextProps) {
138+
var newState = {},
139+
modelName = _getModelName(this),
140+
items;
141+
142+
if (items = nextProps[modelName]) {
143+
newState[modelName] = items;
144+
this.setState(newState);
145+
}
146+
},
137147

138148
componentWillUnmount: function () {
139149
this._sortableInstance.destroy();

st/app.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,9 @@
148148

149149
// Angular example
150150
angular.module('todoApp', ['ng-sortable'])
151+
.constant('ngSortableConfig', {onEnd: function() {
152+
console.log('default onEnd()');
153+
}})
151154
.controller('TodoController', ['$scope', function ($scope) {
152155
$scope.todos = [
153156
{text: 'learn angular', done: true},

0 commit comments

Comments
 (0)