0

我正在尝试将长字符串放入 JS 对象中。我使用的代码可以正常工作:

 parent.$("#data-store").data("content[<%=n%>]" , "<%= @content[n.to_s].squish %>");

所以我的对象看起来像这样:

content[0]: "&lt;div class=&quot;ui-wrapper ui-draggable&quot; style=&quot;overflow: hidden; position: absolute; width: 219px; height: 194px; top: 313.31597900390625px; left: 81.32640075683594px; margin: 0px;&quot;&gt;&lt;img id=&quot;link0&quot; style=&quot;position: static; margin: 0px; resize: none; zoom: 1; display: block; height: 194px; width: 219px;&quot; src=&quot;http://i.imgur.com/5H8QhMr.png&quot; class=&quot;ui-resizable&quot;&gt;&lt;div class=&quot;ui-resizable-handle ui-resizable-e&quot; style=&quot;z-index: 90;&quot;&gt;&lt;/div&gt;&lt;div class=&quot;ui-resizable-handle ui-resizable-s&quot; style=&quot;z-index: 90;&quot;&gt;&lt;/div&gt;&lt;div class=&quot;ui-resizable-handle ui-resizable-se ui-icon ui-icon-gripsmall-diagonal-se&quot; style=&quot;z-index: 90;&quot;&gt;&lt;/div&gt;&lt;img class=&quot;icon-layer-up icon-on-img&quot; src=&quot;/assets/icon_layer_up.png&quot; style=&quot;z-index: 2;&quot;&gt;&lt;img class=&quot;icon-layer-down icon-on-img&quot; src=&quot;/assets/icon_layer_down.png&quot; style=&quot;z-index: 2;&quot;&gt;&lt;img class=&quot;icon-trash1 icon-on-img&quot; src=&quot;/assets/icon_trash.png&quot; style=&quot;z-index: 2;&quot;&gt;&lt;img class=&quot;icon-copy-el icon-on-img&quot; src=&quot;/assets/icon_copy.png&quot; style=&quot;z-index: 2;&quot;&gt;&lt;img class=&quot;icon-layer-up icon-on-img&quot; src=&quot;/assets/icon_layer_up.png&quot; style=&quot;z-index: 2;&quot;&gt;&lt;img class=&quot;icon-layer-down icon-on-img&quot; src=&quot;/assets/icon_layer_down.png&quot; style=&quot;z-index: 2;&quot;&gt;&lt;img class=&quot;icon-trash1 icon-on-img&quot; src=&quot;/assets/icon_trash.png&quot; style=&quot;z-index: 2;&quot;&gt;&lt;img class=&quot;icon-copy-el icon-on-img&quot; src=&quot;/assets/icon_copy.png&quot; style=&quot;z-index: 2;&quot;&gt;&lt;img class=&quot;icon-layer-up icon-on-img&quot; src=&quot;/assets/icon_layer_up.png&quot; style=&quot;z-index: 2;&quot;&gt;&lt;img class=&quot;icon-layer-down icon-on-img&quot; src=&quot;/assets/icon_layer_down.png&quot; style=&quot;z-index: 2;&quot;&gt;&lt;img class=&quot;icon-trash1 icon-on-img&quot; src=&quot;/assets/icon_trash.png&quot; style=&quot;z-index: 2;&quot;&gt;&lt;img class=&quot;icon-copy-el icon-on-img&quot; src=&quot;/assets/icon_copy.png&quot; style=&quot;z-index: 2;&quot;&gt;&lt;img class=&quot;icon-layer-up icon-on-img&quot; src=&quot;/assets/icon_layer_up.png&quot; style=&quot;z-index: 2;&quot;&gt;&lt;img class=&quot;icon-layer-down icon-on-img&quot; src=&quot;/assets/icon_layer_down.png&quot; style=&quot;z-index: 2;&quot;&gt;&lt;img class=&quot;icon-trash1 icon-on-img&quot; src=&quot;/assets/icon_trash.png&quot; style=&quot;z-index: 2;&quot;&gt;&lt;img class=&quot;icon-copy-el icon-on-img&quot; src=&quot;/assets/icon_copy.png&quot; style=&quot;z-index: 2;&quot;&gt;&lt;img class=&quot;icon-layer-up icon-on-img&quot; src=&quot;/assets/icon_layer_up.png&quot; style=&quot;z-index: 2;&quot;&gt;&lt;img class=&quot;icon-layer-down icon-on-img&quot; src=&quot;/assets/icon_layer_down.png&quot; style=&quot;z-index: 2;&quot;&gt;&lt;img class=&quot;icon-trash1 icon-on-img&quot; src=&quot;/assets/icon_trash.png&quot; style=&quot;z-index: 2;&quot;&gt;&lt;img class=&quot;icon-copy-el icon-on-img&quot; src=&quot;/assets/icon_copy.png&quot; style=&quot;z-index: 2;&quot;&gt;&lt;img class=&quot;icon-layer-up icon-on-img&quot; src=&quot;/assets/icon_layer_up.png&quot; style=&quot;z-index: 2;&quot;&gt;&lt;img class=&quot;icon-layer-down icon-on-img&quot; src=&quot;/assets/icon_layer_down.png&quot; style=&quot;z-index: 2;&quot;&gt;&lt;img class=&quot;icon-trash1 icon-on-img&quot; src=&quot;/assets/icon_trash.png&quot; style=&quot;z-index: 2;&quot;&gt;&lt;img class=&quot;icon-copy-el icon-on-img&quot; src=&quot;/assets/icon_copy.png&quot; style=&quot;z-index: 2;&quot;&gt;&lt;img class=&quot;icon-layer-up icon-on-img&quot; src=&quot;/assets/icon_layer_up.png&quot; style=&quot;z-index: 2;&quot;&gt;&lt;img class=&quot;icon-layer-down icon-on-img&quot; src=&quot;/assets/icon_layer_down.png&quot; style=&quot;z-index: 2;&quot;&gt;&lt;img class=&quot;icon-trash1 icon-on-img&quot; src=&quot;/assets/icon_trash.png&quot; style=&quot;z-index: 2;&quot;&gt;&lt;img class=&quot;icon-copy-el icon-on-img&quot; src=&quot;/assets/icon_copy.png&quot; style=&quot;z-index: 2;&quot;&gt;&lt;/div&gt; &lt;div class=&quot;editor ui-resizable ui-draggable&quot; contenteditable=&quot;true&quot; style=&quot;position: absolute; top: 124.3125px; left: 185.3229217529297px; width: 549px; height: 254px;&quot;&gt;&lt;h2 class=&quot;text2&quot; style=&quot;font-size: 4em; font-family: Allura;&quot;&gt;ddsadasd&lt;/h2&gt;&lt;div class=&quot;ui-resizable-handle ui-resizable-e&quot; style=&quot;z-index: 90;&quot;&gt;&lt;/div&gt;&lt;div class=&quot;ui-resizable-handle ui-resizable-s&quot; style=&quot;z-index: 90;&quot;&gt;&lt;/div&gt;&lt;div class=&quot;ui-resizable-handle ui-resizable-se ui-icon ui-icon-gripsmall-diagonal-se&quot; style=&quot;z-index: 90;&quot;&gt;&lt;/div&gt;&lt;img class=&quot;icon-layer-up2 icon-on-edit&quot; src=&quot;/assets/icon_layer_up.png&quot; style=&quot;z-index: 2;&quot;&gt;&lt;img class=&quot;icon-layer-down2 icon-on-edit&quot; src=&quot;/assets/icon_layer_down.png&quot; style=&quot;z-index: 2;&quot;&gt;&lt;img class=&quot;icon-trash2 icon-on-edit&quot; src=&quot;/assets/icon_trash.png&quot; style=&quot;z-index: 2;&quot;&gt;&lt;i class=&quot;icon-move icon-on-edit&quot; style=&quot;z-index: 2;&quot;&gt;&lt;/i&gt;&lt;i class=&quot;icon-font font2 icon-on-edit&quot; style=&quot;z-index: 2;&quot;&gt;&lt;/i&gt;&lt;img class=&quot;icon-font-size icon-on-edit&quot; src=&quot;/assets/font_size2.png&quot; style=&quot;z-index: 2;&quot;&gt;&lt;img class=&quot;icon-layer-up2 icon-on-edit&quot; src=&quot;/assets/icon_layer_up.png&quot; style=&quot;z-index: 2;&quot;&gt;&lt;img class=&quot;icon-layer-down2 icon-on-edit&quot; src=&quot;/assets/icon_layer_down.png&quot; style=&quot;z-index: 2;&quot;&gt;&lt;img class=&quot;icon-trash2 icon-on-edit&quot; src=&quot;/assets/icon_trash.png&quot; style=&quot;z-index: 2;&quot;&gt;&lt;i class=&quot;icon-move icon-on-edit&quot; style=&quot;z-index: 2;&quot;&gt;&lt;/i&gt;&lt;i class=&quot;icon-font font2 icon-on-edit&quot; style=&quot;z-index: 2;&quot;&gt;&lt;/i&gt;&lt;img class=&quot;icon-font-size icon-on-edit&quot; src=&quot;/assets/font_size2.png&quot; style=&quot;z-index: 2;&quot;&gt;&lt;img class=&quot;icon-layer-up2 icon-on-edit&quot; src=&quot;/assets/icon_layer_up.png&quot; style=&quot;z-index: 2;&quot;&gt;&lt;img class=&quot;icon-layer-down2 icon-on-edit&quot; src=&quot;/assets/icon_layer_down.png&quot; style=&quot;z-index: 2;&quot;&gt;&lt;img class=&quot;icon-trash2 icon-on-edit&quot; src=&quot;/assets/icon_trash.png&quot; style=&quot;z-index: 2;&quot;&gt;&lt;i class=&quot;icon-move icon-on-edit&quot; style=&quot;z-index: 2;&quot;&gt;&lt;/i&gt;&lt;i class=&quot;icon-font font2 icon-on-edit&quot; style=&quot;z-index: 2;&quot;&gt;&lt;/i&gt;&lt;img class=&quot;icon-font-size icon-on-edit active&quot; src=&quot;/assets/font_size2.png&quot; style=&quot;z-index: 2;&quot;&gt;&lt;div class=&quot;fonts-size-container active&quot; style=&quot;display: none;&quot;&gt; &lt;ul class=&quot;no-edit&quot;&gt; &lt;li class=&quot;no-edit&quot; data-fontsize=&quot;8em&quot;&gt;8 em&lt;/li&gt; &lt;li class=&quot;no-edit&quot; data-fontsize=&quot;7em&quot;&gt;7 em&lt;/li&gt; &lt;li class=&quot;no-edit&quot; data-fontsize=&quot;6em&quot;&gt;6 em&lt;/li&gt; &lt;li class=&quot;no-edit&quot; data-fontsize=&quot;5em&quot;&gt;5 em&lt;/li&gt; &lt;li class=&quot;no-edit&quot; data-fontsize=&quot;4em&quot;&gt;4 em&lt;/li&gt; &lt;li class=&quot;no-edit&quot; data-fontsize=&quot;3.5em&quot;&gt;3,5 em&lt;/li&gt; &lt;li class=&quot;no-edit&quot; data-fontsize=&quot;3em&quot;&gt;3 em&lt;/li&gt; &lt;li class=&quot;no-edit&quot; data-fontsize=&quot;2.5em&quot;&gt;2.5 em&lt;/li&gt; &lt;li class=&quot;no-edit&quot; data-fontsize=&quot;2em&quot;&gt;2 em&lt;/li&gt; &lt;li class=&quot;no-edit&quot; data-fontsize=&quot;1.5em&quot;&gt;1.5 em&lt;/li&gt; &lt;li class=&quot;no-edit&quot; data-fontsize=&quot;1.3em&quot;&gt;1.3 em&lt;/li&gt; &lt;li class=&quot;no-edit&quot; data-fontsize=&quot;1.2em&quot;&gt;1.2 em&lt;/li&gt; &lt;li class=&quot;no-edit&quot; data-fontsize=&quot;1em&quot;&gt;1 em&lt;/li&gt; &lt;li class=&quot;no-edit&quot; data-fontsize=&quot;0.8em&quot;&gt;0.8 em&lt;/li&gt; &lt;li class=&quot;no-edit&quot; data-fontsize=&quot;0.6em&quot;&gt;0.6 em&lt;/li&gt; &lt;li class=&quot;no-edit&quot; data-fontsize=&quot;0.5em&quot;&gt;0.5 em&lt;/li&gt; &lt;/ul&gt; &lt;/div&gt;&lt;img class=&quot;icon-layer-up2 icon-on-edit&quot; src=&quot;/assets/icon_layer_up.png&quot; style=&quot;z-index: 2;&quot;&gt;&lt;img class=&quot;icon-layer-down2 icon-on-edit&quot; src=&quot;/assets/icon_layer_down.png&quot; style=&quot;z-index: 2;&quot;&gt;&lt;img class=&quot;icon-trash2 icon-on-edit&quot; src=&quot;/assets/icon_trash.png&quot; style=&quot;z-index: 2;&quot;&gt;&lt;i class=&quot;icon-move icon-on-edit&quot; style=&quot;z-index: 2;&quot;&gt;&lt;/i&gt;&lt;i class=&quot;icon-font font2 icon-on-edit&quot; style=&quot;z-index: 2;&quot;&gt;&lt;/i&gt;&lt;img class=&quot;icon-font-size icon-on-edit&quot; src=&quot;/assets/font_size2.png&quot; style=&quot;z-index: 2;&quot;&gt;&lt;div class=&quot;fonts-container&quot; style=&quot;display: none;&quot;&gt; &lt;ul class=&quot;no-edit&quot;&gt; &lt;li class=&quot;no-edit&quot; data-fontname=&quot;Abril Fatface&quot;&gt;&lt;img class=&quot;icon-on-edit&quot; src=&quot;/assets/fonts/Abril-Fatface.png&quot; style=&quot;z-index: 2;&quot;&gt;&lt;/li&gt; &lt;li class=&quot;no-edit&quot; data-fontname=&quot;Alegreya Small Caps&quot;&gt;&lt;img class=&quot;icon-on-edit&quot; src=&quot;/assets/fonts/Alegreya-Small-Caps.png&quot; style=&quot;z-index: 2;&quot;&gt;&lt;/li&gt; &lt;li class=&quot;no-edit&quot; data-fontname=&quot;Alfa Slab One&quot;&gt;&lt;img class=&quot;icon-on-edit&quot; src=&quot;/assets/fonts/Alfa-Slab-One.png&quot; style=&quot;z-index: 2;&quot;&gt;&lt;/li&gt; &lt;li class=&quot;no-edit&quot; data-fontname=&quot;Alike&quot;&gt;&lt;img class=&quot;icon-on-edit&quot; src=&quot;/assets/fonts/Alike.png&quot; style=&quot;z-index: 2;&quot;&gt;&lt;/li&gt; &lt;li class=&quot;no-edit&quot; data-fontname=&quot;Allerta Stencil&quot;&gt;&lt;img class=&quot;icon-on-edit&quot; src=&quot;/assets/fonts/Allerta-Stencil.png&quot; style=&quot;z-index: 2;&quot;&gt;&lt;/li&gt; &lt;li class=&quot;no-edit&quot; data-fontname=&quot;Allura&quot;&gt;&lt;img class=&quot;icon-on-edit&quot; src=&quot;/assets/fonts/Allura.png&quot; style=&quot;z-index: 2;&quot;&gt;&lt;/li&gt; &lt;li class=&quot;no-edit&quot; data-fontname=&quot;Amaranth&quot;&gt;&lt;img class=&quot;icon-on-edit&quot; src=&quot;/assets/fonts/Amaranth.png&quot; style=&quot;z-index: 2;&quot;&gt;&lt;/li&gt; &lt;li class=&quot;no-edit&quot; data-fontname=&quot;Amatic SC&quot;&gt;&lt;img class=&quot;icon-on-edit&quot; src=&quot;/assets/fonts/Amatic-Small-Caps.png&quot; style=&quot;z-index: 2;&quot;&gt;&lt;/li&gt; &lt;li class=&quot;no-edit&quot; data-fontname=&quot;Anonymous Pro&quot;&gt;&lt;img class=&quot;icon-on-edit&quot; src=&quot;/assets/fonts/Anonymous-Pro.png &quot; style=&quot;z-index: 2;&quot;&gt;&lt;/li&gt; &lt;li class=&quot;no-edit&quot; data-fontname=&quot;Antic&quot;&gt;&lt;img class=&quot;icon-on-edit&quot; src=&quot;/assets/fonts/Antic.png &quot; style=&quot;z-index: 2;&quot;&gt;&lt;/li&gt; &lt;li class=&quot;no-edit&quot; data-fontname=&quot;Anton&quot;&gt;&lt;img class=&quot;icon-on-edit&quot; src=&quot;/assets/fonts/Anton.png &quot; style=&quot;z-index: 2;&quot;&gt;&lt;/li&gt; &lt;li class=&quot;no-edit&quot; data-fontname=&quot;Architects Daughter&quot;&gt;&lt;img class=&quot;icon-on-edit&quot; src=&quot;/assets/fonts/Architects-Daughter.png &quot; style=&quot;z-index: 2;&quot;&gt;&lt;/li&gt; &lt;li class=&quot;no-edit&quot; data-fontname=&quot;Archivo Narrow&quot;&gt;&lt;img class=&quot;icon-on-edit&quot; src=&quot;/assets/fonts/Archivo-Narrow.png &quot; style=&quot;z-index: 2;&quot;&gt;&lt;/li&gt; &lt;li class=&quot;no-edit&quot; data-fontname=&quot;Arimo&quot;&gt;&lt;img class=&quot;icon-on-edit&quot; src=&quot;/assets/fonts/Arimo.png &quot; style=&quot;z-index: 2;&quot;&gt;&lt;/li&gt; &lt;li class=&quot;no-edit&quot; data-fontname=&quot;Arvo&quot;&gt;&lt;img class=&quot;icon-on-edit&quot; src=&quot;/assets/fonts/Arvo.png &quot; style=&quot;z-index: 2;&quot;&gt;&lt;/li&gt; &lt;li class=&quot;no-edit&quot; data-fontname=&quot;Berkshire Swash&quot;&gt;&lt;img class=&quot;icon-on-edit&quot; src=&quot;/assets/fonts/Berkshire-Swash.png &quot; style=&quot;z-index: 2;&quot;&gt;&lt;/li&gt; &lt;li class=&quot;no-edit&quot; data-fontname=&quot;Black Ops One&quot;&gt;&lt;img class=&quot;icon-on-edit&quot; src=&quot;/assets/fonts/Black-Ops-One.png &quot; style=&quot;z-index: 2;&quot;&gt;&lt;/li&gt; &lt;li class=&quot;no-edit&quot; data-fontname=&quot;Cabin Sketch&quot;&gt;&lt;img class=&quot;icon-on-edit&quot; src=&quot;/assets/fonts/Cabin-Sketch.png &quot; style=&quot;z-index: 2;&quot;&gt;&lt;/li&gt; &lt;li class=&quot;no-edit&quot; data-fontname=&quot;Cantora One&quot;&gt;&lt;img class=&quot;icon-on-edit&quot; src=&quot;/assets/fonts/Cantora-One.png &quot; style=&quot;z-index: 2;&quot;&gt;&lt;/li&gt; &lt;li class=&quot;no-edit&quot; data-fontname=&quot;Carter One&quot;&gt;&lt;img class=&quot;icon-on-edit&quot; src=&quot;/assets/fonts/Carter-One.png &quot; style=&quot;z-index: 2;&quot;&gt;&lt;/li&gt; &lt;li class=&quot;no-edit&quot; data-fontname=&quot;Chewy&quot;&gt;&lt;img class=&quot;icon-on-edit&quot; src=&quot;/assets/fonts/Chewy.png&quot; style=&quot;z-index: 2;&quot;&gt;&lt;/li&gt; &lt;li class=&quot;no-edit&quot; data-fontname=&quot;Cinzel&quot;&gt;&lt;img class=&quot;icon-on-edit&quot; src=&quot;/assets/fonts/Cinzel.png &quot; style=&quot;z-index: 2;&quot;&gt;&lt;/li&gt; &lt;li class=&quot;no-edit&quot; data-fontname=&quot;Clicker Script&quot;&gt;&lt;img class=&quot;icon-on-edit&quot; src=&quot;/assets/fonts/Clicker-Script.png &quot; style=&quot;z-index: 2;&quot;&gt;&lt;/li&gt; &lt;li class=&quot;no-edit&quot; data-fontname=&quot;Codystar&quot;&gt;&lt;img class=&quot;icon-on-edit&quot; src=&quot;/assets/fonts/Codystar.png &quot; style=&quot;z-index: 2;&quot;&gt;&lt;/li&gt; &lt;li class=&quot;no-edit&quot; data-fontname=&quot;Courgette&quot;&gt;&lt;img class=&quot;icon-on-edit&quot; src=&quot;/assets/fonts/Courgette.png &quot; style=&quot;z-index: 2;&quot;&gt;&lt;/li&gt; &lt;li class=&quot;no-edit&quot; data-fontname=&quot;Coustard&quot;&gt;&lt;img class=&quot;icon-on-edit&quot; src=&quot;/assets/fonts/Coustard.png &quot; style=&quot;z-index: 2;&quot;&gt;&lt;/li&gt; &lt;li class=&quot;no-edit&quot; data-fontname=&quot;Crafty Girls&quot;&gt;&lt;img class=&quot;icon-on-edit&quot; src=&quot;/assets/fonts/Crafty-Girls.png &quot; style=&quot;z-index: 2;&quot;&gt;&lt;/li&gt; &lt;li class=&quot;no-edit&quot; data-fontname=&quot;Creepster&quot;&gt;&lt;img class=&quot;icon-on-edit&quot; src=&quot;/assets/fonts/Creepster.png &quot; style=&quot;z-index: 2;&quot;&gt;&lt;/li&gt; &lt;li class=&quot;no-edit&quot; data-fontname=&quot;Crushed&quot;&gt;&lt;img class=&quot;icon-on-edit&quot; src=&quot;/assets/fonts/Crushed.png&quot; style=&quot;z-index: 2;&quot;&gt;&lt;/li&gt; &lt;li class=&quot;no-edit&quot; data-fontname=&quot;Diplomata SC&quot;&gt;&lt;img class=&quot;icon-on-edit&quot; src=&quot;/assets/fonts/Diplomata-Small-Caps.png &quot; style=&quot;z-index: 2;&quot;&gt;&lt;/li&gt; &lt;li class=&quot;no-edit&quot; data-fontname=&quot;Dr Sugiyama&quot;&gt;&lt;img class=&quot;icon-on-edit&quot; src=&quot;/assets/fonts/Dr-Sugiyama.png&quot; style=&quot;z-index: 2;&quot;&gt;&lt;/li&gt; &lt;li class=&quot;no-edit&quot; data-fontname=&quot;Droid Serif&quot;&gt;&lt;img class=&quot;icon-on-edit&quot; src=&quot;/assets/fonts/Droid-Serif.png &quot; style=&quot;z-index: 2;&quot;&gt;&lt;/li&gt; &lt;li class=&quot;no-edit&quot; data-fontname=&quot;Economica&quot;&gt;&lt;img class=&quot;icon-on-edit&quot; src=&quot;/assets/fonts/Economica.png &quot; style=&quot;z-index: 2;&quot;&gt;&lt;/li&gt; &lt;li class=&quot;no-edit&quot; data-fontname=&quot;Emilys Candy&quot;&gt;&lt;img class=&quot;icon-on-edit&quot; src=&quot;/assets/fonts/Emilys-Candy.png &quot; style=&quot;z-index: 2;&quot;&gt;&lt;/li&gt; &lt;li class=&quot;no-edit&quot; data-fontname=&quot;Fredoka One&quot;&gt;&lt;img class=&quot;icon-on-edit&quot; src=&quot;/assets/fonts/Fredoka-One.png &quot; style=&quot;z-index: 2;&quot;&gt;&lt;/li&gt; &lt;li class=&quot;no-edit&quot; data-fontname=&quot;Germania One&quot;&gt;&lt;img class=&quot;icon-on-edit&quot; src=&quot;/assets/fonts/Germania-One.png &quot; style=&quot;z-index: 2;&quot;&gt;&lt;/li&gt; &lt;li class=&quot;no-edit&quot; data-fontname=&quot;Glass Antiqua&quot;&gt;&lt;img class=&quot;icon-on-edit&quot; src=&quot;/assets/fonts/Glass-Antiqua.png &quot; style=&quot;z-index: 2;&quot;&gt;&lt;/li&gt; &lt;li class=&quot;no-edit&quot; data-fontname=&quot;Glegoo&quot;&gt;&lt;img class=&quot;icon-on-edit&quot; src=&quot;/assets/fonts/Glegoo.png &quot; style=&quot;z-index: 2;&quot;&gt;&lt;/li&gt; &lt;/ul&gt; &lt;/div&gt;&lt;img class=&quot;icon-layer-up2 icon-on-edit&quot; src=&quot;/assets/icon_layer_up.png&quot; style=&quot;z-index: 2;&quot;&gt;&lt;img class=&quot;icon-layer-down2 icon-on-edit&quot; src=&quot;/assets/icon_layer_down.png&quot; style=&quot;z-index: 2;&quot;&gt;&lt;img class=&quot;icon-trash2 icon-on-edit&quot; src=&quot;/assets/icon_trash.png&quot; style=&quot;z-index: 2;&quot;&gt;&lt;i class=&quot;icon-move icon-on-edit&quot; style=&quot;z-index: 2;&quot;&gt;&lt;/i&gt;&lt;i class=&quot;icon-font font2 icon-on-edit&quot; style=&quot;z-index: 2;&quot;&gt;&lt;/i&gt;&lt;img class=&quot;icon-font-size icon-on-edit&quot; src=&quot;/assets/font_size2.png&quot; style=&quot;z-index: 2;&quot;&gt;&lt;div class=&quot;fonts-size-container&quot; style=&quot;display: none;&quot;&gt; &lt;ul class=&quot;no-edit&quot;&gt; &lt;li class=&quot;no-edit&quot; data-fontsize=&quot;8em&quot;&gt;8 em&lt;/li&gt; &lt;li class=&quot;no-edit&quot; data-fontsize=&quot;7em&quot;&gt;7 em&lt;/li&gt; &lt;li class=&quot;no-edit&quot; data-fontsize=&quot;6em&quot;&gt;6 em&lt;/li&gt; &lt;li class=&quot;no-edit&quot; data-fontsize=&quot;5em&quot;&gt;5 em&lt;/li&gt; &lt;li class=&quot;no-edit activefont&quot; data-fontsize=&quot;4em&quot;&gt;4 em&lt;i class=&quot;icon-check&quot;&gt;&lt;/i&gt;&lt;/li&gt; &lt;li class=&quot;no-edit&quot; data-fontsize=&quot;3.5em&quot;&gt;3,5 em&lt;/li&gt; &lt;li class=&quot;no-edit&quot; data-fontsize=&quot;3em&quot;&gt;3 em&lt;/li&gt; &lt;li class=&quot;no-edit&quot; data-fontsize=&quot;2.5em&quot;&gt;2.5 em&lt;/li&gt; &lt;li class=&quot;no-edit&quot; data-fontsize=&quot;2em&quot;&gt;2 em&lt;/li&gt; &lt;li class=&quot;no-edit&quot; data-fontsize=&quot;1.5em&quot;&gt;1.5 em&lt;/li&gt; &lt;li class=&quot;no-edit&quot; data-fontsize=&quot;1.3em&quot;&gt;1.3 em&lt;/li&gt; &lt;li class=&quot;no-edit&quot; data-fontsize=&quot;1.2em&quot;&gt;1.2 em&lt;/li&gt; &lt;li class=&quot;no-edit&quot; data-fontsize=&quot;1em&quot;&gt;1 em&lt;/li&gt; &lt;li class=&quot;no-edit&quot; data-fontsize=&quot;0.8em&quot;&gt;0.8 em&lt;/li&gt; &lt;li class=&quot;no-edit&quot; data-fontsize=&quot;0.6em&quot;&gt;0.6 em&lt;/li&gt; &lt;li class=&quot;no-edit&quot; data-fontsize=&quot;0.5em&quot;&gt;0.5 em&lt;/li&gt; &lt;/ul&gt; &lt;/div&gt;&lt;/div&gt;"

但是当我想通过构成 JS 对象并获取参数 @content 来生成 HTML 并且我想在 HTML 中呈现它时:

<div class="step-wrapper">            
         <%=
            if @content.nil? || @content[n.to_s].nil?
            else
              @content[n.to_s].html_safe

            end
          %>
        </div>

我得到的是用引号 "" 包裹的 HTML,因此 HTML 代码形式 @content 显示为文本。

在打印到 div 时,我应该使用哪种正则表达式从引号中解开这个对象?

带有 html_safe 的代码给了我 JS 错误,在这种情况下我无法使用它。

parent.$("#data-store").data("content[<%=n%>]" , "<%= @content[n.to_s].squish.html_safe %>");
4

0 回答 0