Skip to content

Commit 4b18667

Browse files
author
Paul Bakaus
committed
ui-core: added mouseCapture, replacing the condition feature before. Allows text to be selected in sortables on non-handles.
1 parent 8105c48 commit 4b18667

3 files changed

Lines changed: 12 additions & 6 deletions

File tree

ui/ui.core.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ $.ui.mouse = {
199199
var self = this,
200200
btnIsLeft = (e.which == 1),
201201
elIsCancel = (typeof this.options.cancel == "string" ? $(e.target).is(this.options.cancel) : false);
202-
if (!btnIsLeft || elIsCancel) {
202+
if (!btnIsLeft || elIsCancel || !this.mouseCapture(e)) {
203203
return true;
204204
}
205205

@@ -277,7 +277,8 @@ $.ui.mouse = {
277277
// These are placeholder methods, to be overriden by extending plugin
278278
mouseStart: function(e) {},
279279
mouseDrag: function(e) {},
280-
mouseStop: function(e) {}
280+
mouseStop: function(e) {},
281+
mouseCapture: function(e) { return true; }
281282
};
282283

283284
$.ui.mouse.defaults = {

ui/ui.draggable.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -504,6 +504,7 @@ $.ui.plugin.add("draggable", "connectToSortable", {
504504
this.instance.options.helper = function() { return ui.helper[0]; };
505505

506506
e.target = this.instance.currentItem[0];
507+
this.instance.mouseCapture(e, true, true);
507508
this.instance.mouseStart(e, true, true);
508509

509510
//Because the browser event is way off the new appended portlet, we modify a couple of variables to reflect the changes

ui/ui.sortable.js

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -276,10 +276,7 @@ $.widget("ui.sortable", $.extend($.ui.mouse, {
276276

277277
};
278278
},
279-
mouseStart: function(e, overrideHandle, noActivation) {
280-
281-
var o = this.options;
282-
this.currentContainer = this;
279+
mouseCapture: function(e, overrideHandle) {
283280

284281
if(this.options.disabled || this.options.type == 'static') return false;
285282

@@ -300,6 +297,13 @@ $.widget("ui.sortable", $.extend($.ui.mouse, {
300297
}
301298

302299
this.currentItem = currentItem;
300+
return true;
301+
302+
},
303+
mouseStart: function(e, overrideHandle, noActivation) {
304+
305+
var o = this.options;
306+
this.currentContainer = this;
303307

304308
this.refresh();
305309

0 commit comments

Comments
 (0)