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