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)
|
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 = {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
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.');
|
||||||
},
|
},
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
/* 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 = {
|
||||||
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);
|
||||||
|
|
Loading…
Reference in a new issue