PronounsPage/components/Spelling.vue
2021-04-12 19:10:18 +00:00

28 lines
672 B
Vue

<script>
import spelling from "../plugins/spelling";
const escapeChars = {
'&': '&amp;',
'<': '&lt;',
'>': '&gt;',
'"': '&quot;'
};
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>