rework 4df35b82: clear the different style's id

This commit is contained in:
tophf 2017-05-15 13:42:20 +03:00
parent 4df35b829b
commit 449f86e5ef

View File

@ -102,10 +102,18 @@ function importFromString(jsonString) {
item.name = item.name.trim();
const byId = BG.cachedStyles.byId.get(item.id);
const byName = oldStylesByName.get(item.name);
const oldStyle = byId && sameStyle(byId, item) ? byId : byName;
oldStylesByName.delete(item.name);
if (oldStyle == byName && byName) {
let oldStyle;
if (byId) {
if (sameStyle(byId, item)) {
oldStyle = byId;
} else {
item.id = null;
}
}
if (!oldStyle && byName) {
item.id = byName.id;
oldStyle = byName;
}
const oldStyleKeys = oldStyle && Object.keys(oldStyle);
const metaEqual = oldStyleKeys &&