|
|
|
@ -11,6 +11,7 @@ const frameHtml = `<!doctype html> |
|
|
|
} |
|
|
|
iframe { |
|
|
|
border: none; |
|
|
|
display: block; |
|
|
|
} |
|
|
|
</style> |
|
|
|
</head> |
|
|
|
@ -21,7 +22,7 @@ const frame = document.getElementsByTagName('iframe')[0] |
|
|
|
addEventListener('message', event => { |
|
|
|
const d = event.data |
|
|
|
if (Array.isArray(d) && d[0] === 'srcdoc') { |
|
|
|
frame.srcdoc = d |
|
|
|
frame.srcdoc = d[1] |
|
|
|
} else { |
|
|
|
frame.postMessage(event.data) |
|
|
|
} |
|
|
|
@ -57,10 +58,20 @@ export class Page extends HTMLElement { |
|
|
|
) ?? '' |
|
|
|
const style = document.createElement('style') |
|
|
|
style.textContent = ` |
|
|
|
h1 { |
|
|
|
overflow-x: scroll; |
|
|
|
font-size: 22px; |
|
|
|
font-family: sans-serif; |
|
|
|
} |
|
|
|
textarea { |
|
|
|
width: 80%; |
|
|
|
width: 94vw; |
|
|
|
height: 45vh; |
|
|
|
} |
|
|
|
iframe { |
|
|
|
border: none; |
|
|
|
width: 94vw; |
|
|
|
height: 80vh; |
|
|
|
} |
|
|
|
` |
|
|
|
this.shadowRoot.append(style) |
|
|
|
if (path.startsWith('/sandbox/')) { |
|
|
|
|