Add plain property to active file if not set already
This commit is contained in:
parent
00e7f3284c
commit
1530b1e6b9
3 changed files with 13 additions and 2 deletions
|
@ -11,7 +11,7 @@ const RepoEditor = {
|
|||
Service.getRaw(this.activeFile.raw_path)
|
||||
.then((rawResponse) => {
|
||||
Store.blobRaw = rawResponse.data;
|
||||
this.openedFiles[0].plain = rawResponse.data;
|
||||
Helper.findOpenedFileFromActive().plain = rawResponse.data;
|
||||
|
||||
const monacoInstance = this.monaco.editor.create(this.$el, {
|
||||
model: null,
|
||||
|
|
|
@ -289,6 +289,10 @@ const RepoHelper = {
|
|||
}
|
||||
},
|
||||
|
||||
findOpenedFileFromActive() {
|
||||
return Store.openedFiles.find(openedFile => Store.activeFile.url === openedFile.url);
|
||||
},
|
||||
|
||||
loadingError() {
|
||||
Flash('Unable to load the file at this time.');
|
||||
},
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
/* global Flash */
|
||||
import RepoHelper from '../helpers/repo_helper';
|
||||
import RepoService from '../services/repo_service';
|
||||
|
||||
const RepoStore = {
|
||||
ideEl: {},
|
||||
|
@ -95,8 +96,14 @@ const RepoStore = {
|
|||
if (file.binary) {
|
||||
RepoStore.blobRaw = file.base64;
|
||||
RepoStore.binaryMimeType = file.mime_type;
|
||||
} else {
|
||||
} else if (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);
|
||||
|
|
Loading…
Reference in a new issue