Centralize backwards compat

This commit is contained in:
Ian Gulliver
2019-07-15 01:15:55 +00:00
parent b938ce2d97
commit 968a53c34e
2 changed files with 15 additions and 4 deletions

View File

@@ -110,6 +110,7 @@ class Architype {
switch (ser.version) {
case 1:
this.backwardCompat1(ser);
this.generation_ = ser.generation;
idSource.setId(ser.nextId);
this.editor_.unserialize(ser.editor);
@@ -129,6 +130,20 @@ class Architype {
}
}
backwardCompat1(ser) {
for (let item of ser.editor) {
// 3bdb240
if ((item.type == 'link' || item.type == 'group') &&
item.label != null &&
item.labelObj == undefined) {
console.log('backwards compat 3bdb240', item);
item.labelObj = {
highlight: false,
};
}
}
}
overwrite(ser) {
this.unobserve();
this.editor_.clear();

View File

@@ -26,10 +26,6 @@ class EditorGroup extends EditorSublistBase {
}
static unserialize(ser) {
//// Backwards compat
// 3bdb240
ser.labelObj = ser.labelObj || {};
let group = new EditorGroup(ser.id);
group.nodes_.clear();
if (ser.label != null) {