Skip to content

Commit

Permalink
Fix json file editing
Browse files Browse the repository at this point in the history
  • Loading branch information
G4brym committed May 28, 2024
1 parent 6f0572f commit 27c7e5a
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ Read this in other languages: [Español](READMEes.md), [Português](READMEpt.md)
- Upload/Rename/Download/Delete files
- Right click in file for extra options
- Multipart upload for big files
- File editing

## Getting Started

Expand Down Expand Up @@ -66,6 +67,7 @@ wrangler publish
- Object detection on images using workers-ai ?
- Tooltip when hovering a file with absolute time in "x days time ago" format
- support for responding to emails
- More advanced file editing with more validations per file type

## Known issues

Expand Down
9 changes: 6 additions & 3 deletions packages/dashboard/src/components/preview/FilePreview.vue
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,6 @@ export default {
}
},
async openFile(file) {
console.log(file)
if (bytesToMegabytes(file.size) > 200) {
this.q.notify({
message: "File is too big to preview.",
Expand Down Expand Up @@ -359,7 +358,11 @@ export default {
// Edit functions
enableEdit: function() {
this.fileDataEdited = this.fileData;
if (typeof this.fileData === 'object') {
this.fileDataEdited = JSON.stringify(this.fileData, null, 2)
} else {
this.fileDataEdited = this.fileData;
}
this.editMode = true;
},
cancelEdit: function() {
Expand Down Expand Up @@ -416,8 +419,8 @@ export default {
timeout: 5000 // we will timeout it in 5s
})
this.fileData = this.fileDataEdited
this.cancelEdit()
this.openFile(this.file)
}
},
computed: {
Expand Down

0 comments on commit 27c7e5a

Please sign in to comment.