Added download button in shared editor page
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 16s
Gemini PR Review / Gemini PR Review (pull_request) Failing after 17s
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (pull_request) Successful in 17s
Laravel Pint / pint (pull_request) Successful in 2m6s
Laravel Larastan / larastan (pull_request) Failing after 4m55s
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 16s
Gemini PR Review / Gemini PR Review (pull_request) Failing after 17s
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (pull_request) Successful in 17s
Laravel Pint / pint (pull_request) Successful in 2m6s
Laravel Larastan / larastan (pull_request) Failing after 4m55s
This commit is contained in:
@@ -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
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user