Commit 1530b1e6 authored by Luke "Jared" Bennett's avatar Luke "Jared" Bennett

Add plain property to active file if not set already

parent 00e7f328
...@@ -11,7 +11,7 @@ const RepoEditor = { ...@@ -11,7 +11,7 @@ const RepoEditor = {
Service.getRaw(this.activeFile.raw_path) Service.getRaw(this.activeFile.raw_path)
.then((rawResponse) => { .then((rawResponse) => {
Store.blobRaw = rawResponse.data; Store.blobRaw = rawResponse.data;
this.openedFiles[0].plain = rawResponse.data; Helper.findOpenedFileFromActive().plain = rawResponse.data;
const monacoInstance = this.monaco.editor.create(this.$el, { const monacoInstance = this.monaco.editor.create(this.$el, {
model: null, model: null,
......
...@@ -289,6 +289,10 @@ const RepoHelper = { ...@@ -289,6 +289,10 @@ const RepoHelper = {
} }
}, },
findOpenedFileFromActive() {
return Store.openedFiles.find(openedFile => Store.activeFile.url === openedFile.url);
},
loadingError() { loadingError() {
Flash('Unable to load the file at this time.'); Flash('Unable to load the file at this time.');
}, },
......
/* global Flash */ /* global Flash */
import RepoHelper from '../helpers/repo_helper'; import RepoHelper from '../helpers/repo_helper';
import RepoService from '../services/repo_service';
const RepoStore = { const RepoStore = {
ideEl: {}, ideEl: {},
...@@ -95,8 +96,14 @@ const RepoStore = { ...@@ -95,8 +96,14 @@ const RepoStore = {
if (file.binary) { if (file.binary) {
RepoStore.blobRaw = file.base64; RepoStore.blobRaw = file.base64;
RepoStore.binaryMimeType = file.mime_type; RepoStore.binaryMimeType = file.mime_type;
} else { } else if (file.newContent || file.plain) {
RepoStore.blobRaw = file.newContent || file.plain; RepoStore.blobRaw = file.newContent || file.plain;
} else {
RepoService.getRaw(file.raw_path)
.then((rawResponse) => {
RepoStore.blobRaw = rawResponse.data;
RepoHelper.findOpenedFileFromActive().plain = rawResponse.data;
}).catch(RepoHelper.loadingError);
} }
if (!file.loading) RepoHelper.toURL(file.url, file.name); if (!file.loading) RepoHelper.toURL(file.url, file.name);
......
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