Skip to content

Commit

Permalink
fix: file editor now won't break if the file is empty
Browse files Browse the repository at this point in the history
  • Loading branch information
cadriel committed Jan 24, 2021
1 parent fe76e8e commit 0d5ae1b
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 3 deletions.
3 changes: 1 addition & 2 deletions src/components/widgets/filesystem/FileEditorWidget.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
<template>
<prism-editor
v-if="code && code.length"
class="file-editor"
v-model="code"
@input="emitChange($event)"
Expand Down Expand Up @@ -40,7 +39,7 @@ export default class FileEditorWidget extends Vue {
this.code = val
}
code: string | null = null
code = ''
langMap: {[key: string]: string} = {
md: 'markdown',
Expand Down
2 changes: 1 addition & 1 deletion src/components/widgets/filesystem/FileSystemBrowser.vue
Original file line number Diff line number Diff line change
Expand Up @@ -521,7 +521,7 @@ export default class FileSystemBrowser extends Mixins(UtilsMixin) {
}
createFile (name: string) {
const file = new File([`# ${name}\n`], name)
const file = new File([], name)
this.$emit('upload-file', file, false)
}
Expand Down

0 comments on commit 0d5ae1b

Please sign in to comment.