move iframe creation into Browser

This commit is contained in:
Chris Wanstrath
2011-11-06 23:18:23 -08:00
parent b0efbc7196
commit ac9a5efb94
2 changed files with 11 additions and 7 deletions

View File

@@ -1,4 +1,13 @@
$ = require 'jquery'
module.exports =
class Browser
constructor: (@path) ->
on: ->
$('.main.pane').append @html().hide()
on: ->
html: ->
$ "<iframe src='#{@path}' style='width:100%;height:100%'></iframe>"
show: ->
$(".main iframe[src='#{@path}']").show()
hide: ->
$(".main iframe[src='#{@path}']").hide()

View File

@@ -162,12 +162,7 @@ class Editor
@ace.setSession buffer
else
$('#ace-editor').hide()
path = buffer.path
if $("iframe[src='#{path}']").length
$("iframe[src='#{path}']").show()
else
$('#ace-editor').after iframe =
"<iframe src='#{path}' style='width:100%;height:100%'></iframe>"
buffer.show()
Storage.set @focusedPathKey, path
Event.trigger "editor:bufferFocus", path