mirror of
https://github.com/stylersnico/librenms.git
synced 2026-07-28 00:24:21 +02:00
events/onselectstart: Don't prevent default behaviour on form fields
Fixes #56.
This commit is contained in:
+13
-4
@@ -13,7 +13,8 @@
|
||||
distance: 1,
|
||||
limit: true,
|
||||
offset_left: 0,
|
||||
autoscroll: true
|
||||
autoscroll: true,
|
||||
ignore_dragging: ['INPUT', 'TEXTAREA', 'SELECT', 'BUTTON']
|
||||
// ,drag: function(e){},
|
||||
// start : function(e, ui){},
|
||||
// stop : function(e){}
|
||||
@@ -76,7 +77,7 @@
|
||||
};
|
||||
|
||||
fn.events = function() {
|
||||
this.$container.on('selectstart', this.on_select_start);
|
||||
this.$container.on('selectstart', $.proxy(this.on_select_start, this));
|
||||
|
||||
this.$container.on(pointer_events.start, this.options.items, $.proxy(
|
||||
this.drag_handler, this));
|
||||
@@ -183,8 +184,7 @@
|
||||
return;
|
||||
}
|
||||
|
||||
if (node === 'INPUT' || node === 'TEXTAREA' || node === 'SELECT' ||
|
||||
node === 'BUTTON') {
|
||||
if (this.ignore_drag(e)) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -306,6 +306,11 @@
|
||||
|
||||
fn.on_select_start = function(e) {
|
||||
if (this.disabled) { return; }
|
||||
|
||||
if (this.ignore_drag(e)) {
|
||||
return;
|
||||
}
|
||||
|
||||
return false;
|
||||
};
|
||||
|
||||
@@ -323,6 +328,10 @@
|
||||
$.removeData(this.$container, 'drag');
|
||||
};
|
||||
|
||||
fn.ignore_drag = function(event) {
|
||||
return $.inArray(event.target.nodeName, this.options.ignore_dragging) >= 0;
|
||||
};
|
||||
|
||||
//jQuery adapter
|
||||
$.fn.drag = function ( options ) {
|
||||
return this.each(function () {
|
||||
|
||||
Reference in New Issue
Block a user