summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Eastwood <contact@ericeastwood.com>2017-08-10 13:05:04 -0500
committerEric Eastwood <contact@ericeastwood.com>2017-08-10 13:05:04 -0500
commitd59aed94e7ec441f44301a55e0529a9c34a01fd2 (patch)
treeb9fd487925bb08c461a27b34aba67456baddedb2
parent3a9f210b5ce44f1a464e765ff6e95c1eac5363d8 (diff)
downloadgitlab-ce-d59aed94e7ec441f44301a55e0529a9c34a01fd2.tar.gz
Move syntax highlighting into a method
Fix https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/12198#note_37142936
-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();
});
},
},