Commit 074b24c6 authored by Jacob Schatz's avatar Jacob Schatz

Add loader and fix bugs

parent 6708ce25
...@@ -24,6 +24,20 @@ export default { ...@@ -24,6 +24,20 @@ export default {
Store.toggleBlobView(); Store.toggleBlobView();
}, },
}, },
watch: {
editMode() {
if (this.editMode) {
$('.project-refs-form').addClass('disabled');
$('.fa-long-arrow-right').show();
$('.project-refs-target-form').show();
} else {
$('.project-refs-form').removeClass('disabled');
$('.fa-long-arrow-right').hide();
$('.project-refs-target-form').hide();
}
},
}
} }
</script> </script>
......
...@@ -7,6 +7,13 @@ import Helper from '../helpers/repo_helper'; ...@@ -7,6 +7,13 @@ import Helper from '../helpers/repo_helper';
const RepoEditor = { const RepoEditor = {
data: () => Store, data: () => Store,
destroyed() {
// this.monacoInstance.getModels().forEach((m) => {
// m.dispose();
// });
this.monacoInstance.destroy();
},
mounted() { mounted() {
Service.getRaw(this.activeFile.raw_path) Service.getRaw(this.activeFile.raw_path)
.then((rawResponse) => { .then((rawResponse) => {
...@@ -67,26 +74,15 @@ const RepoEditor = { ...@@ -67,26 +74,15 @@ const RepoEditor = {
}); });
}, },
editMode() {
if (this.editMode) {
$('.project-refs-form').addClass('disabled');
$('.fa-long-arrow-right').show();
$('.project-refs-target-form').show();
} else {
$('.project-refs-form').removeClass('disabled');
$('.fa-long-arrow-right').hide();
$('.project-refs-target-form').hide();
}
},
activeFileLabel() { activeFileLabel() {
this.showHide(); this.showHide();
}, },
dialog: { dialog: {
handler(obj) { handler(obj) {
if (obj.status) { let newObj = obj;
obj.status = false; // eslint-disable-line no-param-reassign if (newObj.status) {
newObj.status = false;
this.openedFiles.map((file) => { this.openedFiles.map((file) => {
const f = file; const f = file;
if (f.active) { if (f.active) {
......
<script> <script>
import RepoStore from '../stores/repo_store'; import Store from '../stores/repo_store';
export default { export default {
data: () => RepoStore, data: () => Store,
mounted() {
$(this.$el).find('.file-content').syntaxHighlight();
},
computed: { computed: {
html() { html() {
return this.activeFile.html; return this.activeFile.html;
...@@ -11,13 +13,11 @@ export default { ...@@ -11,13 +13,11 @@ export default {
}, },
watch: { watch: {
html() { html() {
this.$nextTick(() => { this.$nextTick(() => {
$(this.$el).find('.file-content').syntaxHighlight(); $(this.$el).find('.file-content').syntaxHighlight();
}); });
} }
} }
} }
</script> </script>
......
...@@ -4,10 +4,11 @@ import RepoStore from '../stores/repo_store'; ...@@ -4,10 +4,11 @@ import RepoStore from '../stores/repo_store';
import monacoLoader from '../monaco_loader'; import monacoLoader from '../monaco_loader';
function repoEditorLoader() { function repoEditorLoader() {
RepoStore.monacoLoading = true;
return new Promise((resolve) => { return new Promise((resolve) => {
monacoLoader(['vs/editor/editor.main'], () => { monacoLoader(['vs/editor/editor.main'], () => {
RepoStore.monaco = monaco; RepoStore.monaco = monaco;
RepoStore.monacoLoading = false;
resolve(RepoEditor); resolve(RepoEditor);
}); });
}); });
......
...@@ -5,6 +5,7 @@ import RepoService from '../services/repo_service'; ...@@ -5,6 +5,7 @@ import RepoService from '../services/repo_service';
const RepoStore = { const RepoStore = {
ideEl: {}, ideEl: {},
monaco: {}, monaco: {},
monacoLoading: false,
monacoInstance: {}, monacoInstance: {},
service: '', service: '',
editor: '', editor: '',
......
...@@ -7,6 +7,19 @@ ...@@ -7,6 +7,19 @@
transition: opacity .5s; transition: opacity .5s;
} }
.blob-viewer {
padding: 20px;
}
.monaco-loader {
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
background: rgba(0,0,0,0.2);
}
.modal.popup-dialog { .modal.popup-dialog {
display: block; display: block;
......
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