Fix rendering of snapshot in the player

openid
Marcin Kulik 11 years ago
parent 62be399455
commit ade244e5d0

@ -64,10 +64,14 @@ class AsciiIo.Renderer.Base extends Backbone.View
@fixTerminalElementSize()
@fixPlayerContainerSize()
renderSnapshot: (text) ->
renderSnapshot: (snapshot) ->
return unless snapshot
i = 0
for line in text.split("\n")
fragments = [[line, AsciiIo.Brush.default()]]
for line in snapshot
fragments = _(line).map (fragment) ->
fragment[1].bright = fragment[1].bold
[fragment[0], new AsciiIo.Brush(fragment[1])]
@renderLine i, fragments, undefined
i++

@ -24,7 +24,7 @@ module AsciicastsHelper
renderer_class: renderer_class,
auto_play: options.key?(:auto_play) ? !!options[:auto_play] : false,
hud: options.key?(:hud) ? !!options[:hud] : true,
snapshot: asciicast.snapshot
snapshot: asciicast.snapshot.to_json
}
end

@ -13,7 +13,7 @@
rendererClass: <%= renderer_class.html_safe %>,
autoPlay: <%= auto_play %>,
hud: <%= hud %>,
snapshot: "<%= (j(snapshot)).html_safe %>"
snapshot: <%= snapshot.html_safe %>
});
});
</script>

Loading…
Cancel
Save