fixed refacto of this.buildosUrl
This commit is contained in:
@@ -10,26 +10,36 @@
|
||||
* This code is free to use and modify,
|
||||
* as long as the copyright notice and license are kept.
|
||||
*/
|
||||
const scriptUrl = document.currentScript.src
|
||||
|
||||
class BZgrafloweditor extends Buildoz{
|
||||
constructor(){
|
||||
super()
|
||||
this.defaultAttrs = { }
|
||||
|
||||
}
|
||||
|
||||
|
||||
connectedCallback() {
|
||||
super.connectedCallback()
|
||||
const nodesUrl = this.getBZAttribute('nodes')
|
||||
this.mainContainer = document.createElement('div')
|
||||
this.mainContainer.classList.add('bzgfe-main-container')
|
||||
this.nodesContainer = document.createElement('div')
|
||||
this.nodesContainer.classList.add('bzgf-nodes-container')
|
||||
this.nodesContainer.classList.add('bzgfe-nodes-container')
|
||||
this.mainContainer.append(this.nodesContainer)
|
||||
this.graflow = document.createElement('bz-graflow')
|
||||
this.graflow.setAttribute('nodes', nodesUrl)
|
||||
this.mainContainer.append(this.graflow)
|
||||
this.append(this.mainContainer)
|
||||
|
||||
this.graflow.addEventListener('bz:graflow:nodesLoaded', this.refreshNodes.bind(this))
|
||||
this.graflow.loadNodes(nodesUrl)
|
||||
|
||||
}
|
||||
|
||||
refreshNodes(e){
|
||||
for(const nodeType in this.graflow.nodesRegistry){
|
||||
const nodeDef = this.graflow.nodesRegistry[nodeType]
|
||||
this.nodesContainer.append(nodeDef.cloneNode(true))
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
Buildoz.define('graflow', BZgraflow)
|
||||
Buildoz.define('grafloweditor', BZgrafloweditor)
|
||||
Reference in New Issue
Block a user