dd plugin registration

This commit is contained in:
Pavel Reznikov 2016-08-18 21:01:23 -07:00
parent eeff06dbe8
commit 6d8ce2299c
4 changed files with 39 additions and 9 deletions

19
dist/gridstack.js vendored
View file

@ -132,6 +132,12 @@
this.grid = grid;
}
GridStackDragDropPlugin.registeredPlugins = [];
GridStackDragDropPlugin.registerPlugin = function(pluginClass) {
GridStackDragDropPlugin.registeredPlugins.push(pluginClass);
};
GridStackDragDropPlugin.prototype.resizable = function(el, opts) {
return this;
};
@ -160,6 +166,8 @@
GridStackDragDropPlugin.call(this, grid);
}
GridStackDragDropPlugin.registerPlugin(JQueryUIGridStackDragDropPlugin);
JQueryUIGridStackDragDropPlugin.prototype = Object.create(GridStackDragDropPlugin.prototype);
JQueryUIGridStackDragDropPlugin.prototype.constructor = JQueryUIGridStackDragDropPlugin;
@ -662,10 +670,16 @@
verticalMarginUnit: 'px',
cellHeightUnit: 'px',
oneColumnModeClass: opts.oneColumnModeClass || 'grid-stack-one-column-mode',
ddPlugin: JQueryUIGridStackDragDropPlugin
ddPlugin: null
});
this.dd = new opts.ddPlugin(this);
if (this.opts.ddPlugin === false) {
this.opts.ddPlugin = GridStackDragDropPlugin;
} else if (this.opts.ddPlugin === null) {
this.opts.ddPlugin = _.first(GridStackDragDropPlugin.registeredPlugins);
}
this.dd = new this.opts.ddPlugin(this);
if (this.opts.rtl === 'auto') {
this.opts.rtl = this.container.css('direction') === 'rtl';
@ -1763,6 +1777,7 @@
scope.GridStackUI.Utils = Utils;
scope.GridStackUI.Engine = GridStackEngine;
scope.GridStackUI.GridStackDragDropPlugin = GridStackDragDropPlugin;
$.fn.gridstack = function(opts) {
return this.each(function() {

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -132,6 +132,12 @@
this.grid = grid;
}
GridStackDragDropPlugin.registeredPlugins = [];
GridStackDragDropPlugin.registerPlugin = function(pluginClass) {
GridStackDragDropPlugin.registeredPlugins.push(pluginClass);
};
GridStackDragDropPlugin.prototype.resizable = function(el, opts) {
return this;
};
@ -160,6 +166,8 @@
GridStackDragDropPlugin.call(this, grid);
}
GridStackDragDropPlugin.registerPlugin(JQueryUIGridStackDragDropPlugin);
JQueryUIGridStackDragDropPlugin.prototype = Object.create(GridStackDragDropPlugin.prototype);
JQueryUIGridStackDragDropPlugin.prototype.constructor = JQueryUIGridStackDragDropPlugin;
@ -662,10 +670,16 @@
verticalMarginUnit: 'px',
cellHeightUnit: 'px',
oneColumnModeClass: opts.oneColumnModeClass || 'grid-stack-one-column-mode',
ddPlugin: JQueryUIGridStackDragDropPlugin
ddPlugin: null
});
this.dd = new opts.ddPlugin(this);
if (this.opts.ddPlugin === false) {
this.opts.ddPlugin = GridStackDragDropPlugin;
} else if (this.opts.ddPlugin === null) {
this.opts.ddPlugin = _.first(GridStackDragDropPlugin.registeredPlugins);
}
this.dd = new this.opts.ddPlugin(this);
if (this.opts.rtl === 'auto') {
this.opts.rtl = this.container.css('direction') === 'rtl';
@ -1763,6 +1777,7 @@
scope.GridStackUI.Utils = Utils;
scope.GridStackUI.Engine = GridStackEngine;
scope.GridStackUI.GridStackDragDropPlugin = GridStackDragDropPlugin;
$.fn.gridstack = function(opts) {
return this.each(function() {