Highlight groups

This commit is contained in:
Ian Gulliver
2019-07-10 23:46:25 +00:00
parent dda2102f99
commit c52f93d6d2
5 changed files with 31 additions and 2 deletions

View File

@@ -24,6 +24,7 @@ class EditorGroup extends EditorEntryBase {
type: 'group',
label: this.getLabel(),
members: this.nodes_.serialize(EditorNode),
highlight: this.elem_.classList.contains('highlight'),
};
}
@@ -46,6 +47,10 @@ class EditorGroup extends EditorEntryBase {
}
}
setHighlight(highlight) {
this.elem_.classList.toggle('highlight', highlight);
}
onKeyDown(e) {
super.onKeyDown(e);
@@ -57,6 +62,13 @@ class EditorGroup extends EditorEntryBase {
e.stopPropagation();
e.preventDefault();
break;
case ' ':
this.elem_.classList.toggle('highlight');
this.elem_.setAttribute('data-arch-value', '');
e.stopPropagation();
e.preventDefault();
break;
}
}
@@ -66,6 +78,7 @@ class EditorGroup extends EditorEntryBase {
if (ser.label != null) {
group.setLabel(ser.label);
}
group.setHighlight(ser.highlight);
group.nodes_.unserialize(ser.members);
return group.getElement();
}