From d97bcd7abd1bf214b5383c36fb5a8be9fdf62155 Mon Sep 17 00:00:00 2001 From: dhanabalan Date: Wed, 25 Nov 2026 12:46:04 +0530 Subject: [PATCH] Added download button in shared editor page --- app/Filament/Pages/SharedEditor.php | 15 ++++++++++ .../filament/pages/shared-editor.blade.php | 29 ++++++++++--------- 2 files changed, 30 insertions(+), 14 deletions(-) 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 @@
- {{-- Header --}} -
+
+

+ Type here to share content with other users. +

+
-
-

- Shared Clipboard -

+
-

- Type here to share content with other users. -

-
- - {{-- Clear Button --}} Copy To ClipBoard + {{-- @if (auth()->user()?->hasRole('Super Admin')) --}} + + Download Txt + + {{-- @endif --}}
- {{-- Shared Textarea --}}
- {{-- Footer --}}
-- 2.49.1