This repository has been archived on 2024-07-22. You can view files and clone it, but cannot push or open issues or pull requests.
2021-02-01 12:03:30 -08:00
|
|
|
<script>
|
|
|
|
import spelling from "../plugins/spelling";
|
|
|
|
|
2021-04-12 04:57:18 -07:00
|
|
|
const escapeChars = {
|
|
|
|
'&': '&',
|
|
|
|
'<': '<',
|
|
|
|
'>': '>',
|
|
|
|
'"': '"'
|
|
|
|
};
|
|
|
|
|
2021-02-01 12:03:30 -08:00
|
|
|
export default {
|
|
|
|
mixins: [ spelling ],
|
|
|
|
props: {
|
2021-03-19 12:34:34 -07:00
|
|
|
text: { required: true },
|
2021-04-12 04:57:18 -07:00
|
|
|
escape: { type: Boolean }
|
2021-02-01 12:03:30 -08:00
|
|
|
},
|
|
|
|
render(h) {
|
2021-07-22 10:03:56 -07:00
|
|
|
let text = this.text || '';
|
2021-04-12 04:57:18 -07:00
|
|
|
text = text.replace('<script', '');
|
|
|
|
if (this.escape) {
|
|
|
|
text = text.replace(/[&<>"]/g, tag => escapeChars[tag] || tag);
|
|
|
|
}
|
|
|
|
|
|
|
|
return h('span', {domProps: { innerHTML: this.handleSpelling(text) }});
|
2021-02-01 12:03:30 -08:00
|
|
|
},
|
|
|
|
}
|
|
|
|
</script>
|