PronounsPage/components/Spelling.vue
2024-04-30 19:41:28 +02:00

26 lines
700 B
Vue

<script lang="ts">
import spelling from '../plugins/spelling.ts';
import { escapeHtml } from '../src/helpers.ts';
import { safeInlineMarkdown } from '../src/simpleMarkdown.js';
export default spelling.extend({
props: {
text: { default: '', type: String },
escape: { type: Boolean },
markdown: { type: Boolean },
},
render(h) {
let text = this.text;
text = text.replace('<script', '');
if (this.escape) {
text = escapeHtml(text);
}
if (this.markdown) {
text = safeInlineMarkdown(text);
}
return h('span', { domProps: { innerHTML: this.handleSpelling(text) } });
},
});
</script>