fix: use pdf previews for documents
This commit is contained in:
@@ -248,7 +248,7 @@ class DocumentResource extends Resource
|
||||
->modalSubmitAction(false)
|
||||
->modalCancelActionLabel('关闭'),
|
||||
Tables\Actions\Action::make('preview')
|
||||
->label('预览 Markdown')
|
||||
->label('预览 PDF')
|
||||
->icon('heroicon-o-eye')
|
||||
->color('info')
|
||||
->visible(fn(Document $record): bool => $record->conversion_status === 'completed')
|
||||
|
||||
@@ -49,6 +49,7 @@ class EditDocument extends EditRecord
|
||||
if ($this->record->markdown_path && Storage::disk('markdown')->exists($this->record->markdown_path)) {
|
||||
Storage::disk('markdown')->delete($this->record->markdown_path);
|
||||
}
|
||||
app(\App\Services\DocumentPdfPreviewService::class)->clearCachedPreview($this->record);
|
||||
|
||||
$data['file_path'] = $currentFile;
|
||||
$data['file_name'] = $data['file_name'] ?? basename($currentFile);
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
namespace App\Filament\Resources\DocumentResource\Pages;
|
||||
|
||||
use App\Filament\Resources\DocumentResource;
|
||||
use App\Services\DocumentPreviewService;
|
||||
use App\Services\DocumentService;
|
||||
use Filament\Actions;
|
||||
use Filament\Infolists\Components\Section;
|
||||
@@ -56,7 +55,7 @@ class ViewDocument extends ViewRecord
|
||||
}
|
||||
}),
|
||||
Actions\Action::make('preview')
|
||||
->label('预览 Markdown')
|
||||
->label('预览 PDF')
|
||||
->icon('heroicon-o-eye')
|
||||
->color('info')
|
||||
->visible(fn (): bool => $this->record->conversion_status === 'completed')
|
||||
|
||||
Reference in New Issue
Block a user