Skip to content

Commit

Permalink
[MFM] Fallback to js if specified lang is not available (misskey-dev#…
Browse files Browse the repository at this point in the history
  • Loading branch information
AyaMorisawa authored and mei23 committed Aug 28, 2019
1 parent 8359655 commit 1fed607
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions src/client/app/common/views/components/code-core.vue
@@ -1,16 +1,16 @@
<template>
<prism :inline="inline" :language="lang || 'js'">{{ code }}</prism>
<x-prism :inline="inline" :language="prismLang">{{ code }}</x-prism>
</template>

<script lang="ts">
import Vue from 'vue';
import 'prismjs';
import 'prismjs/themes/prism-okaidia.css';
import Prism from 'vue-prism-component';
import XPrism from 'vue-prism-component';
export default Vue.extend({
components: {
Prism
XPrism
},
props: {
code: {
Expand All @@ -25,6 +25,12 @@ export default Vue.extend({
type: Boolean,
required: false
}
},
computed: {
prismLang() {
return Prism.languages[this.lang] ? this.lang : 'js';
}
}
});
</script>

0 comments on commit 1fed607

Please sign in to comment.