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.
Zaimki/components/Spelling.vue

22 lines
568 B
Vue
Raw Normal View History

2021-02-01 12:03:30 -08:00
<script>
import spelling from "../plugins/spelling";
2021-11-21 08:38:20 -08:00
import { escapeHtml } from '../src/helpers';
2021-04-12 04:57:18 -07:00
2021-02-01 12:03:30 -08:00
export default {
mixins: [ spelling ],
props: {
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) {
2021-11-21 08:38:20 -08:00
text = escapeHtml(text);
2021-04-12 04:57:18 -07:00
}
return h('span', {domProps: { innerHTML: this.handleSpelling(text) }});
2021-02-01 12:03:30 -08:00
},
}
</script>