Skip to content
This repository was archived by the owner on Sep 13, 2023. It is now read-only.

Commit afeabcf

Browse files
committed
Fix remark #1 - when creating a note with one file, save it without clicking on 'Add file'
1 parent c332781 commit afeabcf

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

src/renderer/components/modals/create-note-modal/CreateNoteModal.vue

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,8 @@ export default {
5757
if (!this.containsDupFiles()) {
5858
const noteType = this.getNoteType();
5959
60+
!this.files.length && this.addFile();
61+
6062
this.files.forEach((file, i) => {
6163
const filename = file.name || `${noteType}file${i + 1}`;
6264
const key = converter.filenameToKey(filename, file.language, noteType);
@@ -111,8 +113,13 @@ export default {
111113
computed: {
112114
...mapGetters(['gistsSelected']),
113115
isDisabled() {
114-
return !this.files.length || this.files.some(file => !/\S/.test(file.content));
116+
return (this.isBaseFileValid && this.files.length)
117+
|| (!this.isBaseFileValid && !this.files.length)
118+
|| this.files.some(file => !/\S/.test(file.content));
115119
},
120+
isBaseFileValid () {
121+
return Object.values(this.baseFile).every(v => `${v}`.trim() !== '');
122+
}
116123
},
117124
};
118125
</script>

0 commit comments

Comments
 (0)