Commit 94bb7feb authored by Jacob Schatz's avatar Jacob Schatz Committed by Eric Eastwood

Move monaco from Store to Helper.

parent f0ee82f0
...@@ -19,7 +19,7 @@ const RepoEditor = { ...@@ -19,7 +19,7 @@ const RepoEditor = {
Store.blobRaw = rawResponse.data; Store.blobRaw = rawResponse.data;
Store.activeFile.plain = rawResponse.data; Store.activeFile.plain = rawResponse.data;
const monacoInstance = this.monaco.editor.create(this.$el, { const monacoInstance = Helper.monaco.editor.create(this.$el, {
model: null, model: null,
readOnly: false, readOnly: false,
contextmenu: false, contextmenu: false,
......
/* global monaco */ /* global monaco */
import RepoEditor from '../components/repo_editor.vue'; import RepoEditor from '../components/repo_editor.vue';
import Store from '../stores/repo_store'; import Store from '../stores/repo_store';
import Helper from '../helpers/repo_helper';
import monacoLoader from '../monaco_loader'; import monacoLoader from '../monaco_loader';
function repoEditorLoader() { function repoEditorLoader() {
Store.monacoLoading = true; Store.monacoLoading = true;
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
monacoLoader(['vs/editor/editor.main'], () => { monacoLoader(['vs/editor/editor.main'], () => {
Store.monaco = monaco; Helper.monaco = monaco;
Store.monacoLoading = false; Store.monacoLoading = false;
resolve(RepoEditor); resolve(RepoEditor);
}, reject); }, reject);
......
...@@ -48,9 +48,9 @@ const RepoHelper = { ...@@ -48,9 +48,9 @@ const RepoHelper = {
setMonacoModelFromLanguage() { setMonacoModelFromLanguage() {
RepoHelper.monacoInstance.setModel(null); RepoHelper.monacoInstance.setModel(null);
const languages = Store.monaco.languages.getLanguages(); const languages = RepoHelper.monaco.languages.getLanguages();
const languageID = RepoHelper.getLanguageIDForFile(Store.activeFile, languages); const languageID = RepoHelper.getLanguageIDForFile(Store.activeFile, languages);
const newModel = Store.monaco.editor.createModel(Store.blobRaw, languageID); const newModel = RepoHelper.monaco.editor.createModel(Store.blobRaw, languageID);
RepoHelper.monacoInstance.setModel(newModel); RepoHelper.monacoInstance.setModel(newModel);
}, },
......
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