2018-03-17 18:26:18 +05:30
|
|
|
<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>
|
|
|
|
|
2017-08-17 22:00:37 +05:30
|
|
|
<template>
|
|
|
|
<div class="output">
|
|
|
|
<prompt />
|
2018-03-17 18:26:18 +05:30
|
|
|
<div v-html="sanitizedOutput"></div>
|
2017-08-17 22:00:37 +05:30
|
|
|
</div>
|
|
|
|
</template>
|