[DE] Caption Dialog (saving labels in json)

This commit is contained in:
Julia Svinareva 2019-09-20 14:55:09 +03:00
parent cf9b79dd24
commit fcc65c820a

View file

@ -170,8 +170,7 @@ define([
arr = Common.localStorage.getItem("de-settings-captions") || ''; arr = Common.localStorage.getItem("de-settings-captions") || '';
Common.Utils.InternalSettings.set("de-settings-captions", arr); Common.Utils.InternalSettings.set("de-settings-captions", arr);
} }
arr = arr ? arr.split(';') : []; arr = arr ? JSON.parse(arr) : [];
arr = _.map(arr, function(str){ return { displayValue: str, value: str, type: 1 }; });
// 0 - not removable // 0 - not removable
this.arrLabel = arr.concat([{ displayValue: this.textEquation, value: this.textEquation, type: 0 }, this.arrLabel = arr.concat([{ displayValue: this.textEquation, value: this.textEquation, type: 0 },
@ -352,9 +351,10 @@ define([
}, },
close: function() { close: function() {
var val = _.pluck(_.where(this.arrLabel, {type: 1}), 'displayValue').join(';'); var val = _.where(this.arrLabel, {type: 1}),
Common.localStorage.setItem("de-settings-captions", val); valJson = JSON.stringify(val);
Common.Utils.InternalSettings.set("de-settings-captions", val); Common.localStorage.setItem("de-settings-captions", valJson);
Common.Utils.InternalSettings.set("de-settings-captions", valJson);
Common.Views.AdvancedSettingsWindow.prototype.close.apply(this, arguments); Common.Views.AdvancedSettingsWindow.prototype.close.apply(this, arguments);
}, },