Centralize backwards compat
This commit is contained in:
15
Architype.js
15
Architype.js
@@ -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();
|
||||
|
||||
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user