debian-mirror-gitlab/app/assets/javascripts/notebook/cells/output/html.vue
2018-03-17 18:26:18 +05:30

35 lines
655 B
Vue

<script>
import sanitize from 'sanitize-html';
import Prompt from '../prompt.vue';
export default {
components: {
prompt: Prompt,
},
props: {
rawCode: {
type: String,
required: true,
},
},
computed: {
sanitizedOutput() {
return sanitize(this.rawCode, {
allowedTags: sanitize.defaults.allowedTags.concat([
'img', 'svg',
]),
allowedAttributes: {
img: ['src'],
},
});
},
},
};
</script>
<template>
<div class="output">
<prompt />
<div v-html="sanitizedOutput"></div>
</div>
</template>