Files
architype/EditorNode.js

33 lines
687 B
JavaScript
Raw Normal View History

class EditorNode extends EditorInputBase {
constructor(id, label) {
super(id, label);
2019-07-03 01:42:17 +00:00
this.elem_.classList.add('node');
this.input_.placeholder = 'node name';
}
serialize() {
return super.serialize({
2019-07-03 01:42:17 +00:00
type: 'node',
});
2019-07-03 01:42:17 +00:00
}
isSoft() {
// Nested nodes are presumed to be references to other nodes if they exist
for (let iter = this.elem_.parentElement; iter; iter = iter.parentElement) {
if (iter.xArchObj) {
return true;
}
}
return false;
}
static unserialize(ser) {
let node = new EditorNode(ser.id);
2019-07-03 01:42:17 +00:00
node.setLabel(ser.label);
2019-07-10 23:19:39 +00:00
node.setHighlight(ser.highlight);
2019-07-03 01:42:17 +00:00
return node.getElement();
}
}