mirror of
https://gitlab.com/PronounsPage/PronounsPage.git
synced 2025-10-19 03:52:00 -04:00
26 lines
700 B
Vue
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>
|