mirror of
https://activitypub.software/TransFem-org/Sharkey
synced 2024-11-26 16:03:02 +00:00
[MFM] Fallback to js if specified lang is not available (#5347)
This commit is contained in:
parent
13f69e4291
commit
9d65768d4d
1 changed files with 9 additions and 3 deletions
|
@ -1,16 +1,16 @@
|
||||||
<template>
|
<template>
|
||||||
<prism :inline="inline" :language="lang || 'js'">{{ code }}</prism>
|
<x-prism :inline="inline" :language="prismLang">{{ code }}</x-prism>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import Vue from 'vue';
|
import Vue from 'vue';
|
||||||
import 'prismjs';
|
import 'prismjs';
|
||||||
import 'prismjs/themes/prism-okaidia.css';
|
import 'prismjs/themes/prism-okaidia.css';
|
||||||
import Prism from 'vue-prism-component';
|
import XPrism from 'vue-prism-component';
|
||||||
|
|
||||||
export default Vue.extend({
|
export default Vue.extend({
|
||||||
components: {
|
components: {
|
||||||
Prism
|
XPrism
|
||||||
},
|
},
|
||||||
props: {
|
props: {
|
||||||
code: {
|
code: {
|
||||||
|
@ -25,6 +25,12 @@ export default Vue.extend({
|
||||||
type: Boolean,
|
type: Boolean,
|
||||||
required: false
|
required: false
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
computed: {
|
||||||
|
prismLang() {
|
||||||
|
return Prism.languages[this.lang] ? this.lang : 'js';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
Loading…
Reference in a new issue