提交 ff260458 编写于 作者: R RubaXa

Merge branch 'master' into gh-pages

......@@ -583,11 +583,11 @@ Link to the active instance.
```html
<!-- CDNJS :: Sortable (https://cdnjs.com/) -->
<script src="//cdnjs.cloudflare.com/ajax/libs/Sortable/1.2.0/Sortable.min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/Sortable/1.2.1/Sortable.min.js"></script>
<!-- jsDelivr :: Sortable (http://www.jsdelivr.com/) -->
<script src="//cdn.jsdelivr.net/sortable/1.2.0/Sortable.min.js"></script>
<script src="//cdn.jsdelivr.net/sortable/1.2.1/Sortable.min.js"></script>
<!-- jsDelivr :: Sortable :: Latest (http://www.jsdelivr.com/) -->
......
......@@ -655,8 +655,7 @@
clearInterval(this._loopId);
clearInterval(autoScroll.pid);
clearTimeout(this.dragStartTimer);
clearTimeout(this._dragStartTimer);
// Unbind events
_off(document, 'drop', this);
......@@ -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 (
......@@ -1128,7 +1127,7 @@
};
Sortable.version = '1.2.0';
Sortable.version = '1.2.1';
/**
......
此差异已折叠。
......@@ -6,7 +6,7 @@
"knockout-sortable.js",
"react-sortable-mixin.js"
],
"version": "1.2.0",
"version": "1.2.1",
"homepage": "http://rubaxa.github.io/Sortable/",
"authors": [
"RubaXa <ibnRubaXa@gmail.com>"
......
{
"name": "Sortable",
"main": "Sortable.js",
"version": "1.2.0",
"version": "1.2.1",
"homepage": "http://rubaxa.github.io/Sortable/",
"repo": "RubaXa/Sortable",
"authors": [
......
......@@ -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;
......@@ -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
......
......@@ -134,6 +134,16 @@
this._sortableInstance = Sortable.create((this.refs[options.ref] || this).getDOMNode(), copyOptions);
},
componentWillReceiveProps: function (nextProps) {
var newState = {},
modelName = _getModelName(this),
items = nextProps[modelName];
if (items) {
newState[modelName] = items;
this.setState(newState);
}
},
componentWillUnmount: function () {
this._sortableInstance.destroy();
......
......@@ -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},
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册