Fixes a problem with sorting new added menu items. Fixes https://github.com/rainlab/pages-plugin/issues/41
This commit is contained in:
parent
c9cf2b4352
commit
af2849c9a5
|
|
@ -1590,10 +1590,7 @@ this.clearOffsetParent()},toggleListeners:function(method,events){var self=this
|
|||
events=events||['drag','drop','scroll']
|
||||
$.each(events,function(i,event){self.$document[method](eventNames[event],self[event+'Proxy'])})},clearOffsetParent:function(){this.offsetParent=undefined},clearDimensions:function(){this.containerDimensions=undefined
|
||||
var i=this.containers.length
|
||||
while(i--){this.containers[i].clearDimensions()}},destroy:function(){var group=this.options.group
|
||||
containerGroups[group].options=null
|
||||
containerGroups[group]=undefined
|
||||
for(var i in containerGroups){if(containerGroups[i]){containerGroups[i]=undefined}}}}
|
||||
while(i--){this.containers[i].clearDimensions()}},destroy:function(){containerGroups[this.options.group]=undefined}}
|
||||
function Container(element,options){this.el=element
|
||||
this.options=$.extend({},containerDefaults,options)
|
||||
this.group=ContainerGroup.get(this.options)
|
||||
|
|
@ -2407,9 +2404,11 @@ this.$el.removeData('oc.treelist')
|
|||
this.$el=null
|
||||
this.options=null}
|
||||
TreeListWidget.DEFAULTS={handle:null,nested:true}
|
||||
TreeListWidget.prototype.onDrop=function($item,container,_super){this.$el.trigger('move.oc.treelist',{item:$item,container:container})
|
||||
TreeListWidget.prototype.onDrop=function($item,container,_super){if(!this.$el){return}
|
||||
this.$el.trigger('move.oc.treelist',{item:$item,container:container})
|
||||
_super($item,container)}
|
||||
TreeListWidget.prototype.onAfterMove=function($placeholder,container,$closestEl){this.$el.trigger('aftermove.oc.treelist',{placeholder:$placeholder,container:container,closestEl:$closestEl})}
|
||||
TreeListWidget.prototype.onAfterMove=function($placeholder,container,$closestEl){if(!this.$el){return}
|
||||
this.$el.trigger('aftermove.oc.treelist',{placeholder:$placeholder,container:container,closestEl:$closestEl})}
|
||||
var old=$.fn.treeListWidget
|
||||
$.fn.treeListWidget=function(option){var args=arguments,result
|
||||
this.each(function(){var $this=$(this)
|
||||
|
|
|
|||
|
|
@ -468,16 +468,22 @@
|
|||
// TODO iterate over subgroups and destroy them
|
||||
// TODO remove all events
|
||||
|
||||
containerGroups[this.options.group] = undefined
|
||||
/*
|
||||
|
||||
if (!this.options) {
|
||||
return
|
||||
}
|
||||
|
||||
var group = this.options.group
|
||||
containerGroups[group].options = null
|
||||
containerGroups[group] = undefined
|
||||
|
||||
for (var i in containerGroups) {
|
||||
if (containerGroups[i]) {
|
||||
containerGroups[i] = undefined
|
||||
}
|
||||
}
|
||||
|
||||
*/
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -74,11 +74,21 @@
|
|||
// ============================
|
||||
|
||||
TreeListWidget.prototype.onDrop = function($item, container, _super) {
|
||||
// The event handler could be registered after the
|
||||
// sortable is destroyed. This should be fixed later.
|
||||
if (!this.$el) {
|
||||
return
|
||||
}
|
||||
|
||||
this.$el.trigger('move.oc.treelist', { item: $item, container: container })
|
||||
_super($item, container)
|
||||
}
|
||||
|
||||
TreeListWidget.prototype.onAfterMove = function($placeholder, container, $closestEl) {
|
||||
if (!this.$el) {
|
||||
return
|
||||
}
|
||||
|
||||
this.$el.trigger('aftermove.oc.treelist', { placeholder: $placeholder, container: container, closestEl: $closestEl })
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -228,15 +228,15 @@
|
|||
// instead of updating it. Remove later if nothing weird is noticed.
|
||||
// -ab Apr 26 2015
|
||||
//
|
||||
// TreeView.prototype.update = function() {
|
||||
// this.$allItems = $('li', this.$el)
|
||||
// this.createItemControls()
|
||||
// this.initSortable()
|
||||
TreeView.prototype.update = function() {
|
||||
this.$allItems = $('li', this.$el)
|
||||
this.createItemControls()
|
||||
//this.initSortable()
|
||||
|
||||
// var dataId = this.$el.data('oc.active-item')
|
||||
// if (dataId !== undefined)
|
||||
// this.markActive(dataId)
|
||||
// }
|
||||
var dataId = this.$el.data('oc.active-item')
|
||||
if (dataId !== undefined)
|
||||
this.markActive(dataId)
|
||||
}
|
||||
|
||||
TreeView.prototype.handleMovedNode = function() {
|
||||
this.$el.trigger('change')
|
||||
|
|
|
|||
Loading…
Reference in New Issue