From 968a53c34e292e5e2f64a0f5dc9c09a72ad50c21 Mon Sep 17 00:00:00 2001 From: Ian Gulliver Date: Mon, 15 Jul 2019 01:15:55 +0000 Subject: [PATCH] Centralize backwards compat --- Architype.js | 15 +++++++++++++++ EditorGroup.js | 4 ---- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/Architype.js b/Architype.js index 4ca3e52..9fd49cf 100644 --- a/Architype.js +++ b/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(); diff --git a/EditorGroup.js b/EditorGroup.js index 682f90c..fb77061 100644 --- a/EditorGroup.js +++ b/EditorGroup.js @@ -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) {