debian-mirror-gitlab/app/assets/javascripts/notebook/cells/output/html.vue

43 lines
767 B
Vue
Raw Normal View History

2018-03-17 18:26:18 +05:30
<script>
2020-11-24 15:15:51 +05:30
/* eslint-disable vue/no-v-html */
2021-01-03 14:25:43 +05:30
import { sanitize } from '~/lib/dompurify';
2018-12-13 13:39:08 +05:30
import Prompt from '../prompt.vue';
2018-03-17 18:26:18 +05:30
2018-12-13 13:39:08 +05:30
export default {
components: {
2019-03-02 22:35:43 +05:30
Prompt,
2018-12-13 13:39:08 +05:30
},
props: {
2019-03-02 22:35:43 +05:30
count: {
type: Number,
required: true,
},
2018-12-13 13:39:08 +05:30
rawCode: {
type: String,
required: true,
2018-03-17 18:26:18 +05:30
},
2019-03-02 22:35:43 +05:30
index: {
type: Number,
required: true,
},
2018-12-13 13:39:08 +05:30
},
computed: {
sanitizedOutput() {
return sanitize(this.rawCode, {
2020-10-24 23:57:45 +05:30
ALLOWED_ATTR: ['src'],
2018-12-13 13:39:08 +05:30
});
2018-03-17 18:26:18 +05:30
},
2019-03-02 22:35:43 +05:30
showOutput() {
return this.index === 0;
},
2018-12-13 13:39:08 +05:30
},
};
2018-03-17 18:26:18 +05:30
</script>
2017-08-17 22:00:37 +05:30
<template>
<div class="output">
2019-03-02 22:35:43 +05:30
<prompt type="Out" :count="count" :show-output="showOutput" />
2021-01-29 00:20:46 +05:30
<div class="gl-overflow-auto" v-html="sanitizedOutput"></div>
2017-08-17 22:00:37 +05:30
</div>
</template>