panel/editor: reregister hashes when a widget is edited, all parents must do it
This commit is contained in:
parent
db79ef5a0a
commit
a91afaef7f
2 changed files with 10 additions and 5 deletions
|
|
@ -46,6 +46,10 @@ var updateDom = function(container,data, remote) {
|
|||
|
||||
if (data.type == 'tab') newContainer.trigger('tab-created')
|
||||
|
||||
if (container[0].abstract.parent && container[0].abstract.parent.registerHashes) {
|
||||
container[0].abstract.parent.registerHashes(true)
|
||||
}
|
||||
|
||||
$('.editor-root').attr('data-widget', $('.root-container').attr('data-widget'))
|
||||
sidepanelCreateToggle()
|
||||
|
||||
|
|
|
|||
|
|
@ -73,6 +73,7 @@ module.exports = class Panel extends _widgets_base {
|
|||
|
||||
parsewidgets(this.getProp('tabs'), this.wrapper, this, true)
|
||||
this.createNavigation()
|
||||
this.registerHashes()
|
||||
|
||||
this.navigation.on('fake-click', (e)=>{
|
||||
if (!e.target.hasAttribute('data-widget')) return
|
||||
|
|
@ -82,7 +83,6 @@ module.exports = class Panel extends _widgets_base {
|
|||
this.wrapper.on('tab-created', (e)=>{
|
||||
e.stopPropagation()
|
||||
this.createNavigation()
|
||||
|
||||
})
|
||||
|
||||
} else if (this.getProp('widgets') && this.getProp('widgets').length) {
|
||||
|
|
@ -96,9 +96,10 @@ module.exports = class Panel extends _widgets_base {
|
|||
|
||||
}
|
||||
|
||||
registerHashes() {
|
||||
registerHashes(edited) {
|
||||
|
||||
this.hashes = [this.hash]
|
||||
var widgets = this.widget.find('.widget')
|
||||
var widgets = this.widget.add(this.wrapper).find('> .widget')
|
||||
for (let widget of widgets) {
|
||||
if (widget.abstract.hashes) {
|
||||
this.hashes = this.hashes.concat(widget.abstract.hashes)
|
||||
|
|
@ -106,6 +107,8 @@ module.exports = class Panel extends _widgets_base {
|
|||
this.hashes.push(widget.abstract.hash)
|
||||
}
|
||||
}
|
||||
|
||||
if (edited && this.parent && this.parent.registerHashes) this.parent.registerHashes(true)
|
||||
}
|
||||
|
||||
createNavigation() {
|
||||
|
|
@ -121,8 +124,6 @@ module.exports = class Panel extends _widgets_base {
|
|||
this.navigation.append(`<li class="tablink" data-widget="${tab.abstract.hash}" ${style}><a><span>${$(tab).find('> .label span').html()}</span></a></li>`)
|
||||
}
|
||||
|
||||
this.registerHashes()
|
||||
|
||||
this.setValue(this.value)
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue