Move syntax highlighting into a method

Fix
https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/12198#note_37142936
This commit is contained in:
Eric Eastwood 2017-08-10 13:05:04 -05:00
parent 3a9f210b5c
commit d59aed94e7

View file

@ -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();
});
},
},