diff --git a/app/Listeners/OpenDocumentWindow.php b/app/Listeners/OpenDocumentWindow.php index 413ef86..9efcbad 100644 --- a/app/Listeners/OpenDocumentWindow.php +++ b/app/Listeners/OpenDocumentWindow.php @@ -3,30 +3,23 @@ namespace App\Listeners; use App\Events\DocumentOpened; +use Illuminate\Support\Facades\Log; use Illuminate\Support\Facades\Storage; use Native\Laravel\Dialog; use Native\Laravel\Facades\Window; class OpenDocumentWindow { - /** - * Create the event listener. - */ - public function __construct() - { - // - } - - /** - * Handle the event. - */ public function handle(DocumentOpened $event): void { + $storagePath = Storage::disk('user_documents')->path('OpenSketch'); + Log::debug($storagePath); /** @var \Native\Laravel\Windows\WindowManager $window */ $window = Window::getFacadeRoot(); $path = Dialog::new() ->title('Open Sketch Book') ->asSheet() + ->defaultPath($storagePath) ->open(); if (null === $path) { diff --git a/app/Listeners/StoreDocument.php b/app/Listeners/StoreDocument.php index 8aa1bcf..b307b37 100644 --- a/app/Listeners/StoreDocument.php +++ b/app/Listeners/StoreDocument.php @@ -13,22 +13,17 @@ class StoreDocument { - /** - * Create the event listener. - */ public function __construct() { - // } - /** - * Handle the event. - */ public function handle(DocumentSaved $event): void { + $storagePath = Storage::disk('user_documents')->path('OpenSketch'); $path = Dialog::new() ->title('Save Sketch Book') ->asSheet() + ->defaultPath($storagePath) ->save(); if (null === $path) { diff --git a/config/filesystems.php b/config/filesystems.php index e9d9dbd..516ca1f 100644 --- a/config/filesystems.php +++ b/config/filesystems.php @@ -32,7 +32,7 @@ 'local' => [ 'driver' => 'local', - 'root' => storage_path('app'), + 'root' => '/', 'throw' => false, ], @@ -44,6 +44,12 @@ 'throw' => false, ], + 'user_documents' => [ + 'driver' => 'local', + 'root' => env('NATIVEPHP_DOCUMENTS_PATH' ,''), + 'throw' => false, + ], + 's3' => [ 'driver' => 's3', 'key' => env('AWS_ACCESS_KEY_ID'), diff --git a/vite.config.js b/vite.config.js index dba34a6..48d7e78 100644 --- a/vite.config.js +++ b/vite.config.js @@ -4,7 +4,11 @@ import laravel from 'laravel-vite-plugin'; export default defineConfig({ plugins: [ laravel({ - input: ['resources/css/app.css', 'resources/js/app.ts'], + input: [ + 'resources/css/app.css', + 'resources/js/src/pages/OpenSketch.ts', + 'resources/js/src/pages/SketchManager.ts', + ], refresh: true, }), ],