diff --git a/app/Filament/Pages/SharedEditor.php b/app/Filament/Pages/SharedEditor.php index 8819fb7e..5da806cb 100644 --- a/app/Filament/Pages/SharedEditor.php +++ b/app/Filament/Pages/SharedEditor.php @@ -6,6 +6,7 @@ use App\Models\Configuration; use App\Models\SharedClipBoard; use Filament\Pages\Page; use Illuminate\Support\Facades\Auth; +use Symfony\Component\HttpFoundation\StreamedResponse; class SharedEditor extends Page { @@ -61,6 +62,20 @@ class SharedEditor extends Page { $this->dispatch('copy-to-clipboard', content: $this->content); } + public function downloadTxt(): StreamedResponse + { + $content = $this->content; + + return response()->streamDownload( + function () use ($content) { + echo $content; + }, + 'shared-clipboard.txt', + [ + 'Content-Type' => 'text/plain; charset=UTF-8', + ] + ); + } public static function canAccess(): bool { diff --git a/resources/views/filament/pages/shared-editor.blade.php b/resources/views/filament/pages/shared-editor.blade.php index 4e14f31c..5709063f 100644 --- a/resources/views/filament/pages/shared-editor.blade.php +++ b/resources/views/filament/pages/shared-editor.blade.php @@ -43,20 +43,14 @@
+ Type here to share content with other users. +
+- Type here to share content with other users. -
-