From 73b61f80ebf7db14f443cfe751405f67e2b9ca68 Mon Sep 17 00:00:00 2001 From: Sergey Aksyonov Date: Mon, 22 Dec 2014 14:40:22 +0200 Subject: [PATCH 01/10] Fixed angular directive for complex ng-repeat expressions --- ng-sortable.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/ng-sortable.js b/ng-sortable.js index 12b9388..873e4e8 100644 --- a/ng-sortable.js +++ b/ng-sortable.js @@ -17,9 +17,10 @@ angular.module('ng-sortable', []) (node.nodeValue.indexOf('ngRepeat:') !== -1) ); })[0]; - ngRepeat = ngRepeat.nodeValue.match(/ngRepeat:\s*([^\s]+)\s+in\s+([^\s|]+)/); + ngRepeat = ngRepeat.nodeValue.match(/ngRepeat:\s*([\s\S]+?)\s+in\s+([\s\S]+?)(?:\s)/); - var itemExpr = $parse(ngRepeat[1]); + var lhs = ngRepeat[1].match(/^(?:([\$\w]+)|\(([\$\w]+)\s*,\s*([\$\w]+)\))$/); + var itemExpr = $parse(lhs[3] || lhs[1]); var itemsExpr = $parse(ngRepeat[2]); return { From 3ab736b570bd3e09e548e5c079315a698122e807 Mon Sep 17 00:00:00 2001 From: Sergey Aksyonov Date: Mon, 22 Dec 2014 16:45:50 +0200 Subject: [PATCH 02/10] Fixed expression regex --- ng-sortable.js | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/ng-sortable.js b/ng-sortable.js index 873e4e8..a1d572e 100644 --- a/ng-sortable.js +++ b/ng-sortable.js @@ -17,10 +17,9 @@ angular.module('ng-sortable', []) (node.nodeValue.indexOf('ngRepeat:') !== -1) ); })[0]; - ngRepeat = ngRepeat.nodeValue.match(/ngRepeat:\s*([\s\S]+?)\s+in\s+([\s\S]+?)(?:\s)/); + ngRepeat = ngRepeat.nodeValue.match(/ngRepeat:\s*(?:\(.*?,\s*)?([^\s)]+)[\s)]+in\s+([^\s|]+)/); - var lhs = ngRepeat[1].match(/^(?:([\$\w]+)|\(([\$\w]+)\s*,\s*([\$\w]+)\))$/); - var itemExpr = $parse(lhs[3] || lhs[1]); + var itemExpr = $parse(ngRepeat[1]); var itemsExpr = $parse(ngRepeat[2]); return { From 8b26ca27c9d4c5de5dbe8eabd703e63c552048f6 Mon Sep 17 00:00:00 2001 From: Lebedev Konstantin Date: Mon, 22 Dec 2014 18:40:50 +0300 Subject: [PATCH 03/10] Update ng-sortable.js --- ng-sortable.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/ng-sortable.js b/ng-sortable.js index a1d572e..f6ec09b 100644 --- a/ng-sortable.js +++ b/ng-sortable.js @@ -3,7 +3,7 @@ * @licence MIT */ angular.module('ng-sortable', []) - .constant('$version', '0.3.2') + .constant('$version', '0.3.3') .directive('ngSortable', ['$parse', function ($parse) { 'use strict'; @@ -17,6 +17,8 @@ angular.module('ng-sortable', []) (node.nodeValue.indexOf('ngRepeat:') !== -1) ); })[0]; + + // tests: http://jsbin.com/kosubutilo/1/edit?js,output ngRepeat = ngRepeat.nodeValue.match(/ngRepeat:\s*(?:\(.*?,\s*)?([^\s)]+)[\s)]+in\s+([^\s|]+)/); var itemExpr = $parse(ngRepeat[1]); From 91089fc38179690a02277d70a9b2a7c87eecb3d0 Mon Sep 17 00:00:00 2001 From: afc163 Date: Wed, 24 Dec 2014 23:53:05 +0800 Subject: [PATCH 04/10] Add spm support --- package.json | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/package.json b/package.json index cade1db..5b50d73 100644 --- a/package.json +++ b/package.json @@ -25,5 +25,12 @@ "drag" ], "author": "Konstantin Lebedev ", - "license": "MIT" + "license": "MIT", + "spm": { + "main": "Sortable.js", + "ignore": [ + "meteor", + "st" + ] + } } From b1daa70a2a067bb3c9a577dff7b1f0986e3cf057 Mon Sep 17 00:00:00 2001 From: raphj Date: Sun, 28 Dec 2014 10:26:28 +0100 Subject: [PATCH 05/10] Make Sotable compatible xhtml comparisons of node names (via the nodeName property) are done in upper case. However, nodeName is lower case in xhtml. Let's do everything in upper case. --- Sortable.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Sortable.js b/Sortable.js index 5d10475..4b82eec 100644 --- a/Sortable.js +++ b/Sortable.js @@ -809,7 +809,7 @@ do { if ( (tag === '>*' && el.parentNode === ctx) || ( - (tag === '' || el.nodeName == tag) && + (tag === '' || el.nodeName.toUpperCase() == tag) && (!selector.length || ((' ' + el.className + ' ').match(re) || []).length == selector.length) ) ) { @@ -937,7 +937,7 @@ */ function _index(/**HTMLElement*/el) { var index = 0; - while (el && (el = el.previousElementSibling) && (el.nodeName !== 'TEMPLATE')) { + while (el && (el = el.previousElementSibling) && (el.nodeName.toUpperCase() !== 'TEMPLATE')) { index++; } return index; From 75d95c4439c5131f0023ef32ae590abbe1a446f4 Mon Sep 17 00:00:00 2001 From: David Burles Date: Thu, 8 Jan 2015 16:33:04 +1100 Subject: [PATCH 06/10] fixes conflict with collection-helpers package update mongo-collection-instances to 0.2.6 --- meteor/package.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/meteor/package.js b/meteor/package.js index 823a0ac..148561a 100644 --- a/meteor/package.js +++ b/meteor/package.js @@ -16,7 +16,7 @@ Package.describe({ Package.onUse(function (api) { api.versionsFrom(['METEOR@0.9.0', 'METEOR@1.0']); api.use('templating', 'client'); - api.use('dburles:mongo-collection-instances@0.2.5'); // to watch collections getting created + api.use('dburles:mongo-collection-instances@0.2.6'); // to watch collections getting created api.export('Sortable'); api.addFiles([ 'Sortable.js', From 842856263cb29ec62fbb1dec5a9f639d13895477 Mon Sep 17 00:00:00 2001 From: Willson Mock Date: Sun, 11 Jan 2015 21:53:10 -0500 Subject: [PATCH 07/10] Update README with updated info --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index c84cfc5..b67881a 100644 --- a/README.md +++ b/README.md @@ -430,7 +430,7 @@ Link to the active instance. ## MIT LICENSE -Copyright 2013-2014 Lebedev Konstantin +Copyright 2013-2015 Lebedev Konstantin http://rubaxa.github.io/Sortable/ Permission is hereby granted, free of charge, to any person obtaining From 34bbbcb5a19b1ae762de80a271e1b256abd82429 Mon Sep 17 00:00:00 2001 From: Lebedev Konstantin Date: Sun, 18 Jan 2015 21:34:37 +0300 Subject: [PATCH 08/10] #229: * ghostClass example --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index b67881a..2d202b8 100644 --- a/README.md +++ b/README.md @@ -202,7 +202,7 @@ Sortable.create(list, { #### `ghostClass` option Class name for the drop placeholder. -Demo: http://jsbin.com/boqugumiqi/1/edit?css,js,output +Demo: http://jsbin.com/hunifu/1/edit?css,js,output ```css .ghost { From e08f065adaec1f47e056f0228da53cb986974637 Mon Sep 17 00:00:00 2001 From: RubaXa Date: Sun, 18 Jan 2015 21:55:53 +0300 Subject: [PATCH 09/10] #209: * drag-handle --- st/app.css | 1 + 1 file changed, 1 insertion(+) diff --git a/st/app.css b/st/app.css index 4dbbb8b..2059294 100644 --- a/st/app.css +++ b/st/app.css @@ -220,6 +220,7 @@ img { margin-right: 10px; font: bold 20px Sans-Serif; color: #5F9EDF; + display: inline-block; cursor: move; cursor: -webkit-grabbing; /* overrides 'move' */ } From 8f2aa5eb68f5f31fc1cd0db7a5a3d76c06878803 Mon Sep 17 00:00:00 2001 From: RubaXa Date: Mon, 26 Jan 2015 16:02:31 +0300 Subject: [PATCH 10/10] + create 'cloneEl' on dragStart --- Sortable.js | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/Sortable.js b/Sortable.js index 31386d3..38dbb77 100644 --- a/Sortable.js +++ b/Sortable.js @@ -276,13 +276,6 @@ } } catch (err) { } - - - if (activeGroup.pull == 'clone') { - cloneEl = dragEl.cloneNode(true); - _css(cloneEl, 'display', 'none'); - rootEl.insertBefore(cloneEl, dragEl); - } } }, @@ -347,6 +340,12 @@ this._offUpEvents(); + if (activeGroup.pull == 'clone') { + cloneEl = dragEl.cloneNode(true); + _css(cloneEl, 'display', 'none'); + rootEl.insertBefore(cloneEl, dragEl); + } + if (isTouch) { var rect = dragEl.getBoundingClientRect(), css = _css(dragEl),