debian-mirror-gitlab/app/assets/javascripts/notebook/cells/output/html.vue
2021-02-22 17:27:13 +05:30

43 lines
801 B
Vue

<script>
import { GlSafeHtmlDirective } from '@gitlab/ui';
import { sanitize } from '~/lib/dompurify';
import Prompt from '../prompt.vue';
export default {
components: {
Prompt,
},
directives: {
SafeHtml: GlSafeHtmlDirective,
},
props: {
count: {
type: Number,
required: true,
},
rawCode: {
type: String,
required: true,
},
index: {
type: Number,
required: true,
},
},
computed: {
sanitizedOutput() {
return sanitize(this.rawCode);
},
showOutput() {
return this.index === 0;
},
},
};
</script>
<template>
<div class="output">
<prompt type="Out" :count="count" :show-output="showOutput" />
<div v-safe-html="sanitizedOutput" class="gl-overflow-auto"></div>
</div>
</template>