Skip to content

Commit

Permalink
fix preview js runtime
Browse files Browse the repository at this point in the history
  • Loading branch information
keinn89 committed Feb 10, 2017
1 parent 0f02228 commit 2f0f4bf
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 7 deletions.
11 changes: 7 additions & 4 deletions app/src/components/Preview.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<template>
<div id="preview-wrapper">
<iframe id="preview" ref="previewRef"></iframe>
<div id="preview" ref="previewRef"></div>
<slot></slot>
</div>
</template>
Expand Down Expand Up @@ -45,7 +45,10 @@ export default {
methods: {
update () {
let preview = this.$refs.previewRef
let doc = preview.contentDocument
let frame = document.createElement('iframe')
preview.innerHTML = ''
preview.appendChild(frame)
let doc = frame.contentDocument
doc.body.innerHTML = this.currentProject.html
let script = document.createElement('script')
script.type = 'text/javascript'
Expand All @@ -62,8 +65,8 @@ export default {
this.js = this.currentProject.js
},
updateStyle () {
let preview = this.$refs.previewRef
let doc = preview.contentDocument
let frame = this.$refs.previewRef.querySelector('iframe')
let doc = frame.contentDocument
let style = doc.getElementById(this.currentProject.id + '_style')
style.textContent = this.currentProject.style
this.style = this.currentProject.style
Expand Down
2 changes: 1 addition & 1 deletion electron/dist/index.html
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<!DOCTYPE html><html><head><meta charset=utf-8><title>SketchCode</title><link href=./static/css/app.0c129c566cec643f98e6bd213b10a4f7.css rel=stylesheet></head><body><div id=app></div><script type=text/javascript src=./static/js/manifest.5c91ef3096b498d3d817.js></script><script type=text/javascript src=./static/js/vendor.59b85a65ec429aa040a4.js></script><script type=text/javascript src=./static/js/app.84fcd7fec4a971d11594.js></script></body></html>
<!DOCTYPE html><html><head><meta charset=utf-8><title>SketchCode</title><link href=./static/css/app.0c129c566cec643f98e6bd213b10a4f7.css rel=stylesheet></head><body><div id=app></div><script type=text/javascript src=./static/js/manifest.e1978d8446af9d6b9a58.js></script><script type=text/javascript src=./static/js/vendor.59b85a65ec429aa040a4.js></script><script type=text/javascript src=./static/js/app.0d119dbb1e194077cd8e.js></script></body></html>

Large diffs are not rendered by default.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 2f0f4bf

Please sign in to comment.