|
|
|
@ -57,6 +57,8 @@ export class FileGroupPage extends HTMLElement { |
|
|
|
super() |
|
|
|
this.attachShadow({mode: 'open'}) |
|
|
|
this.csp = "default-src 'self' 'unsafe-inline' 'unsafe-eval'" |
|
|
|
this.viewLoaded = false |
|
|
|
this.onceOnLoaded = undefined |
|
|
|
} |
|
|
|
|
|
|
|
connectedCallback() { |
|
|
|
@ -136,7 +138,11 @@ export class FileGroupPage extends HTMLElement { |
|
|
|
frame.srcdoc = frameHtml |
|
|
|
} |
|
|
|
frame.addEventListener('load', () => { |
|
|
|
this.displayView() |
|
|
|
this.viewLoaded = true |
|
|
|
if (this.onceOnLoaded) { |
|
|
|
this.onceOnLoaded() |
|
|
|
this.onceOnLoaded = undefined |
|
|
|
} |
|
|
|
}) |
|
|
|
this.viewFrame = frame |
|
|
|
this.shadowRoot.append(frame) |
|
|
|
@ -144,9 +150,17 @@ export class FileGroupPage extends HTMLElement { |
|
|
|
|
|
|
|
displayView(doc) { |
|
|
|
const msg = ['srcdoc', doc] |
|
|
|
this.viewFrame.contentWindow.postMessage( |
|
|
|
msg, '*' |
|
|
|
) |
|
|
|
if (this.viewLoaded) { |
|
|
|
this.viewFrame.contentWindow.postMessage( |
|
|
|
msg, '*' |
|
|
|
) |
|
|
|
} else { |
|
|
|
this.onceOnLoaded = () => { |
|
|
|
this.viewFrame.contentWindow.postMessage( |
|
|
|
msg, '*' |
|
|
|
) |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
async displayEdit() { |
|
|
|
|