summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--app/assets/javascripts/repo/components/repo_preview.vue10
1 files changed, 8 insertions, 2 deletions
diff --git a/app/assets/javascripts/repo/components/repo_preview.vue b/app/assets/javascripts/repo/components/repo_preview.vue
index d8de022335b..0caa3a4551a 100644
--- a/app/assets/javascripts/repo/components/repo_preview.vue
+++ b/app/assets/javascripts/repo/components/repo_preview.vue
@@ -4,7 +4,7 @@ import Store from '../stores/repo_store';
export default {
data: () => Store,
mounted() {
- $(this.$el).find('.file-content').syntaxHighlight();
+ this.highlightFile();
},
computed: {
html() {
@@ -12,10 +12,16 @@ export default {
},
},
+ methods: {
+ highlightFile() {
+ $(this.$el).find('.file-content').syntaxHighlight();
+ },
+ },
+
watch: {
html() {
this.$nextTick(() => {
- $(this.$el).find('.file-content').syntaxHighlight();
+ this.highlightFile();
});
},
},