This commit is contained in:
j3d1 2024-05-22 21:34:27 +02:00
parent f7c6b9d128
commit 20c8cd866e
2 changed files with 35 additions and 1 deletions

View file

@ -0,0 +1,32 @@
<template>
<div contenteditable>
<pre>{{ value }}</pre>
<span v-html="rawhtml(value)"></span>
</div>
</template>
<script>
export default {
name: 'FormatedText',
props: {
value: {
type: String,
required: true
},
format: {
type: Function,
default: null
}
},
emits: ['input'],
methods: {
rawhtml(value) {
if (typeof format === 'function') {
return format(value);
} else {
return value;
}
}
}
};
</script>

View file

@ -4,6 +4,7 @@
<li v-for="template in messageTemplates" :key="template.id"> <li v-for="template in messageTemplates" :key="template.id">
{{ template.name }}<br> {{ template.name }}<br>
<pre>{{ template.message }}</pre> <pre>{{ template.message }}</pre>
<FormatedText :value="template.message"/>
</li> </li>
</ul> </ul>
<h3 class="text-center">Message Template Variables</h3> <h3 class="text-center">Message Template Variables</h3>
@ -17,10 +18,11 @@
<script> <script>
import {mapActions, mapState} from 'vuex'; import {mapActions, mapState} from 'vuex';
import Table from '@/components/Table'; import Table from '@/components/Table';
import FormatedText from "@/components/inputs/FormatedText.vue";
export default { export default {
name: 'Settings', name: 'Settings',
components: {Table}, components: {FormatedText, Table},
computed: mapState(['messageTemplates', 'messageTemplateVariables']), computed: mapState(['messageTemplates', 'messageTemplateVariables']),
methods: mapActions(['fetchMessageTemplates', 'fetchMessageTemplateVariables']), methods: mapActions(['fetchMessageTemplates', 'fetchMessageTemplateVariables']),
mounted() { mounted() {