diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/main.rs | 18 | ||||
-rw-r--r-- | src/static/style.css | 4 |
2 files changed, 2 insertions, 20 deletions
diff --git a/src/main.rs b/src/main.rs index ffa6486..2cd3a5d 100644 --- a/src/main.rs +++ b/src/main.rs @@ -523,27 +523,9 @@ fn render_markdown(input: &str, page: &mut Page, _mode: RenderMode) { page.body.push_str("</div>"); } -fn embed_html_as_iframe(input: &str, page: &mut Page, mode: RenderMode) { - if mode == RenderMode::View { - page.body.push_str("<iframe src='?action=run'></iframe>"); - page.frame_src = Some("'self'"); - } else { - page.body - .push_str("<div class=note>Note that JavaScript does not work in the preview.</div>"); - // sandbox=allow-scripts wouldn't work because the strict parent page CSP still applies - - // The sandbox attribute makes browsers treat the embedded page as a unique origin. - page.body.push_str(&format!( - "<iframe srcdoc='{}' sandbox></iframe>", - html_escape(input) - )); - } -} - fn get_renderer(path: &Utf8Path) -> Option<fn(&str, &mut Page, RenderMode)> { match path.extension() { Some("md") => Some(render_markdown), - Some("html") => Some(embed_html_as_iframe), _ => None, } } diff --git a/src/static/style.css b/src/static/style.css index e3d0954..54c4f4a 100644 --- a/src/static/style.css +++ b/src/static/style.css @@ -23,7 +23,7 @@ h1 { flex-grow: 1; } -textarea, iframe { +textarea { flex-grow: 1; } @@ -92,4 +92,4 @@ label { .addition { background: #e6ffed; } .deletion { background: #ffeef0; } .addition ins {background: #acf2bd; text-decoration: none; } -.deletion del {background: #fdb8c0; text-decoration: none; }
\ No newline at end of file +.deletion del {background: #fdb8c0; text-decoration: none; } |