This commit is contained in:
j3d1 2024-05-22 21:43:09 +02:00
parent b3ff77a1fa
commit 0d231b0e65
2 changed files with 9 additions and 4 deletions

View file

@ -1,6 +1,5 @@
<template>
<div contenteditable>
<pre>{{ value }}</pre>
<span v-html="rawhtml(value)"></span>
</div>
</template>

View file

@ -2,9 +2,8 @@
<h3 class="text-center">Message Templates</h3>
<ul>
<li v-for="template in messageTemplates" :key="template.id">
{{ template.name }}<br>
<pre>{{ template.message }}</pre>
<FormatedText :value="template.message"/>
<FormatedText :value="template.message" :format="formatText"/>
</li>
</ul>
<h3 class="text-center">Message Template Variables</h3>
@ -24,7 +23,14 @@ export default {
name: 'Settings',
components: {FormatedText, Table},
computed: mapState(['messageTemplates', 'messageTemplateVariables']),
methods: mapActions(['fetchMessageTemplates', 'fetchMessageTemplateVariables']),
methods: {
...mapActions(['fetchMessageTemplates', 'fetchMessageTemplateVariables']),
formatText(value) {
return value.replace(/{{(.*?)}}/g, (match, key) => {
return `<span class="text-primary">{{ ${key} }}</span>`;
}).replace(/\n/g, '<br>').replace(/\t/g, '&nbsp;&nbsp;&nbsp;&nbsp;');
}
},
mounted() {
this.fetchMessageTemplates();
this.fetchMessageTemplateVariables();