diff options
author | Jacob Schatz <jschatz1@gmail.com> | 2017-06-30 20:09:55 -0400 |
---|---|---|
committer | Jacob Schatz <jschatz1@gmail.com> | 2017-06-30 20:09:55 -0400 |
commit | 7869cbaa7be6360c895b443fff19e1241bf8ed24 (patch) | |
tree | 70a90b828c0c181eb44abe842f24958974f5afc0 | |
parent | 7216a1f12c8202c23e9ac8c67e4ef3ca68a19843 (diff) | |
download | gitlab-ce-7869cbaa7be6360c895b443fff19e1241bf8ed24.tar.gz |
Gets syntax highlighting working.
-rw-r--r-- | app/assets/javascripts/repo/repo_editor.js | 4 | ||||
-rw-r--r-- | app/assets/javascripts/repo/repo_helper.js | 7 | ||||
-rw-r--r-- | app/assets/javascripts/repo/repo_store.js | 1 |
3 files changed, 10 insertions, 2 deletions
diff --git a/app/assets/javascripts/repo/repo_editor.js b/app/assets/javascripts/repo/repo_editor.js index 0d5d03fe41d..f9fc9658440 100644 --- a/app/assets/javascripts/repo/repo_editor.js +++ b/app/assets/javascripts/repo/repo_editor.js @@ -1,6 +1,7 @@ /* global monaco */ import Vue from 'vue'; import Store from './repo_store' +import Helper from './repo_helper' export default class RepoEditor { constructor() { @@ -17,6 +18,7 @@ export default class RepoEditor { model: null } ) + Helper.monacoInstance = monaco; this.initVue(); }); } @@ -59,7 +61,7 @@ export default class RepoEditor { self.monacoEditor.setModel( monaco.editor.createModel( this.blobRaw, - 'plain' + this.activeFile.mime_type ) ); } diff --git a/app/assets/javascripts/repo/repo_helper.js b/app/assets/javascripts/repo/repo_helper.js index 9616ad110b4..af0e3764b58 100644 --- a/app/assets/javascripts/repo/repo_helper.js +++ b/app/assets/javascripts/repo/repo_helper.js @@ -6,12 +6,14 @@ let RepoHelper = { return data.hasOwnProperty('blobs'); }, + monacoInstance: undefined, + Time: window.performance && window.performance.now ? window.performance : Date, - getLanguagesForMimeType(mimetypeNeedle, monaco) { + getLanguagesForMimeType(mimetypeNeedle) { const langs = monaco.languages.getLanguages(); let lang = ''; langs.every((lang) => { @@ -62,6 +64,9 @@ let RepoHelper = { setActiveFile(file) { Store.openedFiles = Store.openedFiles.map((openedFile) => { openedFile.active = file.url === openedFile.url; + if(openedFile.active) { + Store.activeFile = openedFile; + } return openedFile; }); Store.blobRaw = file.plain; diff --git a/app/assets/javascripts/repo/repo_store.js b/app/assets/javascripts/repo/repo_store.js index 5e2dcab4af7..5365c2646bd 100644 --- a/app/assets/javascripts/repo/repo_store.js +++ b/app/assets/javascripts/repo/repo_store.js @@ -10,6 +10,7 @@ let RepoStore = { blobRaw: '', blobRendered: '', openedFiles: [], + activeFile: '', files: [] }; export default RepoStore; |