28 lines
672 B
Vue
28 lines
672 B
Vue
<script>
|
|
import spelling from "../plugins/spelling";
|
|
|
|
const escapeChars = {
|
|
'&': '&',
|
|
'<': '<',
|
|
'>': '>',
|
|
'"': '"'
|
|
};
|
|
|
|
export default {
|
|
mixins: [ spelling ],
|
|
props: {
|
|
text: { required: true },
|
|
escape: { type: Boolean }
|
|
},
|
|
render(h) {
|
|
let text = this.text;
|
|
text = text.replace('<script', '');
|
|
if (this.escape) {
|
|
text = text.replace(/[&<>"]/g, tag => escapeChars[tag] || tag);
|
|
}
|
|
|
|
return h('span', {domProps: { innerHTML: this.handleSpelling(text) }});
|
|
},
|
|
}
|
|
</script>
|