Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 25 additions & 7 deletions src/components/modals/views/TextEditModal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,20 @@
<button type="button" class="btn-close" aria-label="Close" v-on:click="hideModal"></button>
</div>
<div class="modal-body">
<codemirror
ref="fmCodeEditor"
v-bind:value="code"
v-bind:options="cmOptions"
v-bind:height="editorHeight"
v-on:change="onChange"
/>
<div v-if="codeLoaded">
<codemirror
ref="fmCodeEditor"
v-bind:value="code"
v-bind:options="cmOptions"
v-bind:height="editorHeight"
v-on:change="onChange"
/>
</div>
<div class="p-5" v-else :style="{ height: editorHeight + 'px' }">
<div class="d-flex justify-content-center">
<div class="spinner-border spinner-border-big" role="status"></div>
</div>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-info" v-on:click="updateFile">
Expand Down Expand Up @@ -59,6 +66,7 @@ export default {
return {
code: '',
editedCode: '',
codeLoaded: false,
};
},
mounted() {
Expand All @@ -75,6 +83,11 @@ export default {
} else {
this.code = response.data;
}

this.codeLoaded = true;
})
.catch(() => {
this.hideModal();
});
},
computed: {
Expand Down Expand Up @@ -158,4 +171,9 @@ export default {
padding: 0;
}
}

.spinner-border-big {
width: 3rem;
height: 3rem;
}
</style>