Skip to content

Commit

Permalink
Update for Filament 3.0
Browse files Browse the repository at this point in the history
  • Loading branch information
gwlortscher committed Aug 7, 2023
1 parent a58c369 commit 45e8f5f
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 20 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
],
"require": {
"php": "^8.0",
"filament/filament": "^2.0",
"filament/filament": "^3.0",
"spatie/laravel-package-tools": "^1.9.2",
"illuminate/contracts": "^8.74|^9.0|^10.0"
},
Expand Down
4 changes: 2 additions & 2 deletions resources/views/json-editor.blade.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<x-forms::field-wrapper
<x-filament-forms::field-wrapper
:id="$getId()"
:label="$getLabel()"
:label-sr-only="$isLabelHidden()"
Expand Down Expand Up @@ -52,5 +52,5 @@
<div x-ref="editor" class="w-full ace_editor"
style="min-height: 30vh;height:{{ $getHeight() }}px"></div>
</div>
</x-forms::field-wrapper>
</x-filament-forms::field-wrapper>

31 changes: 14 additions & 17 deletions src/FilamentJsoneditorServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,31 +2,20 @@

namespace InvadersXX\FilamentJsoneditor;

use Filament\PluginServiceProvider;
use Filament\Support\Assets\Css;
use Filament\Support\Assets\Js;
use Filament\Support\Facades\FilamentAsset;
use Spatie\LaravelPackageTools\Package;
use Spatie\LaravelPackageTools\PackageServiceProvider;

class FilamentJsoneditorServiceProvider extends PluginServiceProvider
class FilamentJsoneditorServiceProvider extends PackageServiceProvider
{
public static string $name = 'filament-jsoneditor';

/**
* @var string[]
*/
protected array $scripts = [
'invaders-filament-jsoneditor' => __DIR__ . '/../dist/jsoneditor/jsoneditor.min.js',
];

/**
* @var string[]
*/
protected array $styles = [
'invaders-filament-jsoneditor' => __DIR__ . '/../dist/jsoneditor/jsoneditor.min.css',
];

public function configurePackage(Package $package): void
{
$package
->name(self::$name)
->name(static::$name)
->hasConfigFile()
->hasAssets()
->hasViews();
Expand All @@ -35,4 +24,12 @@ public function configurePackage(Package $package): void
__DIR__ . '/../dist/jsoneditor/img/jsoneditor-icons.svg' => public_path('filament/assets/img/jsoneditor-icons.svg'),
], 'filament-jsoneditor-img');
}

public function packageBooted(): void
{
FilamentAsset::register([
Css::make('invaders-filament-jsoneditor', __DIR__ . '/../dist/jsoneditor/jsoneditor.min.css'),
Js::make('invaders-filament-jsoneditor', __DIR__ . '/../dist/jsoneditor/jsoneditor.min.js')
], 'awcodes/headings');
}
}

0 comments on commit 45e8f5f

Please sign in to comment.