From 05b34cbb90370bc408ead4a64c9f1d1fb5f43d61 Mon Sep 17 00:00:00 2001 From: dhanabalan Date: Wed, 25 Nov 2026 12:18:14 +0530 Subject: [PATCH] Added copy button and relevant logic --- app/Filament/Pages/SharedEditor.php | 10 +--- .../filament/pages/shared-editor.blade.php | 48 +++++++++++++++++-- 2 files changed, 45 insertions(+), 13 deletions(-) diff --git a/app/Filament/Pages/SharedEditor.php b/app/Filament/Pages/SharedEditor.php index 35afcbb3..8819fb7e 100644 --- a/app/Filament/Pages/SharedEditor.php +++ b/app/Filament/Pages/SharedEditor.php @@ -57,15 +57,9 @@ class SharedEditor extends Page } } - public function clearContent(): void + public function copyContent(): void { - SharedClipBoard::where('id', 1)->update([ - 'content' => '', - ]); - - $this->content = ''; - - $this->lastSyncedContent = ''; + $this->dispatch('copy-to-clipboard', content: $this->content); } 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 5a76ab09..4e14f31c 100644 --- a/resources/views/filament/pages/shared-editor.blade.php +++ b/resources/views/filament/pages/shared-editor.blade.php @@ -58,12 +58,11 @@ {{-- Clear Button --}} - Clear Content + Copy To ClipBoard @@ -99,4 +98,43 @@ +@script + +@endscript +