OSDN Git Service

conflict
[pettanr/pettanr.git] / app / assets / javascripts / views / speech_balloons / new_element.js.coffee
index 2e7d451..0248d43 100644 (file)
@@ -69,14 +69,16 @@ class Pettanr.Views.SpeechBalloon.NewElement extends Pettanr.View
               new_item = new @target_model(item.attributes)\r
               new_item.unset('id', {silent: true})\r
               new_item.set({panel_id: @editor().item.get('id')}, {silent: true})\r
-              balloon.unset('id', {silent: true})\r
-              balloon.unset('speech_balloon_id', {silent: true})\r
-              speech.unset('id', {silent: true})\r
-              speech.unset('speech_balloon_id', {silent: true})\r
+              new_balloon = balloon.clone()\r
+              new_balloon.unset('id', {silent: true})\r
+              new_balloon.unset('speech_balloon_id', {silent: true})\r
+              new_speech = speech.clone()\r
+              new_speech.unset('id', {silent: true})\r
+              new_speech.unset('speech_balloon_id', {silent: true})\r
               new_item.boosts 'post'\r
-              balloon.boosts 'post'\r
-              speech.boosts 'post'\r
-              new_item.set({balloon: balloon, speech: speech}, {silent: true})\r
+              new_balloon.boosts 'post'\r
+              new_speech.boosts 'post'\r
+              new_item.set({balloon: new_balloon, speech: new_speech}, {silent: true})\r
               @trigger('ready', new_item)\r
           })\r
       })\r