Adds green to circle when unsaved. Activates right tab when closing.
This commit is contained in:
parent
0cdf970024
commit
d52172fa13
5 changed files with 25 additions and 5 deletions
|
@ -30,7 +30,7 @@ function initRepo() {
|
|||
data: () => Store,
|
||||
template: `
|
||||
<div class="tree-content-holder">
|
||||
<repo-sidebar/><div class="panel-right" :class="{'edit-mode': readOnly}">
|
||||
<repo-sidebar/><div class="panel-right" :class="{'edit-mode': editMode}">
|
||||
<repo-tabs/>
|
||||
<repo-file-buttons/>
|
||||
<repo-editor/>
|
||||
|
|
|
@ -13,12 +13,10 @@ const RepoBinaryViewer = {
|
|||
|
||||
methods: {
|
||||
errored() {
|
||||
console.log('errored');
|
||||
Store.binaryLoaded = false;
|
||||
},
|
||||
|
||||
loaded() {
|
||||
console.log('loaded');
|
||||
Store.binaryLoaded = true;
|
||||
},
|
||||
|
||||
|
@ -39,7 +37,6 @@ const RepoBinaryViewer = {
|
|||
if (!this.binary) return;
|
||||
switch (this.binaryMimeType) {
|
||||
case 'image/png':
|
||||
console.log('png bitch')
|
||||
this.binaryTypes.png = true;
|
||||
break;
|
||||
default:
|
||||
|
|
|
@ -65,6 +65,7 @@ const RepoEditor = {
|
|||
},
|
||||
|
||||
editMode() {
|
||||
console.log('edit mode changed')
|
||||
const readOnly = !this.editMode;
|
||||
|
||||
Store.readOnly = readOnly;
|
||||
|
|
|
@ -151,8 +151,25 @@ const RepoStore = {
|
|||
|
||||
removeFromOpenedFiles(file) {
|
||||
if (file.type === 'tree') return;
|
||||
let foundIndex;
|
||||
RepoStore.openedFiles = RepoStore.openedFiles.filter((openedFile, i) => {
|
||||
if(openedFile.url === file.url) foundIndex = i;
|
||||
return openedFile.url !== file.url;
|
||||
});
|
||||
|
||||
RepoStore.openedFiles = RepoStore.openedFiles.filter(openedFile => openedFile.url !== file.url);
|
||||
// now activate the right tab based on what you closed.
|
||||
if(RepoStore.openedFiles.length === 0) return;
|
||||
|
||||
if(RepoStore.openedFiles.length === 1 || foundIndex === 0) {
|
||||
RepoStore.setActiveFiles(RepoStore.openedFiles[0]);
|
||||
return;
|
||||
}
|
||||
|
||||
if(foundIndex) {
|
||||
if(foundIndex > 0) {
|
||||
RepoStore.setActiveFiles(RepoStore.openedFiles[foundIndex - 1]);
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
addPlaceholderFile() {
|
||||
|
|
|
@ -100,6 +100,7 @@
|
|||
&.close {
|
||||
width: auto;
|
||||
font-size: 15px;
|
||||
opacity: 1;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -110,6 +111,10 @@
|
|||
margin-left: 15px;
|
||||
color: $gray-darkest;
|
||||
}
|
||||
|
||||
i.fa.fa-circle {
|
||||
color: $brand-success;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue