add auto detection of id created automatically to allow to have different id when cloning (can be done via dynamic props too )
This commit is contained in:
parent
3671f8317b
commit
25944ad60b
1 changed files with 10 additions and 2 deletions
|
|
@ -129,8 +129,16 @@ class Clone extends Widget {
|
|||
this.cloneClass = [...this.cloneTarget.container.classList].filter(i=>excludedCloneClasses.indexOf(i) === -1)
|
||||
this.container.classList.remove('empty')
|
||||
this.container.classList.add(...this.cloneClass)
|
||||
|
||||
var clone = parser.parse([{...deepCopy(this.cloneTarget.props), ...this.getProp('props')}], this.widget, this)
|
||||
let clonedProps = deepCopy(this.cloneTarget.props)
|
||||
function resetAutoIds(ob){
|
||||
if(ob.widgets)
|
||||
for (const o of ob.widgets){resetAutoIds(o)}
|
||||
if( ob.id && ob.id.startsWith(ob.type+'_')){
|
||||
ob.id = "auto"
|
||||
}
|
||||
}
|
||||
resetAutoIds(clonedProps)
|
||||
var clone = parser.parse([{...clonedProps, ...this.getProp('props')}], this.widget, this)
|
||||
|
||||
if (clone.getProp('id') === this.cloneTarget.getProp('id')) {
|
||||
widgetManager.trigger('change.*', [{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue