feat: footer override markdown inline parsing

This commit is contained in:
NGPixel 2023-03-17 17:13:32 -04:00
parent 51e5f42622
commit b5b1913396
No known key found for this signature in database
GPG Key ID: 8FDA2F1757F60D63
2 changed files with 13 additions and 1 deletions

View File

@ -88,6 +88,7 @@
:label='$t(`admin:general.footerOverride`)' :label='$t(`admin:general.footerOverride`)'
v-model='config.footerOverride' v-model='config.footerOverride'
prepend-icon='mdi-page-layout-footer' prepend-icon='mdi-page-layout-footer'
append-icon='mdi-language-markdown'
persistent-hint persistent-hint
:hint='$t(`admin:general.footerOverrideHint`)' :hint='$t(`admin:general.footerOverrideHint`)'
) )

View File

@ -2,7 +2,7 @@
v-footer.justify-center(:color='bgColor', inset) v-footer.justify-center(:color='bgColor', inset)
.caption.grey--text(:class='$vuetify.theme.dark ? `text--lighten-1` : `text--darken-1`') .caption.grey--text(:class='$vuetify.theme.dark ? `text--lighten-1` : `text--darken-1`')
template(v-if='footerOverride') template(v-if='footerOverride')
span {{footerOverride}} |  span(v-html='footerOverrideRender + ` | `')
template(v-else-if='company && company.length > 0 && contentLicense !== ``') template(v-else-if='company && company.length > 0 && contentLicense !== ``')
span(v-if='contentLicense === `alr`') {{ $t('common:footer.copyright', { company: company, year: currentYear, interpolation: { escapeValue: false } }) }} |  span(v-if='contentLicense === `alr`') {{ $t('common:footer.copyright', { company: company, year: currentYear, interpolation: { escapeValue: false } }) }} | 
span(v-else) {{ $t('common:footer.license', { company: company, license: $t('common:license.' + contentLicense), interpolation: { escapeValue: false } }) }} |  span(v-else) {{ $t('common:footer.license', { company: company, license: $t('common:license.' + contentLicense), interpolation: { escapeValue: false } }) }} | 
@ -11,6 +11,13 @@
<script> <script>
import { get } from 'vuex-pathify' import { get } from 'vuex-pathify'
import MarkdownIt from 'markdown-it'
const md = new MarkdownIt({
html: false,
breaks: false,
linkify: true
})
export default { export default {
props: { props: {
@ -32,6 +39,10 @@ export default {
company: get('site/company'), company: get('site/company'),
contentLicense: get('site/contentLicense'), contentLicense: get('site/contentLicense'),
footerOverride: get('site/footerOverride'), footerOverride: get('site/footerOverride'),
footerOverrideRender () {
if (!this.footerOverride) { return '' }
return md.renderInline(this.footerOverride)
},
bgColor() { bgColor() {
if (!this.$vuetify.theme.dark) { if (!this.$vuetify.theme.dark) {
return this.color return this.color