mirror of
https://github.com/chriswritescode-dev/opencode-manager.git
synced 2026-12-05 12:24:30 +01:00
Fix empty file editing in file browser
This commit is contained in:
1 parent
52f1ccbf1e
commit
a500d2ce55
1 file changed
+8
-1
@@ -180,7 +180,7 @@ export const FilePreview = memo(function FilePreview({ file, hideHeader = false,
|
||||
)
|
||||
}
|
||||
|
||||
if (!file.content) return null
|
||||
if (file.content === undefined) return null
|
||||
|
||||
if (isTextFile) {
|
||||
if (viewMode === 'edit') {
|
||||
@@ -201,6 +201,13 @@ export const FilePreview = memo(function FilePreview({ file, hideHeader = false,
|
||||
|
||||
try {
|
||||
const textContent = decodeBase64(file.content)
|
||||
if (!textContent) {
|
||||
return (
|
||||
<div className="text-center text-muted-foreground py-8">
|
||||
Empty file - click Edit to add content
|
||||
</div>
|
||||
)
|
||||
}
|
||||
const lines = textContent.split('\n')
|
||||
return (
|
||||
<div className={`pb-[200px] text-sm bg-muted text-foreground rounded font-mono ${
|
||||
|
||||
Reference in new issue
Block a user