summaryrefslogtreecommitdiff
path: root/public/assets/javascripts/ui/editor/MediaEditor.js
diff options
context:
space:
mode:
Diffstat (limited to 'public/assets/javascripts/ui/editor/MediaEditor.js')
-rw-r--r--public/assets/javascripts/ui/editor/MediaEditor.js14
1 files changed, 13 insertions, 1 deletions
diff --git a/public/assets/javascripts/ui/editor/MediaEditor.js b/public/assets/javascripts/ui/editor/MediaEditor.js
index 9b81db1..9a3c355 100644
--- a/public/assets/javascripts/ui/editor/MediaEditor.js
+++ b/public/assets/javascripts/ui/editor/MediaEditor.js
@@ -161,7 +161,7 @@ var MediaEditor = FormView.extend({
unbind: function(){
if (this.scenery) {
- if (this.tainted) {
+ if (this.tainted && this.scenery.media) {
this.scenery.media.title = this.$name.val()
this.scenery.media.description = this.$description.val()
Minotaur.watch( app.router.editorView.settings )
@@ -178,8 +178,20 @@ var MediaEditor = FormView.extend({
destroy: function(){
var scenery = this.scenery
this.hide()
+
+ UndoStack.push({
+ type: 'destroy-scenery',
+ undo: scenery.serialize(),
+ redo: { id: scenery.id },
+ })
+
+ // TODO: watch individual scenery object here
+ Minotaur.watch( app.router.editorView.settings )
+
Scenery.remove(scenery.id)
Scenery.resize.hide()
+ this.tainted = false
+ this.scenery = null
},
})