Fixes . Passing in the raw attributes to the component settings treema would edit the data before the component's set method would get a snapshot of the original data for whatever was the first change in the data.

This commit is contained in:
Scott Erickson 2014-07-04 20:45:42 -07:00
parent 0a139fdbb3
commit b635c4cf16
2 changed files with 2 additions and 1 deletions
app
models
views/editor/level/component

View file

@ -211,7 +211,7 @@ class CocoModel extends Backbone.Model
try
jsondiffpatch.patch newAttributes, delta
catch error
console.error 'Error applying delta', delta, 'to attributes', newAttributes, error
console.error 'Error applying delta\n', JSON.stringify(delta, null, '\t'), '\n\nto attributes\n\n', newAttributes
return false
@set newAttributes
return true

View file

@ -45,6 +45,7 @@ module.exports = class LevelComponentEditView extends View
buildSettingsTreema: ->
data = _.pick @levelComponent.attributes, (value, key) => key in @editableSettings
data = $.extend(true, {}, data)
schema = _.cloneDeep LevelComponent.schema
schema.properties = _.pick schema.properties, (value, key) => key in @editableSettings
schema.required = _.intersection schema.required, @editableSettings