Skip to content

Commit

Permalink
Merge branch 'dev'
Browse files Browse the repository at this point in the history
  • Loading branch information
RubaXa committed Jul 18, 2015
2 parents 591b311 + f3e090c commit 43fd373
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 6 deletions.
5 changes: 2 additions & 3 deletions Sortable.js
Original file line number Diff line number Diff line change
Expand Up @@ -655,8 +655,7 @@

clearInterval(this._loopId);
clearInterval(autoScroll.pid);

clearTimeout(this.dragStartTimer);
clearTimeout(this._dragStartTimer);

// Unbind events
_off(document, 'drop', this);
Expand Down Expand Up @@ -885,7 +884,7 @@
selector = selector.split('.');

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

do {
if (
Expand Down
7 changes: 4 additions & 3 deletions ng-sortable.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,9 @@


angular.module('ng-sortable', [])
.constant('version', '0.3.7')
.directive('ngSortable', ['$parse', function ($parse) {
.constant('ngSortableVersion', '0.3.7')
.constant('ngSortableConfig', {})
.directive('ngSortable', ['$parse', 'ngSortableConfig', function ($parse, ngSortableConfig) {
var removed,
nextSibling;

Expand Down Expand Up @@ -67,7 +68,7 @@
scope: { ngSortable: "=?" },
link: function (scope, $el, attrs) {
var el = $el[0],
options = scope.ngSortable || {},
options = angular.extend(scope.ngSortable || {}, ngSortableConfig),
source = getSource(el),
watchers = [],
sortable
Expand Down
10 changes: 10 additions & 0 deletions react-sortable-mixin.js
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,16 @@
this._sortableInstance = Sortable.create((this.refs[options.ref] || this).getDOMNode(), copyOptions);
},

componentWillReceiveProps: function (nextProps) {
var newState = {},
modelName = _getModelName(this),
items;

if (items = nextProps[modelName]) {
newState[modelName] = items;
this.setState(newState);
}
},

componentWillUnmount: function () {
this._sortableInstance.destroy();
Expand Down
3 changes: 3 additions & 0 deletions st/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,9 @@

// Angular example
angular.module('todoApp', ['ng-sortable'])
.constant('ngSortableConfig', {onEnd: function() {
console.log('default onEnd()');
}})
.controller('TodoController', ['$scope', function ($scope) {
$scope.todos = [
{text: 'learn angular', done: true},
Expand Down

0 comments on commit 43fd373

Please sign in to comment.