Commit 7869cbaa authored by Jacob Schatz's avatar Jacob Schatz

Gets syntax highlighting working.

parent 7216a1f1
/* 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
)
);
}
......
......@@ -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;
......
......@@ -10,6 +10,7 @@ let RepoStore = {
blobRaw: '',
blobRendered: '',
openedFiles: [],
activeFile: '',
files: []
};
export default RepoStore;
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment