diff --git a/src/platform/markdown.ts b/src/platform/markdown.ts
index 81d1c678..0bfba258 100644
--- a/src/platform/markdown.ts
+++ b/src/platform/markdown.ts
@@ -4,13 +4,16 @@ import { PLATFORMS } from "../common/emu";
import { Platform } from "../common/baseplatform";
class MarkdownPlatform implements Platform {
- mainElement;
- htmlDiv;
+ mainElement : HTMLElement;
+ iframe : HTMLIFrameElement;
constructor(mainElement:HTMLElement) {
this.mainElement = mainElement;
- this.htmlDiv = $('
').appendTo(mainElement);
- $(mainElement).css('overflowY', 'auto');
+ this.iframe = $('').appendTo(mainElement)[0] as HTMLIFrameElement;
+ //this.iframe = $('').appendTo(mainElement)[0] as HTMLIFrameElement;
+ this.iframe.style.backgroundColor = 'white';
+ mainElement.classList.add("vertical-scroll"); //100% height
+ mainElement.style.overflowY = 'auto';
}
start() {
}
@@ -20,8 +23,15 @@ class MarkdownPlatform implements Platform {
}
resume() {
}
- loadROM(title, data) {
- this.htmlDiv.html(data);
+ loadROM(title, data:string) {
+ // have to do this b/c sandboxed without same origin
+ // TODO: preserve scroll position
+ if (this.iframe.srcdoc)
+ this.iframe.srcdoc = data;
+ else
+ this.iframe.src = "data:text/html;charset=utf-8," + escape(data);
+ //this.iframe.contentWindow.postMessage({body:data}, "*");
+ //$(this.iframe).contents().find('body').html(data);
}
isRunning() {
return false;