diff options
author | Martin Fischer <martin@push-f.com> | 2022-10-28 11:12:04 +0200 |
---|---|---|
committer | Martin Fischer <martin@push-f.com> | 2022-10-28 11:33:23 +0200 |
commit | a972a4b5fa7a41d7a19d422db8af86d8817dfe81 (patch) | |
tree | dcb858cf24a5977a3a6820abfedb71978f6a6c2b /src/main.rs | |
parent | 8876a8f21ff859894817b8c9418acaa243b90c36 (diff) |
stop rendering .html files via <iframe>s
Now that we have Lua scripting we don't need iframes anymore.
Diffstat (limited to 'src/main.rs')
-rw-r--r-- | src/main.rs | 18 |
1 files changed, 0 insertions, 18 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, } } |