diff --git a/composer.json b/composer.json index e6ee0935c5..275a5ead84 100644 --- a/composer.json +++ b/composer.json @@ -8,7 +8,6 @@ ], "license": "MIT", "require": { - "appstract/laravel-blade-directives": "^1.10", "blade-ui-kit/blade-heroicons": "^0.3", "graham-campbell/markdown": "^13.1", "league/glide-laravel": "^1.0", diff --git a/resources/views/fields/checkbox.blade.php b/resources/views/fields/checkbox.blade.php index 6aa728c338..c870b0efa2 100644 --- a/resources/views/fields/checkbox.blade.php +++ b/resources/views/fields/checkbox.blade.php @@ -2,7 +2,6 @@ @endpushonce -@pushonce('js:trix') - @script('https://www.unpkg.com/trix@1.3.1/dist/trix.js') +@pushonce('js') + @endpushonce @section('field') diff --git a/src/BladeDirectives.php b/src/BladeDirectives.php index 6c22155fb9..8376948508 100644 --- a/src/BladeDirectives.php +++ b/src/BladeDirectives.php @@ -13,4 +13,16 @@ class BladeDirectives { return '{!! \Filament::scripts() !!}'; } + + public static function pushOnce($expression): string + { + $var = '$__env->{"__pushonce_" . md5(__FILE__ . ":" . __LINE__)}'; + + return "startPush({$expression}); ?>"; + } + + public static function endPushOnce(): string + { + return 'stopPush(); endif; ?>'; + } } diff --git a/src/FilamentServiceProvider.php b/src/FilamentServiceProvider.php index 2746196907..789efd1403 100644 --- a/src/FilamentServiceProvider.php +++ b/src/FilamentServiceProvider.php @@ -90,6 +90,8 @@ class FilamentServiceProvider extends ServiceProvider { Blade::directive('filamentStyles', [BladeDirectives::class, 'styles']); Blade::directive('filamentScripts', [BladeDirectives::class, 'scripts']); + Blade::directive('pushonce', [BladeDirectives::class, 'pushOnce']); + Blade::directive('endpushonce', [BladeDirectives::class, 'endPushOnce']); } protected function bootPublishing(): void