thelounge/client/components/ParsedMessage.vue

23 lines
606 B
Vue
Raw Normal View History

<script lang="ts">
import {defineComponent, PropType, h} from "vue";
2019-11-16 17:24:03 +00:00
import parse from "../js/helpers/parse";
import type {ClientMessage, ClientNetwork} from "../js/types";
export default defineComponent({
name: "ParsedMessage",
2018-07-12 08:26:12 +00:00
functional: true,
props: {
2018-07-12 08:41:40 +00:00
text: String,
message: {type: Object as PropType<ClientMessage | string>, required: false},
network: {type: Object as PropType<ClientNetwork>, required: false},
},
render(context) {
2018-07-19 17:44:24 +00:00
return parse(
typeof context.text !== "undefined" ? context.text : context.message.text,
context.message,
context.network
2018-07-19 17:44:24 +00:00
);
},
});
</script>