diff --git a/components/lenses/renderers/HTMLLensRenderer.vue b/components/lenses/renderers/HTMLLensRenderer.vue index dc050b0a7..20438ce43 100644 --- a/components/lenses/renderers/HTMLLensRenderer.vue +++ b/components/lenses/renderers/HTMLLensRenderer.vue @@ -151,23 +151,18 @@ export default { togglePreview() { this.previewEnabled = !this.previewEnabled if (this.previewEnabled) { - // If you want to add 'preview' support for other response types, - // just add them here. - if (this.responseType === "text/html") { - // If the preview already has that URL loaded, let's not bother re-loading it all. - if (this.$refs.previewFrame.getAttribute("data-previewing-url") === this.url) return - // Use DOMParser to parse document HTML. - const previewDocument = new DOMParser().parseFromString( - this.responseBodyText, - this.responseType - ) - // Inject tag to head, to fix relative CSS/HTML paths. - previewDocument.head.innerHTML = - `` + previewDocument.head.innerHTML - // Finally, set the iframe source to the resulting HTML. - this.$refs.previewFrame.srcdoc = previewDocument.documentElement.outerHTML - this.$refs.previewFrame.setAttribute("data-previewing-url", this.url) - } + if (this.$refs.previewFrame.getAttribute("data-previewing-url") === this.url) return + // Use DOMParser to parse document HTML. + const previewDocument = new DOMParser().parseFromString( + this.responseBodyText, + this.responseType + ) + // Inject tag to head, to fix relative CSS/HTML paths. + previewDocument.head.innerHTML = + `` + previewDocument.head.innerHTML + // Finally, set the iframe source to the resulting HTML. + this.$refs.previewFrame.srcdoc = previewDocument.documentElement.outerHTML + this.$refs.previewFrame.setAttribute("data-previewing-url", this.url) } }, },