Commit 37b7ce48 authored by Jacob Schatz's avatar Jacob Schatz Committed by Eric Eastwood

Move monaco instance to helper so it doesn't get recursively tracked.

parent 46ce53da
...@@ -8,8 +8,8 @@ const RepoEditor = { ...@@ -8,8 +8,8 @@ const RepoEditor = {
data: () => Store, data: () => Store,
destroyed() { destroyed() {
if(this.monacoInstance){ if(Helper.monacoInstance){
this.monacoInstance.destroy(); Helper.monacoInstance.destroy();
} }
}, },
...@@ -25,7 +25,7 @@ const RepoEditor = { ...@@ -25,7 +25,7 @@ const RepoEditor = {
contextmenu: false, contextmenu: false,
}); });
Store.monacoInstance = monacoInstance; Helper.monacoInstance = monacoInstance;
this.addMonacoEvents(); this.addMonacoEvents();
...@@ -34,7 +34,7 @@ const RepoEditor = { ...@@ -34,7 +34,7 @@ const RepoEditor = {
this.showHide(); this.showHide();
const newModel = this.monaco.editor.createModel(this.blobRaw, languageID); const newModel = this.monaco.editor.createModel(this.blobRaw, languageID);
this.monacoInstance.setModel(newModel); Helper.monacoInstance.setModel(newModel);
}).catch(Helper.loadingError); }).catch(Helper.loadingError);
}, },
...@@ -48,12 +48,12 @@ const RepoEditor = { ...@@ -48,12 +48,12 @@ const RepoEditor = {
}, },
addMonacoEvents() { addMonacoEvents() {
this.monacoInstance.onMouseUp(this.onMonacoEditorMouseUp); Helper.monacoInstance.onMouseUp(this.onMonacoEditorMouseUp);
this.monacoInstance.onKeyUp(this.onMonacoEditorKeysPressed.bind(this)); Helper.monacoInstance.onKeyUp(this.onMonacoEditorKeysPressed.bind(this));
}, },
onMonacoEditorKeysPressed() { onMonacoEditorKeysPressed() {
Store.setActiveFileContents(this.monacoInstance.getValue()); Store.setActiveFileContents(Helper.monacoInstance.getValue());
}, },
onMonacoEditorMouseUp(e) { onMonacoEditorMouseUp(e) {
...@@ -67,7 +67,7 @@ const RepoEditor = { ...@@ -67,7 +67,7 @@ const RepoEditor = {
watch: { watch: {
activeLine() { activeLine() {
this.monacoInstance.setPosition({ Helper.monacoInstance.setPosition({
lineNumber: this.activeLine, lineNumber: this.activeLine,
column: 1, column: 1,
}); });
...@@ -115,13 +115,13 @@ const RepoEditor = { ...@@ -115,13 +115,13 @@ const RepoEditor = {
if (this.isTree) return; if (this.isTree) return;
this.monacoInstance.setModel(null); Helper.monacoInstance.setModel(null);
const languages = this.monaco.languages.getLanguages(); const languages = this.monaco.languages.getLanguages();
const languageID = Helper.getLanguageIDForFile(this.activeFile, languages); const languageID = Helper.getLanguageIDForFile(this.activeFile, languages);
const newModel = this.monaco.editor.createModel(this.blobRaw, languageID); const newModel = this.monaco.editor.createModel(this.blobRaw, languageID);
this.monacoInstance.setModel(newModel); Helper.monacoInstance.setModel(newModel);
}, },
}, },
}; };
......
...@@ -4,6 +4,8 @@ import Store from '../stores/repo_store'; ...@@ -4,6 +4,8 @@ import Store from '../stores/repo_store';
import '../../flash'; import '../../flash';
const RepoHelper = { const RepoHelper = {
monacoInstance: {},
getDefaultActiveFile() { getDefaultActiveFile() {
return { return {
active: true, active: true,
......
...@@ -6,7 +6,6 @@ const RepoStore = { ...@@ -6,7 +6,6 @@ const RepoStore = {
ideEl: {}, ideEl: {},
monaco: {}, monaco: {},
monacoLoading: false, monacoLoading: false,
monacoInstance: {},
service: '', service: '',
editor: '', editor: '',
sidebar: '', sidebar: '',
......
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