events: restore "tab-created" usage

This commit is contained in:
jean-emmanuel 2018-01-12 13:14:06 +01:00
parent a4266e2e76
commit 412866e417
3 changed files with 6 additions and 6 deletions

View file

@ -42,8 +42,11 @@ var updateDom = function(container,data, remote) {
// widget
var newContainer = parser.parse([data], container[0].abstract.parentNode, container[0].abstract.parent)
container.replaceWith(newContainer)
if (data.type == 'tab') newContainer[0].abstract.trigger('tab-created', [{widget: newContainer[0].abstract}])
$('.editor-root').attr('data-widget', $('.root-container').attr('data-widget'))
newContainer.trigger('resize')

View file

@ -79,11 +79,10 @@ module.exports = class Panel extends _widgets_base {
this.setValue($(e.target).index(), {sync: true, send:this.value != $(e.target).index()})
})
this.on('widget-created', (e)=>{
this.on('tab-created', (e)=>{
if (e.widget == this) return
if (e.widget.parent == this && e.widget.getProp('type') == 'tab') {
this.createNavigation()
}
this.createNavigation()
e.stopPropagation = true
})
this.setValue(this.getProp('value') || 0)

View file

@ -50,8 +50,6 @@ module.exports = class Tab extends Panel {
this.detached = false
var $body = $('body')
}
hide() {