mirror of
https://github.com/n8n-io/n8n.git
synced 2024-11-15 17:14:05 -08:00
46 lines
978 B
Vue
46 lines
978 B
Vue
<template>
|
|
<iframe class="__html-display ph-no-capture" :srcdoc="html" />
|
|
</template>
|
|
|
|
<script lang="ts">
|
|
import type { PropType } from 'vue';
|
|
import sanitizeHtml, { defaults, type IOptions as SanitizeOptions } from 'sanitize-html';
|
|
import type { INodeExecutionData } from 'n8n-workflow';
|
|
|
|
const sanitizeOptions: SanitizeOptions = {
|
|
allowVulnerableTags: false,
|
|
enforceHtmlBoundary: false,
|
|
disallowedTagsMode: 'discard',
|
|
allowedTags: [...defaults.allowedTags, 'style', 'img', 'title'],
|
|
allowedAttributes: {
|
|
...defaults.allowedAttributes,
|
|
'*': ['class', 'style'],
|
|
},
|
|
transformTags: {
|
|
head: '',
|
|
},
|
|
};
|
|
|
|
export default {
|
|
name: 'RunDataHtml',
|
|
props: {
|
|
inputData: {
|
|
type: Array as PropType<INodeExecutionData[]>,
|
|
},
|
|
},
|
|
computed: {
|
|
html() {
|
|
const markup = (this.inputData?.[0].json.html as string) ?? '';
|
|
return sanitizeHtml(markup, sanitizeOptions);
|
|
},
|
|
},
|
|
};
|
|
</script>
|
|
|
|
<style lang="scss">
|
|
.__html-display {
|
|
width: 100%;
|
|
height: 100%;
|
|
}
|
|
</style>
|