editor data

This commit is contained in:
Mo Bitar
2017-02-26 21:10:49 -06:00
parent 2eefef7e60
commit ac2661bc6e
2 changed files with 24 additions and 3 deletions

View File

@@ -8,12 +8,14 @@ class Editor extends Item {
super.mapContentToLocalProperties(contentObject)
this.url = contentObject.url;
this.name = contentObject.name;
this.data = contentObject.data || {};
}
structureParams() {
var params = {
url: this.url,
name: this.name
name: this.name,
data: this.data
};
_.merge(params, super.structureParams());
@@ -27,4 +29,17 @@ class Editor extends Item {
get content_type() {
return "SN|Editor";
}
setData(key, value) {
var dataHasChanged = JSON.stringify(this.data[key]) !== JSON.stringify(value);
if(dataHasChanged) {
this.data[key] = value;
return true;
}
return false;
}
dataForKey(key) {
return this.data[key] || {};
}
}